Alvin Poh

Tag: list

How To Check All Checkboxes In A Form With Javascript

I had an application that had a long list of checkboxes in a form. I wanted the ability to check all the checkboxes at once, or uncheck them at once. However, after googling for a solution, it seemed that all of them required me to label all my checkboxes with the same name. The nature of my application didn’t allow me to do that, so I had to find my own solution.

The following Javascript code allows you to toggle (check or uncheck) all the checkboxes in your form. Just put this Javascript code chunk on a new line anywhere in the body of your webpage.

And you can use it with any form on your page, like this:

And here is a sample of how it works:

How To Print The List of Files in a Folder on the Mac

Sometimes you just need to print out the list of files in a particular folder. While I was on Windows, sometimes I’d just take a screenshot of the folders’ contents, but when I had to print it out or when the folder’s contents were too much, I had to use a third-party software just to accomplish this.

On the Mac, you have Automator! Automator allows you to get the contents of any folder on your Mac. With the contents, you can save it as a text file so you can print, copy, or do whatever with it.

Here’s 5 easy steps to list your folder contents on a Mac:

  1. Open Automator
  2. Create a new workflow
  3. Drag: Ask for Finder Items (Change “Type” to Folder)
  4. Drag: Get Folder Contents
  5. Drag: New Text File (Choose your filename and location)
  6. Hit “Run”

And voila! Your folder contents are saved to a text file, ready to be used.

Tip: You can search for your actions, e.g. search for “folder”, and you should see the “Get Folder Contents” displayed.

Why I Chose To Switch To Mac OS Over Windows 7?

So several people have asked me why I made the change to Mac OS, from being a Windows user for over 2 decades. Here’s why:

mac versus windows

1. A more functional laptop

I wanted a new laptop. I narrowed it down to a Lenovo, Sony or Macbook. 2 years ago, I wouldn’t even consider the Macbook, but these days the Macbooks come with a very functional touchpad, a gorgeous screen, and very comfortable keyboard. Not only that, it’s unibody design meant less of the flaws that you’ll get with a conventional laptop, such as my old Thinkpad with its warped base, cracked plastic bits, and creaky metal hinges (still a solid machine nevertheless).

2. A new OS

Windows 7 was released, and with that, it means a new learning curve. Why not learn Mac OS? Granted, it’s probably steeper than Windows 7, but it’s still something that you have to learn anyway.

3. Focus on function

The Mac OS isn’t just pretty, it’s more functional too. One thing that always left me irate is the activation of Windows. Even genuine users would get bugged with activation alerts and be hassled with the procedure. Mac OS? Just buy the CD, install it, and you’re set. That’s beautiful.

Is everything all good and rosy though? Not at all. Here are some quirks that I still haven’t gotten used to:

1. Replacing folders in finder

This is a file operation that I don’t get at all. When you overwrite a folder in Mac OS, the entire folder gets replaced. E.g. assume you had a folder named MyFolder. Inside MyFolder, there’s 10 files.

Now imagine you suddenly discover that you had another version of MyFolder elsewhere on your hard drive, and it has 5 files inside that’s not found within the 10 files. Great – now you have 2 locations, but you just want 1. So you just copy the 2nd folder over to the original location.

Under Windows, the 5 files will be added to the original 10 files, so that you will have a total of 15 files.

Under Mac OS, the new folder will completely replace the original folder, i.e. you will find a total of 5 files (the new ones) inside. What happens to the original 10 files you ask? They’re GONE.

I found out the hard way about this (my files were completely overwritten and unretrieveable). No undo function for that too.

2. Mac Office 2008

It sucks. If you do a lot of documents and work in Office 2008, then this may be a huge deal breaker. Mac Office 2008 runs so slowly and has such a counter-intuitive interface that I find myself loading up VMWare just to run Office under Windows.

