Hey there! Thanks for dropping by Kiran’s Blog! Take a look around and grab the RSS feed to stay updated. See you around!
Follow these simple steps to create a custom ringtone for your iPhone, using iTunes 10.
- Open iTunes 10 - Browse to the song from which you’d like to make a custom ringtone. - Right click on the song, choose “Get Info->Options” - In the Options tab, set ‘Start time’ and ‘End time’ for the clip you would like as the ring tone. - Right click on the song and choose “Create AAC version”. - iTunes will create an AAC version of the clip you’ve selected, with the same name as the original. - Edit the original song file, back to old Start & End times. - Right click on the newly created clip, and select ‘Show in Finder’, to open the music folder. - You’ll notice that the clip has an extension of .m4a. Rename the extension to .m4r. - Copy the .m4r file to your Desktop. - Go back to iTunes, and delete the clip from iTunes. - Drag and drop the .m4r file from your Desktop to iTunes Ringtones folder. - Sync the ringtones with your iPhone.
That’s it! You’ll find your custom ringtone in iPhone (Settings->Sound->Ringtone)
Looking for a way to link to a specific part of a youtube video? Just add the following string to the end of the youtube url: #t=MmSs where M=minutes, S = seconds.
#t=MmSs
For example, the following link takes you straight to 5:18 in that video. http://www.youtube.com/watch?v=zawRpMV4EeA#t=5m18s
Inspired by a few bloggers, here’s an attempt to track my favorite products over time. This is my 2010 list of ‘products I can’t live without’:
Twitter Gmail Google Finance Google Docs Google Chrome Google Picassa Microsoft Outlook TechHit TwInbox TechHit SimplyFile TechHit QuickJump VLC ITunes GarageBand Adium Skype VirtualBox Mint iPhone Pandora Twitter for iPhone Amazon YouTube MyFitnessPal (iPhone App) Credit Karma
Tweet
Mighty Pacific at sunset.
Mighty Pacific
Mount Tamalpais is the highest peak in the Marin Hills, which are part of the Northern California Coast Ranges. A view of the Pacific ocean coastline from Tamalpais peak.
Maestro Ilayaraja has composed for an unimaginable number of films (900 Films & 5000 Songs) and I don’t think I can ever claim that I’ve heard them all. Last week I tripped over this wonderful melody. Check out the prelude and interludes. Mind blowing!
Mac users, here’s how to increase/decrease tempo of an audio file with GarageBand.
1. Open Spotlight. Type “GarageBand”. Select on “GarageBand” application. Start it. 2. Create a new project in GarageBand (File -> New) 3. Drag and drop your audio file (MP3, M4A etc) in GarageBand. 4. Press Alt+Ctrl+G 5. Highlight the audio track. (Track’s color changes to purple) 6. Click on Track Editor (Scissors symbol at the bottom of GarageBand) 7. Check “Follow Tempo & Pitch” in Track Editor. 8. GarageBand displays Tempo next to the PlayHead display. Click on Tempo, and adjust it to your liking.
Enjoy!
A cheat sheet, listing some guidelines for good coding practices.
Indenting - Use tabs for indenting. - Set tab to 4 spaces. - Keep lines <80 chars long, for better readability.
Spacing and Linefeeds - No trailing whitespace at the end of the lines. - Use Unix style formatting. * Lines must end only with a line feed (LF). * All text files should end in a single newline (\n) after the closing PHP tag (?>). - If you are using Windows platform for development, please set your editor to save files in Unix format.
Naming Conventions - Use the following naming conventions. * filenames-in-general * javascriptFunctions * javascriptVariables * mysql_columns * mysql_tables * _php_global_vars * php_functions * php_variables * CONSTANT_NAMES * phpClassMethods * phpClassNames * README.txt
Arrays - Arrays should be formatted with a space separating each element (after the comma)
$array_number_one = array('this', 'is', 'foo' => 'bar'); - If the line declaring an array spans longer than 80 characters, each element should be broken into its own line with proper indentation. $form['title']=array( '#type'=>'textfield', '#title'=>'Post Title', '#maxlength' => 32, '#required' => TRUE, '#size' => 15, );
$array_number_one = array('this', 'is', 'foo' => 'bar');
$form['title']=array( '#type'=>'textfield', '#title'=>'Post Title', '#maxlength' => 32, '#required' => TRUE, '#size' => 15, );
Function Arguments - Function arguments should be separated by spaces, both in the definitions and in function calls. There should not be any spaces between the arguments and the opening and closing brackets, or between the function name and the opening bracket.
Eg: function this_is_a_test($argument1, $argument2) - Arguments with default values should always go at the end of the argument list. Eg: function this_is_a_test($argument1, $argument2, $argument3 = 'abc')
function this_is_a_test($argument1, $argument2)
function this_is_a_test($argument1, $argument2, $argument3 = 'abc')
PHP Code Layout - Do NOT combine multiple lines of code into a single line, even if they are comments or debug statements.
Eg:
$variable = $something + $something; $another_variable = $something_else; echo "test"; //WRONG Correct way:
$variable = $something + $something; $another_variable = $something_else; echo "test"; //WRONG
$variable = $something + $something;
$another_variable = $something_else;
echo "test";
- Braces should ALWAYS be included when writing code using if, for, while etc. blocks. No exceptions here, even if the braces could be omitted. Leaving out braces makes code harder to maintain in the future and can also cause bugs that are very difficult to track down.
Eg: Wrong practices: if ($condition1) echo "some code"; if ($condition1) echo "some code"; else echo "some code";
if ($condition1) echo "some code"; if ($condition1) echo "some code"; else echo "some code";
Correct way: if ((condition1) || (condition2)) { //action1 } elseif ((condition3) && (condition4)) { //action2 } else { //default action }
if ((condition1) || (condition2)) { //action1 } elseif ((condition3) && (condition4)) { //action2 } else { //default action }
- Control statements should have one space between the control keyword and opening parenthesis.
- Split lengthy IF statements into several lines. if (($condition1 && $condition2) || $condition3 || $condition4 ) { //do something }
if (($condition1 && $condition2) || $condition3 || $condition4 ) { //do something }
SQL Code Layout
- Do NOT hard code db_prefix in table names. (Specific to Drupal). - Always capitialise all SQL keywords (SELECT, FROM, VALUES, AS etc.) and leave everything else in the relevant case. - If you are using WHERE clauses to return data corresponding to a set of conditions, enclose those conditions in brackets in the same way you would for PHP if blocks.
Eg: SELECT * FROM {node} WHERE ( (rid = 5) AND ((type = 'recording') OR (blah = 'somevalue')) )
SELECT * FROM {node} WHERE ( (rid = 5) AND ((type = 'recording') OR (blah = 'somevalue')) )
- Split lengthy SQL statements into several lines.
Quoted Strings - Strings in PHP can either be quoted with single quotes (”) or double quotes (”"). The difference between the two is that the parser will use variable-interpolation in double-quoted strings, but not with single-quoted strings. So if your string contains no variables, use single quotes, otherwise, use double quotes.
SQL Injection - Make sure your SQL code does not expose SQL Injection vulnerability.
Eg: This code is prone to SQL Injection. db_query("INSERT into {node} (nid, vid, type, uid, created, changed) VALUES($nid, $vid, '" . $type . "', $user->uid, $created, $changed)");
db_query("INSERT into {node} (nid, vid, type, uid, created, changed) VALUES($nid, $vid, '" . $type . "', $user->uid, $created, $changed)");
Instead, use: db_query("INSERT into {node} (nid, vid, type, uid, created, changed) VALUES(%d, %d, '%s', %d, %d, %d)",$nid, $vid, $type , $user->uid, $created, $changed);
db_query("INSERT into {node} (nid, vid, type, uid, created, changed) VALUES(%d, %d, '%s', %d, %d, %d)",$nid, $vid, $type , $user->uid, $created, $changed);
This post is password protected. To view it please enter your password below:
Password:
1. Install SysStat apt-get install sysstat
apt-get install sysstat
2. Enable Stat collection Open vi /etc/default/sysstat Edit the file, change “ENABLED” to “true”.
vi /etc/default/sysstat
3. Start Sysstat /etc/init.d/sysstat start
/etc/init.d/sysstat start
3.a. By default, sysstat reports activity every 10 minutes everyday. If you’d like to change that interval, edit it here: /etc/cron.d/sysstat
/etc/cron.d/sysstat
4. To look at your load averages, type in sar -A
sar -A