About the IT Department in Hospital Universiti Sains Malaysia
Information System Unit of HUSM was established in year 2000 due to the specific needs of IT implementation in hospital. At that moment, there were only 4 people working, but today, the numbers has grown up to 25 people. Since the beginning of establishment, the unit has extensively developing applications software for the hospital. Lead by En. Azuddin Bin AB Rahman and his team consisting of 7 IT Officers, 13 programmers and 4 technicians, they have delivered more than 10 systems for various purposes. As computer science graduates, the team believes that they can build any application without the needs to acquire one from external sources. With that mindset, the software development alone has saved the hospital millions of ringgit.
Top 5 Subtitle Websites
These are my favourite websites for movies/tvseries subtitles.
For TV Series, I recommend the first site, usually subtitle will be released on the day of the scene release, easier to see too if you want to see the latest release (just keep hitting the Reload button). For movies, use the third one, and the 6th will provide you with an automatic app to download your subtitle. If you have other good website, just post it in the commment, thanks :)
Reading Mifare 1K Card using Java in Linux
At the end of last year, my friends and I were tasked to read our staff card. The main objective was pretty simple, to create a library where we don’t have to depend on the vendor everytime we want to read our own staff card and the library should also be working on Windows and Linux (that means Java to us).
Working Environment
- Slackware 12.2
- JDK 6 Update 11
- Netbeans 6.5
- libusb 0.1.12
- Windows Binary of JPC/SC Java API 0.8.0
- Your contactless smartcard reader’s driver
My First Experience using Canon 40D
On the 5th of September 2008, I bought my first DSLR gears during my trip to Kuala Lumpur. The items are Canon 40D, Canon Speedlite 580EX II, Canon 50mm f/1.8 and some other things for about RM 5,000 which I don’t think is a really good bargain, but definitely better than what I’ll get if I bought them in Kelantan.
Ever since that purchase, I’ve been reading the manual whenever I got free time as I thought how am I supposed to be a better photographer if I don’t know the full potential of my camera ? I also managed to get some pirated book about the camera such as Canon EOS 40D Digital Field Guide. I was actually preparing myself for my uncle’s engagement event on the 3rd day of Hari Raya Aidilfitri. However, another event added to my list which is my cousin’s wedding event. I’m pretty happy that I finally had the chance to try whatever I learnt to the real world since using the chair in my room as a model is getting boring.
So, fast forward to my cousin’s wedding day. The main event that day was “Akad Nikah” which took place at a mosque near her house. Sadly, on my first try out as a photographer using my new camera, I made a lot of mistakes, lots of them. These are the mistakes that I knew (there are definitely more):
- I didn’t identify the main characters for the event thus there are only a few photos of them.
- Overuse of f/1.8 resulting a very bad group photos.
- Always beware with the additional characters such as children playing around which spoiled my shot with their blur movement.
- Wrong setting for shutter speed whenever I want to capture a candid moment such as hugging, shaking hands and so on.
- I need to ask them to look at me whenever I want to take photos (yes, I forgot to ask them to do that every time there are other photographers around).
- I need to know in advance the settings for the indoor and outdoor. Almost all of my outdoor shots after the event (which took place indoor) were overexposed as I didn’t have the time to test the correct settings.
- Always test other flash exposures even though the initial setting is OK at the first try.
- I should’ve known the limitation of my 50mm lens.
- I should not feel shy whenever I want to get close the subject.
So, what about the mistakes that I’ve done during my uncle’s engagement day ? This is the list:
- All the previous mistakes ;)
However, one thing for sure, I really need to start saving and buy a wide angle lens. 50mm is great for portrait shots, but not for group shots or even two people at some distance in a cramp room. *Sigh*, there’re still so many things to learn.
Printing to PDF Using CUPS
- Install CUPS-PDF based on your distro, you can download if from here.
- Click this link http://localhost:631 or type it into your browser.
- If the page requested a username and password, just enter your root username and password.
- Go the “Administration” tab and select “Add Printer” in the Printer section.
- For “Add Printer” page, put a name for your virtual PDF printer, any name will do. Then click “Continue”.
- For the second page, that is “Device for a”, you should select “CUPS-PDF (Virtual PDF Driver)”. If it’s not there, then you haven’t execute Step 1 successfully.
- In the 3rd page, choose “Generic” as the Make and then click “Continue”.
- 4th page, choose “Generic CUPS-PDF Printer (en)” as the model and then click “Add Printer”. You’re done, but we need to customize where the file will be located when you printed it.
- Edit /etc/cups/cups-pdf.conf in your favourite editor.
- Put these lines at the end of the file and save it (both can be customized):
1 2 | Out /home/${USER}/Desktop
Label 1 |
- The first line actually tell CUPS to print your file to the Desktop and the second line will make sure your file won’t be overwritten by the newer one.
- Restart your CUPS, for Slackware users, you can type this command /etc/rc.d/rc.cups restart
- So, that’s all and good luck !
Tested on Slackware 12.1, CUPS 1.3.7
Java Printing Fix for Linux with CUPS
Apparently, there’s a bug in Java where people using newer version of CUPS cannot print (can’t even display the print dialog) due to a null pointer exception and this is actually a known bug. So, how do we fix this? For people who use Gnome, you can refer to this page.
However, for people who uses non gui environment such as Fluxbox, Openbox and etc (Gnome and KDE user can use these steps too), you can fix it by editing your CUPS printers configuration file. You can get edit the file at /etc/cups/printers.conf
<DefaultPrinter Printer> # Printer configuration file for CUPS v1.3.7 # Written by cupsd on 2008-09-08 11:24 . . . Option orientation-requested 3 </Printer>
Make sure you add line 7 to every configuration for every printer you’ve installed. If you cannot find the file, you probably haven’t configured any printer yet.
This fix is simply to make sure CUPS will provide a page orientation setting to Java.
The exception:
Caused by: java.lang.NullPointerException: null attribute at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147) at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121) at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263) at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437) at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195) at sun.print.ServiceDialog.(ServiceDialog.java:124) at javax.print.ServiceUI.printDialog(ServiceUI.java:188) at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855) at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
Refer to some of the discussions here:
UPDATE: I forgot to add, you need to restart your CUPS after editing the configuration (Thanks to Brandon Bell)
Tested on Slackware 12.1, JDK 1.6 Update 7, CUPS 1.3.7
Auto Resize JTable Column Width
This code should resize your JTable column width based on the contents of the header and data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | public JTable autoResizeColWidth(JTable table, DefaultTableModel model) { table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setModel(model); int margin = 5; for (int i = 0; i < table.getColumnCount(); i++) { int vColIndex = i; DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); TableColumn col = colModel.getColumn(vColIndex); int width = 0; // Get width of column header TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); } Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); width = comp.getPreferredSize().width; // Get maximum width of column data for (int r = 0; r < table.getRowCount(); r++) { renderer = table.getCellRenderer(r, vColIndex); comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, vColIndex), false, false, r, vColIndex); width = Math.max(width, comp.getPreferredSize().width); } // Add margin width += 2 * margin; // Set the width col.setPreferredWidth(width); } ((DefaultTableCellRenderer) table.getTableHeader().getDefaultRenderer()).setHorizontalAlignment( SwingConstants.LEFT); // table.setAutoCreateRowSorter(true); table.getTableHeader().setReorderingAllowed(false); for (int i = 0; i < table.getColumnCount(); i++) { TableColumn column = table.getColumnModel().getColumn(i); column.setCellRenderer(new DefaultTableColour()); } return table; } |
Example:
1 2 3 | // Must pass the model DefaultTableModel model = new DefaultTableModel(); jTable = autoResizeColWidth(jTable, model); |
Tested on JRE v5 and JRE v6
Japanese Drama: Kurosagi
“In this word, there are three types of swindlers. Those who defraud other people’s money, Shirosagi. Those who deceive others by manipulating their feelings, Akasagi. And then, using the Shirosagi and Akasagi as his only source of food, is the ultimate swindler in history. His name is Kurosagi” Pretty cool eh ? That’s the opening text of this drama.
Reading MyKad using Visual Basic
It seems that a lot of people asking how to read MyKad using Visual Basic, but since I don’t have the slightest idea on how to code in VB, I started to search around. To my surprise, Xenon (the one who reverse engineered MyKad to get the APDU) actually wrote a small application in VB to read MyKad. So, for those who can’t afford to buy SDK from commercial company, you can download the code here for FREE !
Hospital Universiti Sains Malaysia at WCIT 2008
In case you didn’t know, HUSM stands for Hospital Universiti Sains Malaysia and I’m currently working there. Early this year, my head of the department got invited by MDeC to this event. The event took place at Kuala Lumpur Convention Center from 18/5/2008 to 22/5/2008. You can read all the information about WCIT here.

