Windows 7 sometimes breaks FTP connections on Java 7 if firewall is enabled

Windows 7 sometimes breaks FTP connections on Java 7 if firewall is enabled.

Command

netsh advfirewall set global StatefulFTP disable

 

usually fixes the problem.

VirtualBox: Fixing piix4_smbus 0000.00.07.0: SMBus base address uninitialized – upgrade bios or use force_addr=0xaddr

If you see the following error message when booting Arch Linux:
==
piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddr
==

To fix this, add "blacklist i2c_piix4" to file /etc/modprobe.d/modprobe.conf

/etc/modprobe.d/modprobe.conf
==
blacklist i2c_piix4
==

Javascript: Chrome is a lot more restrict

Today I ran into an issue where simple javascript would stop running for no apparent reason.

I finally traced the problem down to where I was handling the response on a jquery.form callback:

 

                            if (response.message instanceof Array) {
                                var html = "";
                                for (var line in response.message) {
                                    html += "<li>" + line + "</li>";
                                }
                            } else {
                                html = response.message;
                            }
                            $("#errorMessages ul").html(html);

 

Since I was missing "var" in the for loop for response.message, chrome would thrown an error, and no more code would run on the iframe…

Noting that it was working yesterday, that drove me nuts for a while.

 

Firefox: Some tips to improve your experience

Put the protocol back in the URL bar:

1. Enter the config by visition   about:config

2. Enter "browser.urlbar.trimURLs" and change the value to "false"

Disable the parameter to have "http"back

 

 

Kohana: Buffering output on view and rendering it before in the source code

Sometimes you need to hack the order the source code is going to be rendered in a view:

– You want an extra piece of CSS that only aplies to that view, so you think it's not worth creating a single CSS file and including in your mashed file

– You need the same as above for javascript

– Your mind has not completely grasped the way to organize code in MVC  🙂

 

 

Here's a way to do it:

 

in your view you add something like this:

<?php View::start_buffer('head_end'); ?>
<style>
    ::-moz-selection {
        background: #b3d4fc;
        text-shadow: none;
    }

</style>
<?php  View::end_buffer('head_end'); ?>

 

Then, by taking advantage of the wonderful cascading file system that Kohana gives you, you create a View.php class in your application folder that will need to extend the render() function (I'm just adding the relevant changes for this to work; you can have your own extra sauce):

 

class View extends Kohana_View
{
    static public $buffers = array();

    public static function start_buffer($buffer_name)
    {
        self::$buffers[$buffer_name] = '';
        ob_start();
    }

    public static function end_buffer($buffer_name)
    {
        self::$buffers[$buffer_name] = ob_get_clean();
    }

    public function render($file = NULL)
    {
        $rendered = parent::render($file);

        if (! empty(self::$buffers['head_end']))
        {
            $rendered = str_replace('</head>', self::$buffers['head_end'] . '</head>', $rendered);
        }
        return $rendered;
    }

}

 

The buffer names are completely arbitrary, you can make them any way to want.

I leave up to you to improve the way each buffer will be mapped to different locations in the source code.

Drop me a line with your changes

mysql: Dumping single database table and restoring

Sometimes you need to dump a single table from a mysql table and restore it somewhere else. Here's what you need:

 

1. Dump the table (compress it so it will take shorter to transfer over the network)

 

mysqldump -h <HOST> -u <USERNAME> -p <DATABASE> <TABLE> | gzip > <DUMP_FILENAME>.gz

 

HOST is the hostname or IP address of the mysql server

USERNAME is a user with access to the database and table

DATABASE and TABLE are self explanatory

DUMP_FILE is the name you want for the file containing the compressed dump

 

2. Transfer the file where you need it to be, with "cp" or "scp"

 

 

cp <DUMP_FILENAME>.hz  folder/new_name

scp <DUMP_FILENAME>.hz  user@machine:folder

 

 

Linux: Some maintenance

Your linux distribution may run some maintenance jobs or checks daily and you may get things like the following in your email:

 

'<USERNAME>' is a member of the 'httpd' group in /etc/group but not in /etc/gshadow

The grpconv command creates gshadow from group and an optionally existing gshadow.

execute:

$ sudo grpconv

 

 

user 'jira': directory '/home/jira' does not exist

Simple create the folder and change its permissions:

$ sudo mkdir /home/jira
$ sudo chown jira:jira /home/jira -Rfv

 

 

 

Linux: Manjaro 0.8.5 torrent

Here is a torrent for all the files for Manjaro 0.8.5 release

Please seed!

If you prefer, go to SourceForge

http://sourceforge.net/projects/manjarolinux/files/?source=dlp

 

Linode: Install mysql from package

 

# pacman -S mysql
resolving dependencies…
looking for inter-conflicts…

Targets (3): libmysqlclient-5.5.30-7  mysql-clients-5.5.30-7  mysql-5.5.30-7

Total Download Size:    12.81 MiB
Total Installed Size:   123.89 MiB

Proceed with installation? [Y/n] y
:: Retrieving packages from extra…
 libmysqlclient-5.5.30-7-x86_64        3.4 MiB   129K/s 00:27 [##################################] 100%
 mysql-clients-5.5.30-7-x86_64       834.8 KiB   115K/s 00:07 [##################################] 100%
 mysql-5.5.30-7-x86_64                 8.6 MiB   143K/s 01:02 [##################################] 100%
(3/3) checking package integrity                              [##################################] 100%
(3/3) loading package files                                   [##################################] 100%
(3/3) checking for file conflicts                             [##################################] 100%
(3/3) checking available disk space                           [##################################] 100%
(1/3) installing libmysqlclient                               [##################################] 100%
(2/3) installing mysql-clients                                [##################################] 100%
(3/3) installing mysql                                        [##################################] 100%
Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h li558-80 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/scripts/mysqlbug script!

[root@li558-80 ~]# systemctl start mysqld
[root@li558-80 ~]# systemctl enable mysqld
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
[root@li558-80 ~]# mysql_secure_installation

 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 … Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 … Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 … Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 – Dropping test database…
 … Success!
 – Removing privileges on test database…
 … Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 … Success!

Cleaning up…

 

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

 

 

 

nano /etc/mysql/my.cnf
-----------------------------------------
[mysql]
default-character-set = utf8

[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
character-set-server = utf8
collation-server = utf8_unicode_ci

---------------------------------------

 

 

Linode: Update your ArchLinux VPS

connect 2 sessions on your Linode

 

On the second, run this:

dd if=/dev/urandom of=/dev/null

 

on the first one, do the following:

pacman-key --init

 

You can stop the dd process on the second connnection

pacman-key --populate archlinux

pacman-key --refresh-keys

 

Update pacman

pacman -Sy pacman

 

Update your installation

pacman -Syu

 

Enjoy a quick cofee

 

That should do it