Deleting Flash Cookies

Adobe’s Flash Player quirks are the bane of my existence, and small things like what I’m about to explain are what really sets me off about it. Get this. Flash Player will allow websites to store cookies that it calls Local Shared Objects (LSO) on your computer. However, when you clear your browsing data (cookies/tmp) these Local Shared Objects remain until removed by the website that created them, or by forceful, manual ejection.

Now for a little paranoia. Websites can store these flash cookies without your knowledge and/or consent, and these flash cookies can contain plain text usernames and passwords, as well as other personal or private information.

What to do? Well, there is a little freeware application I’d like to recommend to you called Kill Flash Cookies. KFC is cross-platform and they even offer a command line version!

Adding Domains in Webmin Control Panel

Webmin can be kind of intimidating at first, and there’s definitely a learning curve. But the meticulousness of it really comes from the fact that most other control panels unify into one interface what Webmin does in the hopping through several different pages. However, with this little guide, you should have no trouble at all adding domains to your dedicated server through the Webmin control panel. (Rackspace Hosting uses Webmin by default on the dedicated servers they provide.)

Once you are logged into your Webmin control panel, follow these steps:

  • Navigate to Servers » BIND DNS Server
  • On the BIND DNS Server page, click on the Create Master Zone link
  • Under New master zone options, fill these fields in before clicking Create:
    • Domain name / Network » YOURDOMAIN.COM
    • Email address » YOU@YOURDOMAIN.COM (Webmaster Email)
    • IP address for template records » Server IP
  • On the Edit Master Zone page you are redirected to, click the Address icon
  • Under Add Address Record, fill these fields in before clicking Create:
    • Name » www
    • Address » Server IP
  • After the record has been created, click on the Return to record types link towards the bottom
  • Now all that is left to do is add a Virtual Host in Apache for the new domain. Click on the Apache Webserver icon to proceed
  • Click on the Create virtual host tab on the Apache Webserver page
  • Under Create a New Virtual Server, fill in these fields before clicking on the Create Now button
    • Handle connections to address » Specific address .. Server IP
    • Port » 80
    • Document Root » /var/www/yourdomain.com
    • Server Name » yourdomain.com
    • Add virtual server to file » Standard httpd.conf file
    • Copy directives from » Nowhere
  • Click on the Apply Changes link to commit the new domain settings

Now, just make sure your domain name is pointed at your new server’s IP address from your registrar’s domain administration panel, and you’re all set!

Deleting Files Ending With a Period

I once made the very unfortunate mistake of renaming a file and then accidentally saving the change while I was halfway through making the change, right on the period before the extension. What happened then? Well, I became unable to delete or rename said file, forcing me to leave it untouched for months, bothering the back of my mind. (You might have gotten a file with a period at the end of the filename from another operating system, or sometimes unarchiving a RAR or ZIP with a bad filename will make this happen.)

When trying to delete or rename the file, you will be prompted with the following error:

Error Deleting File or Folder – Cannot delete file: Cannot read from the source file or disk

Why can’t you delete it? Windows considers filenames ending with a period invalid, and therefore lists it in Explorer, but is unable to manipulate the file whatsoever.

However, you can utilize long paths to circumvent this behavior.

If you’re trying to delete a file:
del "\\?\C:\Users\User\Downloads\Filename."

If you’re trying to delete a folder:
rd /s "\\?\C:\Users\User\Downloads\Foldername."

Full Screen Flash Video on Secondary Monitor

While Flash supports watching full screen video on one monitor only, however the slightest disturbance from another application or the other screen will cause the YouTube video (or other full screen flash application) to lose focus and return to normal size.

Well, Jmaxxz has created a hack that causes Flash to ignore activity on other monitors, enabling you to watch full screen flash content on a separate monitor unhindered.

Download FlashHacker

Instructions

  • Download and run FlashHacker
  • Close all browsers before pressing ‘Hack My Flash!’
  • Open your browser and flash player in full screen mode, enjoy!
  • In order to reset, just click ‘Unhack Flash’ within FlashHacker

Set Vim to Show Line Numbers By Default

It’s quite simple really. If you didn’t know how to show line numbers in vi(m), it is by typing the following command when you’re in the application:

:set number

But that doesn’t persist when you exit out of the text editor. When vi(m) launches, it reads settings from a file called .exrc in your user’s home directory, so we can add the setting as a default by executing this into the command line:

echo set number >> ~/.exrc

When you next open vi(m), line numbers will appear by default.

SSH Reverse Tunnel Manager

Do you need to automate the creation and persistence of a SSH reverse tunnel? Don’t want to spend too much time on the command line, or are afraid doing so?

Well, ezTunnelSSH is your godsend. It can be set to automatically open when your computer starts, as well as to automatically reconnect when it gets disconnected. ezTunnelSSH supports key and password authentication, too!

ezTunnelSSH - SSH Reverse Tunnel Manager
ezTunnelSSH - SSH Reverse Tunnel Manager

