Categories
Uncategorized

Trello – Project Collaboration and Management

I must say, I just learned about Trello and I really love it.  While it is great for teams, I have also found it very useful for individual organization as well.

Trello is like having virtual boards with post it notes.  The idea of the “post it” notes allows you to easily move them around to prioritize events.  You have different boards for different states.

As a personal organizational tool, if you know and understand the 80/20/FTF principal, you can have one board for 80’s, one for 20’s, one for FTF’s and one for completed tasks.  This will allow you to easily add a task and then you can move them between your lists as you see fit.  And you can have a list of completed tasks for historical purposes.

As a collaboration tool, you can easily assign different people to tasks.

It’s just a fantastic tool to use.

 

Categories
Technology

PunchTab Loyalty Program – Easy To Use – Easy To Scam :(

I started looking into a loyalty program called PunchTab.com.  It is super easy to install, but it is also super easy to game.  🙁

The fact that the points are generated through JavaScript, means it is super simple to open a javascript console, copy/paste in some code a you have free points.  I don’t know what the answer is, but they want you to have a catalog of “gifts” to give to visitors based on points.  Not a good idea, unless you happen to have money to burn.

Sorry PunchTab, you are a no go at this point in time.

Categories
post

How I Am Choosing Sections Of A Website To Optimize

I have an e-commerce system that is a complete PHP spaghetti mess.

I am running way Way WAY to many database queries. I want to share how I am tackling this mess.

I am using the mysql general log to store the queries that are being run to both a table and a file. At first I was using this to see what was run most often, and started caching those in memcache.

Today I decided, why don’t I find out what pages are causing the most queries, and optimize those, instead of individual queries. For example, my first test showed my product page took 110 queries.

1) I am executing this https://gist.github.com/1958901 on every page when I initialize the DB.
2) I turn on the general log for a few minutes. set global general_log=1; wait…. set global general_log=0;
3) I am using this query to find out what threads are running the most queries.
SELECT general_log., count(*) as c from general_log where general_log.event_time like ‘2012-03-02%’ and argument like ‘SELECT%’ group by q order by c DESC limit 10
4) I can then use the thread_id to find out what it was doing. The @page from the gist above will be one of the first queries, so I know where to start analyzing.

I hope this helps someone else.

Categories
post

Rackspace Cloud Servers to the Rescue

Rackspace’s cloud server architecture has a fantastic API. I recently found a need for an automated script to have access to a server for less than an hour a day.

Within this script, I am easily able to see if there is a server ready for it already, if not, it creates a server out of an image that I have already created for this purpose, waits for the server to become active, and then it does its work.

I have a separate script that check periodically for servers running past their expired time and deletes them so that we don’t have to keep paying for them.

This will take a server from about $10/month to less than $0.50 / month.

Categories
Uncategorized

Slim PHP Route Does Not Appear To Be Working, Always Chooses / Route

Most people probably run Slim PHP the way it was intended.

By adding a .htaccess file into your directory and letting it do it’s magic thing. However, I have complete access to our server, and choose not to allow .htaccess files. I instead put all of my apache mod_rewrite statements into my apache config files.

However, I just found out that if you are running your Rewrite’s through your <VirtualHost> tags, then one of your server variables may be incorrect. I am not sure if this is Apache’s fault, or PHP’s. However, a simple fix is just set it yourself.

At the top of your PHP file, put the following.

$_SERVER[‘SCRIPT_NAME’] = ‘/RELATIVE_PATH_TO_YOUR_SLIM_APP_FILE.php’;

most people would probably use the following.

$_SERVER[‘SCRIPT_NAME’] = ‘/index.php’;

Categories
post

Pre-Commit Fails When Removing a File From Git

I just blogged about automatically running PHP Lint when committing a file into the repo. Well I also had the joy of it failing because I removed a file.

If you get “Could not open input file: abc.php”, then you may have the same problem I did.

There’s an easy solution. The pre-commit file looks for all changed files. Technically, a removed file is changed, but it also doesn’t exist when you go to run php -l against it.

