Tuesday, November 22, 2011

google email phone mobile verification contact requirement

Problem
If you want to create a new Google email. They will ask for your mobile phone number.
This is Google security feature to prevent bot

Reason
Once, I read a blog (cant remember URL) about the phone verification only appear because of username you put. They will search for number or any repetitive name. If have, they will ask for phone verification

Solution
Thus the solution you need is simply putting a unique name. This is difficult since most of any name you try might already been taken.

So the solution for the solution is, "Elf name generator". Yes, Elf name is less frequently use in gmail so you will have high chance to get register new email without phone number verification

Here is some list of website that generate Elf name for you (You can find many website by simply searching "elf name generator"). Good luck in creating your new email... legolas
  1. http://elf.namegeneratorfun.com/
  2. http://online-generator.com/name-generator/elf-name-generator.php
  3. http://chriswetherell.com/elf/index.php
I do not responsible for broken link, these link are search through google on Nov 2011

That is all, your sincerely
Eärendur Fëfalas

make a troll website

I was so boring and got nothing productive to do, and so I made some "art of trolling" stuffs.
Thus, I teach you how to make a trolling Google blogspot

Example?
You can see the example here, it is my testing website anyway http://legendarytesting.blogspot.com/

Usage
In blog you can post a comment. If you put a trolling comment, people will start to look into your detail such as your blog or and website URL you put. So this is how you use it!

How to create?
Simply create a new identity for 'trolling' purpose (recommended)
  1. Create a new Google email (If you having a difficulties creating a new Google email, please refer here)
  2. Create new blogspot from the Google email
  3. Make a new post and put the code below
<div style="position: fixed; z-index: 999; overflow: hidden; top: 0px; left: 0px; width: 100%; height: 100%; background-color: white;">
    <table style="width: 100%; height: 100%;" border="0">
        <tr>
            <td>
                <div align="center">
                    <img style="border: none; box-shadow: none" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI_eHlYrh06Qg1FfiuZotW3L0qOE7XF5kX7cu29cnBA58mEF0DdAVeb77ZGsbvkMrDSLzDrIO3UeKyUbrCFBY08KswzbjOXUZp6MyXZlKf7-D4TIq8HLH9AqFE0YAM2aPqRgg32Gk8TVA/s800/trollface.jpg"/>
                </div>
                <div align="center">
                    <h2 style="letter-spacing: 3px; font-size: 20px; color: black; font-family: 'Times New Roman', Courier, Garamond, serif;">Problem?</h2>
                </div>
            </td>
        </tr>
    </table>
</div>

Thursday, October 27, 2011

Netbean chinese character problem

Probably happen in my pc (Window XP Home)
Create a new .php file, then when I paste the chinese character it show all right

Problem rises when the display (like export into PDF)
This is because the character encoding for the netbeans (NetBeans IDE 6.9.1) is not UTF-8

So simply fix this problem by changing the file type. As for me, I'm using notepad2 to change to file type into UTF-8. Below is the example


http://localhost/search/

Limit download speed Free download manager

*21 September 2013 Update
If you using web browser to download and unable to use "Free download manager"
The alternative will be NetBalancer at http://seriousbit.com/netbalancer/
This is much advance technique where you need to limit manually "Firefox.exe" application into 100kbps as example



If you live in a "shared internet" environment and you don't want to be selfish by hogging all the bandwidth for download you can always cap the bandwidth

If you are using Torrent, be default they allow you to do so

But if you want to use normal download, you have to use download manager
Here I would recommend FDM; Free Download Manager

Download link here : http://www.freedownloadmanager.org/

They have a feature for limit the bandwidth but you have to set the speed manually
Basically I set

  1. Light mode = 20kBps max
  2. Medium mode = 50 kBps max
  3. Heavy mode = No limit


In Malaysia (normally or at least in my case)
20kBps download speed means you can play online game without lag or delay
50kbps download speed means you will lag in game, while okay for surfing website

Monday, October 24, 2011

Get element style in string

You have an element. You want to get the style applied into it. Where the format is string

eg: <a id="hupla1" style="width: 300px;">HELLO</a>

So you want to get "width: 300px;"

I refer from here http://objjob.phrogz.net/css/object/243 maybe you can find better solution and any alternative.

But my solution is document.getElementById('hupla1').style.cssText

Wednesday, October 19, 2011

Using mogrify

Is a tool (using ubuntu) to manipulate image in a batch. For an example is resize the image

Frequent command that I always use
mogrify -resize 800x600 -format jpg * MYIMAGE/*/*/*

This is to resize a folder whith a subfolder (it has 2 subfolder)

Tuesday, September 6, 2011

cakephp check database configuration exist and connection alive valid

Keyword
Check cakephp database configuration exist
Check cakephp database can be connect

In cakephp you need to configure the connection
The configuration file was in app/config/database.php

Inside the file, you can see 2 variable which is 'default' and 'test'

By default is 'default' but if you want to use 'test' in the controller for example, you need to call it like this
$this->Mmodel->useDbConfig = 'test';
 

Problem arise is, can we connect to 'test' without problem?

So, here is the code I made. Been googling it and quite hard to found the solution, thus I'm putting this in my blog. lol...

This code will check
- Does the configuration 'test' exist
- If the configuration exist, does the database connection valid

If these 2 condition is pass, you can only have SQL Syntax Error like selecting table that does not exist

So here is the code (its free)
//Checking is done by connecting with the  database
if (class_exists('DATABASE_CONFIG')){
    $dbConfigName1 = 'test'; //<-- PUT YOUR DATABASE CONFIG VARIABLE NAME HERE

    $dbConfig1 = new DATABASE_CONFIG();
    //pr( $dbConfig1);                    

    if( isset( $dbConfig1->$dbConfigName1)){                       

        //Now check wether the database configuration, its alive!
        //pr( $dbConfig1->$dbConfigName1);
        $dbTemp1 =& ConnectionManager::getDataSource($dbConfigName1);

        if( $dbTemp1->isConnected() == true){

            //Means database exist and you can use it
            echo "DATABASE CONFIG '$dbConfigName1' EXIST AND MANAGE TO CONNECT";
        }
        else{

            //Database configuration exist, but cannot connect to the database
            echo "DATABASE CONFIG '$dbConfigName1' EXIST BUT FAILED TO CONNECT";
        }
    }
    else{

        //The database configuration does not exist
        echo "HAS NO DATABASE CONFIGURATION WITH NAME '$dbConfigName1'";
    }
}
else{

    //The database.php file not even exist. How can this be? IMPOSIBIEBERBEL!
    echo "CANNOT FIND THE 'database.php' CONFIGURATION FILE";
}

