Accessing JQuery UI Dialog’s Options and Methods From Within The Dialog

Posted June 5th, 2011 (Updated 29 Oct 2011) in Javascript

I discovered recently a little quirk with accessing a JQuery UI Dialog‘s options and methods from within the dialog itself. I was AJAXing the dialog’s contents and was having difficulty figuring out how to access the dialog’s methods. As it turns out, from the contents of the dialog you don’t use

$(this).closest('.ui-dialog').option()

which returns a javascript object, but instead use

$(this).closest('.ui-dialog-content').option()

Seeing as this post would otherwise be pretty short, let’s do a little more than simply retrieving options. Below I’ll explain not only to open a AJAX dialog from a HTML link, but also tell the dialog what element opened it. This could be useful in such instances as when you need to click a link which opens a dialog allowing you to upload a user avatar, and upon uploading, replaces the link with the avatar image.

For the lazy, you can download the complete tutorial files here.

Read More »

How to Fix Trackpad Issues on Ubuntu 10.10

Posted June 3rd, 2011 (Updated 29 Oct 2011) in Linux

Upon downgrading back to Ubuntu 10.10 after my horrendously bad experience with 11.04, I’ve been reunited with a bug I’d previously put up with for 6 months: The trackpad on my laptop often ‘mouseups’ when dragging, resulting in windows not being dragged correctly. In addition, web browser and pidgin tabs will occasionally close on click instead of giving focus to that tab. Well here’s the fix!

Make sure the following 2 lines are In the InputClass section of /etc/X11/xorg.conf.d/50-synaptics.conf:

Option "ClickFinger3" "1"
        Option "EmulateTwoFingerMinZ" "280"

Here’s what mine looks like:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Option "ClickFinger3" "1"
        Option "EmulateTwoFingerMinZ" "280"
EndSection

You’ll probably need to do a reboot for the changes to take effect.

Thanks to users egermani and ejmarkow for their respective fixes here and here.

Read More »

Cloud Database Backup

Posted May 25th, 2011 (Updated 29 Oct 2011) in Database, Linux

Update 2011-10-12: More storage options! Google Storage, Local HDD, FTP, experimental unlimited Google Docs conversion

Have you ever wanted to ensure that even if your server dies in the most spectacular of ways, your DB is safe? Meet Cloud Database Backup. Cloud Database Backup is a little script I’ve written that allows you to quickly and easily back up your MySQL DBs to the cloud.

Currently you can back your database up to:

  • Amazon S3
  • FTP
  • Google Docs
  • Google Storage
  • Local HDD

Download the script here.

Requirements:

  • MySQL with access to INFORMATION_SCHEMA database
  • php, php5-cli (for S3 backups)
  • python2, python-gdata (for Google Docs backups)

This is an updated version of my old Automatic MySQL Database Backup script that adds support for Google Docs (which now allows uploads of any file type for non-enterprise users), the recently opened Google Storage, as well as local HDD and FTP servers. It does a MySQL dump of each DB separately, zips them all and uploads the zip to your cloud service of choice.

I’ve also added in an experimental ‘db chunker’ which uses this script to split SQL dumps into convertible sizes for Google Docs, allowing you to upload unlimited backups for free; owever due to a reproducible bug in Google Docs, I wouldn’t recommend its use (and it’s disabled by default).

To get started simply update your details in the appropriate places at the top of backup.sh and type ./backup.sh. Presto!

I’ve also included a crontab example to allow automation of backups.

Read More »

Updating Samsung F4 EcoGreen Firmware Without a Floppy Drive

Posted May 10th, 2011 (Updated 29 Oct 2011) in Uncategorized

A while back Samsung released a line of relatively cheap “EcoGreen” 2TB hard drives. Being the storage hungry IT nerd that I am, I picked up 2 of the things before finding out their firmware contains a known data write bug requiring a firmware patch best summed up with the following:

“It [the drive] will “forget” to write out its buffer if certan SMART commands are sent to the drive. This is the very definition of silent data corruption.”
source

Samsung has released a patch but it requires booting into DOS which is incredibly difficult to do on todays floppyless PCs. After a bit of googling I came across the following two solutions to get the job done:

Bootable ISO image

This is the easier solution of the two but it is also the one that didn’t work for me. Michael has created a FreeDOS image with the patch merged in. For the download and installation details, see this post.

Bootable USB image

After trying and failing the above, I settled for a bootable USB image instead. User ZDOS has written up a handy tutorial here which I’ve detailed a bit more in depth below:

  • Download the Windows 98 system files (at the top) and HP USB Disk Storage Format Tool from here and F4EG.exe from here.
  • Install the HP Format Tool and run it with administrator privileges (right click – Run as Administrator).
  • Extract the Windows 98 system files.
  • With the HP Format Tool, format your USB drive (quick format should be enough) as Fat32 making sure you use the Windows 98 system files where it offers.
  • Once done, copy F4EG.exe to your USB drive.
  • Shutdown and unplug all HDDs besides your unpatched Samsung drive
  • Boot your PC and enter the BIOS by pressing Delete during startup. Ensure that your HDDs are set to run in AHCI mode.
  • Reboot either ensuring USB-HDD is selected as your top boot device or press F12 during startup to visit the One Time Boot Device page (results may vary – check your motherboard documentation).
  • You should see a Windows 98 logo flash on the screen for a split second and then a command prompt. In the prompt type F4EG and press enter. Your drive should flash itself.

