How to use Split with jQuery?

var str = ‘something — something_else’; var substr = str.split(‘ — ‘); // substr[0] contains "something" // substr[1] contains "something_else" Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

MongoDB + power outage = downtime

MongoDB handles unexpected shutdowns quite appallingly, one thing that I always forget is the general server language for speaking with the server and getting the info I need to get her back up and running. $ sudo status mongodb $ sudo stop mongodb $ sudo start mongodb $ sudo restart mongodb To see whats going on… If you see “Error: couldn’t connect to server 127.0.0.1} (anon):1137″ This condition is largely

Apache Address already in use: make_sock: could not bind to port 80 error and solution

Just had this delightful problem tonight, fix: First make sure port 80/443 is not used by any other service or application with netstat command: # netstat -tulpn| grep :80 If port 80 is bind to httpd, kill all process: # killall -9 httpd Now start the httpd: # /etc/init.d/httpd start Make sure it’s a user capable of sudo Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit

Creating a soft or symbolic link in ubuntu

Sometimes you want to link to a directory that isn’t necessarily within the web root for the particular site you are on. Simple enough solution for it though. ln -s /webroot/home/httpd/test.com/index.php /home/sbramley/index.php or ln -s /webroot/home/httpd/test /home/sbramley/ So you can link to a directory of file easyyyyy Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on

twisted-knickers
Twisted Knickers – Change is good

Twisted knickers is a site I built when I first started building sites, unfortunately web standards were pretty shocking back then and my skill set wasn’t up to par. The entire site was built using a table (yes, before I knew how to float divs). So when I got the opportunity to fix it up this year I jumped at the opportunity, who likes having their name against something that

Matching a string

I just posted on splitting a string, might as well add my match as they can often come hand in hand. preg_match("your search item", "your_string") Boom, done Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this post

Splitting a string

I’ve just spent 15 minutes looking for this darn function, never again! Here is how to split a string to get the information you require: Edit: A wise PHP guru just gave me an alternative option as well. $chars = explode(‘-’, "your-string-here"); Is the same as: $chars = preg_split(‘/-/’, "your-string-here", -1, PREG_SPLIT_NO_EMPTY); $your = $chars[0]; $string = $chars[1]; $here = $chars[2]; Works just peachy Bookmark on Delicious Digg this post

Update table with join function – MYSQL

True story, I always forget where each value should be positioned for a left join on an update statement. This is always useful for a reference guide for me: UPDATE t1 LEFT JOIN t2 ON t2.id = t1.id SET t1.col1 = newvalue WHERE t2.id IS NULL Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Subscribe to the comments on this

PHP shorthand IF statements

Easy to forget the correct syntax but darn it’s useful, a recap on shorthand php if statements. Basic True / False Declaration $is_admin = ($user['permissions'] == ‘admin’ ? true : false); Conditional Welcome Message echo ‘Welcome ‘.($user['is_logged_in'] ? $user['first_name'] : ‘Guest’).’!'; Conditional Items Message echo ‘Your cart contains ‘.$num_items.’ item’.($num_items != 1 ? ‘s’ : ”).’.'; Conditional Error Reporting Level error_reporting($WEBSITE_IS_LIVE ? 0 : E_STRICT); Conditional Basepath echo ‘<base href="http’.($PAGE_IS_SECURE

Clickable elements

<a> tags are great for text and images, but what about divs? or list elements? not so much. With most of my images, I set them as background images of a div, when it comes to positioning divs on a page it’s just easier than having to mess with the images within them as well. Here’s a tidy way of making your div clickable. <div onclick="location.href=’http://sbramley.com/’;" style="cursor: pointer;"> </div> Bookmark

Next Page »

Switch to our mobile site