Website Control Login with jQuery

October 1, 2009 2 comments

Having multiple websites with different environment can be a pain to use or switch between them. This gave me an idea to create a control panel automated in jQuery. This is my real first go with  jQuery, as all other were snippets which end up in the bin.

I already had a simple HTML page with buttons which posted login information to the login page so I could login with a single click. This page was made simple and addition websites required a new form with new hidden input fields and a button. Repeat this for each site added was becoming tedious and that is were the idea lit up.

I wanted a simple array which contains all the websites name, environment, username and password located nicely in one place. This way it’s easier to manta in the website being located in a nicely tight place. With this in mind, the following was coded.

var operators = [
    { name: "Site1", env: "Env1", username: "testuser1", password: "testpass1" },
    { name: "Site2", env: "Env2", username: "testuser2", password: "testpass2" },
    { name: "Site3", env: "Env3", username: "testuser3", password: "testpass3" },
];

With this set, I can add or remove entries at will without any real code involved.

Read more…

Categories: Programming Tags: , , ,

SHA1 Speed Differences [PHP vs MySQL] – Part 2

September 26, 2009 1 comment

Back again for the second part of SHA1 Speed Differences. Who will win this battle between PHP vs MySQL? This post is a continuation of SHA1 Speed Differences [PHP vs MySQL] – Part 1 directly replying to the post MD5/SHA1 Encryption in PHP vs. MySQL.

As discussed in part 1, using an index on the digest field brings us to a reasonable results. This post will be based around differences in speed performance between PHP vs MySQL. It is based on a lot of testing but I won’t annoy you with a lot of numbers.

First thing I noticed was, that if I increased the number of records from 500 to 1000 and even to 2000, the increase in query time was becoming drastically large. One problem was due to the index, which I’ve explained in part 1 but the difference in PHP vs MySQL was becoming evident. The table had no index for both queries which lead  me to think that MySQL version had something wrong. To cut it short, when MySQL manages to get the result spot on with the index or few records (like 10-100), the speed difference between PHP vs MySQL is negligible, but when the amount of records increase, MySQL SHA1 was really slowing down. The results I kept getting were as follows (only select queries done):

Rows PHP MySQL
500 3.947ms 5.273ms
1000 4.884ms 9.603ms
2000 5.856ms 15.507ms

Read more…

SHA1 Speed Differences [PHP vs MySQL] – Part 1

September 24, 2009 4 comments

Reading my favorite blog, I’ve encountered a rather interesting article discussing the speed difference between PHP and MySQL in SHA1 algorithms. The results obtained were suspicious to me. Usually in database terms, reads are faster then inserts, but in this case it was the opposite.

Being the hard headed I am, I had to find out what was wrong with the tests conducted in that article. The poster kindly provided the source which was really dandy as I could execute the same tests as the poster did. After several head bangs trying to setup PHP to work flawless on my pc, I managed to analyse the tests.

At first glance, everything looked really well done and flawless. Tests were godly written and everything was up to standard. After considerable time contemplating and a beer, I came to the conclusion that the problem lies elsewhere. The tests were simple enough that it was very easy to understand and even test. One query had a fixed string and the other one had an SHA1 function call from MySQL, exactly as the test intended.

The thought that was haunting me was that even the normal PHP method, (ie. the string comparison) reading was slower than the insert. Looking at this problem alone and excluding PHP vs MySQL performance led me to the problems. Yes that’s right, there is more than one problem. It’s not how the tests are written but it’s more how databases work internally which should be taken into consideration once working with databases. Read more…

Google Visualization Configuration Options

September 19, 2009 2 comments

Continuing with the previous post, I wanted to modify the default area chart a little more.

While I was skimming the page containing the methods and events, I got stuck on the section ‘Configuration Options’. That being said, the page looks like a JavaDoc thus placing methods, properties and the sorts on the same page and of similar format.

My first guess without reading anything I tried to set the line colors of the area chart with the following code:

var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.color = [ 'black', 'green' ];

Read more…

Joys of Free Tools

September 19, 2009 Leave a comment

There we are, another day passed and as promised I’m gonna get some features jotted down.

I was approached by a friend to lend a hand in his project which turns out being quite interesting. The project resulted to be simple with the end result of showing a graph of daily values.

I knew about Google visualization package which consists around a gazillion of free, very useful tools. While browsing the gallery, I encountered what i needed most: ‘Area Chart‘.

Read more…

The Grand Opening!

September 17, 2009 Leave a comment

Hi and welcome to my blog.

It’s 1:10 am in the morning and my eyes, body and head cannot do any more to keep me awake.

I’ll be posting some interesting coding pieces I have encountered tonight by scrambling google’s free visualisation APIs. (if I don’t forget them)

Till then, have a wonderful time.

Categories: Other
Follow

Get every new post delivered to your Inbox.