Category Archives: Technology

Filter Google Code Commits

Google code project hosting doesn’t give you an easy way to filter commits easily. In any way really. Hadeer Younis has posted a nifty script that dynamically filters them from the changes page.

Being the person I am, I refactored that script for easier usage.

  • Browse normally to the commit list page, example: http://code.google.com/p/smartsoft-12/source/list
  • Load this once:
    if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,h,s){s=d.createElement('script');s.type='text/javascript';s.src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';((h=document.head)||(h=document.getElementsByTagName('head'),h?h[0]:document.body)||document.documentElement).appendChild(s)})(document);
    var total_commits = -1;
    var results = false;
    function filter_commits(regex) {
        if (total_commits == -1) {
            total_commits = $('.pagination:first').text().split('of')[1].split('Older')[0].trim()
        }
        $('div.list b:last').html('Please wait while we filter the log...');
    	if (results == false)
    	    $('#colcontrol').load('list?num='+total_commits+' #colcontrol', function(){
    	        results = $('#resultstable>tbody').clone();
    			do_filter(regex);
    	    });
    	else
    		do_filter(regex);
    }
    function do_filter(regex) {
    	$('#resultstable>tbody').html(results.html())
    	$('#resultstable>tbody>tr + tr:visible').each(function(){
    		if(!$(this).text().match(regex))
    			$(this).hide()
    	});
    	$('div.list b:last').html('Committed changes (done filtering)');
    }
  • Run this to filter
    // enter a regular expression to match against (username, r#, [uU]pdate issue #, etc)
    filter_commits("kamasheto");
    

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.)

Mac101 — Owning Your First Mac Pt. 2

Owning your first Mac is usually a big step. Overcoming the feeling of buying perhaps the most overpriced gadget you’ve ever admired. And it probably goes on to having to live with people who, even when they decide to keep it to themselves, look at it as a rip-off because, always, there are much cheaper alternatives with perhaps even better specs!

All that aside, you’ve probably also spent a considerable portion of your life on a PC. You’re used to it, familiar with it, and most of all, grown attached to it.

Among other things, these are a few reasons of the many reasons I think people take Windows with them when they move to a Mac. They either install Windows *just in case* or have their older laptop readily available for when they (almost always) need it. This branches to two main problems: not exploring, and porting your conveniences. I’ll elaborate.

Not Exploring

Out of the box, a Mac is far beyond your best companion. Aside from all the apps you’ll ever need for you to dive right into work, there are probably apps that you won’t know you need until later. If you decide to assume a Mac is yet another PC and not lurk around for what’s there and what’s not, you might never know what power lies within your hands. Always look for missing items and never hesitate to Google!

Porting Your Conveniences

Get used to the old (could be bad) habits and using them on your Mac. For example relying on GUI for all tasks. Mac is built on unix and has the same powerful terminal you expect to find on any linux machine. This lets you do extraordinary things with a few commands. Once you’re used to the new “Mac” conveniences, you’ll realize everything could be done better. ;-)

Remember, treat your Mac as a new environment. Don’t use your Mac alongside a PC at least during the first few weeks of your purchase. Get used to your new gadget because it is rewarding. Happy Macing!

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!

Setting Nameservers VS A-records

If you’ve used your personal domain on Tumblr you’d know how easy it is to set it up: you create an A-record at your domain provider, in my case GoDaddy, and tell Tumblr what your domain is. That’s it.

Aside from being dumbly easy, this configuration has always tempted me to be a tumblr user with my domain. Reason being, I could host my email MX record configuration at GoDaddy which means I ensure a better quality or uptime for my precious email records – which in plain English means I get my emails all the time.

Judging by the fact I rely a whole lot on those records to receive my emails, I kinda need to make sure that’s properly handled before settling for a specific setup.

Continue reading