Oh, did I mention that ezTunnelSSH is open source, too?

Bend: Free Minimalist Code & Text Editor

Bend is a minimalistic, aesthetically pleasing code and/or text editor. It was an open source project available on CodePlex, but the author has deleted the project sometime between now and the last time I checked out this cool little app.

Not to mention smooth looks, but it has multiple tabs, line numbers, a javascript beautifier, HTMLTidy, and a fast regular expressions search engine as well!

Bend Free Code & Text Editor

I was able to locate a working set of files from the depths of the internet after a wild goose chase, but I don’t have any of the source files, or the actual installation file (the installer checks home and fails now, anyway) so if any of you have either, please forward them along so we can put them all together!

So, without further ado, download Bend, and cheers!

Lighttpd, PHP, and MySQL on CentOS 5

I’m logging down the installation procedure for a LLMP stack on the CentOS Linux distribution, mostly for my own reference. Because who am I kidding? No one reads this blog anyways. :]

Step 1) Installing & Configuring MySQL

  • yum install mysql mysql-server
  • chkconfig --levels 235 mysqld on && /etc/init.d/mysqld start
    • Sets MySQL to start up when the system boots, and starts the mysql daemon.
  • mysqladmin -u root password your_new_password
    • Set a root password for your MySQL installation.

Step 2) Installing & Configuring Lighttpd

  • If you’re installing on an x86_64 machine:
    wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm && rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
  • If you’re installing on an i386 machine:
    wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm && rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  • yum install lighttpd
  • chkconfig --levels 235 lighttpd on && /etc/init.d/lighttpd start
    • Sets Lighttpd to start up when the system boots, and starts the Lighttpd daemon.
  • Lighttpd’s default document root is /srv/www/lighttpd, you can use this or change it by editing the configuration file /etc/lighttpd/lighttpd.conf and restarting Lighttpd.

Step 2) Installing & Configuring PHP5 (via FastCGI)

  • yum install lighttpd-fastcgi php-cli
  • echo cgi.fix_pathinfo = 1 >> /etc/php.ini
    • Inserts option to use the real path information for CGI.
  • vi /etc/lighttpd/modules.conf
    • Edit Lighttpd’s module configuration file and uncomment the toggle for mod_fastcgi by removing the hash (#) symbol at the beginning of the line.
  • cp /etc/lighttpd/conf.d/fastcgi.conf /etc/lighttpd/fastcgi.conf-bak
    • Back up the default FastCGI module configuration.
  • vi /etc/lighttpd/conf.d/fastcgi.conf
    • Replace the contents of fastcgi.conf with the following:

      fastcgi.server             = ( ".php" =>
                                     ( "localhost" =>
                                       (
                                         "socket" => "/tmp/php-fastcgi.socket",
                                         "bin-path" => "/usr/bin/php-cgi"
                                       )
                                     )
                                  )

Step 3) Adding MySQL support to the PHP installation

  • yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

Step 4) Finalizing and testing Lighttpd, PHP, and MySQL stack

  • /etc/init.d/lighttpd restart
    Create a phpinfo.php file in your document root, and browse to /phpinfo.php to verify the installation.

Cheers!

PHP Warning – Failed to Write Session Data

I’ve seen this error pop up a few times, but it usually happens when I choose to install LightTPD instead of Apache.

Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct.

What this means is that the path designated in your php.ini to store session data either does not exist or is not writable by the web server. When you are experiencing this warning from the php backend, the web facing tier of your application most likely has no session persistence at all.

How do we resolve this? Well, you just have to correct your session.save_path variable in your php configuration file, which is usually available at /etc/php.ini, so go ahead and open that up.

Find the line
session.save_path = "/var/lib/php/session"

Replace with (or comment out and add after)
session.save_path = "/tmp"

Once you’ve saved the change to your php configuration, go ahead and reboot your web server. You shouldn’t be experiencing this error anymore.

Resize Animated GIFs and Preserve Animation

Resizing images is fairly simple, whether you are resizing images from the command line or in the programming language of your choice, but when it comes to animated GIFs (or other animated image type) things can get hairy, especially when most techniques will simply resize the first frame of your image, while destroying the rest of the animation frames.

Circumventing this is easy (if you have ImageMagick installed) and the resizing is performed with simple commands:
convert big.gif -coalesce coalesce.gif
convert -size 200x100 coalesce.gif -resize 200x10 small.gif

If you want to perform this action in PHP, you’d do something like this:
system("convert big.gif -coalesce coalesce.gif");
system("convert -size 200x100 coalesce.gif -resize 200x10 small.gif");

User’s Note: Resizing animated GIFs this way usually creates a larger file size, even though the dimensions are smaller, this is because during the resize process, the images in each frame are de-optimized.

Source: http://stackoverflow.com/questions/718491/resize-animated-gif-file-without-destroying-animation