28. 10. 2012

Google drive na Linuxu

28.10.2012 - aktualizace

InSync instalace: https://forums.insynchq.com/discussion/1499/insync-for-linux-beta-9-0-9-24

O.K. nasel jsem mraky postu, kde se tvrdi, ze linux verze Google Drive je na spadnuti a ve skutecnosti je konektor v ubuntu jiz od verze 11.11.

Vse co potrebujete je aplikace grive

nainstalujte si ji: sudo apt-get install grive

pokud neni nalezena tak proste pridejte PPA:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive

Pri prvnim startu si vlezte do adresare, kde chcete soubory synchronizovat, protoze presne tam kde budete se stahnou.

cd /home/jan/googleDrive
grive -a

-----------------------
Please go to this URL and get an authentication code:

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fdocs.google.com%2Ffeeds%2F+https%3A%2F%2Fdocs.googleusercontent.com%2F+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds%2F&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=2234324534510474.apps.googleusercontent.com

-----------------------
Please input the authentication code here:
4/s4NWnV-mW57wmBad34rMXiGs3YdfsdfarwdOl05ti8ZT3YVKkAocQI


to je vse, ted to pobezi:

4/s4NWnV-mW57wmBaDg5ej1MXiGs3earwdOl05ti8ZT3YVKkAocQI
Reading local directories
Synchronizing folders
Reading remote server file list
Synchronizing files
sync "./plugtmp" created in remote. creating local
sync "./orbit-jankozak" created in remote. creating local
sync "./jna" created in remote. creating local


grive on github : https://github.com/Grive/grive/


Aktualizace (28.10.2012)

Pro ubuntu jiz existuje balicek s appletem. Je dostupny pro:

insync-beta-cinnamon - Insync for Desktop Linux - (beta9) - cinnamon
insync-beta-gnome - Insync for Desktop Linux - (beta9) - gnome
insync-beta-gnome-cinnamon-common - Insync for Desktop Linux - (beta9) - gnome-cinnamon-common
insync-beta-kde - Insync for Desktop Linux - (beta9) - kde
insync-beta-ubuntu - Insync for Desktop Linux - (beta9) - ubuntu

Takze doporucuji, do budoucna by se z toho udajne mela stat komercni aplikace, ale do te doby to snad pujde i jinak.

12. 10. 2012

GIT merge - visual tools

http://gitguru.com/2009/02/22/integrating-git-with-a-visual-merge-tool/

2. 10. 2012

Netbeans IDE a pozice kurzoru na menu

Pouzivam Netbeans na Linuxu uz roky, a co jsem si nainstaloval MINT misto obvykleho Ubuntu (miluju Gnome 3 menu) jako pomstu za Unity. Ted tam mam Cinnamon, tedy Gnome 3, ale s normalnim panelem, konfigurovatelny, 3D app switch a tak.

No k veci. 

Problem:

 Pri kliknuti na menu v NB se menu sice zobrazi, ale poloha kurzoru je posunuta oproti fakticke poloze indikovane kliknutim na polozku menu. Zjednodusene: pokud drzim, po kliknuti na polozku menu, leve tlacitko misy stiskle a posunu ji dolu, je indikovana, jako vybrana polozka, polozka mimo faktickou pozici kurzoru, v mem pripade o 2cm vyse.
Problem se vyskytuje vyhradne v menu, coz je sice videt, ale dokud nad tim nezacnete premyslet jako nad problemem s menu... JAVU jsem vyloucil na zaklade toho, ze ostatni aplikace fungovali tak jak meli. Ale trosku pozde...

 

 Reseni:

Musime zmenit startup options pro netbeans v configuracnim souboru. Pokud mate Netbeans nainstalovane pod rootem tak muzete zmenit bud:

/usr/local/netbeans-X.Y/etc/netbeans.conf

,nebo vytvorte

~/.netbeans/X.Y/etc/netbeans.conf a zkopirujte do nej obsah vyse uvedeno souboru

Najdete radek zacinajici: netbeans_default_options

Muj vypada takto,  dulezite je: -J-Dapple.laf.useScreenMenuBar=false
Puvodne to bylo povolene, ale presne toto zpusobilo ten problem.

Funkcni verze s tematem Metal, odstrante --laf Metal pokud si to neprejete.

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=false -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=false -J-Dsun.zip.disableMemoryMapping=true --laf Metal"

Tak a je to...

29. 8. 2012

GIT rebase a push/pull branch


GIT rebase a push/pull branch


http://www.lorrin.org/blog/2011/10/03/argumentless-git-pull-and-git-push/


GIT - Rebase pro kazdy novy upstream

Nastavte si rebase pro kazdy novy upstream, dela to historii srozumitelnejsi!

git config --global branch.autosetuprebase always

Dalsi vysvetleni rebase:
http://gitready.com/advanced/2009/02/11/pull-with-rebase.html


