четверг, 16 апреля 2015 г.

Залить все таблицы из tar.gz в mysql

Если каждая таблица задамплена отдельно можно отдной командой залить все

find . '*.sql.gz' | while read line; do gunzip < $line | mysql -u root -p 7min ; done

понедельник, 30 марта 2015 г.

mytop через brew в os x install_driver(mysql) failed: Can't load '/usr/local/Cellar/mytop/1.6/libexec/lib/perl5/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/usr/local/Cellar/mytop/1.6/libexec/lib/perl5/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib

Если получаем ошибку при старте или копиляции нужно сделать симлмнк


Ошибка:
mytop
install_driver(mysql) failed: Can't load '/usr/local/Cellar/mytop/1.6/libexec/lib/perl5/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/usr/local/Cellar/mytop/1.6/libexec/lib/perl5/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
Referenced from: /usr/local/Cellar/mytop/1.6/libexec/lib/perl5/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Reason: image not found at /System/Library/Perl/5.18/darwin-thread-multi-2level/DynaLoader.pm line 194.
at (eval 13) line 3. Compilation failed in require at (eval 13) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /usr/local/Cellar/mytop/1.6/libexec/bin/mytop line 235.
Создаем симлинк:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

вторник, 3 февраля 2015 г.

Mysql подсказки

Развернуть из gz сразу в  MySQL:

time gunzip < db.sql.gz |mysql -uroot -pPASS dbName

четверг, 10 октября 2013 г.

Редактирвание SQL в vim и подсветка

Для того что бы vim подсвтил синтаксис sql в командном режиме выполняем
:set ft=sql

понедельник, 23 сентября 2013 г.

vagrant mac os x делаем доступную виртуалку на 80 порту

Web Development on Port 80 and 443 in Vagrant

In this post I'm going to talk about using port 80 and 443 for web development on a Mac running 1 or more virtual machines under Vagrant.

Why use port 80 and port 443?

Port 80 is the standard port for HTTP and 443 is the standard port for HTTPS. While other ports can be used, they're non-standard, and some (if not most) webapps make assumptions about those port numbers. You can really get burned on matters of HTTP redirection, such as when a form is submitted or when redirection from HTTP to HTTPS happens. While applications can certainly be built to take the port numbers into account, many are not.
Unfortunately, it's not a simple matter of telling configuring your Vagrant instance to listen on ports 80 and 443. Any port under 1024 requires the program to be running as root. And running an app as the root user is generall y never a good idea.

Can I forward ports from the Vagrant instance?

Why yes, you can! It's as simple as putting these lines in your Vagrantfile:
config.vm.forward_port 80, 8080
config.vm.forward_port 443, 8443

Wait, those are ports 8080 and 8443!

Yes, they are. Remember what I said about needing to be the root user? But, under Mac OS/X we can forward ports 80 and 443 to ports 8080 and 8433. The trick is to use the ipfw utility which comes with OS/X and is used to manage its built in firewall.
Here's a "quick and dirty" way to do it from the command line:
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443
From that point on, attempting to connect to http://localhost/ and https://localhost/ will be forwarded by ipfw to ports 8080 and 8433, which will be received by Vagrant which will in turn forward any traffic sent there to ports 80 and 443 on its virtual machine.
Until you reboot, at least.

Is there a way to make this forwarding permanent?

Yes, there is. It involves setting up a service through OS/X that is started at bootup.
The first step is to set up a plist in the file /Library/LaunchDaemons/org.dmuth.ipfw.plist:
xml version="1.0" encoding="UTF-8"?>
 
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>org.dmuth.ipfw</string>
    <key>Program</key>
    <string>/sbin/ipfw</string>
    <key>ProgramArguments</key>
    <array>
      <string>/sbin/ipfw</string>
      <string>-q</string>
      <string>/etc/ipfw.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true>
  </true></dict>
</plist>
This will tell the machine that there is a new service which, when started, tells ipfw to load firewall rules out of the file /etc/ipfw.conf. That means we next need to populate /etc/ipfw.conf as follows:
#
# Flush all of our pre-existing rules.
#
flush
 
#
# Forward port 80 to our Vagrant instance.
#
add 100 fwd 127.0.0.1,8080 tcp from any to me 80
 
#
# Same deal for port 443
#
add 101 fwd 127.0.0.1,8443 tcp from any to me 443
Now we just need to enable the service. Run this on the command line
sudo launchctl load -w /Library/LaunchDaemons/org.dmuth.ipfw.plist

That was a lot of work!

It sure was. But it can be automated. This is the part where you should read my Chef 101 article because things like the above can be completely automated. In fact, I created a cookbook for the above. It can be installed with the following Chef command:
sudo chef-solo -c ./config.rb -o mac-os-x-ipfw

пятница, 8 февраля 2013 г.

Записать рабочий стол в ubuntu

gtk-recordesctop ставим и запускаем на запись, после конвертируем в avi командой
mencoder -idx out.ogv -ovc lavc -oac mp3lame -o output.avi

CButtonColumn url для стандартных кнопок

array(    'class'=>'CButtonColumn',    'viewButtonUrl'=>'Yii::app()->controller->createUrl("students/view",array("id"=>$data->id))',    'updateButtonUrl'=>'Yii::app()->controller->createUrl("students/update",array("id"=>$data->id))',    'deleteButtonUrl'=>'Yii::app()->controller->createUrl("students/delete",array("id"=>$data->id))',
),