Open your pre-commit file, and change the line that looks like this:

exec(“git diff-index –cached –name-only {$against}”, $output);

to

exec(“git diff-index –diff-filter=ACMRTUXB –cached –name-only {$against}”, $output);

Categories
post

Run PHP Lint before committing to GIT

This is going to sound stupid, but if you don’t have rock solid unit tests in place, one of the things you should be doing is running PHP Lint.

What is PHP Lint?
Simply stated, it checks your php file for syntax errors. How many times have you forgotten a semi-colon, or had unmatched curly braces?

How do I run PHP Lint?
It is very easy to run from the command line
php -l your_php_file.php

Using GIT? You should setup a pre-commit hook to always do this so you don’t push something bad into the repo. I am guilty of doing this in the past. 🙁

Here is a great post by Travis Swicegood about setting this up.
http://phpadvent.org/2008/dont-commit-that-error-by-travis-swicegood

One thing to remember is that you also have to make the script executable.
chmod 744 .git/hooks/pre-commit

Categories
post

phpUnderControl javascript fix for Internet Explorer

There are two errors in the phpUnderControl javascript that causes IE to work like the other browsers.

Basically, you may not be aware that the “home screen” auto updates in other browsers. I kept refreshing like a madman until I opened it in another browser and saw it happen automatically. Then I dug in and fixed it.

Here is the patch:
[code]
@@ -16,7 +16,7 @@
if(d != null) {
el.setStyle( {
‘height’: d.getAttribute(‘height’) + ‘px’,
– ‘width’: d.getAttribute(‘width’) + ‘px’,
+ ‘width’: d.getAttribute(‘width’) + ‘px’
} );
}
delete d;
@@ -26,7 +26,7 @@
var d = el.contentWindow.document.body.scrollHeight;
if(d != null && d > 20) {
el.setStyle( {
– ‘height’: (d + 50) + ‘px’,
+ ‘height’: (d + 50) + ‘px’
} );
}
else {
[/code]

Categories
PHP Snippets Programmer's Mindset

Solved: vBulletin Quick Reply Not Working (ckeditor.js unable to get value of the property ‘label’)

I have a vBulletin board that I manage and while recently had users complain about the Quick Reply not working.  They had to go into the advanced editor to make it work.

Doing my due diligence as an IT professional quickly narrowed it down to…. IE of course.  I spent hours digging, using a debugger I kept getting the error in the title of this post.  I kept going through the Call Stack trying to figure out what was going on, but the javascript is minified very tightly, so following it became daunting.

Two days later another user complained about not being able to update their profile.  While debugging this, both problems became very clear.

I had recently put in some rewrite rules to make the forum more SEO friendly.  However there are a couple situations where the rewrite rules broke down.  I was missing the two lines colored in green below.

RewriteEngine On
RewriteRule ^/videos.html /forums/36-Bowling-Videos-amp-Pictures
RewriteRule ^/threads/ckeditor.php /ckeditor.php?t=$1 [L]
RewriteRule ^/threads/(.*) /showthread.php?t=$1 [L]
RewriteRule ^/forums/(.*) /forumdisplay.php?$1 [L]
RewriteRule ^/entries/(.*) /entry.php?$1 [L]
RewriteRule ^/blogs/(.*) /blog.php?$1 [L]
RewriteRule ^/members/ajax.php /ajax.php?$1 [L]
RewriteRule ^/members/(.*) /member.php?$1 [L]
RewriteRule ^/list/(.*) /list.php?$1 [L]
RewriteRule ^/list/author/(.*) /list.php?$1 [L]
RewriteRule ^/$ http://www.bowlingboards.com/forum.php  [R,L]

It was that simple.  I am sure I am missing some other rules, and will try to get them corrected in due time.

 

Categories
status

Just had my first GitHub pull request put…

Just had my first GitHub pull request put into a project. Happy to contribute, even in small ways.

https://github.com/EmilStenstrom/jQuery-animate_from_to