Ruby post title to slug

Is this Rails? (works in Sinatra) string.parameterize That’s it. For even more sophisticated slugging, see ActsAsUrl. It can do the following: “rock & roll”.to_url => “rock-and-roll” “$12 worth of Ruby power”.to_url => “12-dollars-worth-of-ruby-power” “10% off if you act now”.to_url => “10-percent-off-if-you-act-now” “kick it en Français”.to_url => “kick-it-en-francais” “rock it Español style”.to_url => “rock-it-espanol-style” “tell your … Read more

Convert whole dataframe from lower case to upper case with Pandas

astype() will cast each series to the dtype object (string) and then call the str() method on the converted series to get the string literally and call the function upper() on it. Note that after this, the dtype of all columns changes to object. In [17]: df Out[17]: regiment company deaths battles size 0 Nighthawks … Read more

Dictionary to lowercase in Python

You will need to use either a loop or a list/generator comprehension. If you want to lowercase all the keys and values, you can do this:: dict((k.lower(), v.lower()) for k,v in {‘My Key’:’My Value’}.iteritems()) If you want to lowercase just the keys, you can do this:: dict((k.lower(), v) for k,v in {‘My Key’:’My Value’}.iteritems()) Generator … Read more

How do I lowercase a string in C?

It’s in the standard library, and that’s the most straight forward way I can see to implement such a function. So yes, just loop through the string and convert each character to lowercase. Something trivial like this: #include <ctype.h> for(int i = 0; str[i]; i++){ str[i] = tolower(str[i]); } or if you prefer one liners, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)