Reference
http://bakery.cakephp.org/articles/T0aD/2009/07/08/handle-database-connection-errors
http://debuggable.com/posts/handling-database-connection-errors-in-cakephp:480f4dd5-9570-421a-a04d-43cdcbdd56cb

Thursday, August 11, 2011

mysql I need to remember script

SELECT colourid, COUNT(colourid) as noofoccurance FROM vtiger_appendixcolour WHERE colourid != 0 GROUP BY colourid ORDER BY noofoccurance DESC;
This is to find each colourid, how much frequency it has been used. Typically use this to find 'search by popularity;

Wednesday, July 13, 2011

Cool I want to remember link

Uhh... need to bookmark this (but sharing in post is a good method too)

Convert your code into HTML format
http://puzzleware.net/CodeHTMLer/default.aspx

javascript slider for div simple

This is to make a javascript slider


The main concept was taken from here and modify it alot http://www.sitepoint.com/forums/javascript-15/slide-div-horizontally-449624.html

Below will be the code, if you want to see the demo, refer to this page http://legendarytesting.zymichost.com/codemo/sliderfinal.html

Note to remember
  • I have test and work well on these browser (except for different browser slide with different speed)
    • Google Chrome (v10.0.648.205)
    • Firefox (v5.0)
    • Opera (v11.11)
    • Safari (v5.0.5)
    • Internet Explorer (v8.0.6001)
  • Using these script, it will store value on element (not store inside the javascript which I think much better method). You may change these code for your own needs
  • Note the padding must be inside the 3rd div, else it will run out of alignment (depend on your browser)
  • The 2nd div (with 999px width) must be put and always put additional width (browser compability purpose also)
  • Variable "Column width" is important, you need to add the padding value also (300px actual + 10px padding = 310px)

<html> 
    <head> 
        <title>Simple Slider</title> 

        <script type="text/javascript" language="javascript"> 
            //<![CDATA[ 

            function snapColumn( snapToCol) 
            { 
                slidingDiv  = document.getElementById("d1");
                divWidth    = document.getElementById("columnwidth").innerHTML; 
                currentCol  = document.getElementById("currentcolumn").innerHTML; 

                slidingDiv.style.left = -1 * (snapToCol-1) * divWidth; 
                document.getElementById("currentcolumn").innerHTML = snapToCol; 

                document.getElementById("poswatch").innerHTML = slidingDiv.style.left; 
            } 

            function slideLeft( stopPos) 
            { 
                slidingDiv = document.getElementById("d1"); 
                document.getElementById("functiondebug").innerHTML = parseInt(document.getElementById("functiondebug").innerHTML) + 1; 
                 
                if( parseInt(slidingDiv.style.left) > stopPos){ 
                    slidingDiv.style.left = parseInt(slidingDiv.style.left) - 2 + "px"; 
                    document.getElementById("poswatch").innerHTML = slidingDiv.style.left;                     

                    setTimeout(function(){slideLeft(stopPos)}, 2); 
                } 
                else{ 
                    document.getElementById("slidestatus").innerHTML = 0; 
                } 
            } 

            function nextColumn() 
            { 
                if( document.getElementById("slidestatus").innerHTML == 1){ 
                    return false;
                } 

                document.getElementById("slidestatus").innerHTML = 1; 
                slidingDiv  = document.getElementById("d1");
                divWidth    = document.getElementById("columnwidth").innerHTML; 
                currentCol  = document.getElementById("currentcolumn").innerHTML; 
                currentCol  = parseInt(currentCol) + 1; 
                stopPos     = -1 * (currentCol-1) * divWidth; 

                if( currentCol > parseInt(document.getElementById("columntotal").innerHTML)){ 
                    document.getElementById("slidestatus").innerHTML = 0; 
                    return false;
                } 

                //alert(stopPos); 
                //slidingDiv.style.left = stopPos; //Snap to the position immidietely
                slideLeft( stopPos); 
                document.getElementById("currentcolumn").innerHTML = currentCol; 
            } 

            function slideRight( stopPos) 
            { 
                slidingDiv = document.getElementById("d1"); 
                document.getElementById("functiondebug").innerHTML = parseInt(document.getElementById("functiondebug").innerHTML) + 1; 
                 
                if( parseInt(slidingDiv.style.left) < stopPos){ 
                    slidingDiv.style.left = parseInt(slidingDiv.style.left) + 2 + "px"; 
                    document.getElementById("poswatch").innerHTML = slidingDiv.style.left;                     

                    setTimeout(function(){slideRight(stopPos)}, 2); 
                } 
                else{ 
                    document.getElementById("slidestatus").innerHTML = 0; 
                } 
            } 

            function previousColumn() 
            { 
                if( document.getElementById("slidestatus").innerHTML == 1){ 
                    return false;
                } 

                document.getElementById("slidestatus").innerHTML = 1; 
                slidingDiv  = document.getElementById("d1");
                divWidth    = document.getElementById("columnwidth").innerHTML; 
                currentCol  = document.getElementById("currentcolumn").innerHTML; 
                currentCol  = parseInt(currentCol) - 1; 
                stopPos     = -1 * (currentCol-1) * divWidth; 

                if( currentCol < 1){ 
                    document.getElementById("slidestatus").innerHTML = 0; 
                    return false;
                } 

                //alert(stopPos); 
                //slidingDiv.style.left = stopPos; //Snap to the position immidietely
                slideRight( stopPos); 
                document.getElementById("currentcolumn").innerHTML = currentCol; 
                return true;
            } 
            //]]> 
        </script> 
    </head> 
    <body> 

        <label>Variable</label> 
        <table border="1"> 
            <tr> 
                <td>DIV current style.left</td> 
                <td><div id="poswatch">0</div></td> 
            </tr> 
            <tr> 
                <td>Check function executed</td> 
                <td><div id="functiondebug">0</div></td> 
            </tr> 
            <tr> 
                <td>Current column</td> 
                <td><div id="currentcolumn">1</div></td> 
            </tr> 
            <tr> 
                <td>Max no of column</td> 
                <td><div id="columntotal">3</div></td> 
            </tr> 
            <tr> 
                <td>Column width</td> 
                <td><div id="columnwidth">310</div></td> 
            </tr> 
            <tr> 
                <td>Slide Status</td> 
                <td><div id="slidestatus">0</div></td> 
            </tr> 
        </table> 
        <div style="height: 50px;"></div> 

        <label>Use this to slide</label><br/>
        <b onclick="previousColumn()">< BACK</b> | <b onclick="nextColumn()">NEXT ></b> 
        <div style="height: 50px;"></div> 

        <label>Use this to snap to specific column</label><br/>
        <a onclick="snapColumn(1)">[1]</a> | <a onclick="snapColumn(2)">[2]</a> | <a onclick="snapColumn(3)">[3]</a> 
        <div style="height: 50px;"></div> 

        <!-- 1st div --> 
        <div style="width: 310px; overflow: hidden; border: 1px dashed black;"> 

            <!-- 2nd div --> 
            <div id="d1" style="width: 999px; position: relative; left: 0px;"> 

                <!-- 3rd div (a) --> 
                <div style="width: 310px; height: 100px; background-color: plum; float: left;" align="right"> 
                    <div style="padding: 5px;"> 
                        <b>SPARTA !!!!!!!!!!!!!!!!!!!!!</b> 
                    </div> 
                </div> 

                <!-- 3rd div (b) --> 
                <div style="width: 310px; height: 100px; background-color: bisque; float: left;" align="right"> 
                    <div style="padding: 5px;"> 
                        <b>IS !!!!!!!!!!!!!!!!!!!!!</b> 
                    </div> 
                </div> 

                <!-- 3rd div (c) --> 
                <div style="width: 310px; height: 100px; background-color: powderblue; float: left;" align="right"> 
                    <div style="padding: 5px;"> 
                        <b>THIS !!!!!!!!!!!!!!!!!!!!!</b> 
                    </div> 
                </div> 
            </div> 
        </div> 
    </body> 