For plenty more useful information on this issue, I found this forum thread very helpful.

Read More »

How To Allow Applications Back Into The The Notification Area In Ubuntu 11.04

Posted May 7th, 2011 (Updated 29 Oct 2011) in Linux

One of my last niggling issues with Ubuntu 11.04 is, as you’d expect, another remnant of Unity carried over to the Ubuntu Classic desktop. This remnant is the notification area (or ‘Systray’ to you Windows converts) not allowing all applications access to it. Below is the line you’ll need for bringing Ubuntu back to the 21st century:

gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

Thanks to the good fellows at Web UDP8 for this little piece of magic.

PS. It appears the VLC icon STILL does not always appear. There’s a question posted on the VLC forums about this issue and it looks as though it’s due to an incompatibility between QT4 and Gnome. Stay tuned for further developments on this issue.

Read More »

Save Firefox 4 Tabs on Close

Posted May 7th, 2011 (Updated 29 Oct 2011) in Uncategorized

It seems firefox 4 has stupidly removed the option to save tabs on exit however there’s a way to get this very useful functionality back. Here’s how:

  1. Type about:config in the URL/Location/Address bar and press the Enter key
  2. Accept the warning message (promise to be careful)
  3. The preferences page/list will open
  4. Filter = browser.tabs.warnOnClose
  5. If its value is set to false, double-click on it (in the lower panel) to toggle its value to true
  6. Repeat steps 4 and 5 for these following 3 preferences also:
    • browser.warnOnQuit
    • browser.warnOnRestart
    • browser.showQuitWarn

Taken from mozilla support. A big thank you to user Helper7677 for this solution!

Read More »

Why I Hate Unity

Posted April 30th, 2011 (Updated 30 Jan 2015) in Linux

Note: Also see the followup to this post: How to Make Ubuntu 11.10 More Usable

So my previous post How to Move App Menus Back Into Their Windows in Ubuntu turned out a little more bitter than even I had first intended. As a result I think it’s only fair I give a few more reasons as to why I have such a strong dislike towards Unity.

Let me preface this post by saying that I was actually quite looking forward to Unity. It looked relatively promising (although I was slightly worried about reports it wasn’t as customizable as Gnome) and after I ended up liking icons on the left when thinking I wouldn’t, I was determined to give Unity a fair go. I would also like to say that many of these issues will probably be sorted out in later bug fixes and updates – but that does not help me right here right now on my shiny new Ubuntu install a few days after release.

So here it is: a ‘by no means complete’ list of reasons using Unity is not a good idea at this point in time.

Read More »

Use .htaccess to Block Pages Based on IP

Posted April 29th, 2011 (Updated 29 Oct 2011) in Uncategorized

Due to the antics of some douchebag (IP address 109.120.34.16) I’ve had to look into blocking pages based on IP address with .htaccess files. This may come in handy to others out there so I figured I’d write up my findings.

To block everyone except specific IPs here’s what you’ll need (more info):

order deny,allow
deny from all
allow from <ip address>

To apply this restriction only to specific files, wrap the above code in the <File> tag:

<Files wp-login.php>
	order deny,allow
	deny from all
	allow from <ip address>
</Files>

Thanks to user NuclearMeltdown on the #httpd channel on Freenode for his assistance.

Read More »

How to Move App Menus Back Into Their Windows in Ubuntu

Posted April 28th, 2011 (Updated 29 Oct 2011) in Linux

You’ve recently upgraded to Ubuntu Natty and discovered that Unity is crap. Don’t worry – you’re in the vast majority. One of the many issues with this disastrous attempt at a shell is that it moves application menus into a global menu in the top panel. This may be useful for small screens – but for the other 99% of the market it’s just downright frustrating.

After a bit of searching I came across this post describing how to banish the global menu back to the warped hell from whence it came. You want to remove the indicator-appmenu package.

This is but one of a great many great challenge you’ll face if you decide to continue on with Unity. Good luck…and may God have mercy on your soul should you choose to stick with it.

Read More »

Fix Firefox Language for Google.com on Ubuntu

Posted April 28th, 2011 (Updated 29 Oct 2011) in Linux

OK so this is an issue I’ve had for a very long time now (since Firefox 4 beta) whereby Google keeps defaulting to a strange language and seemingly completely ignoring my preference for English:

Incorrect language on google.com in Firefox 4

 

The reason for this is a bad language string in Firefox’s settings. You can fix it by doing the following:

Edit - Preferences 
Content - 
Choose... (under Languages)

You’ll see the following language:

chrome://global/locale/intl.properties

Delete it. It’s wrong and it’s causing you problems. Once deleted, time to add your language of choice:

Select Language to add... -
<pick your desired language>

You should now be greeted with a much easier to read google index page!

Here’s hoping this post will make it out in time to save the flood of Ubuntu Natty users on their shiney new Firefox 4 installs :)

Read More »

Page 10 of 15« First...89101112...Last »