Sunday, February 27, 2011

My new mouse

I just purchase a new mouse (for my laptop) and I was so hype about it until I make it into a blog post

Here is the picture


Okay, what I would like to tell in this post is about "What is the best mouse for laptop"
This is only my opinion and might also be wrong

Many people think, when the mouse for laptop it must be
  1. Wireless - For portability purpose
  2. Small - For portability purpose too
I would like to said that these 2 feature is correct but there are more important thing you need to consider when purchasing "Mouse for laptop (portable)"

Work on all surface
The first thing you might forget is about "Work on all surface". Yes, you are using a laptop and you might use it in different place on different surface. It can be
  1. Wooden or cement table at the park
  2. Glass or Metal table on cafe
  3. Bedsheets / Marble / Sofa / Couch at your house (with lazy typing posture)
Thus, what you need for portable mouse 1st is it work on all surface. These can be solve by a mouse with a "laser" and not "optical". But my new mouse was "blue lace" I dont know what it is but it does work like laser... peww peww

Less wire = retractable
I do not encourage for wireless mouse because
  1. Heavy (need battery)
  2. Huge or bulking (cause the battery)
Although the "wireless" looks cool but try to look at the main point why we want a wireless mouse?
The answer will be "the wire mouse will mess up by laptop bag and look so uncool" issit?

Thus, these can be solve my retractable wire, means the wire cord can be expand and shrink.
My new mouse, the retractable wire was inside the mouse, causing it to have sleeker design and it does not bulking

Size
Last one is the size, the smaller the better. But some like bulking mouse rather than small mouse. So this option is optional. If you dont mind about the size, pick up a slim mouse design

Finally, my mouse spec is
  1. Slim design but can adjust the height
  2. Blue lace
  3. Retractable wire inside the mouse
  4. RM 28 (on 27 Feb 2011)
  5. Brand: Areson

Thursday, February 17, 2011

Disable phpmyadmin login

PhpMyAdmin is a webbased database management application and it is a very good tool for developer.

But there is one problem if you want to install it localhost which is annoying login after AFK for a while

I have google for these solution and the result wasnt good enough so I post this so I can refer it back

Manage to work it out by referring the manual http://www.phpmyadmin.net/documentation/#servers_user


Nows lets disable the annoying login

Advantage: no annoying
Disadvantage: Less secure, password stored in a file without encrypted

These was tested on Ubuntu machine version 10.10 so I'm not sure about windows
The version of phpmyadmin is 3.3.7deb3build0.10.10.1

1st open the configuration of the phpmyadmin file

sudo gedit /etc/phpmyadmin/config.inc.php



Search for string "/* Authentication type */" (its at line no 35)
Disable the "cookie" auth_type and put these code. It should look like these

/* Authentication type */
//$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'mypasswordissecret';


So you eventually change the auth_type into 'config' and you required to put the username and password for that

To test the annoying login is now disabled, restart your FireFox (reset the cache) and try to direct to the phpmyadmin (In my case I type "http://localhost/phpmyadmin/" in my FireFox URL)

It work when you are not asked for login. KUPO!

p/s: I know the file was /etc/phpmyadmin/config.ini.php is from file /var/www/phpmyadmin/config.inc.php

Edit 29 Nov 2012
For phpMyAdmin 3.4.11 the configuration file for windows was in libraries/config.default.php
here is my setting, for localhost development
$cfg['Servers'][$i]['auth_type'] = 'config'; //Default is cookie
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['nopassword'] = true; //Default is false
$cfg['Servers'][$i]['AllowNoPassword'] = true; //Default is false

Wednesday, February 16, 2011

jquery i always use script

Set the element (by ID) to readonly
$('#blockm3').attr('readonly', true);

Disable the element (by ID)
$("#cautionremark").attr("disabled", true);

Change the element (by ID) styles
$("#cautionremark").css({backgroundColor: '#ccc'})

Select element by name (the element is a dropdown, select)
Learn it from here: http://api.jquery.com/attribute-equals-selector/
alert( $('select[name="userstatus"]').val());

Sunday, February 13, 2011

PC cannot start, backup data before format

This is common to Windows users, read cause it useful

Your window affected by virus (or anything) and cannot start. But you got important stuff in the partition and 'formatting' will delete the thing

Dont worry there is a way to "get it back before format" which is by using LIVE CD

Let me cut to the point else read the whole story

Use Ubuntu LIVE CD


What is LIVE CD?
It is like "installing operating system temporarily" and in these case I'm suggesting you to use "Ubuntu Live Pendrive"

What can you do with Temporary Operating System?
You will able to access the partition (as long as not corrupted or damaged) and take anything you want to save first

Real story, I have been helping 2 of my friend because of their PC cannot boot
These happen a long time ago but he remind me about it today

Why pendrive and does it possible?
  1. Yes, you only need 1GB pendrive (is already enough) and LIVE Pendrive is better in term of size and options.
  2. Notebook does not have CD/DVD ROM so pendrive is the solution

How to have these "Ubuntu LIVE Pendrive?"
  1. Go to these website and download it http://www.ubuntu.com/desktop/get-ubuntu/download
  2. Have a pendrive and make it bootable pendrive. The tutorial was on the download link
  3. Go to your "cannot start" PC, put the LIVE Pendrive and start, make sure to change your first boot to CD (I think to CD is already can be detected)
  4. The Ubuntu LIVE Pendrive will loading and you will be using Ubuntu to backup your data before formatting

