The way Eric Gach does blogging.
Posts tagged PHP
Netbeans 6.9 CPU Usage
Jul 18th
I use Netbeans for just about all of my editing on projects anymore.. and the latest version of 6.9 has had a problem I’ve been dying to get fixed for a while. I’m primarly a PHP programmer, so I’m not sure if the bug extends beyond the PHP plugin or not. However, I’ve noticed while having a project open, Netbeans seems to use 100% of one of my CPUs (dual core machine). I’ve been casually searching around for a fix and until tonight I hadn’t found anything. Finally I found this comment on the netbeans blog which provides a flag to use that seems to have fixed it completely!
Hopefully this helps some of you out there from getting totally frustrated with netbeans. For those of you who don’t want to click the link… the fix is to add this flag to your shortcut for netbeans.
-J-Dnetbeans.indexing.recursiveListeners=false
SiTech_Plugins
Nov 30th
Well, I’m finally doing it. I’m rewriting my voodoo code that makes reloadable modules or plugins in PHP. I’ve always toyed with the idea of rewriting my original work for PHP_Modules and making it work with classes; now the time has come. I have started work with my SiTech library to make SiTech_Plugins. It will be the same concept of PHP_Modules, but not only will it work with functions, it will now work with classes. This is something that was never really possible before because when PHP_Modules was written, it was written for PHP 4.
I haven’t gotten very far yet with code, but the theory of it is to create a base class with a __call() method. That’s basically all the base class will consist of. When a plugin is loaded, the class read from the plugin file will be created to extend this base class. From there, all methods found within the class will be stored as lambda functions inside a special class variable. This then makes it easy to reload code, by recreating the lambda function when the code is reloaded. Therefore, the class itself never needs to be redefined, it just needs all the functions reloaded. So, in theory this is entirely possible with PHP 5 and the use of the magic __call() method for classes.
Some of you may wonder why I don’t use runkit from PECL. While it would make things a ton easier, I wanted more of a code solution that might work for everyone without extra requirements. I might look into creating it to work both ways though. I can imagine runkit would be a lot cleaner method of doing such voodoo, but I’m also unsure if runkit will even compile with 5.3. I’ll have to do some research into that and find out for sure. Of course, there will be more to come as I make progress even if its good or bad progress.
Life & Updates
Nov 10th
Well, its been a bit since my last post and I think its time for another update. I’m still looking for a job, haven’t had any luck finding much yet. Might have a part time job lined up until something else works out though, so that’s good
On the other hand, I’ve had some time to work on dev.php-oop.net So far its been mainly backend work, so there’s not a lot more to show for it, but I’ve taken some time to implement a new password hashing using crypt and blowfish. I’m also trying to work on the password reset form to make it work better. Currently it just resets the password, but I want it to e-mail the user, then the user must click a link before the password is actually reset.
On the other hand, my jogging is going well. I’m not keeping up with it as good as I would like, but I have managed to go as far as 3 miles in one time. I also went this past Sunday and jogged with my friend, we both ran to see how fast we could do a mile and half. I managed to run it in 12 minutes and 51 seconds! I just hope I can keep doing it and keep running further. I would like to participate in a marathon sometime soon as well. I’m also, starting this week, lifting weights with the weight set I just got moved in. I’m hoping between that and running, I can make up for the last few years of my life that I just haven’t tried anything to get into shape. Hopefully I’m making up for lost time at this point
Life & Changes
Oct 24th
Well… things have been changing in my life lately. I’ve had to move back to my home town and look for a job in the Kansas City area. I’m currently living in a house my parents own until I can get a job and a place of my own. Kelsey had to move back in with her parents for the time being until sometime in late January or early February of next year. Its hard on both of us, but we’ll make it through it. I’m currently looking for employment in the St. Joseph, MO or Kansas City area, so if anyone knows of anything, please feel free to let me know.
On another note, with the lack of work I’ve had lately, its given me time to work on php-oop.net again. I’ve actually been working with the dev site to get things going. I started with a total rewrite because I wanted to take a totally different approach to the back end of the site. I didn’t want to use a framework, but I wanted the same structure. I wound up using my own SiTech library for the back end to make it more MVC like. I think the approach is working wonderfully. I’ve learned new things and made tweaks to SiTech to improve functionality and how it all ties together. If anyone is interested in participating with either SiTech or the development of php-oop.net, please let me know. I could always use some extra help.
A couple of other things I’m trying to do more/better is writing in my blog, and jogging each day. This is the first post after a while, so we’ll see how that part goes, but the jogging is already going great! I started Monday (the 19th) by jogging almost 3/4th of a mile. I can say that Tuesday, my legs were so sore that it killed me! Wednesday I went jogging again, but I’m not really sure how far I made it. Thankfully after that my legs weren’t as sore, but still hurt Thursday. Yesterday (Friday) I went jogging again and actually made it a full mile! Since we ran on a track, I also did a lap of sprint/jog where I sprinted the straight parts, and jogged through the corners. It was really great, and I’m happy to say today my legs don’t hurt at all. Hopefully next week I’ll be able to push it up to where I can go every day instead of every other day.
Well, here’s to hoping things go as planned… I’ll update again later this week.
Product Review: Zend Studio Neon
Mar 21st
Well, now that Zend has released Zend Studio Neon, I’ve taken the time to download it and give it a try. I have to say, they’ve done a pretty decent job with it. The feature set is very robust and integration with the Zend debugger is very nice. It uses PDT plus some extras to provide excellent PHP IDE support. It’s got all the good stuff of Zend Studio and Eclipse combined in one. Out of the problems I noticed in the beta’s, most have been fixed, but there’s still a few lingering.
One issue is mainly an issue with Eclipse itself, there’s no way to convert spaces to tabs or vice-versa. There’s also no way to make it trim spaces on the end of lines. This is a feature that Zend Studio has had itself in previous versions. An easy fix to this is a plugin made by Andrei Loskutov called AnyEdit. It’s made for Eclipse itself, but since Zend Studio Neon is Eclipse, it installs easily using the directions provided on the page.
Another issue, which was really the show stopper for me, is that the building of the workspace will sometimes “freeze”. I say “freeze” because Neon continues to respond, however, you can no longer save any files, close the workspace, or close Neon itself. I must note that I only experianced this issue twice within the few weeks that I used it. It’s annoying enough of an issue that I don’t care to deal with it. Both times I had the problem was when I went to save a file and it wouldn’t save, therefore loosing the work I had just completed. I have noticed that sometimes it does take a while for the project to build the workspace, but I gave it plenty of time to continue each time and it did not make any progress.
Other than those two problems, Zend Studio Neon is a very solid PHP IDE. I haven’t gotten around to testing every little feature, but I enjoyed working with it and would reccomend it with caution. Be aware that there are still issues that I’m sure Zend is working on solving, but for the most part it’s a very stable editor. Happy PHPing!
New Tutorial Series: What you should know about X
Feb 5th
I’ve started on a new series of tutorials that I plan on writing over the next few weeks. They’re pretty simple subjects, but I feel they need to be out there! The series is titled “What you should know about: X“. My first subject in the series is Dynamic Includes. This is based on my previous tutorial that is here, but is completely rewritten.
I’ll start working on a new tutorial when I get the chance. As the tutorial says in the conclusion, it will be about input filtering to prevent injection attacks on your site. I hope someone who reads these will learn something they can put to use! If you notice any problems or errors, please just let me know. Happy reading!
Just an update.
Dec 20th
Hey all. I just thought I’d take a few minutes to write a post. I know, it’s been a while again, but I’ve been pretty busy as of lately. I’m currently reading a new book, working on php-oop.net and working full time. This week I’ve also come down with a bad cold. Yesterday before getting off work I started to feel pretty crappy, so I went and layed down after work. Wound up falling asleep around 7 last night and didn’t make it back out of bed until 8:30 this morning. So far it’s just a head cold, but my whole body aches and I’ve got a slight fever. Nothing I can’t deal with though.. start popping the cold pills and I’ll be ok. Right now I just feel groggy because my whole head is clogged up.
On the programming side of things, I have been working on php-oop.net. Not much has been done recently, except I got my friend kuja to help me out with a new design. I don’t have it active on the dev site yet, but I plan on doing so as soon as we iorn out a few things with the design. Just take note that the dev site might not always work as it’s updated from SVN and could break. However, it’s given me new motivation to actually want to work on the backend of the site now. Currently, there’s only some basic user stuff implemented, which leaves a lot to be desired. At least it shows a base system that’s somewhat functional. The SiTech backend that runs the site also needs work too, so I’m sort of maintaining both projects at once.
As far as progress with SimpleIRC, I haven’t really touched it in a couple weeks. I’ve kept myself busy with other things. I really need to get back to SimpleIRC though as everyday miniE is showing more and more issues that I don’t want to take the time to fix since I am writing a new bot. Things with my new server are going smoothly. I’ve since setup a lot of new stuff like SSL, virtual e-mail addresses, and a Call of Duty game server. I admit, I don’t have a lot of time to play Call of Duty, but that’s my own fault. It’s at least nice to have a server up and running.
Well, that’s all for now. I’ll update later this week (or weekend) when I’m feeling better.
PHP and ini_set() – A few things you should know
Dec 12th
Today I was writing some code for a website I’m building and came across a problem when trying to set the include path. When I was using set_include_path() and ini_set() to set the include_path, both functions would return false. It took me some time and a bit of help from Davey to finally figure out what was going on.
In my Apache configuration I was using php_admin_value to set an include_path for one of my virtual hosts. If you’re not familiar with php_admin_value, you can see the manual page here. By using php_admin_value in the httpd.conf (or a vhost), you’re there by telling PHP to force that setting and disallow anything else to change it, meaning PHP scripts or even .htaccess files. That was fine, except what I didn’t realize, is that for some reason PHP sees that setting and disallows it to be changed in any other virtual host or PHP script running under Apache. I can only speculate that this behavior is a bug and not intended. I would assume for that value to only affect the virtual host it was declared in, but instead, I spent 30 minutes debugging my code wondering why my calls to set_include_path() were returning false.
Let me just clarify for a second, the virtual host I had php_admin_value on was called, lets say foo.example.com and the code I was working on, that was returning false, was in the virtual host for bar.example.com. So, as soon as I realized that was the only place I was using php_admin_value at was foo.example.com, I changed it to php_value and restarted Apache with the new configuration. Instantly the code on bar.example.com began working as expected and setting my new include_path value. I’m not sure if this is default expected behavior, but it’s not what I expected at all. I will be filing a bug report to verify this though.
Well, that was my fun for the evening. I just wanted everyone to be aware of the effects php_admin_value and php_admin_flag have on your Apache configuration. If anyone has any different results or findings, please let me know!