January 3, 2011

[GRAPHICS] My GTUG logo deviations

Here are some of my GTUG logo deviations (inspired by @aygul's bootcamp logo):





ASCII/HTML GTUG logo



                      ..::::..                       :::::::::::.
                 ::::::::::::::::::              :::::::::::::::::::             .COOOOOOOOOOOOOc
              ::::::::::::::::::::::::         :::::::::::::::::::::::        .OOOOOOOOOOOOOOOOOOOOC
           ::::::::::::::::CCCc:::::::::     .::::::O@@@@@@@@@@@@c::::::    .OOOOOOOOOOOOOOOOOOOOOOOOO      .ccccccccccccc:.
          :::::::::::::8@@@@@@@@@@o:::::::  .:::::::@@@@@@@@@@@@@C:::::::  OOOc:COOOOO    OOOOOOOOOOOOOc:cccccccccccccccccccccc
         ::::::::::::c@@@@@@CC8@@@@@::::::: ::::::::::::o@@@@:::::::::::::OOO   OOOOOC    OOOOOOOOOOOCccccccccccccccccccccccccccc:
        :::::::::::::@@@@@C:::::8@@@@:::::::::::::::::::o@@@@::::::::::::OOOc   OOOOOc    OOOOOOOOOCcccccccOO@@@OCccccccccccccccccc:
       ::::::::::::::@@@@@c:::::C@@@@:::::::::::::::::c:C@@@@::::::c::::oOOOc   OOOOOc    OOOOOOOOccccco@@@@@@@@@@@@occcccccccccccccc.
       ::::::::::::::@@@@@c:::::::::::::::::::::::::::::C@@@@:::::::::::COOO:   OOOOOc    OOOOOOOccccc8@@@@8OOO@@@@@@occcccccccccccccc.
      .::::::::::::::@@@@@c::::::::::::::::::::::c:::c::o@@@@:::::::::::COOO:  .OOOOOc    OOOOOOcccccO@@@@cccccc@@@@@@ccccccccccccccccc.
      .::::::::::::::@@@@@c::@@@@@@@@c::::::::::::::::::c@@@@:::::::::::oOOOc   OOOOOc    OOOOOoccccc@@@@8ccccccO@@@@@cccccccccccccccccc
       ::::::::::::::@@@@@c::@@@@@@@@::::::::::::::::::::@@@@::::c:::::: OOOc   OOOOOc    OOOOOcccccc@@@@Occcccccccccccccccccccccccccccc:
       ::::::::::::::@@@@@c:::::C@@@@::::::::  :::c:::c::@@@8::::::::::  .OOO   OOOOOc    OOOOCcccccc@@@@Occccccccccccccccccccccccccccccc
        :::::::::::::@@@@@C:::::8@@@@:::::::    .::::::::::::::::::::     .OOO           :OOOOCcccccc@@@@OccO@@@@@@@@@ccccccccccccccccccc
         :::::::::::::@@@@@@@8@@@@@@@::::::        .::::::::::::c:          COOO:      .OOOOOOCcccccc@@@@OccO@@@@@@@@@ccccccccccccccccccc
          :::::::::::::o@@@@@@@@@c@@C:::::                                    COOOOOOOOOOOOOOOOcccccc@@@@OccccccO@@@@@cccccccccccccccccc.
            ::::::::::::::::::::::::::::                                        .OOOOOOOOOOOOOOCccccc@@@@@ccccccO@@@@@cccccccccccccccccc
              ::::::::::::::::::::::::                                               .ccccccc   cccccc@@@@Occccc@@@@@@ccccccccccccccccc
                 ::::::::::::::::::                                                              cccccc@@@@@@@@@@@@@@@cccccccccccccccc
                       ......                                                                     :cccccc8@@@@@@@OC@@@ccccccccccccccc
                                                                                                    ccccccccccccccccccccccccccccccc
                                                                                                      :cccccccccccccccccccccccccc
                                                                                                         :cccccccccccccccccccc.
                                                                                                              .ccccccccc:.                            

                                                                                                                                                      


Original GTUG logo was created by @romannurik

Source: http://wiki.gtugs.org/logos

[SOLVED]Building CSS sprites with Bash & Imagemagick

If you want to automatically generate image sprites - css file just use this script
$ spriteit.sh button button '*.png'

Output:
Generating sprite file...
executing: convert button_disabled.png button_hover.png button.png button_selected.png -append button/button-sprite.png
Sprite complete! - Creating css & test output...
#1 done
#2 done
#3 done
#4 done

Complete! - 4 sprites created, css written & test page output.

Script source:
#!/bin/bash

# uses imagemagick to stich together all images in a folder and
# then writes a css file with the correct offsets along with a
# test html page for verification that its all good

if [ $# -gt 0 ]
then

if [ 'x' != 'x'$4 ]
then
ext2=.$4; # the extension to iterate over for input files
else
ext2=".png"; # the extension to iterate over for input files
fi

if [ 'x' != 'x'$3 ]
then
#ext="."$3; # the extension to iterate over for input files
ext=$3; # the extension to iterate over for input files
else
ext=".gif"; # the extension to iterate over for input files
fi

name=$1; # output will be placed in a folder named this

if [ $2 ]
then
classname=$2"-sprite";
else
classname=$1"-sprite";
fi
css="$name/$classname.css";
html="$name/test.html";

rm -fr $name;
mkdir $name;
touch $css $html;

echo "Generating sprite file...";
#echo convert *$ext -append $name/$classname$ext;
echo executing: convert $ext -append $name/$classname$ext2;
convert $ext -append $name/$classname$ext2;

echo "Sprite complete! - Creating css & test output...";

echo -e "<html>\n<head>\n\t<link rel=\"stylesheet\" href=\"`basename $css`\" />\n</head>\n<body>\n\t<h1>Sprite test page</h1>\n" >> $html

echo -e ".$classname {\n\tbackground:url('$classname$ext2') no-repeat top left; display:inline-block;\n}" >> $css;
counter=0;
offset=0;
for file in $ext
do
width=`identify -format "%[fx:w]" "$file"`;
height=`identify -format "%[fx:h]" "$file"`;
#idname=`basename "$file" $ext`;
idname=`basename "$file" $ext2`;

clean=${idname// /-}
echo ".$classname#$clean {" >> $css;
echo -e "\tbackground-position:0 -${offset}px;" >> $css;
echo -e "\twidth: ${width}px;" >> $css;
echo -e "\theight: ${height}px;\n}" >> $css;

echo -e "<a href=\"#\" class=\"$classname\" id=\"$clean\"></a>\n" >> $html;

let offset+=$height;
let counter+=1;
echo -e "\t#$counter done";
done

echo -e "<h2>Full sprite:</h2>\n<img src=\"$classname$ext2\" border=1/>" >> $html;
echo -e "</body>\n</html>" >> $html;

echo -e "\nComplete! - $counter sprites created, css written & test page output. @russenreaktor";

else

echo -e "There should be at least 1 argument!\n\tbuildSprite.sh output_folder classname input_pattern"
echo -e "\n\tbuildSprite.sh folder1 test '*.png' png"

fi

Source: jaymz.eu

[SOLVED] Save music played via browser as mp3 file

Problem: You hear nice music via your browser but you want download this music as mp3.

 

Solution: Use Freecorder - Powerful, Free Video Downloader, Audio Recorder & Converter - http://www.applian.com/freecorder4/

December 26, 2010

December 25, 2010

[SOLVED] Android: no adb on Suse linux or "???????????? no permissions"

You cant develop on your linux pc because you are getting something like this.
$ adb devices
List of devices attached
???????????? no permissions

temporary solution - to restart adb server as root
$ su
$ adb kill-server
$ adb start-server
$ adb devices

add your device to devices list.
1) check your vendor ID
$ lsusb
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 044: ID 18d1:2d66 <- this is my mobile
Bus 002 Device 004: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 002 Device 003: ID 10d5:0001 Uni Class Technology Co., Ltd

In my case , for Nexus One, it is 18d1

2) now add lines in to "/etc/udev/rules.d/51-android.rules"
$ su
$ vim /etc/udev/rules.d/51-android.rules

now paste these lines with your values
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", OWNER="%YOUR_USER%" GROUP="%YOUR_USER_GROUP%"

save your file.

now it should work...

Source: google.com

December 14, 2010

[SOLVED] Unix: search files between TIME1 and TIME2 with string 123456 in it

e.g.

TIME1 = 2010-11-02 00:00
TIME2 = 2010-11-24 00:00
SEARCHSTRING= 123456
File pattern "PATTERN1231313123.txt"

create files with right timestamps
 touch -t 11020000 /tmp/stamp_2010-11-02_0000
touch -t 11240000 /tmp/stamp_2010-11-24_0000

check your list of files if it is right
find . -regextype posix-awk  -regex '^\./PREFIX[0-9]*.txt' -newer /tmp/stamp_2010-11-02_0000 -and -not -newer /tmp/stamp_2010-11-24_0000 -ls

export your list
 find . -regextype posix-awk  -regex '^\./PREFIX[0-9]*.txt' -newer /tmp/stamp_2010-11-02_0000 -and -not -newer /tmp/stamp_2010-11-24_0000 -exec grep --color "123456" {} \; > /tmp/mydata_123456.csv

Source: serverfault.com, gnu.org

December 13, 2010

[SOLVED] Android: Multiple substitutions specified in non-positional format

Getting an error after updating to SDK 0.8
Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? strings.xml

It happens in string files on strings with %
	"%s/%s (Linux; Android)"

You should change it to
	"%1$s/%2$s (Linux; Android)"

Source: developer.android.com

December 9, 2010

[SOLVED] PHP: Why 2 !=2 aka "never compare floating point numbers for equality"

“never compare floating point numbers for equality”.

The reason (19.6*100) !== (double)1960, is because inside a computer they are not equal.

Try this:

<?php

printf("%.15f", (19.6*100));

?>

Outputs: 1960.000000000000227 (not 1960 as somewhat expected)

If comparison is required a few options come to mind (other than BCMath):

1) Round numbers before comparison:

