Saturday, July 7, 2018

simple youtube download pc window

What this about?
The simplest youtube downloader

Why?

  • Most online youtube downloader website being taken down
  • While free youtube downloader bloated with ads and things you don't need

Solution
Command line youtube downloader, Im going to teach how

STEP 1
Go to http://rg3.github.io/youtube-dl/download.html and download "Windows exe"



STEP 2
Open command line (also called CMD)


STEP 3

  1. Name of the file you download is "youtube-dl.exe"
  2. Go the where you download it
  3. Copy the file_path, in my case is C:\Downloads
  4. Then go to the CMD, paste cd C:\Downloads and press enter

STEP 4
At CMD type youtube-dl https://www.youtube.com/watch?v=FLQnavmeC9k
Press enter and you will see the progress. Done!


Advance
Youtube download to audio mp3

Sunday, July 1, 2018

cakephp3 laragon phpunit No code coverage driver is available

If you using CakePHP3 inside Laragon

Then when you study CakePHP3 testing you can generate the "testing results" into HTML

Problem is

phpunit --coverage-html webroot/coverage tests/TestCase/Model/Table/ArticlesTableTest

Return you this error "No code coverage driver is available"

Reason: Because no XDEBUG

Solution: Install it


How to install it, just follow this tutorial: https://forum.laragon.org/topic/264/tutorial-how-to-add-xdebug-to-laragon


I just repeat as the link

Check XDEBUG install or not, go to http://localhost/?q=info then search "xdebug"

If not install, press "ctrl + a" to select the whole page

Then go here https://xdebug.org/wizard.php and paste the whole page, then press button "Analyse my phpinfo() output"

The xdebug wizard will tell you what to do, in my case, to install XDEBUG into Laragon is

  1. Download php_xdebug-2.6.0-7.1-vc14-x86_64.dll
  2. Move the downloaded file to C:\laragon\bin\php\php-7.1.12-Win32-VC14-x64\ext
  3. Edit C:\laragon\bin\php\php-7.1.12-Win32-VC14-x64\php.ini and add the line
  4. zend_extension = C:\laragon\bin\php\php-7.1.12-Win32-VC14-x64\ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll
  5. Restart the webserver

After restart web server, run again the command

phpunit --coverage-html webroot/coverage tests/TestCase/Model/Table/ArticlesTableTest

and you will get, at the end of the console

Generating code coverage report in HTML format ... done

Then to access the HTML results, go

http://localhost/mycakeapp/coverage/index.html

-end-

laragon CMDER command line shell is not recognized as an internal or external command, operable program or batch file

Problem

When I use Laragon CMDER command line

I receive error when type "bin/cake"

'bin' is not recognized as an internal or external command,
operable program or batch file.

Or

vendor/bin/phpunit

Return

'vendor' is not recognized as an internal or external command,
operable program or batch file.


In my case, changing "/" into "\" works

So use

bin\cake instead of bin/cake

or

vendor\bin\phpunit instead of vendor/bin/phpunit

will works

Friday, March 1, 2013

CURL not working in WAMP Window 8 64 bit

Keyword
CURL WAMP Window 8 64 bit

Quick google give me this and it works
http://stackoverflow.com/questions/10939248/php-curl-not-working-wamp-on-windows-7-64-bit

Repeat same thing

1. Visit http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/

2. Download CURL at "Fixed curl extensions". I download "php_curl-5.3.13-VC9-x64.zip" as suggested

3. Replace C:\wamp1\bin\php\php5.3.13\extcurl.dll

4. Restart WAMP

5. It Working!!

Note
Please also enable curl extension as php.ini

Sunday, November 25, 2012

Net beans high CPU process

net bean high cpu process

  • So I was developing some PHP using netbeans 6.9.1 on my i3 ubuntu 10.10 laptop
  • Then I realize the CPU process is too high causing my laptop to easily get hot
  • I have been using netbeans 6.9 for a long time and no problem before
  • This problem just occured and I not really sure the reason (either netbean update or ubuntu update?)
  • Do some google and asking few friend, they said yes there is a report for this problem
  • Anyway, the problem is solve once I install netbeans 7.2.1

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