Friday, February 11, 2011

Disable ubuntu notification

Notification in Ubuntu will be cool if you just Install Ubuntu. But after a while I just be more annoying.

I found out how to take it of from here, quite easy to google actually
http://www.killertechtips.com/2009/04/26/disable-notifications-in-ubuntu-904-jaunty-jackalope/


sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service /usr/share/dbus-1/services/org.freedesktop.Notifications.service.disabled


Restart you PC after that

This is to enable it back (i guess, never try)

sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.disabled /usr/share/dbus-1/services/org.freedesktop.Notifications.service

Thursday, February 10, 2011

Ubuntu rip FLV convert to MP3

I want to download Justin Bieber official video from youtube and convert into mp3 so I can hear it in my phone... so this is the step to do it

Able to download/rip the video (.flv file) from youtube

Before this, if you play a video on youtube, the file (.flv) will be store in your "/tmp" (stand for temporary) folder. But now it is missing and I don't know why is it.
I do realize it happen after I update with my Update Manager

So, how do I rip (take) flv video from youtube right now?

The answer is by using Unplug. It is a "Firefox addon" and this addon is also available in Windows.
The link is here https://addons.mozilla.org/en-US/firefox/addon/unplug/

So after you Install Unplug in your Firefox, you can start ripping.
While you play the video right click in any place and menu will appear. Inside the menu will have "Unplug" and click it and download it in any folder

EDITED #2 (Feb 2010)
I search through the forums and found out it moved to here
But these location is more trouble some
/home/asipo/.mozilla/firefox/bf3zqtab.default/Cache

Or these for google chrome
/home/asipo/.cache/google-chrome/Default/Cache


Convert the FLV to MP3 using "FFMPEG"

You need to install FFMPEG and other additional library because your FFMPEG might now be "good enough" to convert into a different format
So you will need to install other library. I refer it here http://ubuntuforums.org/showthread.php?t=1117283

Thus, the code is

sudo apt-get install ffmpeg libavcodec-extra-52

For Ubuntu Maverick Meerkat 10.10, Ubuntu Lucid Lynx 10.04 and Ubuntu Karmic Koala 9.10

To script to convert is (type in terminal)

ffmpeg -i "justin bieber.flv" -acodec libmp3lame -ab 128k "justin bieber.mp3"


This is still not good, now you want to convert a lot flv file to mp3. So in this case you need a bash script aka programming.
The source for this bash script was from here http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=1430243

So the code will be

for f in *.flv
do
ffmpeg -i "$f" -acodec libmp3lame -ab 128k "${f%.flv}.mp3"
done



Use this script and paste into a new document. Rename the document to "flv2mp3.sh"
After that make it executable

chmod -777 flv2mp3.sh


To execute this script use this

./flv2mp3.sh



p/s: Justin bieber is only an example

Tuesday, February 8, 2011

Javascript numeric input

This is my cheatsheet while playing with the javascript, always forgot about them so I job it down here

Easy to find, one of them is in here
http://javascript.internet.com/forms/validate-numeric-only.html

Round a number into 2 decimal place
var result = Math.round(annualPremium*100)/100



Convert string to Integer
http://www.keyboardface.com/archives/2006/04/04/javascript-string-to-int/
parseInt(10.10) //Return 10



Another alternative for number format
http://www.pageresource.com/jscript/j_a_03.htm
profits.toFixed(2) //returns 2489.82
profits.toPrecision(4) //returns 123.5 (round up)



Check is numeric
http://andrewpeace.com/javascript-is-numeric.html AND http://bytes.com/topic/javascript/answers/526119-convert-double-cdbl-javascript
valueCredit = document.getElementById('thisIsSparrta').value;
if( valueCredit != '' && !isNaN(valueCredit)){
    totalCredit += parseFloat(valueCredit);
}



Adding and removing 'readonly' attribute to element
http://bytes.com/topic/javascript/answers/655784-change-textbox-readonly
document.getElementById('helloworld').setAttribute('readonly', true);
document.getElementById('helloworld').removeAttribute('readonly');


Change the element background
http://www.codeproject.com/KB/scripting/focusBGColor.aspx
document.getElementById('helloworld').style.backgroundColor = '#EBEBE4';


Select all the text in textbox
http://javascript-array.com/scripts/onclick_select_all_text_in_field/
document.getElementById(id).focus();
document.getElementById(id).select();

p/s: Remember not to use 'onclick' function because just in case the user dont want to select all (they made typo mistake and want to remove only 1 character)


Check the element has what attribute
There is a source, but I forget whare I take it from
document.getElementById.hasAttribute('acinput')

p/s: The attribute can be anything actually, typically is 'readonly' for textbox

Tuesday, February 1, 2011

Installer file name

I always forget for ubuntu what is their installer file type name (like .msi for windows)

32 bit .deb (For Debian/Ubuntu)
64 bit .deb (For Debian/Ubuntu)
32 bit .rpm (For Fedora/openSUSE)
64 bit .rpm (For Fedora/openSUSE)