<?php

$sig_figs = 5;
echo (round((19.6*100), $sig_figs) !== round((double)1960, $sig_figs)) ? 'not equal' : 'equal';

?>

Outputs: equal

Source: php.net

November 23, 2010

[SOLVED] helloWorldPlugin example from LiveView SDK 1.0 does't work

No example from LiveView™ SDK 1.0 work (helloWorldPlugin).

Getting something like (mPluginId=0):
D/LiveViewPlugin(15550): Plugin registered. mPluginId: 0 isSandbox? true
D/LiveViewPlugin(15550): Plugin installation notified.
D/LiveViewPlugin(15550): Registry success!

Just add in your manifest.xml
<uses-permission android:name="com.sonyericsson.extras.liveview.permission.LIVEVIEW_API"/>

Noow works everything perfect - you got your mPluginId and can play ;)
D/LiveViewPlugin(15843): Plugin installation notified.
D/LiveViewPlugin(15843): Registry success!D/LiveViewPlugin(15843): Plugin registered. mPluginId: 161427209 isSandbox? true
D/LiveViewKupriyanovPlugin(15481): startPluginD/LiveViewKupriyanovPlugin(15481): Enter HelloWorldService.startWork.

Source: http://russenreaktor.wordpress.com/2010/11/23/solved-helloworldplugin-example-from-liveview-sdk-1-0-doest-work/