PHP 5.3.16 na Ubuntu, redis

Dnes jsem nainstaloval redis, zkousel jsem jak balicek z distra: 2.2, tak vlastni kompilaci 2.4, bohuzel to porad nejelo, php proste vytuhlo, resp. cekalo. Pripojeni probehlo OK, bohuzel query bezely nelidsky pomalu.

Po delsim hledani jsem zjistil, ze PHP 5.3.10 z distra nefunguje ani s jendou verzi jak by melo.
Pro instalaci PHP 5.3.16, ktera s Redis funguje nadherne:

  1. Do /etc/apt/sources.list pridejte:
    deb http://packages.dotdeb.org stable all
    deb-src packages.dotdeb.org stable all
  1. Import GPG klice aby nebyl APT ukecanej:
    wget -q -O- dotdeb.org/dotdeb.gpg | apt-key add -
  2. Update APT:
    sudo apt-get update
  3. (volitelne) upgrade co lze:
    sudo apt-get upgrade
  4. Install nove PHP:
    sudo apt-get install php5 
Test:
 $ php -v

18. 8. 2012

Logitech Unified Receiver, MX Performance mouse, (x)buntu 12.04

Tak jsem si poridil krasnou mys, kterou bohuzel nemohu pouzivat na linuxu, wokna ok, ale nekupuju si takovouhle mys kvuli herni konzoli, ze?! Obecne je to problem s tim Unified Receiver-em v tehle verzi. Ja jsem to pouzil na MX Performace Mouse.

Takze jsem zjistil, ze nejsem sam, kdo ma tento problem, zatim existuji dva workaroundy co jsem nasel.

1) pridejte do /etc/rc.local
modprobe -r hid_logitech_dj
modprobe hid_logitech_dj

2) otevrete /etc/modprobe.
d/blacklist.conf
odkomentujte "blacklist usbmouse" (zmen na "#blacklist usbmouse") nebo odstrante radku celou a restartujte system

Instatni reseni:  
sudo modprobe -r hid_logitech_dj && sudo modprobe hid_logitech_dj

15. 8. 2012

Netbeans 7 pekne na Linuxu (Ubuntu)

Pokud mate hnusne Netbeansy tak to obycejne byvaji fonty ve Vasem JRE, bud si nainstalujte jine JRE, jako Oracle Sun:
 
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin

nebo si jen aktivujte jiny styl pro netbeans. V adresari netbeans, /usr/local/netbeansX
najdete etc/netbeans.conf

do promenne netbeans_default_options pridejte nakonec pred posledni uvozovky:

 --laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd

Muj radek pak vypada takto:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true --laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd"


Dalsi odkaz na, ktery jsem dodatecne nalezl:
http://wiki.netbeans.org/NBLookAndFeels

6. 8. 2012

GIT web frontendy

GIT web frontend


Casto potrebujete nejaky pristup ke svemu GIT repu, idealne i k projektu, obcas je vyhodne pouzivat nejaky unifikovany, uz jenom kvuli odkazum na ruzne patche a diffy.

Par reseni jsem vyhledal, nesnazim se je hodnotit!

Zakladni:


  • gitweb, nativni (vyvijeny gitem) v PERL
  • cgit C
  • git-php PHP
  • ViewGit PHP

Komplikovanejsi (vice sluzeb):



  • gitorious RUBY
  • InDefero PHP, klon GoogleCode with git, Mercurial, SVN
  • GitLab

Nejvice je obecne doporucovany GitLab, tak prilozim screenshot a odkaz.

Howto Install: https://github.com/gitlabhq/gitlabhq/blob/stable/doc/installation.md

Screenshoty; http://blog.gitlabhq.com/screenshots/

29. 7. 2012

GREP search and replace

Nasel jsem krasnej post:

Use this command:
egrep -lRZ "\.jpg|\.png|\.gif" . \
    | xargs -0 -l sed -i -e 's/\.jpg\|\.gif\|\.png/.bmp/g'
  • egrep: find matching lines using extended regular expressions
  • -l: only list matching filenames
  • -R: search recursively through all given directories
  • -Z: use \0 as record separator
  • "\.jpg|\.png|\.gif": match one of the strings ".jpg", ".gif" or ".png"
  • .: start the search in the current directory
  • xargs: execute a command with the stdin as argument
  • -0: use \0 as record separator. This is important to match the -Z of egrep and to avoid being fooled by spaces and newlines in input filenames.
  • -l: use one line per command as parameter
  • sed: the stream editor
  • -i: replace the input file with the output without making a backup
  • -e: use the following argument as expression
  • 's/\.jpg\|\.gif\|\.png/.bmp/g': replace all occurrences of the strings ".jpg", ".gif" or ".png" with ".bmp"





Dropbox musite mit

juknete na dropbox!

