“Fix” phpMyAdmin timeout after 1440 seconds

If you are a regular user of phpMyAdmin like me, then you’ll have more than once had the problem of returning to your phpMyAdmin tab after a while and being prompted to login again, because you’ve been idle for 1440 seconds (=24 minutes). This is particularly annoying if you were in the middle of debugging something, e.g. with elaborate querys, but were interrupted by something or someone and now you have to start all over again!

Fixing this is actually quite easy and has been explained in detail by Brian Chang.

Be aware though, that you probably should not implement this “fix” on any servers that are accessible from the outside. Doing this on your dev machine, like the one from my tutorial, is a good idea though and something I’ll definitely add in its next iteration!

The more changes, the more stays the same!

It’s been a while, almost two years now, since my last post. Phew, let’s see how that happend (excuses, excuses..) and what’s happening in the future.

Pretty soon after my latest entry I went on a trip around the world for about 6 month and even though I fully intended to write weekly posts about cool stuff I did/encountered, I ended up not writing a single new entry. The trip was the best thing I’ve done in a long time though, so it definitely was worth it!

And once I got back, I was nearly overwhelmed by work. A lot of old projects needed maintenance and then a couple of big new projects came along and I simply lost sight and the interest in my blog. There was so much to do and so little time.

Now, two years later, I’ve re-discovered my interest for blogging/sharing and will try to do so on a more regular basis. Maybe actually do it once a week like I originally intended or at least a couple of times per month. They’ll probably not be the most extensive posts, but I’ll do what I can to keep them interesting.

So what’s going on right now/what has changed since my last post?

  • I’m still self-employed and working as a freelancer for serveral smaller companies/agencies. Even though I don’t need to be in any office or so and could easily work from any place I want to, I usually tend to stay at home and work from there. It’s what I’ve gotten used to and gives me the most flexibility in terms of working hours. I know there are quite a few people out there who can not work from home, because they get either easily distracted or want to keep work seperated from their private life. Both points I can understand, but so far it’s been working out fine for me…who knows for how long that’ll be the same :)
  • The site is at an all time high in terms of fake registration…
  • …and at a near all time low in terms of actual user activity. I guess I’ll have to spam some links on Twitter or so to get the traffic flowing again :)
  • I’ve switched from Prototype to jQuery. It’s been overdue for a long time and I’ve used the past year or so to get used to it and refine my skills. Absolutely loving it so far, so be prepared for a couple of jQuery related posts!
  • CodeIgniter 3.0 is still in beta/not released yet and it’s been like this for at least a year. I’m not sure what’s up with that, but I’m using it for all my current projects and it’s working like a charm.
  • I’m looking for a new PHP framework to base my projects on. CI has been fun, but I think it’s time to broaden my horizon and find something new/more advanced to play with. Laravel 4 looks really good, I think I’ll give it a try.
  • I’ve finally made the transition from SVN to Git. I have to admit I’m still not 100% sure about some things like branch management and such, but I’m getting there…I hope :) Most of my new projects are already hosted as private repos on Bitbucket and I want to start actually contributing to some open source software I’m using and give my own projects (mostly JS) a room for display. So keep an eye on my Github and Bitbucket profiles.
  • Inspired by some of the comments about my inital “Dev-Box” post, I’ve started experimenting with Virtual Box. Supposedly you can use the same VM on both Windows and Mac (which is important since I do work on both my MacBook and my Windows desktop machine and I want to share the development environment between them) and once I get the shared folder thing figured out, I’ll post a lengthy tutorial on how to get it all set up.

I think that’s it for now. Not too much after all, damn.

So here’s to more frequent updates on interesting topics! Cheers!

TortoiseSVN – Change User After Save Authentication

I had to update the credentials I use for one of the repos I work on but in TortoiseSVN there’s no built-in way of updating the saved credentials if the entered user is still valid (otherwise it will prompt you for a new username/password), except deleting all the saved authentication info for ALL repos worked on via TortoiseSVN.

After some research on Google I found this blog post by JohnnyCoder where he describes the same problem solved it using the above mentioned method of removing all the saved data. Lucky for me in one of the comments Brad Divine described a different approach which would only require you to delete a single file, the one holding the credentials for the one repo you want to update instead all of them. Sadly his approach didn’t work for me but with a slight adjustment to the path he mentioned I got it working on my Windows 7 system:

Go to this folder:

C:\Users\<your-username>\AppData\Roaming\Subversion\auth\svn.simple

The files you find here can viewed in any text editor and each file holds the credentials for one repository. They all have cryptic names but you can manually open them all and find the one you are looking for real quickly. Once you got it, just delete the file and next time you want to commit or update your local copy, TortoiseSVN will ask you for new credentials.

In case you are wondering, the folder for XP users looks like this:

C:\Documents and Settings\<your-username>\Application Data\Subversion\auth\svn.simple\

Dev-Box: mod_rewrite and Virtual Hosts for your Apache

This is gonna be a quick one, but I think you’ll find this quite useful … if you don’t already know it by heart ;)

As I promised in my initial Dev-Box post, I promised to give further useful instructions/tips for your development VM, so here we go: mod_rewrite and Virtual Hosts for Apache. Two basics that every coder should know by heart and uses every day (even though he might not be aware of it). I, for example, create a virtual host for every new project I start. That way I can access them easily via their own URL and don’t have to remember the exact folders they reside in.

Continue reading

Dev-Box: Installing a Mail Server

It’s been a while, but I’m back with another useful tutorial for all those out there using VMs like my Dev-Box. Last time I talked about getting SVN to work on your VM and now time it’s all about setting up a mail server, something you need for pretty much every web application you might develop.