</html>

If you wandering how I convert these code into HTML syntax, refer it here http://puzzleware.net/CodeHTMLer/default.aspx

Monday, July 11, 2011

CSS I need to remember link

CSS I need to remember link, but I always forget

http://www.w3schools.com/css/css_howto.asp

<style type="text/css">
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
</style>

Thursday, July 7, 2011

microsoft word make landscape orientation on certain some few one page

I have 10 page with portrait. Just want to make page 5 only to be landscape cause its a diagram
Take me 30 minutes, until this tell me how to...

http://tortoiseshell.net/coffeebreak/blog/index.php/62/word-2007-practice-how-to-make-one-page-out-of-many-landscape.html

thanks internet

Tuesday, June 7, 2011

Get web server application folder name WAMP LAMP

Let say you have a web application like wordpress in your localhost web server (WAMP)
The wordpress name is 'wordpressasipo'

Thus, the path to these is
C:\wamp\www\wordpressasipo

While in localhost it will be
http://localhost:80/wordpressasipo

The problem here is how the get the 'application name' (which is wordpressasipo) dynamically
Means even after you change the folder name (into wordpressasipo1 for example) it will still work

Here is the solution, quite usefull and I cant get this in quick googling

basename( realpath('.'));

Thus, if your application was in C:\wamp\www\wordpressasipo will return string wordpressasipo 

Monday, May 23, 2011

Buy most optimum or worth it storage drive like hard disk or flash drive or pen drive

In these post I will share some equation about "Purchasing the most optimum hard disk / flash drive"

Im not sure is anybody already found out about these but I use these equation yesterday (already know about it along time ago but never get a chance to use it and update to blog)

The equation is

Optimum value = price / size

Where
price is the price of purchasing the hard disk
size is the hard disk size (like GB or TB)
The smallest value is the most 'optimum' or should I said 'most worth it'



How these calculation is made? How did I found out these equation?
Is based on example actually

Lets get through it!

Let say you went to shop and want to purchase a flash drive, here is the price list
50 GB = RM 100
100 GB = RM 200
150 GB = RM 300

Thus
100/50 = 2
200/100 = 2
300/150 = 2

These means, all are optimize, you can buy any size you want and they are all worth it



Example above is not the actual case, in flash drive and hard disk usually the

  • out dated will be very cheap
  • current will be normal
  • latest will be expensive


Like these
50 GB = RM 100
100 GB = RM 150
150 GB = RM 400

Thus
100/50 = 2
150/100 = 1.5 (lowest)
350/250 = 2.67

As you can see, the 100 GB will be the most worth it in this case
If the difference is like 0.1 means there is not much difference, unless you want to buy 99999 pieces. But still... 0.1?

Friday, May 6, 2011

phpmyadmin too many table in database cause pagination

Too many table will automatically create a page pagination

If you are using phpmyadmin version 3.3.9, and your table in the database is alot (about 600 table)
then the page number will appear (these called pagination in web term, I think)

These page number is quite annoying since I remember some important table name from the database and having a page number slow me down cause I search the table name by using "Ctrl + F" from Google Chrome
Thus, when I Ctrl+F and type the table name, it does not appear...

Note that phpmyadmin work best when using Google Chrome (because of its "Ctrl +F" function) compared to Firefox, Opera and Safari (I have test them all and these in only an opinion)

So, the reason behind all my problem lies in the default config @global integer $cfg['MaxTableList'] where it will do a pagination for database table (set default into display 250 table in a page)

The reason, change this and all problem solved!

So, regarding on which IDE did you use in programming, search globally (in whole project) for string name @global integer $cfg['MaxTableList']

If you are using windows with WampServer Version 2.1, the phpmyadmin program is located at C:\wamp5\apps\phpmyadmin3.3.9