I’m not kidding when I say it takes 10-20 seconds for Word (or any other Office app) to open up. Besides that, try auto-fitting a table to the page width, or changing a document theme, or styling text (e.g. headers), or inputting smart art. You’d feel like killing yourself. And that’s not an exhaustive list, by the way.

I have no idea why the MacBooks in the Apple stores open up Microsoft applications so fast.

3. Finder

It sucks too. First of all, what’s Finder? Finder is to the Mac OSX as Explorer is to Windows. My first grouse: there’s no cut in Finder. You’ve only got copy and paste, which is absurd, even with all that talk about it being a more secure operation. I had to look for alternative file browsers to use on Mac OSX because of this missing functionality.

Second grouse: you can’t move things around intuitively because it doesn’t have a fixed folder list on the side. If you are ten folders deep and want to drag a file out to the top folder, you’ll have to pull serious tricks to do so (even with that spring-loaded thing). In Windows at least there’s a folder list on the side that allows you to go to any folder that you want easily. I had to solve both these problems by getting PathFinder, which is what Finder should really have been.

4. Flash

Again, this sucks. Adobe has clearly put Windows as their platform of choice, and Unix a distant second. Anytime you run Flash or Air on your Mac, you’ll see a huge spike in CPU usage. Sometimes if you leave something running – like GrooveShark, Pandora, or something like that – your system can be brought down to its knees. Unlike the above issues, this problems has no workaround at all, except to wait for Adobe to beef up Unix support for Flash/Air, which is annoying.

How To Select Columns of Text in Your Browser (FireFox)

This is a neat trick for copying columns of text from a table into some other application. This is particularly useful when you don’t need the whole table of information, and just want one column or several columns (e.g. just the usernames from a list of members).

I haven’t tried it on other browsers, but it works for me in Firefox 3.6.2. (Another reason why I love Firefox – it’s just so full of functionality). I’m particularly impressed that it’s something that I wouldn’t know that exists, but they’ve already thought ahead about it, and have it fully implemented already.

firefox logo

So here’s the trick – on the Mac, just hold down the Cmd key and select the column that you want by clicking and dragging with your mouse. On Windows, it’s the Ctrl key.

How To Remove/Uninstall KEXTs In Mac OSX

KEXTs are Kernel Extensions, and I realised that a program that I installed in the past (SteerMouse) had left its KEXT behind even though I uninstalled the program. You can see the list of KEXTs in your system at /System/Library/Extensions/, but do note that Mac OSX only loads whichever KEXT is needed.

As you can’t just delete the KEXT from within Finder, I had to find out how to remove it. Turns out it’s just one command in Terminal:

rm -rf /System/Library/Extensions/SteerMouse.kext

My KEXT is named SteerMouse.kext, but you can replace that with the KEXT name of your choice. Once you’ve got it deleted, reboot your system and the KEXT will be gone.

eBay’s New Pricing

Looks like eBay’s making more changes to their pricing again. This will be interesting, and I’ll dare say there’ll be a whole new slew of $0.99 auctions. What this definitely means is that eBay will get more listings, and because it gets a cut of the final value fees, the more auctions that close in this manner, the higher their income is going to be. With other free auctions and classified ads websites around, It’s going to be interesting to see if this strategy works, and how eBay adapts to the changing auction/ecommerce landscape and new competitors to the scene.

Starting March 30, 2010 selling on eBay will be a better deal than ever!

  • List Auction-style FREE–no Insertion Fees–when you start your Auction-style listing under $1.
  • Get new, lower Insertion Fees for all other start prices.
  • Either way, pay one easy Final Value Fee of 9% of the winning bid (but never more than $50)-and pay only if your item sells.
  • List in Fixed Price for 50¢, with Final Value Fees for the most part staying the same.

This new standard fee structure will replace the current “first 5 listings free”–you’ll pay no Insertion Fees whenever you list Auction-style and start pricing under $1!*

Copyright © 2016 Alvin Poh

Web Hosting by VodienUp ↑