Show query result in more rows

mysql Every time we execute a mysql query in a table with mor fields or a query with few join, we have the problem to show the result because it appears in one single line and it is difficult to read the data quickly.

Searching in google I have found the solution to show the query result as each field per row. The syntax is very simple, you must add \G at the end of the query like this:

select * from students where country=’Italy’\G;

and the result will be something like to:

*************************** 1. row ***************************
id: 1
name: giak
surname: camp
city: Ancona
state: AN
country: Italy
modifiedtime: 2015-19-11 11:52:32
modifiedby: 1
*************************** 2. row ***************************
id: 2
name: micky
surname: mouse
city: Pesaro
state: PU
country: Italy
modifiedtime: 2015-12-11 08:11:45
modifiedby: 1
*************************** 3. row ***************************



Posted in Uncategorized | Leave a comment

Include js file into another js file

In the last days I had a big problem: how I can include a javascript file into another javascript file without use the tag script?
Searching on Google I have found the answer to my problem with this simple javascript function:

function addJavascript(jsname,pos) {
     var th = document.getElementsByTagName(pos)[0];
     var s = document.createElement(‘script’);

the variable jsname is the name of the javascript file
the variable pos is the tag where you want to add the file

An example of usage:

It works for me, I hope for you too!

[ the original news ]

Posted in javascript | Leave a comment

Php tools

imagesLast days I searched on the web a place where I find simple help to common problems with php tools. The search game me this site:

Here you can find more information and example about php and Apache. It was very useful for me.


Posted in Php | Tagged , , , , , , | Leave a comment

Enable usb devices on VirtualBox

linux_poweredLast days I had  big problem: active the usb on VirtulBox un Ubuntu 10.04. The first idea was to recompile the kernel, but my friend ( a very strong linux system administrator, here his linkedin profile) suggest me to use this command before start VirtualBox:

mount –bind /dev/bus /proc/bus

I tried the command on latest version of VirtualBox: 4.2.6

Posted in linux | Tagged , , , , , | 1 Comment

Align list item to the left in unordered list

cssDuring last days I need to find a solution to align the unsorted list <ul> to align to left. In all browsers the problem is you see space in the left side of the list, so I need a solution for this problem for a jQuery accordion menu.

My solution is to add this property padding-left: 0pt to the ul block.

You must use the rule in this way:

ul {

float: left;

width: 215px;

margin: 15px 0;

padding: 0pt;

background: #ececec;


This property is supported by all browsers. I hope this tip could help other developers.

Posted in css | Tagged , , , , , , , , | 1 Comment

Open embedded links in comments in new window

wordpress148x140Last week I need to find out a solution for a my friend. He want to open all links embedded in comments in a new windows.

I searched on google for more time unti I found the solution, to use an hook.

Because I think other people will need a solution for this problem or maybe for a similar problem, I will describe it the solution, step by step. Are you ready? Go…

Step 1 Find the file named functions.php in your theme folder (every theme has this file) and open it for edit

Step 2 At the end of the file you can create the function to open the links in new windows, like this:

function comment_text_target_blank( $comment ) {
    $pos =  strrpos($comment,”_blank”);
    if ($pos===FALSE) {
        $theComment = str_replace(“<a”,”<a target=’_blank’ “, $comment);
    } else {
        $theComment = $comment;

    return $theComment;

Step 3 create the hook to apply new function

add_filter(‘comment_text’, ‘comment_text_target_blank’, 1000);

This solution works for me from version 3.4.2 and newer of wordpress. I hope I helped you.

Posted in wordpress | Tagged , , , , , | Leave a comment

How to change the default wordpress avatar

wordpress148x140During the current week I need to change the default avatar in the wordpress site.

Searching in google I have found this article very interesting:

where the author expains very well the simple steps to do to set your own default avatar.

To change the avatar is very simple: you need to search the follow part of code in all files of the wordpress:

get_avatar($comment, 50 );

in this case the second parameter is the dimension of the avatar assuming the avatar has the width euqals to the height.

You can add a third parameter that rapresents your own images like

get_avatar($comment, 50, '');

Enjoy with wordpress!

Posted in wordpress | Tagged , , , | Leave a comment