If you are lazy or not have a capability to find the whole project, here is the location
C:\wamp5\apps\phpmyadmin3.3.9\libraries\config.default.php (on line 501)

thats all, hope its usefull

Wednesday, April 27, 2011

Sysinternal - check window startup

Once upon a time, when I was still using Windows XP. I encounter alot of virus
Some of them able to delete manually and some of them does not (and so I format)

Here is one of the tool that I use to check any startup program (like virus or anything)
And it is a good tool because it scan deep down to the core (better than msconfig)

The software name was sysinternal
It is better (so far) from the most "checking window startup tool" application because most of them were just displaying just like what msconfig did

As for the download link, I cannot found the official website to download
Here is the might be can work (I didnt test it cause Im currently on Linux
http://technet.microsoft.com/en-us/sysinternals/bb842062
http://download.cnet.com/Sysinternals-Desktops/3000-2346_4-75077421.html

Why these software is good (to me) ?
  1. Most of startup software is no better than this (they just msconfig)
  2. Can use to remove virus
  3. Can use to improve window startup (especially when you remember the setting after format)

Screenshot

Thats all, hopefully its useful

Thursday, April 7, 2011

Smashing magazine I want to remember link

Here is the link from smashing magazine that is useful to me

Useful JavaScript and jQuery Tools, Libraries, Plugins
http://www.smashingmagazine.com/2011/04/07/useful-javascript-and-jquery-tools-libraries-plugins/

Speeding Up Your Website’s Database
http://www.smashingmagazine.com/2011/03/23/speeding-up-your-websites-database/

Thursday, March 24, 2011

Disable history back if pressing backspace

If you press backspace on the website page (but not on textbox) it will go to its previous page
This is to disable them

Taken from here, then I modified
http://www.sitepoint.com/forums/javascript-15/disable-back-javascript-168890.html

These is javascript coding
//DISABLE "GO BACK TO PREVIOUS HISTORY" IF PRESSING "BACKSPACE"
if (typeof window.event != 'undefined')
    document.onkeydown = function()
    {
        if( event.keyCode == 8){
            theEvent = event.srcElement.tagName.toUpperCase();
            if( theEvent == 'HTML'){
                return false;
            }
            else if( theEvent == 'INPUT'){
                theType = event.srcElement.getAttribute('type').toUpperCase();
                //alert(theType);
                switch(theType){
                    case 'TEXT':
                        return true;
                        break;

                   default:
                        return false;
                }
                return false;
            }
            else{
                switch( theEvent){
                    case 'TEXTAREA':
                        return true;
                        break;

                    default:
                        //alert('Backspace pressed on ' + theEvent + ', return false');
                        return false;
                }

                return false;
            }
        }
    }
else
    document.onkeypress = function(e)
    {
        if( e.keyCode == 8){
            theEvent = e.target.nodeName.toUpperCase();
            if( theEvent == 'HTML'){
                return false;
            }
            else if( theEvent == 'INPUT'){
                theType = e.target.getAttribute('type').toUpperCase();
                //alert(theType);
                switch(theType){
                    case 'TEXT':
                        return true;
                        break;

                   default:
                        return false;
                }
                return false;
            }
            else{
                switch( theEvent){
                    case 'TEXTAREA':
                        return true;
                        break;

                    default:
                        //alert('Backspace pressed on ' + theEvent + ', return false');
                        return false;
                }

                return false;
            }
        }
    }

Saturday, March 19, 2011

javascript detect and capture keyboard keycode

These is how to capture what user have type in their keyboard
The captured data is the "keycode" which is an integer

Like 'enter' key, the code is 13

Some data that I have discover and might be usefull to others and myself
These was tested and the same for IE, Firefox, Google Chrome and Safari
a until z keycode 97 until 122
A until Z keycode 65 until 90
0 until 9 keycode 48 until 57


Lets get to the code

function whatKeyCodeHaveIType( theEvent)
{
    charCode = (theEvent.which) ? theEvent.which : theEvent.keyCode

    theTempoElement = document.getElementById('thisiswhatyouhavetpye');
    theTempoElement.innerHTML = theTempoElement.innerHTML + ', ' + charCode;

    //This is to ignore "ENTER" key. Its usefull to prevent a form from autosubmit if you press enter
    return (charCode != 13);
}

//Later in HTML, use these
<input id="whatyouhavetype" style="width: 500px;" onkeypress="return whatKeyCodeHaveIType(event);"/>
<textarea id="thisiswhatyouhavetpye" cols="70" rows="5"></textarea>

Type something here :


javascript detect finish typing keystroke delay autocomplete

Okay, the title might be confusing but here is what these about

You want to execute certain function, right after the user has finish its typing

These is different from normal 'keypress' or 'keyup' or 'keydown' event detection because these will execute a function every key is press. Right now you want to give certain delay so that the function only execute at the right time

These is important if you developing an autocomplete (AJAX) because you dont want to execute the script too much. Typing "HELLO" means you do the SQL statement 5 times
H
HE
HEL
HELL
HELLO


But if you do a proper keystroke delay (detect user finish typing) you will only execute the SQL statement once
HELLO


Cut to the story, hopefully understand what I was trying to explain at the top

Here is the function
var typingTimer;
var doneTypingInterval = 700;

//Detect keystroke and only execute after the user has finish typing
function delayExecute()
{
    clearTimeout(typingTimer);
        typingTimer = setTimeout(
        function(){somethingExecuted('typesomethinghere')},
        doneTypingInterval
    );

    return true;
}

function somethingExecuted( theInputName)
{
    alert( "You have type '" + document.getElementById(theInputName).value + "'");
}

//Later in the HTML code, put these
<input onkeypress="return delayExecute();" id="typesomethinghere">

Type something here : (These input id is 'typesomethinghere')
The script will only execute after you finish typing. By assuming when you have stop typing for 0.7 seconds, means you have finish typing

Type something here :
These is what happen if you dont use the script



Tuesday, March 15, 2011

Ubuntu restore panel to default

Keyword
  • Accident delete top panel
  • Restore panel

Okay, I made a mistake like others always do "DELETE THE TOP PANEL!!"

To recover it back was quite easy, can find on google http://ubuntuforums.org/showthread.php?t=1475584
gconftool-2 --shutdown
rm -rf ~/.gconf/apps/panel
pkill gnome-panel
Hope this will help

Monday, March 14, 2011

Install LAMP on Ubuntu

These is a double posting, the original was from here http://asipi.blogspot.com/2009/10/haih.html

I write it back here because the title and here will be the latest updated place
(Yes I do update these post again if got any changes)


1

Install apache & mysql & phpmyadmin : http://www.howtoforge.com/ubuntu_lamp_for_newbies

*Update 23 Jan 2010
My Software source was from Malaysia and it has problem!. So it set my source to "Main Server" (Software source download from Main Server)


2

Enable the www folder
This will make your be able to add new folder into the localhost
using terminal :

sudo chmod -R 777 '/var/www'

Please note that /var/www is your root for the website
/var/www/smellynomore means http://localhost/smellynomore


3

You will realize that u cant open the phpmyadmin on http://localhost/phpmyadmin
This is because when you see inside /var/www there is no "phpmyadmin" folder

Solve it by referring here http://ubuntuforums.org/showthread.php?t=1036836

Solve by doing this in terminal :

sudo ln -s '/usr/share/phpmyadmin' '/var/www'



4

Additional configuration for the mysql

When you first time install the mySQL, everything is working fine.
But then, after you reboot the PC, the mySQL server cant start.

The mySQL configuration file will be missing after boot
After some haih...checking, you will realize that file inside "/var/run/mysqld" is missing

I solve it by this link, http://ubuntuforums.org/showthread.php?t=386056
Try to chown to "mysql.mysql" if owned by root, and give it a 755
It is because of the folder write permission

How to chown and chmod, please note that I dont know what happen to security issue when I done this, just want to 'make it work!'

sudo chown -R asipo '/var/run/mysqld'
sudo chmod -R 777 '/var/run/mysqld'




5

Load the mod_rewrite module
I google here to solve it http://ubuntuforums.org/showthread.php?t=255556&page=2

Using terminal :

sudo a2enmod rewrite
sudo gedit /etc/apache2/sites-enabled/000-default


After that change AllowOverride None to AllowOverride All

Then, restart Apache

sudo /etc/init.d/apache2 force-reload



6

Additional, command to mySQL server (check, start, restart and stop)
http://abbysays.wordpress.com/2008/05/20/how-to-startstop-mysql-server-on-ubuntu-804/

Setting up the cakePHP 1.2.5
There will be 2 problem
1. Warning (512): /var/www/cakemake/app/tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 262]
2. Your tmp directory is NOT writable.