November 21, 2010

[SOLVED] How can i call Wi-Fi settings screen from my App

To start wifi settings dialog:
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

to start Settings Dialog
startActivity(new Intent(Settings.ACTION_SETTINGS));

to start any settings dialog read the reference

Source: stackoverflow.com

Reference: http://developer.android.com/reference/android/provider/Settings.html

[SOLVED] How to create Alert Dialog?

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
       .setCancelable(false)
       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                MyActivity.this.finish();
           }
       })
       .setNegativeButton("No", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
           }
       });
AlertDialog alert = builder.create();
alert.show();

Source: developer.android.com

[SOLVED] How to check internet access on Android?

You can use
Context.getSystemService(Context.CONNECTIVITY_SERVICE).getNetworkInfo(ConnectivityManager.TYPE_MOBILE)

or
Context.getSystemService(Context.CONNECTIVITY_SERVICE).getNetworkInfo(ConnectivityManager.TYPE_WIFI)

and parse the DetailedState enum of the returned NetworkInfo object

 

and don't forget to allow it the Manifest

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

 

Source: stackoverflow.com

Documentation: http://developer.android.com/reference/android/net/ConnectivityManager.html

November 20, 2010

[SOLVED] Android: When the soft keyboard pops up, the EditText is invisible

Just add android:windowSoftInputMode="adjustPan" for your activity in manifest file
<activity android:name="SampleActivity" android:label="@string/app_name" android:windowSoftInputMode="adjustPan" >
...
</activity>

Source: stackoverflow.com

Documentation: http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
Tutorial: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

November 16, 2010

[SOLVED] Android - Arrange two buttons next to each other and to center them horizontally.

Arrange two buttons next to each other and to center them horizontally.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="horizontal"
    android:background="@android:drawable/bottom_bar" android:paddingLeft="4.0dip"
    android:paddingTop="5.0dip" android:paddingRight="4.0dip"
    android:paddingBottom="1.0dip" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_below="@+id/TextView01">
    <Button android:id="@+id/allow" android:layout_width="0.0dip"
        android:layout_height="fill_parent" android:text="Allow"
        android:layout_weight="1.0" />
    <Button android:id="@+id/deny" android:layout_width="0.0dip"
        android:layout_height="fill_parent" android:text="Deny"
        android:layout_weight="1.0" />
</LinearLayout>

 

Source: stackoverflow.com

November 15, 2010

November 14, 2010

GTUG Bootcamp 2010 in Munich

Here yo will get small overview of  "GTUG Bootcamp 2010 in Munich". You can also go directly to picasa gallery to comment pictures there ;) http://picasaweb.google.com/m.kupriyanov/GTUGBootcamp2010InMunich

Stuttgart GTUG [@StuGTUG] goes GTUG BootCamp in Munich #gtugbc



October 28, 2010

[SOLVED] Install LaTeX and beamer on openSUSE 11.2


zypper in texlive-latex


Add this repository and search for beamer

ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/Education/openSUSE_11.0/

October 24, 2010

[SOLVED] How do I install a Perl Module?


A) Start CPAN Shell:
# perl -MCPAN -e shell


B) Install a perl module:
At cpan> shell prompt install module using install module::Name command. For example install module called MIME::Lite:
# cpan> install MIME::Lite
Alternatively, try out the following command:
# cpan -i MIME::Lite




Source: How do I install a Perl Module?.

October 12, 2010

GAE: To python, or not to python

"To python, or not to python: that is the question: Whether 'tis nobler in the mind to suffer The strings and arrays of outrageous fortune, Or to take java against a sea of troubles, And by opposing end them?" #GAE