Geek

Hidden Windows Features

Written Thursday, September 16th, 2010 by Jim

Windows

Network Password Management

A very frustrating aspect of Windows (among many) is it’s unclear management of network passwords. On some occasions, when entering a password you will be given a check-box feature asking if you’d like to save the password onto the system. On other occasions this feature is not available. When logging on to our internal network here at the office it can be quite handy to have our local machines remember our network passwords so we don’t have to enter them in day by day. If the system manages to remember our passwords, how do we change or even remove them for that matter? Windows has a buried feature that allows the management of all your network passwords. This has always been a part of Windows and may be well known but I thought it’d be worth mentioning for those who are unaware of it.

Click “Start” –> “Run…”
Type: “control userpasswords2″ (without the quotes)
Click on the “Advanced” tab.
Click on the “Manage Passwords” button.

Voila! All your previously connected network computers should be listed here and you can manage your passwords via the “properties” button.

Shutdown Timer

Windows has the built-in ability to shutdown your computer via a timer. This can be handy if you’ve initiated a lengthy process and want to shut down the computer after it’s done but you don’t want to wait around for it to finish to do so.

Click “Start” –> “Run…”
Type: “shutdown -s -t XX” (where XX is the time until shutdown in seconds)

Alternatively, instead of “-s” you can type “-r” and that will reboot the computer instead.

WordPress Plug-ins

Written Thursday, September 9th, 2010 by Jim

Wordpress

We like using WordPress for many of our clients that require frequent updating to their websites. It’s a great CMS solution that is straight forward to use, and for us developers, there is vast community support which include a plethora of plug-ins. Plug-ins improve site functionality, save time and enhance user experience. Here are some of our favorite WordPress plug-ins (in no particular order) that we find ourselves using over and over again.

  • Kimili Flash Embed: Allows easy embedding of Flash movies (swfs) using SWFObject.
  • Multi-Level Navigation: Adds a multi-level CSS based dropdown/flyout/slider menu to your navigation items.
  • Cforms: A highly customizable, flexible and powerful form builder.
  • Category Order: Easily allows re-ordering of categories via drag and drop.
  • Exclude Pages from Navigation: Provides a checkbox on the editing page which you can check to exclude pages from the primary navigation.
  • Hide Admin Panels: Hides admin panels for a specific user and/or role. This is great for preventing certain users from accidentally changing settings that should not be changed.
  • WP-Maintenance Mode: Adds a splash page to the website that lets visitors know the site is down for maintenance.
  • Slideshow Gallery: A flexible and easily configurable Javascript powered slide-show gallery.
  • Custom Admin Branding: Custom branding of the WordPress install which include custom images for and styles for the log-in screen, admin header and footer.
  • WP-Lytebox: Used to display images by overlaying it on the current page. It’s based on the popular Lightbox script.
  • Google Analytics for WordPress: Simple addition of Google Analytics adding lots of features such as custom variables and automatic clickout and download tracking.
  • IntenseDebate: A feature-rich comment system which enhances and encourages conversation on the website.
  • WP-Cache: An extremely efficient WordPress page caching system to make your site much faster and responsive.

WhatTheFont!

Written Thursday, September 2nd, 2010 by Jim

WhatTheFont!

As a designer, many times I am given the task of re-designing or re-purposing a website and the client wishes to maintain the look and feel of their previous site or simply just maintain their brand. It’s important to continue using the fonts that were used because consistent font use is all part of defining a brand. The problem is, for the most part, the client is unable to provide us the font file that was used because it is in the hands of an unreachable previous web-developer or designer. In other cases, I may be given an image (say, of a poster or a banner) and have been given the task of altering or adding copy to it but again, the font used in the image is unavailable to me. What do I do?

The geniuses at MyFonts have a tool on their website called WhatTheFont! It is a font recognition tool where you upload an image that contains the unknown font, define which letters are which, and then it spits out various font possibilities that resembles the closest match to the font in your image. It’s not fool-proof and there are times I’ve uploaded images that the system couldn’t recognize, but all in all it does a pretty darn good job saving me time and migraines. Check it out!

Javascript Deobfuscate & Beautifier

Written Wednesday, September 1st, 2010 by Chris

Some developers spend a great deal of time developing javascript for various projects and want to protect that code from being stolen or re-purposed for other reasons. I get why they do it and support the concept. The problem is when the code has issues. If the code has been obfuscated it’s impossible to make code changes or edits to the JavaScript….or in the case I recently came across, fix the developers code as there is a bug/conflict that is unique to my install.

So, for every security feature available there’s a hack to undo it. I found this tool that deobfuscates and beautifies the JavaScript so it’s readable and editable (thanks Einar for making this tool…very helpful).