Dropbox je cloud reseni, ktere funguje jak z webu tak z Windows, Linux, Mac, Android
nabizi zdarma dostatek storage a spoustu moznosti jak ziskat nejakou zdarma, sam jsem aktualne na 5GB zdarma. Pokud dropbox chcete tak kliknete na muj referal a dostanu za vas 250MB :-)

Dik

25. 7. 2012

How to create custom application launchers in Gnome 3

http://blog.randell.ph/2011/08/01/how-to-create-custom-application-launchers-in-gnome-3/

17. 7. 2012

Batch update URL aliases in Joomla 2.5

Jak nastavit spravne URL aliasy pro existujici zaznamy v databazi.

Zjistil jsem, ze Joomla neumi odstranit diakritiku z nazvu tak aby friendly URL bylo spravne a č nebylo smazano. Nenasel jsem zadny nastroj, ktery by to dokazal opravit nad existujicimi zaznamy, tak jsem si napsal malinkej PHP script.

Prepiste si ho tak aby jste mohli parametry zadavat treba v konzoli, tohle byla jednorazovka.


mb_internal_encoding('UTF-8');


$conn = mysql_connect('localhost','xxxxx','xxxxxxx');
mysql_select_db('xxxxxx');
mysql_query('set names utf8');


$result = mysql_query('select * from j25_content order by id desc');
while ( $record = mysql_fetch_assoc($result) ) {
    $found = mysql_query('select count(*) matched from j25_content where `alias`="'.addslashes(seoUrl($record['title'])).'" and id<>'.$record['id']);
    $foundM = mysql_fetch_assoc($found);
    $alias = seoUrl($record['title']);
    if ($foundM['matched']>1)
    {
        $duplicates++;
        $alias.="-".(intval($found['matched'])+1);
        echo ('[!!] ' . $record['alias']. 'would be duplicit, changed to: '.$alias."\n");
    }
    if ($record['alias']!=$alias) {
        echo ('[++] ' . $record['alias']. ' changed to '.$alias.' from title "'.$record['title'].'"'."\n");
        mysql_query('update j25_content set alias="'.$alias.'" where id='.$record['id']);
        $modified++;
    } else {
        $correct++;
    }
       
}
$result = mysql_query('select * from j25_menu order by id');
while ( $record = mysql_fetch_assoc($result) ) {
    $found = mysql_query('select count(*) matched from j25_menu where `link`="'.addslashes(seoUrl($record['title'])).'" and id<>'.$record['id']);
    $foundM = mysql_fetch_assoc($found);
    $alias = seoUrl($record['title']);
    if ($foundM['matched']>1)
    {
        $duplicates++;
        $alias.="-".(intval($foundM['matched'])+1);
        echo ('[!!] ' . $record['alias']. 'would be duplicit, changed to: '.$alias."\n");
    }
    if ($record['link']!=$alias) {
        echo ('[++] ' . $record['link']. ' changed to '.$alias.' from title "'.$record['title'].'"'."\n");
        mysql_query('update j25_menu set alias="'.$alias.'",  path="'.$alias.'" where id='.$record['id']);
        $modified++;
    } else {
        $correct++;
    }
       
}

echo mysql_num_rows($result)." analyzed, $correct was ok, $modified has been modified, $duplicates was duplicate...\n";


/**
  * Return URL-Friendly string slug
  * @param string $string
  * @return string
  */

function seoUrl($string) {
        //Unwanted:  {UPPERCASE} ; / ? : @ & = + $ , . ! ~ * ' ( )
        $string = mb_strtolower($string);
    $string = iconv('UTF-8','ASCII//TRANSLIT',$string);
        //Strip any unwanted characters
        $string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
        //Clean multiple dashes or whitespaces
        $string = preg_replace("/[\s-]+/", " ", $string);
        //Convert whitespaces and underscore to dash
        $string = preg_replace("/[\s_]/", "-", $string);
        return $string;
}

16. 7. 2012

Update/Install Java Oracle JDK on Ubuntu 10-12.04

Pokud potrebujete pro nektere program JDK od javy misto OpenJDK, ktere ma dost problemu s vykonem a zobrazenim tak existuje PPA repositar, kde to lze jednoduse updatnout do aktualni verze.

Jak na to:

K pridani PPAv Ubuntu (12.04, 11.10, 11.04 and 10.04):
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer

Pokud vse probehlo bez chyby tak kontrola:
java -version

Meli by jste videt neco podobneho:
java version "1.7.0_04" Java(TM) SE Runtime Environment (build 1.7.0_04-b20) Java HotSpot(TM) Server VM (build 23.0-b21, mixed mode)

The package installs all the Java binaries, so you can also try "javac -version" which should return "javac 1.7.0_04" and so on (the "_04" part of the version can be different because I'm constantly updating the PPA with the latest Oracle Java 7 version).

If for some reason, the Java version in use is not 1.7.0, you can try to run the following command:
sudo update-java-alternatives -s java-7-oracle