Solve by : Once again chmod 777 is not secure, yeah!

sudo chown -R asipo '/var/www/smellynomore/app/tmp'
sudo chmod -R 777 '/var/www/smellynomore/app/tmp'




7

Install x-debug
http://ubuntuforums.org/showthread.php?t=525257

EDITED #2 (Feb 2011)
I dont know why lately my xdebug does not working. So I edit the php.ini file
I make the all to be "Deleopment mode" because its defaulted to "Production mode"
So I guess that is the reson, plus use this on ERROR Report
error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE


8

After that, it will read index.html
I dont know how to change it for the thing to refer into index.php

However, this is the index.php code (simple version of mine)

<p><b>Localhost</b></p>
<p>Select folder or file to navigate</p>

<?php

echo "<ul>";
if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            echo "<li><a href='$file'>$file<a></li>";
        }
    }
    closedir($handle);
}
echo "</ul>";
?>
If you have been wandering how I put this code into this blog. This is the place http://asipi.blogspot.com/2011/01/write-blog-post-using-tinymce.html

Thus when you open your http://localhost/index.php will get something like this


9

phpMyAdmin login might be annoying, solve it from here http://asipi.blogspot.com/2011/02/disable-phpmyadmin-login.html


10 Edit 28 Nov 2012
To install CURL. I follow this website http://buzznol.blogspot.com/2008/12/install-curl-extension-for-php-in.html

Basically, in terminal type : sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
Then restart the LAMP server, then test it using var_dump(curl_version()); make sure to put -pre- html tag around it

Note that to restart the server. Using this command seems to be even better. Feel like it was relly restarting... sudo /etc/init.d/apache2 restart

Thats all
good luck, kupo!

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)

Sunday, January 30, 2011

Prevent mail from spam or junk by encryption from crawler

If you write a blog and put your email on it. There is a chance for you to get Spam/Junk mail
This can be cause of many reason but I'm focus on crawler method

How this spam works?
Basically this is the procedure
1. They find your email
2. They write email to you

Spam usually include 1000 email or more and of course it is done by using a bot (a system) and not just people manually type in

To find your email
They using web-crawler, spam-crawler or anything-crawler. These crawler will browse slowly through the internet (from blog to blog, website to website until forever). If your blog put an hyperlink of your friend blog (blogroll they called) these crawler will go into it

Thus in, programming these crawler detect 2 things

1st detection
Detect "http://" text. If they found and word, URL or string match. They will retrieve the link and put in on the "Next going to be crawl list"

2nd detection
Since they want to spam to your mail, they simply find any string or word with "@" symbol. Thus your email will be captured in these process

Write email to you (spam)
These is a process of producing mass email and of course they use the list they got from the first step and use a bot (system) to mass mail it


Prevention

There is 2 type of prevention
1. Email filter (thats why you have spam/junk mail categories)
2. Prevent your email from being on the spammer list

1st prevention - Filter your mailbox
This is already common and build in feature for almost all email system like gmail and others. So no need discussing much

2nd prevention - Prevent from listed
This is what I want to discussed about
Usually people will make their email not in easy format or encryption.

Using different email format like (let say your email is ajskdhqjeakjbdia@gmail.com)

Email: ajskdhqjeakjbdia (@gmail)

Email: ajskdhqjeakjbdia at gmail dot com

Or they use encryption like these

ajskdhqjeakjbdia@gmail.com
(It looks normal but it is actually encrpted)

So these encryption can be easily google. But I'm suggesting you the simplest one which taken from these website http://www.web-designz.com/tools/email_encoder.shtml
Note: The simplest method might also means it is easily detectable by the crawler

