Monday, October 31, 2011

How to Add Syntax Highlighter in Blogger

I found this cool stuff called Syntax Highlighter by Alex Gorbatchev and uses it in my page. Basically, it highlights your code to have a nice color scheme.

How to install at blogger:
1. Go to Blogger Dashboard > Design > Edit HTML.
2. Press CTRL+F to find the </head> code
3. Copy the codes below:
4. Paste it on top of this </head> code
5. Preview your template, then if your code changes color, then save it.

For further details, you may click here and read more

Verdict
The good thing: It makes your codes more readable and it's easy to install.
The bad thing: It takes time to load your page because it gets its resources from Alex's site.

Wednesday, October 19, 2011

Basic Typography for reports

Last Tuesday, We had a design class. I learned something about cheats regarding making your reports. The instructor said that if you want to make your report look very presentable use 10 or 12 font-size because that is the font size that people are familiar with. Size 11 is like torn between two numbers so it wont be that effective.

In choosing your font face:
If all else fail, use Arial.


You ask why? There was a time that Times New Roman was said to be the most legible font face, but really it is Arial and it is the safest font to use for web interfaces. Also, If you want to make your report look studious, use the font face Helvetica. It has this feeling of being a book-like font.

For powerpoint presentations, add images after 3-4 slides and never forget to put a graph! Just make your presentation in bullet format. I remember the time back in High School where the students uses Cartolina just to have a visual presentation for the audience, now, powerpoint presentations are what's in!

With this simple things, you can create a great an impression that you are prepared and well-equipped even though you're not. Haha! I wish I had known this things while I was doing my book reports back in college.

Tuesday, October 18, 2011

Add ID to TR using Datatables

I find datatables for sorting of table very useful. (See datatables.net) It has live search and very flexible with customization. In my project, I tried to insert a new row by using the following sytax:
var myTable = $('#result_table').dataTable( );
var checkbox = 
var edit = Edit

$('#result_table').dataTable().fnAddData( [
     $('#add_division_name').val(),
     checkbox,
     edit
] );                          
But the problem is since the insertion is automated, I could not insert an ID for TR on the fly. So here's the solution I got:
// Get the settings of the table
var oSettings = $('#result_table').dataTable().fnSettings();       
// Count the rows, server side data
var rows = data.count;
// Insert the server side id
oSettings.aoData[rows].nTr.id = 'tr-' + data.id; 
I tried counting the hidden and shown rows so the counting of rows will be made front end by using the :hidden selector, but my codes doesn't seem to work. Looks like I have to stick to server side counting of rows.

Thursday, October 13, 2011

Passing data to jquery ui-dialog

I've always thought that passing of data to a dialog box in jquery is impossible. The only way to do this would mean setting a value to global variable and accessing it when ready. This post proves me wrong while browsing at stackoverflow.

jQuery provides a method which store data for you, no need to use a dummy attribute or to find workaround to your problem. Bind the click event:
$('a[href*=/Booking.aspx/Change]').bind('click', function(e) {
    e.preventDefault();
    $("#dialog-confirm")
        .data('link', this)  // The important part .data() method
        .dialog('open');
});
And your dialog:
$("#dialog-confirm").dialog({
    autoOpen: false,
    resizable: false,
    height:200,
    modal: true,
    buttons: {
        Cancel: function() {
            $(this).dialog('close');
        },
        'Delete': function() {
            $(this).dialog('close');
            var path = $(this).data('link').href; // Get the stored result
            $(location).attr('href', path);
        }
    }
});

Monday, October 10, 2011

My First Post

This is my first post.

Testing Post Outlook
"Knowledge without sharing is nothing"