czwartek, 20 lutego 2014

how fast check your log file about browser versions with visiting your site

how fast check your log file about browser versions with visiting your site
awk -F\" '{print $6}' file.log \ | sed 's/(\([^;]\+; [^;]\+\)[^)]*)/(\1)/' \ | sort | uniq -c | sort -fr

środa, 19 lutego 2014

Linux, Bash, How generate password string into lowercase string and numbers

tr -cd [:lower:]1234567890  < /dev/urandom |  fold -w 6 | head -126

czwartek, 21 listopada 2013

How to reverse a string in BASH

How to reverse a string in #BASH console ?

#host$ echo -n "sebastian" |rev

How to load image from remote server on the UIImageView in iphone and save to application ?

Save An Image To Application Documents Folder From UIView On IOS.

//imageUrl =
-(NSString *)saveLocalImageFromUrl:(NSString *)imageUrl
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *filename = [imageUrl lastPathComponent]; //get base file name
    NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:filename];
    NSString *foofile = [documentsDirectory stringByAppendingPathComponent:localFilePath];
    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:foofile];
    if(fileExists) {
        NSData *thedata = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];
        [thedata writeToFile:localFilePath atomically:YES];
    return localFilePath;

wtorek, 5 listopada 2013

Doctrine 2 Zend Framework 2 with UTF-8

It's good solution for problem with Doctrine 2 and coding UTF-8.
This configuration set UTF-8 for DB.
This config: YourProjectPath/config/autoload/doctrine.local.php

return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'host',
'port' => '3306',
'user' => 'username',
'password' => 'password',
'dbname' => 'dbname',
'charset' => 'utf8',
'driverOptions' => array(
1002=>'SET NAMES utf8'

środa, 20 lutego 2013

Ubuntu mount samba folder

If you have a problem with samba on Ubuntu, try something like this:
You need:
- smb packet or if You don't have, install like that: sudo apt-get install smbclient

Check your samba server, [-L|--list=HOST], [-U|--user=USERNAME]

smbclient -L 192.168.1.xx -U username Enter username's password:

Domain=[WORK_GROUP_NAME] OS=[Unix] Server=[Samba ver.]

Sharename Type Comment 
--------- ---- ------- 
username Disk username devel
then: check man mount, man mount.cifs and options and:  

mount -t cifs //192.168.1.xx/username/samba_folder /home/username/local_folder/ -o username=WORK_GROUP_NAME/username,password=passwd

środa, 13 lutego 2013

HowTo: Check RAM Size In Ubuntu Linux

I was looking for the way how check size used memory in Ubuntu, I found like this

ps -e -orss=,args= | sort -b -k1,1n

I know about command top, but it's very satisfactory.