If you are a programmer and wandering how did the website do the answer is they are using convertToUnicode(...) function

If you view the page source. It wont show and "@" or your email at all because it is encrypted and of course the crawler is a system, they read the page source and not reading like you did (using web browser)

-End-

GIMP save for web image optimize reduce size

If you are using Windows and want to upload huge picture size into the internet (or blog) optimize it first using Adobe Photoshop 'save image as web' feature. It can reduce image size and make your image to load faster!

Story
Im using ubuntu and they dont give adobe photoshop crack for free :(
But I need adobe photoshop 'Save image as web' feature.
Ubuntu only provide me 'GIMP' but I found the same feature as a plug-in

Straight to the source. I copy from here http://www.techzilo.com/install-save-for-web-gimp-plugin-ubuntu/

What is 'Save image for web' ?
Save image for web is a technology to compress the image size so it can load faster in the internet

Weakness
Reduce the image quality. But this wont affect much (unless you have super vision)

Advantages
Image load faster

Conclusion
The advantages overcome the weakness make this a good thing to share!

Others
I was kinda lazy to write the thing back cause the source it self is already 100% fool proof

Saturday, January 29, 2011

Make a horizontal list



This is more like HTML & CSS tutorial to make ordered list to go vertical

This is order list (normal)
  • Hello
  • This is
  • Testing

This is order list (horizontal)
I actually copy the code from this guy http://leandrovieira.com/projects/jquery/lightbox/

<style type="text/css">
    /* jQuery lightBox plugin - Gallery style */
    #gallery {
        background-color: #444;
        padding: 10px;
        width: 520px;
    }
    #gallery ul { list-style: none; }
    #gallery ul li { display: inline; }
    #gallery ul img {
        border: 5px solid #3e3e3e;
        border-width: 5px 5px 20px;
    }
    #gallery ul a:hover img {
        border: 5px solid #fff;
        border-width: 5px 5px 20px;
        color: #fff;
    }
    #gallery ul a:hover { color: #fff; }
    </style>


<div id="gallery">
 <ul>
  <li>Hello</li>
  <li>This is</li>
  <li>Testing</li>
 </ul>
</div>


The result

Write blog post using TinyMCE

Google blog text editor has improved!.They have "Edit HTML" or "Compose" tab (like below)



Tuesday, January 25, 2011

HTML UTF encoding entities


I was doing some project require math symbol. The key was not exist in keyboard
The website that I use as reference is
http://www.fileformat.info/info/unicode/char/b1/index.htm
The link is a plus minus symbol (±). You can search fur further symbol at the top left

Or also here
http://www.danshort.com/HTMLentities/index.php?w=hertz

Sunday, January 23, 2011

CakePHP jquery autocomplete

Im using cakephp 1.2 and want to make autocomplete on them
Have googling for several hours (including tying it) and finally succeed

p/s: Im using try an error method. Im afraid that this 3rd try was success because of additional code I have put during try #1 and #2

1st I try to use this and succeess (except when want to autocomplete from database source)
Using original jquery http://jqueryui.com/demos/autocomplete/ which is version jquery-ui-1.8.8.custom.min.js and jquery-ui-1.8.8.custom.css

2nd was from this blog (this fail)
http://nuts-and-bolts-of-cakephp.com/2008/05/07/jquery-autocomplete-in-cakephp/
http://www.pengoworks.com/workshop/jquery/autocomplete.htm

3rd was from this website
http://www.cakephp.bee.pl/ajax/autoComplete

Thanks for all those programmer who make my life easier

After several investigation (I go crazy with these 2nd try for almost 2 days and turned out it cause of URL?)
I manage to enable the 2nd try. The reason of error is because I didnt put my system name
the website tutorial said "/products/autoComplete" but if your CakePHP 1.2 system name is 'accounting' means its going to become '/accounting/products/autoComplete'

What next? I want to make the view to be able to save more Account name. Thus is use a loop like this
input("Account.$aa.name"); ?>
input("Account.$aa.id"); ?>

Remember, the account name is just a name. At the controller what matters is the Account.$aa.id
Thus, after the autocomplete on the Account Name, the Account Id will be put the Id of the selective Account

To do this you require to modify function findValue(...) because this is where the event for 'Choosing which Account Name from the list of autocomplete'. And also a dummy input and one new function

New dummy input (on the view)
<input id="tempCount" value="" />

New dummy function (on the view at the javascript)
function tempCountert( theTempCountValue)
{
document.getElementById('tempCount').value = theTempCountValue;
}
Then you need to change you loop for the account name

From
input("Account.$aa.name"); ?>

To
input("Account.$aa.name", array( 'onchange'=>'tempCountert("Account'.$aa.'Id")')); ?>

Finally will be on the function findValue(li). Make sure to add this code
var updatedColumner = document.getElementById('tempCount').value;
document.getElementById(updatedColumner).value = sValue;



How my code works?
  1. You type in some value in the 'Account name' and the autocomplete list out the match
  2. When you click one of the match result. The dummy input (tempCount) will change the value to Account Name index. let say Account.0.name will print out 'Account0Id' in dummy input
  3. Function findValue(...) will be executed. And get the value in dummy input. Thus change the value

Thursday, January 20, 2011

Netbeans detect cakephp .ctp file

It is happen I use Netbeans as IDE and CakePHP as web framework
The problem is Netbeans only detect .php, .html and others but not .ctp file

.ctp file is a cakephp file which is similar to .php (dont know why these cakephp guys want to use different file name)


Fow Windows users

And to make the Netbeans to be able to detect it was originally from this blog http://www.davidtan.org/netbeans-enable-syntax-hightlighting-for-cakephp-ctp-view-files/comment-page-1/#comment-18469

I rewrite down the same thing
  1. From the Menu, go to Tools > Option (Then there will be a pop-up window named "Options")
  2. From the Options windows there is several Tabs, click on the "Files" tab
  3. Under the Files tab, there is a "File Extension:". Try to create a new file extension and name it "ctp"
  4. Then "Associated File Type (MIME)" for the ctp file extension, set it to "text/x-php5"
  5. Finally press "OK" button at the bottom


