A song i have been chasing for a while now.
“I was wrong. And if you should call, it’s no trouble, no trouble at all”
Well it’s been a long time since I’ve posted pretty much anything on my pages of wisdom here. Which pretty much indicates that I’ve been busy. Very busy, and loving it. I’ve been buried in books and code. My previous employer got me back off the job market and has been prepared to take me on for a full time position as a web developer. If you’ve been following the story on twitter then you will know that I got picked up for a CakePHP developer role through my blog here. That unfortunately fell through because of the demand for work delivered by the company. Which was kind of depressing.
But nevertheless they got back to me, and I’m doing just as I was before and more. I’m in a really excellent position. My co-worker is miles ahead of me in terms of experience with web programming and he understands my position and in turn delegates jobs that are just a little outside of my comfort zone, non-stop. So I’m constantly learning and developing more advanced apps. So yes, I’m always digging through documentation and buying books. I pretty much get up early in the morning, arrive up to an hour early at work, study some bit with coffee. Work all day, drive home, and study my books!
Otherwise we’ve been taking it easy. My partner, who is on a working holiday visa here in Australia is finding it very tough to get any sort of job. We started out trying to get her on track with a her desired career path but none of the companies wanted to hear about it, simply because she was not an Australian resident. With that, we have been striving for just about any work, retail, receptionist, office work and even cleaning. She’s got a degree, a ton of experience, well mannered and presented and just has the best attitude to make things happen, and yet still no luck. If you want to help her out, or know of anyone that could give her a chance that she deserves, so she can stop handing out hundreds of resumés check her out at www.lizzyinbrizzy.com.
What I’m currently looking into now is source code versioning with Git and setting up git repos and access control via Gitosis. Also learning all the PHP functions i can and understanding how to extend CakePHP methods to be more DRY and MVC endorsed. Also this Lithium by Nate Abele, I do want to check this out sometime soon, however had a quick look at the documentation, and didn’t really see much there yet. But alas, the weekend is coming up haha
And with that expect a lot more code snippets and reviews of books coming in the near future! As always if you have any questions or comments please let me know, I’m always up for helping.
So i wanted to shorten some urls quickly and easily.
I went looking around for a script and came up with a hybrid of my findings.
Simply make a file wherever on your unix system, i called mine tinyurl.sh
Then dump this code in:
1 2 3 4 | #!/bin/sh curl -s http://tinyurl.com/create.php?url=$1 \ | sed -n 's/.*\(http:\/\/tinyurl.com\/[a-z0-9][a-z0-9]*\).*/\1/p' \ | uniq | pbcopy |
Yep, Thats it. Next i would recommend you add an alias to the file. On mac you can do this by editing the ~/.profile file and inserting alias tinyurl=”~/path/to/tinyurl.sh”
Its usage it quite simple after you setup the alias. Simply type tinyurl in the terminal followed by the url you wish to shorten. The result will automatically be copied into your clipboard!
Example:
tinyurl http://www.google.comEnjoy
It’s pretty simple!
Just make sure subversion client is installed and then checkout the php port file with the revision number of 53555 which is the latest for the 5.2.10:
1 2 3 | svn co -r 53555 http://svn.macports.org/repository/macports/trunk/dports/lang/php5 cd php5 sudo port install +fastcgi+mysql5+pear |
Or you can simply use the branch of PHP 5.2 via:
1 | sudo port install php52 +fastcgi+mysql5+pear |
Happy porting!
As i develop new CakePHP projects i like to spin the wheel with generating a “secure” salt string to be used in core.php. Instead of just bashing my head against the keyboard hoping for some random, usable, 40 character long string, i decided to let php do it for me, which i run from console!
<?php function generateCode($length=8){ $string = ""; $possible = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for($i=0;$i < $length;$i++) { $char = $possible[mt_rand(0, strlen($possible)-1)]; $string .= $char; } return $string; } for($i=0; $i < 100; $i++){ echo generateCode(40)."\n"; } ?>
If you have just woken up from a 10 year long coma, you might realise that the internet has been dumbed down to 140 characters and services that offer “URL Shortening” are quite widely used. Well today, coma awakened or not, I will be writing out a basic tutorial which will give you an understanding of just how to create a service like bit.ly or owl.ly to shorten URLs so you can insert them to fit within your 140 chars max tweets.
In this tutorial I will be creating this website using CakePHP 1.2.4, because it rocks, and you will think it rocks too if you haven’t used it yet! If you are unfamiliar with CakePHP please jump into it now by checking out either of these two books: Beginning CakePHP by Apress & Free CakePHP Book by Matt Curry! So let’s begin!
Now this isn’t going to be a tutorial into all the joys and wonders of CakePHP. There are simply too many to list, my database wouldn’t be able to hold so much information. However if you are new to CakePHP, all that this tutorial requires is that you have successfully set up CakePHP, wherever you may prefer. There are plenty of tutorials and guides on how to get CakePHP set up on the web. I did a quick search and found this one to be quite good, but there are plenty more out there. The most common newbie gotcha I find is making sure the .htaccess files are uploaded correctly. But with all that said and done! Let’s get going with our URL shortening website!
Final Source Files: app.tar.gz
Images & CSS: imagescss.tar.gz
Demo: http://jotlab.com/tutorials/url/
*please note that the random string generation will lead to collisions. This is a beginner to intermediate level tutorial, so teaching about base converting is out of the question! Well for me!*
I had heard so much about this book that i decided to pick myself up a copy of this widely acclaimed author. Outliers looks at the make up of success and how success is merely not just hardwork, perseverance and luck. Gladwell uses a ton of examples and stories to help prove his point, all of which are incredibly interesting and engaging! I recommend that if you are intrigued about what makes successful people successful, you take a look into Outliers!
I like and agree with this guy
But jailbreak already.