Compare two links and choose the one with higher end number [closed] - image

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
So my problem is I try to compare two links from tumblr and choose that link which has higher number in this case is just choose _1280 over _500.
http://25.media.tumblr.com/393e9f295c4cac3af0a4b6d3a64c434d/tumblr_mi9e85iFwA1qavye5o1_500.jpg
http://25.media.tumblr.com/393e9f295c4cac3af0a4b6d3a64c434d/tumblr_mi9e85iFwA1qavye5o1_1280.jpg
I know how to get image links from tumblr but I'm too stupid to make, a code for this. I don't even know how to start... And this is just my beginning of trying do something in bash (cygwin).
I will appreciate any help :)

Here are some string manipulation functions to get you started.
bash:~$ var1=http://25.media.tumblr.com/393e9f295c4cac3af0a4b6d3a64c434d/tumblr_mi9e85iFwA1qavye5o1_500.jpg
bash:~$ var2=${var1##*_}
This gives you the part of the string after the last underscore
bash:~$ echo $var2
should output 500.jpg
bash:~$ var3=${var2%.*}
This gives you the part before the dot
bash:~$ echo $var3
should output 500
Then you can compare the numbers.

Related

Regular expression to find unknown acronyms [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need a regular expression that will pick out lines with ALL CAPS or unknown acronyms.
ie: something like
/[A-Z]{2,}/
combined with
/(?!USA|UK|TLA)/
You mean something like this?
\b(?!(?:USA|UK|TLA)\b)[A-Z]{2,}\b
See it here on Rubular
\b is a word boundary to ensure that it will find complete words.

Comparing multiple values in an if statement - Ruby [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Can you compare multiple values in a single if statement in Ruby? If so, how? I know in other languages, you would just use a double ampersand (&&), but I have never seen any example or documentation about it, even in the official ruby documentation! Thanks for all the help in advance.
Yes, you can use the && operator
if a == 1 && b == 2
# do things
end
It IS in the documentation.
http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html#UG

What do these Fortran (90) statements do? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have run into the follow code and I do not understand it. What does it do?
A(*)
do n=(k,k-1,j+1-k)
A(*) looks like (part of) the declaration of an 'assumed-size array'; the typical use of this would be in the declaration of a dummy argument to a procedure. Distinguish carefully between assumed-size and 'automatic' arrays. Assumed-size arrays are deprecated in modern Fortran but common in FORTRAN77 and earlier variations.
do n=(k,k-1,j+1-k) looks like a syntactically-incorrect loop statement. The correct form would be do n=k,k-1,j+1-k which loops over the range [k,k-1] in strides of size j+1-k.

Does anyone know the algorithm used for navigating a Pac-Man maze? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need an algorithm for this pacman maze. Can anyone help?
You don't say what kind of algorithm you want, but if you are implementing the movement of the ghosts, then you should read "Understanding Pac-Man Ghost Behavior" by Chad Birch.
That's quite a large question.
Anyway, I've yet written a Pac-Man game in both Java and C and I implemented the maze as a matrix filled as follows:
- "-1" if there's a wall;
- "1" if there's a candy;
- else, "0".
To navigate through the maze, you have to use key events. When you'd like to turn left or right, you test if there's a wall ("-1").
I don't know if this answered your question, but feel free to precise if it's not the case.
Another site with quite some informations on pacman is the PacMan dossier

NSXMLParser for xml! why is it so hard to use? is there an easy way? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
For the last few hours I have tired to get my head around using NSXMLParser.
I understand parts of how it works.
WHY Oh WHY! is this so hard? Is there an easy way to do it, like just name the tag and get the contents?
Oh how I miss XmlDocument object from .Net.
Thanks a million.
Why don't you try NSXMLDocument instead? With it you can do the kind of things you want using xpaths. Check out the docs or this sample code : http://developer.apple.com/mac/library/iPad/index.html#samplecode/XMLBrowser/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40008875

Resources