For Ubuntu users

I found the solution from here, pretty much the same but slightly in different place
http://forums.netbeans.org/post-60683.html&highlight=

Write back same things
tools > option > miscellaneous > Files tab

PHP generate document PDF, ODT, Excel (XLS)

Just to record down any PHP library that can help in generate document

PDF
FPDF = http://www.fpdf.org/

ODT
odtPHP = http://www.odtphp.com/

XLS (Excel)
PHPExcel = http://phpexcel.codeplex.com/

odtPHP is from Anaska. Who / what is Anaska?
Not sure for myself but I do belive they produce something really useful. Check out your WAMP it is from Anaska too :D

Recover delete data or partition using testdisk & photorec

Related name
  • Recover deleted data
  • Recover data in deleted partition


From the last post (http://asipi.blogspot.com/2011/01/merge-harddisk-partition.html), the software have made my friend harddisk partition to go 'missing'. This is how I recover the data in the 'missing' partition back
Straight to the point, use testdisk & photorec link is here http://www.cgsecurity.org/wiki/TestDisk


If you are bored and want to read the whole story, proceed...

What is recovery and what is backup?
Both of them relate with 'keeping your data safe'. Backup is prevent while recovery is cure

Thus,

Backup
Save important data before your harddisk become corrupt

Recover
Get back important data after harddisk become corrupt

Backup is better than recover because, recover not guarantee 100% success but you will never know 'when to do the backup?'

This post focused on recovery
Okay, there is 2 software that I would like to suggest in recovery

1st software, Recuva
This is recommended by my friend and when I see it (not try) I do feel like this software is good. Here is the link http://www.piriform.com/recuva




2nd software, testdisk & photorec
This is the software that I want to promote actually. Here is the listed advantages that I know

Good detecting
Several software cannot detect corrupted harddisk. But this software can!. So when recover my friend harddisk it let me select the corrupted harddisk, the partition to recover

Harddisk format supported
There is alot of harddisk type it can support, typical that I still can remember is NTFS, FAT, Solaris (what is this?) and bla bla bla...

How good this recover?
It recover is 100% good. This is because they scan the harddisk by memory allocation.
Means as long as there is any single bytes in the harddisk will be scan. The problem was it was too good until unwanted data is also recover.
Chance of getting corrupted file is also high (because it was too good, seriously!)

*It cost RM 300 - RM 500 to recover you harddsik (in business). And knowing this cost you RM 1 (your electricity bill and time wasted to read)

Weakness
The first weakness but still not a 'real weakness' for me. Which is this program is in a commandline.Since im a programmer (and used to it), I'm going to said their commandline interface is excellent

Second weakness is it recover all the data as possible. Means your deleted file 1000 years ago is also possible as a result it highly corrupted. This is what happen if you want to perfection in recover

Wednesday, January 12, 2011

jQuery navigation menu

Im not sure does anybody know about this. Think it will be easier to find in google
Below is the link for website that show example on jQuery navigation menu

36 Eye-Catching Jquery Navigation Menus
http://www.1stwebdesigner.com/resources/36-eye-catching-jquery-navigation-menus/

By the way, the website it self http://www.1stwebdesigner.com is totally awesome for me

Tuesday, January 11, 2011

PHPExcel

PHPExcel make a nice looking table header
Actually is not really nice looking. Just a proper presentation...
There is too many code and I got no time to upload...

Sources from here
http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=32427

$headerStart = 22; //Start row

foreach( array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'M', 'N', 'O', 'Q', 'R', 'S', 'T') as $alphabet){
$objPHPExcel->getActiveSheet()->getStyle($alphabet.$headerStart)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->mergeCells( $alphabet.$headerStart.":".$alphabet.($headerStart+1));
$objPHPExcel->getActiveSheet()->getStyle($alphabet.$headerStart)->getAlignment()->setVertical( PHPExcel_Style_Alignment::VERTICAL_CENTER);
}

Saturday, January 8, 2011

using permission?

You want to use anything inside my blog post? (such as code, tutorial etc)

Here is the permission upon each categories

Read here first
1st of all, most of my post has their own reference and I post back the link where I found it. Then I copy the same thing for myself use.
Thus, if I put the link you can check if the link stated about permission to use. I think most of the time the link will be on others blog or forum so I myself not even really sure about the permission...

Coding
This is a code that I made by myself. It is FREE and also 'AS IS'
Means you can use it for anything you want and anything happen is your responsibility
No need to credit me

Arts
Something that I draw and post it here. This is my artwork and I value it. You can use it but not for commercial
Need to credit me

Picture
Right now (so far) is my own sources of picture (I make my own screen shot or from camera). You can use this picture for anything and no need to credit me. If it is not my picture then ask the owner

Opinion / Tutorial (like comparing Ubuntu and Window)
It is just an opinion and tutorial. You can use it as long as credit to me

p/s: Credit to me means if you copy the post into somewhere and telling 'this is from this link' not compulsory to ask my permission to use it or telling 'original author is asipo'

Friday, January 7, 2011

windows or linux(ubuntu)?




In this post is discussing about which OS (operating system) you should use
When I said linux it focused on ubuntu but this might also apply to other Linux OS too

I do belive (im Malaysia) majority is using Windows. So lets start using my believe...

You 100% cannot use ubuntu when
- You are a gamer. Cause most of game was on Windows

If you still insist using ubuntu while you are a gamer
- Yes you can try, install ubuntu inside windows (they called it wubi i think)

You 50% (might can) use ubuntu when
- Using it as home user; surfing, typing and chatting
- Another 50% goes to your 'resistance to change'

Here is my resistance to change from windows to ubuntu
1. Im used to Microsoft office, using open office is weird. This is first time, after 2 month of using it I can say "I like open office a bit more than ms office"

2. Surfing - There is no google chrome. Well can actually download it. Just "Installation in Windows is different in Linux"

3. Chatting - Ubuntu dont have Yahoo Messanger (not sure about MSN). But luckly they have empath or pidgin. You can still chat but less feature compared to YM. The best part using empath is "No advertisement + Faster!"

4. Used software - Let say you used to certain program like 'Yahoo messanger'. This software does not exist in Ubuntu, so either you find alternative or leave it