As my posts are meant for users that use VMs for local development, I’ll not tell you how to install a usual mail server, but rather how to configure it that way, that all outgoing emails go to one email address instead of the address they are meant for. Using such a catch-all setup allows you to test emails coming from your app without having to send mails to existing accounts and even allows you to use your live database for testing and not having to worry that the live users might get an email that’s only meant for testing.

Continue reading

Leave Google alone ;)

Google just confirmed that the Federal Trade Commission is investigating them. Propably because other websites like Expedia, TripAdvisor, WebMD have complained that Google might prefer their own websites over others in their search results. I see why they might be upset about this but to be honest I don’t see why Google should care.

Sure, Google is the biggest web search provider around and everyone uses it, but no one forces people to use it and Google can pretty much do with their search engine what they want or am I wrong here? It was the same with Microsoft some years ago when they were forced by the European Commission to add other browsers like Firefox, Safari and Opera to Windows and let the user choose which one should be installed as the standard browser. They bent to that order and now we (at least in Europe) have a choice, but I don’t honestly don’t understand why they could be forced to do so. Don’t get me wrong, I’m glad more people might actually switch from IE to some other/better browser but why should a company have to actively support their competitors?

Am I the only one that thinks this isn’t right?`Or am I missing the point here? Please feel free to comment on/explain what’s going on here!

Dev-Box: Installing SVN

My last post about setting up a Virtual Machine to use as your local webserver was quite the success (hits increased from about 30 to nearly 1000 within 2 days…and dropped back to somewhere slightly above the old value by now) and I promised I would write some more tutorials on how to install some useful libs, so here we go and start with SVN in combination with TortoiseSVN a SVN client for Windows.

Continue reading

Dev-Box: Virtual Machines for Developers

This post goes out to all the coders using a Windows machine for development. Might be interesting for others aswell but I can’t say much about that as I’m a Windows user myself ;)

So what is this about? Well, some time ago I ran into smaller problems when trying to move a website from my local machine (which used XAMPP) to a real server (which was running on Ubuntu or some other Linux distro) and it was hard to fix the problems because of the differences between Windows and Linux servers.

I talked about this with a friend of mine and he told me about Virtual Machines (=VM). I had never heard of them before but what I heard was intriguing. Virtual Machines allow you to run a machine inside your machine, e.g. a Linux server inside your Windows machine. So you can use this VM with Linux to test your website locally before moving it to the real server. I know that no server is like the other and you might still run into some problems due to different library versions and so on, but you gotta admit that two Linux servers have way more in common than a Linux and a Windows server ;)

So in this post I’ll tell you how to setup your own VM with all the libs you need. Even if you haven’t worked with Linux before, you should be able to follow this tutorial/example easily.
Continue reading

Proto.Spy

A while back a friend of mine mentioned this site to me: It checks which porn sites you have been on.

The technology used to achieve this is quite simple. It inserts links to a bunch of porn sites in the page and uses Javascript to check the link color, abusing the fact that browsers by default use different colors for links you have visited or have not.

Some days ago I came across a blog post by David Walsh in which he described how to perform the above described check using jQuery. I was amazed how easy that was and thought it must be equaly easy to do the same using Prototype. Well, here we go:

I’ve set up a demo that checks a small number of sites (no porn, sorry).

Here is the small function I use to do the checks:

Event.observe(window,'load',function(){
 siteList.each(function(site){
  var a = new Element('a', { href: 'http://' + site, }).addClassName('check').insert(site);
  if(a.getStyle('color') == '#800080' || a.getStyle('color') == 'rgb(0, 128, 0)') {
   $('link-list').insert(a.addClassName('highlight').removeClassName('check').wrap('li'));
  } else {
   var b = new Element('a', { href: 'http://www.' + site }).addClassName('check').insert(site);
   if(b.getStyle('color') == '#800080' || b.getStyle('color') == 'rgb(0, 128, 0)') {
    $('link-list').insert(b.addClassName('highlight').removeClassName('check').wrap('li'));
   } else {
    $('link-list').insert(a.removeClassName('check').wrap('li'));
   }
  }
 });
},false);

with siteList being an array of sites that will be checked. The basically creates an anchor element for each site in the array and checks that elements color. If it matches my defined css style for visited links, than I add the class name ‘highlight’ to the element, otherwise I don’t. That’s pretty much what David Walsh does aswell, but additionally to that I check both http://example.com and http://www.example.com as some might have visited the one but not the other. If none were visited, I show the http://example.com link.

Any questions? No? Then start abusing this ;)

P.S.: This is an older post I copied from my old blog. Thought some of you might find this useful.

Extended logging of database errors in CodeIgniter

Some of you might and now and then have run into a database error while working with CI. Such errors are mostly caused by errors in your querys like not escaping user input or your fields or simply syntax errors.

In small applications that not much of a problem, but the bigger the application the harder it get’s to find the part where the bad query is hiding.

dootzky from the CodeIgniter Forum had exactly that problem and with a little help from wiredesignz we were able to add some more detail to the error messages!

Simply add this to the body of ‘application/errors/error_db.php’:

if($_SERVER['HTTP_HOST'] == 'localhost') {
   $trace = debug_backtrace();
   echo "The error occured in file ".$trace[4]['file']." on line ".$trace[4]['line']."";
}

Now additionally to the error you already know, you will be shown in which file and on which line the error occured (the db->get() method was called)! As this might pose a security risk on live systems, dootzky added the check for localhost.

I know that with CI 2.0 this might be obsolete because the error messages were enhanced, atleast the database errors now show filename and line, but someone still using some older version of CI (like I do for most of my older projects) might still find this handy.

P.S.: This is an older post I copied from my old blog. Thought some of you might find this useful.