** side note: Sometimes it’s not about obfuscating the code. Sometimes a developer is just trying to minify the code for faster download. Minifying can reduce the size of a JavaScript considerably, but in my opinion should only be done if it’s a REALLY large .js file.

SFTP Jail

Written Monday, August 23rd, 2010 by Chris

SFTP Jail

I’m not an ISP and only provide site hosting to clients who we’ve developed sites for. Generally our clients don’t get access to their sites via SFTP since we do the site updates and we’re just not set up to let clients start FTPing on our servers. The clients who do need to make updates to their sites can either use the CMS we build for them or they can go to a ISP to host their site for them.

I’ve recently run into an exception where we needed to provide SFTP access to a couple of our clients. SFTP means we’d need to give them SSH access which translates into shell access. I’m not keen on giving shell access on my servers to anyone but my staff (and even then only to a select few). I’ve known about SSH jails, but never had a need to create one…until now.

So, I went at it and made myself a SSH jail for these select clients. I can now provide SFTP access to the clients web accounts while preventing them from being able to navigate to arbitrary locations on the server (and no shell access). Other than a few security alterations, I basically followed these directions to set up the server with a jail.

Magento Database Recovery

Written Thursday, August 12th, 2010 by Chris

Magento

We recently made some alterations to our Magento dev server and buggered up the database in such a bad way we couldn’t even log into the admin. The easiest way to recover was to restore from last nights backup. Turns out it wasn’t so easy.

I removed the buggered MySQL db and restored last nights dump. As I was importing the DB I was getting this error:

ERROR 1005 (HY000): Can't create table 'Table.frm' (errno: 150)

I knew that none of the files had changed so it must have been a database issue. After some digging I added this to the sql file:


SET FOREIGN_KEY_CHECKS = 0; -- TOP of .sql
SET FOREIGN_KEY_CHECKS = 1; -- BOTTOM of .sql

The import worked fine this time round. When I browsed to the site I got this php error:

"PHP Fatal error: Call to a member function extend() on a non-object in /var/www/html/website_thebigtoybook/privatesale/app/code/core/Mage/Core/Model/Mysql4/Config.php on line 115"

I’m pretty pissed off at this point. Thankfully I was able to track down a fix pretty quickly (with some help) and added the following to the top of the .sql file:

SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;

I of course had to delete the database, then re-import with this new setting. It worked like a charm and we were back in business. If I had more time I’d look into exactly what these commands do (although I do have some idea…related to indicies and INNODB tables) but I’m going away for a few days and just need to get it done…so more homework on this will be done another day.

Input Director

Written Wednesday, July 28th, 2010 by Chris

Input Director

I, like many developers, have several computers at their disposal. Other than the dozen or so servers that I manage for myself and various clients (which are Linux systems and only ever touch with SSH) I have two Windows workstations at my desk. One is my desktop and the other my notebook. I use the notebook for all communication stuff like Email, IM, Skype, etc. (although it does get used as a test system from time to time as well). All my dev and everyday type work is done with my desktop system.

In the IT world there’s a thing called a KVM (Keyboard, Video, Mouse) which sysadmins use to allow one keyboard, one monitor, and one mouse to control several systems. Just hit a keyboard combo (or go old school and press a button on the KVM box) and you can toggle through all your systems without having to move around and swap between keyboards. Major space saver as well. Not sure it’s used much anymore since SSH is really the only way to go, but maybe Windows sysadmins still use them.

Input Director connected computers

In any case, I had a need for a sort of KVM for my desktop to toggle between my desktop and my notebook. Since the notebook has a monitor I really only need a KM. Several years ago I found a product called Synergy, which was great in my experience a bit buggy…especially over a wireless connection. It did the trick, but I was super happy when I found Input Director. It is far less buggy, and is still being developed and improved upon.

Once you have the software set up (which I admit can be a little tricky at times) it basically allows you to (virtually, not physically) move your mouse off one machine and onto the other (via the network). Once the mouse is on the other system it will allow you use your keyboard to type to your hearts content. Of course moving your mouse off the screen back onto your primary computer will move mouse and keyboard control back to your main system. If you have more than two computers you can setup Input Director to manage them all quite easily. One note of caution though, if you have several people on the same network using the Input Director be sure to check you settings or your buddy will be able to take over your computer…makes for a few laughs on April 1.

One other point I want to make, you can copy and paste text from one system to the other. Apparently you can also copy and paste files as long as the source file is in a shared folder (although I’ve not tried this).

Browser Tools

Written Wednesday, July 14th, 2010 by Chris

We develop websites…and of course we use various types of tools to do this. Every web developer I know follows the following simple rules:

1) Develop for Firefox. Build out your site to work with Firefox first. Once you’re happy with the page/site, modify your CSS and HTML to then make it work in IE, Safari, Chrome, etc.
Firefox, Internet Explorer, Safari, Chrome and Opera
2) Install and use the Web Developer Toolbar
Web Developer Toolbar
3) The Firebug plugin for Firefox is a MUST HAVE: (not to be confused with our friends at the create-a-game site Fyrebug)
Firebug

For Flash developers there’s some tools that make all the difference when it comes to debugging and testing:
4) Flash Switcher which allows you to easily toggle between various versions of Flash.
Flash Switcher

5) Flash Tracer which allows you to see your Flash IDE output, but inside your browser.
Flash Tracer
6) The debug versions of Flash which you can get (along with all the past versions of Flash) from Adobe’s archive.

server-status

Written Sunday, July 4th, 2010 by Chris

Munin and Nagios

We use Munin and Nagios to monitor our farm of servers. We recently upgraded our own corp site with one based off WordPress. Just this evening I noticed that Munin wasn’t returning nice charts for the Apache processes. After some digging I discovered it was due to rewrite rules in the .htaccess overriding the httpd.conf config. Easy fix though, just added a rule to the .htaccess to ignore the server-status url:

RewriteCond %{REQUEST_URI} !=/server-status

I’m posting here for my own notes. I give full credit to this site.

rsync

Written Wednesday, June 30th, 2010 by Chris

rsync

I’ve talked about some of my favorite windows based programs, but the best program EVER is rsync.  I don’t go a work day without using rsync. I use rysnc for two major purposes

1) Deployments: We work off a local dev server for all our projects.  Historically we’ve SFTPd the files up to the live environment once we were done.  This was fine for our first deployment, but doing updates sometimes  required us to track down files deep in the folder structure.  More often than not we’d forget a file or two.  rsync solved all those issues.  Now when we launch the site we just do the following

rsync --dry-run -vaz --exclude-from /var/www/html/website_client/excludesFolder/excludeList.txt /var/www/html/website_client/ myusername@123.123.123.123:/var/www/html/client

Seems simple enough I know, but no one told me about this.  I just had to figure it out on my own.  So I’m helping spread the idea.  It’s not my original idea, so I take no credit (all credit goes to the makers of rsync).  note: Obviously remove the –dry-run to actually MOVE the files.  The excludeList.txt is just a plain text file of files you don’t want to sync up to the production servers. You know, things like the DB connection file and the .htaccess files that have different paths.

2) Backups: I use rsync to do both my local nightly backups as well as my offsite backups.  Due to limited space (or the desire to optimize space) there’s a trick you can use:

/usr/bin/rsync -vaz --partial --timeout=800 --exclude-from /backup/rsync_exclude.txt --progress --bwlimit=50 -e/usr/bin/ssh --del --link-dest=/backup/2010-06-09 root@source.ip.address:/data/ /backup/2010-06-24

What’s going on there is:

  • -vaz = verbose, archive, compress : ie. I log the files being transferred, grab everything recursively and preserve as much as possible, on and compress the transfer to reduce bandwidth usage.
  • –partial : in case something goes wrong in the middle of a large file transfer, this will allow you to pick up where you left off.
  • –exclude-from : discussed above, it says what we don’t want to have transferred
  • –bw-limit : throttle the bandwidth so I can still browse the web without huge lag.  Not required for local rsync of course
  • -e : sets the location of  your ssh
  • –del : so that we get a mirror image we’ll delete files off the backup server if it’s been removed off the origin server
  • –link-dest : this is the most important one – this is a previous copy of the site…so last nights backup.  I’ll explain more below
  • source : where are you getting the files from
  • destination : where on your backup server are you putting the files.

I’ve taken all this and placed it into a backup script to dynamically generate the dates and make it easy for me to do the same task on other servers.

So what this command does is look at the –link-dest path start downloading files that have changed or are new.  The really important part though is that it creates hard links to the files that are the same/haven’t changed.  What this does is allow you to browse through the folder structure of a backup and see every file that exists…even if it wasn’t backed up that day, BUT it doesn’t take up any additional disk space (well, technically it takes up a few bytes for the link itself, but what’s a few bytes among friends).  When you delete the file you’re actually just deleting the hard link, so as long as there’s a hard link somewhere on the file system the file will still be there. Nice eh!?

So, to summarize, rsync is awesome for both deployments and backups.  If I were stranded on a deserted island and could only have one program, rsync would be it.

Directory Opus

Written Monday, June 28th, 2010 by Chris

Directory Opus

In my last post I talked about my passion for tabs.  That passion lead me to start using Directory Opus.

