Category Archives: Development

Preview Print CSS on-the-fly

There are countless tools to help you with debugging CSS intended for the front-end “screen.” Inspector tools are now bundled with most modern browsers and are very powerful in terms of letting the developer manipulate the DOM in realtime.

However as soon as you try to develop UI for the printer it starts to get lame. Previewing the printer friendly version requires sometimes lots of steps and that could be quite exhausting on the long run. You could use addons that attempt to make this easier, but it still gets exhausting.

A good workaround I came across is using Javascript to dynamically remove the screen CSS and enable the print CSS instead. The underlying idea is quite simple: (jQuery)

	$('link[media="screen"]').remove()
	$('link[media="print"]').attr('media', 'screen')

You could run this code on load ($(function(){ /* here */ });), or trigger it on a certain event (clicking a certain test button for example.)

AutoCompleteTextView Not Showing On-Screen Keyboard

Problem

When attempting to write in an AutoCompleteTextView element, the on-screen keyboard doesn’t show. After changing views and going back to the Activity that had the element, the keyboard worked as intended.

Environemt

The on-screen keyboard worked as intended on the android 1.6 emulator. However on the Samsung emulator (2.2) and a Samsung device the keyboard failed to show.

Solution

You should not requestFocus by the autocomplete element. After removing the requestFocus the autocomplete worked with the on-screen keyboard every time it got focus.

Credits: @dina_helal for reporting. Thanks!

Change Mac OS X Menu Bar Icons

As much as I love how Mac OS X looks, I sometimes hate how some applications decide to just do things their own ways and make things look out of place. Whether it be in terms of app UI, dock icon, or sometimes even menu bar.

If you’re anything like me, it’s hard to settle for this menu bar:

Continue reading

XML File Reader

I’ve been looking for a very simple XML reader to use for my bachelor project. I didn’t want a complex reader that manipulates the entire DOM (parse the attributes, etc), or one that is complicated to use. So I’ve come to implement my own.

Continue reading

Prompt On Quitting Firefox

I’ve been using Firefox 4 for Mac for quite some time and I haven’t really noticed that even when my options are set to warn me before closing Firefox, it doesn’t. And if you set THAT option on, you probably need it to work as intended.

So yeah, how to fix that. According to this answer, you should:

  • Go to about:config
  • Look for the option browser.showQuitWarning
  • Toggle to true

That’s it. It should be active immediately after that.

Update A better way would be to install Always Ask (Firefox addon) clean and does exactly that. This addon shows a popup confirmation every time you try and Quit Firefox even if you have only one tab open. Works for me!
Update 2 Lifehacker has posted a detailed guide as well. You might want to check it here