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.

wtorek, 12 lutego 2013

Temperature in html5

It is my first commit to GitHub. I made simple tools for my friend.
It's very simple script in JQuery and HTML5.
It was a year ago, maybe useful for someone.
In the folder "data/" are test measurements in files.

I am using FileReader from HTML5 for reading file with data and google.visualization.LineChart.

poniedziałek, 4 lutego 2013

Mysql - Polish chars e.g: ź,ż,ć

How you can search Polish chars e.g: ź,ż,ć etc. in Wordpress using MySql query ?
If you uses Wordpress and create db query - not wp_query, check your tables in DB where you searching. In my case helped change from utf8_general_ci COLLATION to utf8_spanish_ci.

prevention: ALTER DATABASE `db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_polish_ci; and: ALTER TABLE wp_postmeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_polish_ci; 

Maybe you should look to
before installing wordpress.

I found an interesting solution but it is not optimal!:
CONVERT(table_name USING utf8) COLLATE utf8_polish_ci LIKE '$letter%'

czwartek, 24 stycznia 2013

Top 172 blogs about security.

It's blogs about security, a worth of reading, a list of 172 sites.
Do you know others? worth reading? send me and I'll add to the list.

XSS scanner

It is really simple scanner for XSS for pentesters your website.
Another who recommend: