Supressing Error Messages in PHP
Every once in awhile PHP decides to throw some errors. Usually it’s because you didn’t do something right, but what if it’s throwing errors anyways? What if you are on a production server and you need to suppress the errors?
In that case add the following the the top of your file, or include it as a header.
{code type=PHP}
ini_set(“display_errors”, 0);
ini_set(“log_errors”, 1);
{/code}
Optionally, if only a particular statement is throwing an error, you can do this:
{code type=PHP}
$myName = @get_name();
{/code}
The “@” symbol will suppress any errors that the calling function makes.
Remember, suppressing errors is no substitute for good coding. But, sometimes you do what you have to do.
Showing All Errors in PHP
When I was first starting to create web sites with PHP, I struggled with getting error reporting turned on. Turns out, that you can have it enable at the server, or in the document, or in both. For development, it’s probably a good idea to have this at the top of script:
error_reporting(E_ALL); ini_set('display_errors', '1');
This will allow php to display all errors, notices, and warnings. Simple things like developing with error reporting full on like this help prevent security breaches and unknown application behavior.
Aristo, a jQuery UI Theme
I recently posted a question to Hacker News about using Theme Roller for site design. The general concensus was that it’s great, but sometimes looks a little childish. So, a fellow HN user released http://taitems.tumblr.com/post/482577430/introducing-aristo-a-jquery-ui-theme. It’s called Aristo, and it really cleans up the jQuery UI stuff.
Take a look if you get bored. It’s worth it.
I’ve been on a WordPress kick lately, and decided that Hacker News needed a WordPress plugin. This plugin simply places a nice little Y Combinator badge in the upper right-hand corner of your post, with a link that says “Submit to HN”. If you’d like to check it out, it’s used on this post.
Also, it can be downloaded here.
If you have any questions or need support, please leave a comment.
PC to Mac Transition (Developer’s View)
For the longest time I’ve been a PC user. My very first computer related memory was playing video games on a 286 with some version of MS-DOS on it (4.?). After that, my family graduated to Windows 3.1, then 95,98, XP, Vista, and then Windows 7. Needless to say, I have been using using PCs for the better part of my entire life. I’ve been using PCs with Windows for most of that time as well. However, not exclusively.
When I started college, I found that REAL programmers used Linux. So, I installed Ubuntu 4.10, and went from there. From that point on, I have been using Linux (Ubuntu) as my development environment for all applications. I’ve done my level best to stay away from Macs because I feel they are overpriced, overhyped, and have a generally pretentious user base (not true for all Mac people, just the types I encounter). I also figured knowing 2 operating systems well was probably good enough. Turns out that it wasn’t as soon as I started working for DDM.
DDM is a company filled with graphic designers. It’s also a fairly progressive place, with nice perks, a fun office layout. Due to the abundance of graphic designers, DDM is an all Mac shop. I would argue that the graphic designers can have their Macs and I can have my PC, but alas, that is not possible. So, with great hesitation, I accepted by brand new 17inch Macbook Pro.
Firstly, the specs on this machine aren’t spectacular, but they aren’t bad either. It has a 2.8Ghz Core 2 Due in it, with 4 GB of DDR3 memory. It has some type of Nvidia card in it as well, but I can’t seem to find out what type. Either way, good, but not amazing or anything.
The display is probably the high point of the laptop. It has a nice matte finish (per my request), and some ridiculously high resolution. Problem for me is that the resolution is so high that it makes it hard to read text. That’s okay though, because I’ve learned the zoom shortcut keys for all of my favorite applications.
Coding on a Mac works much the same as it does anywhere else. I tried to use a port of Gedit as my default editor, but I ran into problems with it saving backups when I didn’t want them. I ended up switching to Textmate, which so far seems like a nice package. My only real gripe with Textmate is that it changed the default behavior for the “End” key. It says “Oh, you want to go to the end of the line? I don’t! Lets go to the end of the document instead!”. Turns out, you need to press CMD+Arrow to get to the end of the line, which I find extremely annoying. Actually, CMD + anything is annoying. The ctrl key works fine for everyone else, but Apple just has to go an ruin it for everyone.
Aside from that, life goes on much as it always has. Code works much the same no matter where you are, it’s just a matter of how comfortable you are in that environment.
Tether a Blackberry on Alltel
I cannot even describe to you the overwhelming feeling of accomplishment that I have now that I have finally tethered my Blackberry Curve (Alltel) to BOTH my laptops. On Windows 7, it was fairly simple: pair the phone, then set up a com port. On the Mac, is was pair the device, set up the DUN for Generic & CDMA. After that, the phone number, user name, and password are: #777, <your 10 digit phone number>, alltel.
It took me over a year to find that information on the internet. I don’t know if people just don’t use Alltel or what, but it was exceedingly hard to find.
Down speeds are around 280kb/s, with uploads coming it at about 90kb/s. Latency is around 330ms. Not great, but not bad either. I can easily work on those speeds, so long as I don’t need to do any heavy uploading/downloading.
If you need help tethering, leave a comment and I’ll see if I can help.
It’s been awhile since I’ve posted here, so I thought that I’d write a quick blurb about what has been going on in my life. So far this year, I have:
- Quit grad school.
- Got a job as a PHP + MySQL developer for DDM Marketing and Communications in Grand Rapids, MI.
- Become far better at PHP that I used to be.
- Commuted over 5000 miles.
- Bought a new car.
- Went to Arizona to visit my sister.
- Moved to Grand Rapids.
- Ate at some excellent new food places.
- …and FINALLY learned how to tether my Blackberry Curve (Alltel) to my computer via Bluetooth.
Overall, it’s been a fairly exciting couple of months. I get married at the end of July, and look forward to that above all else.
Thanks for being patient. New posts on the way.