Repeat, 'you used to windows until you feel like dont want to use linux' is common and this is the most reason of 'dont want to change' aka 'resistance to change'. I myself happen to have this feel



What so good about Linux ? (focused on Ubuntu). Well, this is most likely my experience and opinion.

good thing #1
Better security. All you virus from windows will not work (No virus). Remember better doesn't means impenetrable. But it do better than windows in almost all of the case

How to apply this 'good thing #1' ?

1. If you have a 'home PC' and you kids or parent is using the PC. You PC have high % of getting virus or malware or what ever dangerous stuff. This is the solution and the reason I keep suggesting it to others

2. If you were student and keep getting virus from 'Lab' (this is typical way for Malaysians PC to get virus, usually pendrive is the transfer medium). This linux will solve the problem 100%

3. If you create 2 type of user. The lower user cannot access the other files. Err... this is linux security like folder owner and folder group permission stuff. I never care about this. but in case you have 'sensitive data' Linux can help it

4. You dont need to buy Kaspersky on install antivirus. yeay!


good thing #2
I admin installation in Linux is hard (you need to use command line in special software). but ubuntu make it easy, you have a feature like 'add remove program in windows' but it 10x advance

1. They have 'update manager' this is to install or update driver

2. They have 'add remove software'. It can remove and also ADD! ADD! ADD! ADD! ADD! free software. There is tons of free software outside

How to apply this 'good thing #2' ?

1. My parent like to play solitaire in Windows when free time. If you use ubuntu you can ADD! ADD! ADD! ADD! ADD! games for free and the game is better than windows. This only apply for small and simple game, as I said 'home typical user' (not gamer sejati!)

good thing #3
Faster, better, stronger, harder...
This most likely what I hate on Windows after using Ubuntu

Windows have a little but yet annoying problem when it come with thumbdrive/pendrive
- SLOW
- Cannot eject, something was in use

So if you use Ubuntu you can feel the smoothness in detecting pendrive, eject is easy and transfer file is also FAST!
The main point is 'Stable' I guess

So... thats it I know

Thanks
Myself

trying linux? try ubuntu!

I already test several linux based system and touch it on surface as 'normal user'
Normal means I use it for office, chatting and surfing

Not like awesome hacker or freaky nerd cause they are +10 level higher

So I have test
1. Ubuntu
2. Fedora
3. Redhat
4. SUSE Server Linux <-- not sure correctly spelled

Redhat and SUSE is because of my workplace, so I'm not suggesting you to use it for home. Not it leave either Ubuntu or Fedora

Straight to the point = use ubuntu

Reason?

Lets start with bias
1. I have use ubuntu longer than fedora, so maybe the 'feel' make me suggesting ubuntu

Another reason, semi bias or more like personal experience / opinion
1. Ubuntu have better interface
2. Easily install and update 'FREE BUT NOT ACTUALLY FREE' driver / software
3. Better ERROR display (this is a level newbie 60% - intermediate 40%)

Other than that is nu thin much except I like fedora default wallpaper
By chance, if fedora ambassador is reading this, please do not get angry :D

Ubuntu swap space

If you want to use ubuntu, there is 2 type of typical installation

1. Install in windows (called wubi i think)
2. Install in empty partition (means you format you partition or resize)

For 'I want to try' users. Just take no1 it seriously awesome and easy

For 'I can use ubuntu!' users. Option 2 is additional

Note that if you format window, they will reset the boot loader (not sure the real term) so you ubuntu will not displayed. (I still not reach a level on how to get solve this problem, but do believe it is 99% can be recover)

Installing 1st option require no skill, but 2nd option does require some knowledge

For anyone who didnt know about linux (like me) this might be helpful. Others this is newbie

Lets proceed with 'how to install using the 2nd option'

1. During installation you need to specify 'where you want to install the ubuntu'

They will show 3 option
1. Install side by side (I already forgot about this, but do use it once)
2. Install in whole (format 100% you hdd, all partition)
3. Install in specific

This post is about option 3

When you select option 3, you can choose which partition you want to format and install ubuntu on it

Remind that you need to make 2 partition. 1st is the real partition and the 2nd will be the 'temporary what? i forgot'

1st partition will be a dropdown writing 'ext4'
make 2nd partiton 2G space only! (this is the reason I write this post, cause my newbieness create 10G space yo). They type was 'swap space'

note that there is a debate on how many swap space you should allocate. This 2GB is my opinion after 30min of google

After setting up this 2 partitions just proceed like normal (cause installing ubuntu was easy)

Wednesday, January 5, 2011

CakePHP connect 2, many, multiple database

Tag
CakePHP connect with more than 1 database
CakePHP connect multiple database
CakePHP connect more database
CakePHP connect 2 database
CakePHP connect with 2 database. 1 is CakePHP structured and another 1 is not

The main source is from here
http://blog.4webby.com/posts/view/6/cakephp_models_using_multiple_db_connections

Repeat the same thing
class DATABASE_CONFIG {

var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'your_host',
'login' => 'your_login_1',
'password' => 'your_password_1',
'database' => 'DB_1',
'prefix' => ''
);

var $general_syst = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'your_host',
'login' => 'your_login_2',
'password' => 'your_password_2',
'database' => 'DB_2',
'prefix' => ''
);
}
?>

class User extends AppModel {

var $name = 'User';
var $useDbConfig = 'general_syst';

//your code here
//....
}

class Post extends AppModel {

var $name = 'Post';
var $useDbConfig = 'default';

//your code here
//....
}

$this->Post->bla_bla_bla : data will be retrieved/inserted/updated from DB_1
$this->User->bla_bla_bla : data will be retrieved/inserted/updated from DB_2


Here is some additional
1. I can connect even without make it persistance.

pr($this->Student->useDbConfig);
$this->Student->useDbConfig = 'general_syst';
$ret = $this->Student->query("SELECT * FROM tbl_lecturer");


Note that tbl_lecturer is another non cakePHP database. It used MySQL database and query does take the data nicely

If you want to check the database connection. Refer here http://asipi.blogspot.com/2011/09/cakephp-check-database-configuration.html