On top of that, without even changing the methodology by which the lookup is performed, you could return straight out of the conditional:
if ($code == 'CA') return $modx->lexicon('continents.north_america');
instead of wasting time performing another bajillion comparisons when you already know the only correct answer.
And short of an array, a commentor on the original post points out that a switch would work, too:
switch($code) { case 'AF': case 'AM': return $modx->lexicon('continents.asia'); case 'AX': case 'AL': return $modx->lexicon('continents.europe'); /* Etc. */ default: return ''; }
I think this will work for you. Just make a method of it and let the url be a parameter.
Maybe it could be done much simpler, but it should work for your purpose.
OK here are my 3 bash scripts which will download the Soros documents from DCLeaks. Enjoy :)
Download Part I -- dcleaks-soros-1
Download Part II -- dcleaks-soros-2
Download Part III -- dcleaks-soros-3
I would use ffmpeg. It supports millisecond times. There are various guis available if you prefer that. I don't know enough to recommend one, but maybe someone else does.
Also, it would help to include your operating system in your question.
Edit: If you go this route, you'll want to use the 'copy' codec so as not to re-encode your file. Here is an example.
You aren't starting at the rightmost digit here. If you want to do that, replace
for ( int i = 0; i < d.length; i++ )
with
for (int i = d.length() - 1; i >= 0; i--) {
If you want to look at a good version of Luhn's algorithm, check it out here -> http://snipplr.com/view/7823/
Love this site too. Going to chime in with everyone else on that :)
I used to use a site called Snipplr (http://snipplr.com/) back in the day, but at some point all I saw were ads when I went there. Got way too busy, so keep it classy is all I'd recommend :)
If we are talking about 2-3 numbers of $IdsOfBasesToCopy
, you can use that statement but it isn't a good practice. You may use batch-insert or transaction;
Principle taken from http://snipplr.com/view/54755/
Sub ExtractPictures() Dim Sht As Worksheet Dim Pic As Picture Dim sPath As String Dim lPic As Long
sPath = "C:\Users\Username\Documents\ExcelPictures\"
Application.ScreenUpdating = False
For Each Sht In ThisWorkbook.Sheets lPic = 1 For Each Pic In Sht.Pictures Pic.CopyPicture xlScreen, xlPicture With Sht.ChartObjects.Add(Left:=Pic.Left, _ Top:=Pic.Top, _ Width:=Pic.Width, _ Height:=Pic.Height) With .Chart .Paste .Export sPath & Sht.Name & "_pic" & lPic & ".jpg", Filtername:="JPG" End With .Delete End With Pic.Delete lPic = lPic + 1 Next Pic Next Sht
Application.ScreenUpdating = True
End Sub
If you google batch user input, you will find alot of examples. You are going to be using a bunch of statements using SET, ECHO, IF-ELSE, GOTO, etc. This should help:
Hi salmonmoose. If you want to select a voxel without rendering them, here's some C++ code that might help you out. You mentioned traversing unit-cubes, and this is what this does.
http://snipplr.com/view/64883/voxel-raycaster/
To use this code, construct a Raycaster object with a given starting position and direction vector (both Vector3f). Calling getNextVoxel() will return the next unit-cube that you hit (a Vector3i).
This code uses glm, a convenient utility library for OpenGL math, for Vector3f (glm::vec3) and Vector3i (glm::ivec3). However, just replace those with whatever you use to represent vectors.
If you have questions on how it works or anything else, just ask! You are free to use it for whatever.
Internet Explorer won't allow you to change the field type though.
HTML5 has a placeholder attribute that handles things automatically for you.
<input name="password-login" id="password-login" type="password" placeholder="Password" />
That will work in modern web browsers. For IE though, you can add the ability to do so by using a shim. You can find them at places such as:
https://github.com/parndt/jquery-html5-placeholder-shim http://www.jonathansewell.co.uk/index.php/2011/05/25/html5-placeholder-shimshivfiller/ http://snipplr.com/view/47390.58337/
If your doing this as a learning experiment, then ignore.
Whenever I see people trying to parse a common file format, the first thing I think is "Someone must have had to do this before." A quick Google search shows a few PHP libraries for manipulating wav files you might want to use.
http://www.phpclasses.org/package/2608-PHP-Manipulate-audio-files-in-the-WAV-format.html#download
The url "http://www.comunio.de/soapservice.php?wsdl" is the link to the soap service. On my server, I have a php file with this code: http://snipplr.com/view/30223/getful-soap-to-json/
And when I load that .php file in my Web-Browser, I get the response mentioned in the original post. So I have www.myserver.com/myfile.php?function=getplayerbyid&amp;params={"playerid" : 31945}
The 'mountain of xml' is the soap service. There you can see, which functions are available. The php file should grep the function and params from the url, send a soap request and return the answer as json to me.
You can also use a system() call (http://snipplr.com/view/56345/quickest-way-to-shell--use-system-instead-of-nstask/).
I would imagine it would be slower, and consume more resources, as is the nature of an interpreted language, but other than that I'd imagine there'd be little difference.
You could even pass the input to stdin and get the output from stdout if you wanted.
> Unless you wanted a given string to always produce exactly the same color and shade every time, in which case you should use the same seed.
That's exactly what I want.
As it's only a small part of a personal project, I didn't really spent any more time with it. I think I've used something like that to generate a HEX from a string, but how I said, the results where too close together, so everything almost looked the same.
Maybe I'll give it another try someday.
it'd appear that the grid system is here
It as a bunch of stuff that looks like it comes from tutorials etc....
If you want to (in confidence) PM me the url of the site I can have a look...
If that listener isn't in your document class make sure you're waiting until the stage property is available to add it.
http://snipplr.com/view/27959/
If you want to post your files I'll take a look.
From this guide:
> The empty braces get filled in with the file names and the escaped semicolon ends the command that is executed
So basically this is running sha512sum
on each file that is returned by find SRC_DIR -type f
.
Now that looks better then what I was expecting.
You've encountered a problem many of us do in the FAQ section of your site.
You might want to add this class:
http://snipplr.com/view/10979/css-cross-browser-word-wrap
It'll word wrap that div so even long urls stay inside the div instead of overflowing!
Also, download and run:
https://chrome.google.com/webstore/detail/gplegfbjlmmehdoakndmohflojccocli
Your current score is 63/100 try to get it high as you can but you are limited because you are on a shared hosting account and I know for a fact that hostgator doesn't allow gzip or mod_deflate.
But still try to get your score high as you can. It will help with your search rankings on Google.
Sorry for my late post to your question (although you may have already solved your problem). I use the following on my windows box to SSH to a shared Linux hosting account (should work on your Linux box).
First download ssh.py from http://commandline.org.uk/forum/topic/420/ [edit] Sorry, the ssh.py download url from the above is now a 404.
Here is the correct url: http://snipplr.com/view/48033/sshpy-friendly-python-ssh2-interface/ [/edit]
def copy_to_remote(output_file): import ssh ssh_host = 'your_host' usr = 'your_username' pwd = 'your_password' ss = ssh.Connection(host=ssh_host, username=usr, password=pwd) ss.put(output_file) ss.close()
Just add your own try-except stuff and you are good to go.
for the random string part this may help
http://stackoverflow.com/questions/2375968/url-shortener-best-encoding-method
There is a function here that will convert to base 62 (like say the primary key from that record of the db)
http://snipplr.com/view/22246/base62-encode--decode/
Or you could always do something like this - found here
function base64UrlEncode($data){ return strtr(rtrim(base64_encode($data), '='), '+/', '-_'); }
function base64UrlDecode($base64){ return base64_decode(strtr($base64, '-_', '+/')); }
I liked it, but I think I'm gonna go with https://gist.github.com/ or http://snipplr.com. I kinda want to have a library with my snippets on my page, so the next step is to look for an xml or json feed.
You don't even need to generate a file on the server...that's what the Content-Disposition: attachment; header is for. It tells the browser that any data it receives (I.E.: anything you echo) is actually a file and it needs to download it.
This is the way I've always generated CSV from a database: http://snipplr.com/view/2234/export-mysql-query-results-to-csv/
Seeing as a few of those mysql functions are now depreciated (PHP 5 and up, I believe), I've used the suggested methods in the PHP manual.