A windows program that is a replacement for Explorer.  The features I use the most are:

  • explorer window tabs!  Yeah!
  • rename function (select to rename a file then just press the down arrow to start renaming the next file in the list…big time saver)
  • search function is awesome
  • side by side windows (apparently it has FTP built in as well, but I’ve never used it)
  • when copying files it gives you a proper progress bar for the current and total group of files…but better than that you can pause your copy/move!
  • favorites (that’s Jim’s opinion, not mine)
  • view pane to show previews of images (including PSDs) and videos (again Jim likes this one, I don’t use it)
  • overall ability to customize your explorer

There’s tons of other features that I know I’m not talking about…I’ve not even discovered all the cool things this app can do. It’s not a tool that everyone NEEDS to have, but it’s sure nice to have.

Putty Connection Manager

Written Friday, June 25th, 2010 by Chris

Putty Connection Manager

For those users of Putty in Windows, Putty Connection Manager is a MUST HAVE!  There’s several nice features, but there’s two in particular I just can’t live without any more.

1) Putty tabs.  Ever since I started using Firefox’s I’ve been a tab freak.  If an app doesn’t allow me to have several instances of it within the same window it bugs me.  With PuttyCM I can have tons of Putty sessions open and can easily manage them in one window.

2) Multi-window commands.  When you have several sessions open at once, you can lay them out on the screen so you can see them all at once.  This in itself is nice so you can have a log being monitored while you run commands from a different session.  The best part of this though is that you can send the same command to all the open windows.  Very nice when you have to install something on 10 servers.  I know you can use a script (and I’ve done this), but there’s often a case when you need to do stuff on the fly (a quick and dirty way) and being able to do this over all the systems at once is super nice.  Just be careful with the rm -rf *  :)

Putty Connection Manager, get it, you’ll LOVE IT!

We’re geeks!

Written Friday, June 25th, 2010 by Chris

Geek Inside

I have a notebook on my desk (old school coiled paper notebook…not one of these fancy Interweb type gadgets) that I’ve carried around with me for the past 10 years.  It has all sorts of geek notes.  Thinks like how to compile a FreeBSD kernel, how to setup Samba, how to config NFS, etc.  Some of the notes I now know by heart, but I still refer to it frequently.  I know I can find all this stuff in Google, but good old pen and paper has been tried and true for me so I have a tendency to start there…especially if I’ve already done it once before.

It’s time to join the new millennium though and move these notes to an electronic version.  It’ll save me the time of having to Google as much and of course add to the masses of knowledge out there…all be it mostly redundant I’m sure.

New BashBang.com Website

Written Tuesday, June 22nd, 2010 by Chris

Welcome to the new BashBang.com website.  We’ve just moved our Flash based website over to WordPress.  Although we do about 80% of our development in Flash (or Flex) we’ve decided to migrate the site over to an HTML based site instead.  There are several reasons for this:

1) Easier Maintenance – Although we build tools to allow for easy updates in Flash it’s still not as convenient as good old HTML.  We can make fast edits and updates without much effort at all. Even though we’re developers and can technically do all the pieces on our own website…we’re busy, and the thing that gets pushed off is always your own stuff.  So our site was woefully out of date with several missing projects not yet listed.  Making this switch to WordPress means I can have a Intern or administrative staff member help out by allowing them access to update the site themselves.

2) WordPress = CMS – We’ve been using WordPress more and more for our clients.  Although I have many beefs with the way WordPress does things, the simple fact is that it’s easy.  It’s easy for our clients to use, easy to skin, easy to install 3rd party plugins, easy to pass off to someone else to work on (I’m a busy guy remember).  I like easy.

3) iPhone/iPad – There’s been a lot of buzz about the new Apple toys not supporting Flash.  I’m not making the switch because of this reason (traffic to the bashbang.com site using these devices is less than half of one percent), but it is a positive side effect that I wanted to point out.  I’ll get into my views of the iPhone/iPad lack of Flash support in another post.

4) I want to blog – I have opinions.  Pretty strong ones in fact, and I’d like to voice some of them.  I also have a very good memory…it’s just short.  So I wanted to have my own repository of notes.  I’m still pretty old school when it comes to reminders.  I keep notebooks and sticky notes all over my desk.  So this is an attempt of organizing myself.

5) I’m an expert (“ex” as in “a has-been” and “spurt” as in “a drip under pressure”) – … in some areas, so I figured my company site was a good place to talk about the things I do and share some of that knowledge.  I’ll try and convince some of the other BashBang team to write about things they are experts in or things they’ve learned.  In actuality I hate to be called an expert.  There’s always someone out there who knows more than me.  I’m actually a jack of all trades type.  Not just in computers, but other stuff too.  I’ll probably stick to computer stuff in this blog though.

6) I want to write gooder – I write a lot, but it’s mostly proposals and emails.  Everything I write I try to add in a laugh or two…the more boring the document, the more campy my writing becomes. I’ve heard from various sources that the more one writes the better one gets at it … so I’m calling this hour one, 9999 hours to go (Outliers).