2012-12-23

How to set default playback (NVIDIA HDMI) device on Debian Squeeze


I install alsa-driver-1.0.25 from source, because default version 1.0.23 did not see "Nvidia GPU 14 HDMI/DP"

It can be tested with
$ alsamixer


By pressing F6 and selecting Sound Card:


After installation all outputs was muted by default, so I unmute, by selecting and pressing key "m".

Then start investigating my hardware, for more details:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Intel
    HDA Intel, ALC1200 Analog
    Default Audio Device
front:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Analog
    Front speakers
surround40:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
    HDA Intel, ALC1200 Digital
    IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia
    HDA NVidia, HDMI 0
    HDMI Audio Output


$ cat /proc/asound/cards
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xfcff8000 irq 28
 1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe8fc000 irq 17



$ cat /proc/asound/devices
  1:        : sequencer
  2: [ 0- 2]: digital audio capture
  3: [ 0- 1]: digital audio playback
  4: [ 0- 0]: digital audio playback
  5: [ 0- 0]: digital audio capture
  6: [ 0- 0]: hardware dependent
  7: [ 0]   : control
  8: [ 1- 9]: digital audio playback
  9: [ 1- 8]: digital audio playback
 10: [ 1- 7]: digital audio playback
 11: [ 1- 3]: digital audio playback
 12: [ 1- 3]: hardware dependent
 13: [ 1- 2]: hardware dependent
 14: [ 1- 1]: hardware dependent
 15: [ 1- 0]: hardware dependent
 16: [ 1]   : control
 33:        : timer






In the terminal it work just fine. I can make audio output by specifying playback device.

For example HDMI audio played with:
$ aplay -D plughw:1,9 some_audio_file.wav
$ mplayer some_audio_file.wav -ao alsa:device=hw=1.9


PC analog output (green socket, in the back) played with:
$ aplay -D plughw:0,0 some_audio_file.wav
$ mplayer some_audio_file.wav -ao alsa:device=hw=0.0


PC analog output is the default playback so it also played with:
$ aplay some_audio_file.wav
$ mplayer some_audio_file.wav


To make HDMI playback by default instead of PC analog output (green socket, in the back).


It Need to create a file ~/.asoundrc
Hidden file in a home directory, with a content like this:

$ cat ./.asoundrc
-----------------------------------------------------------------------------------------------------------
# HDMI configuration with volume control

# Instructions for use
# 1) Find your hmdi hardware Card Number and Device Number. Open a terminal and do:
# aplay -L
# That will list all of the hardware audio devices. Look for the one labeled HDMI.
# Note what Card Number and Device Number it lists (they seem to be card 0,
# device 3 but your system may be different).
# 2) Edit the pcm.hdmi_hw device defined here to set your Card Number and Device Number.
# 3) Put this file in either /etc/asound.conf or in your home directory as .asoundrc.
# sudo cp jons_asound.conf /etc/asound.conf
# or
# sudo cp jons_asound.conf $HOME/.asound.conf
# 4) Exit mythfrontend. Then restart the sound system:
# sudo /etc/init.d/alsa-utils restart
# 5) Start mythfrontend and go to the audio setup screen
# "Utilities / Setup" then "Setup" then "General" then "Next" until you
# get to the Audio tab.
# 6) Fill in the info - it's case sensitive:
# Audio output device: ALSA:hdmi_complete <--- note you have to type in this field
# Passthrough output devide: Default
# ... Stereo... ... Passive...
# Mixer Device: ALSA:default
# Mixer controls: hdmi_volume <--- type in this field
# 7) Work your way back to Watch TV and give it a try.

pcm.hdmi_hw {
type hw
card 1 # <----- Put your card number here
device 9 # <----- Put your device number here
}

pcm.hdmi_formatted {
type plug
slave {
pcm hdmi_hw
rate 48000
channels 2
}
}

pcm.hdmi_complete {
type softvol
slave.pcm hdmi_formatted
control.name hdmi_volume
control.card 1
}

pcm.!default hdmi_complete
-----------------------------------------------------------------------------------------------------------




This taken from Good Tip (Ubutu Forum)












Single folder size on Linux terminal

$ du ./  --max-depth=0 --block-size=MB
734MB    ./

2012-12-04

Small, low power NAS with Raspberry Pi


Hardware:
 * Raspberry Pi
 * SD Card 4GB
 * Power supply 5V 2A, with micro USB jack

User Application:

Web server for media streaming on Raspberry Pi

   Runs Lighttpd server. Performance: no problem streaming 9GB *.mkv movie.
   Test done with 1TB external HDD 3.5 USB2 NTFS partition;

   Easy addons (non tested):
             * Torrent Client: "transmission-daemon"
             * FTP server: "proftpd"
             ...
             * Use your imagination... =)
             ...

        
Costs:

Raspberry Pi Type B Single Board Computer 512MB        £25.92  UK    (110LT)
SD Card 4GB (It would be better CL10)                               ~£5  UK        (22LT)
Power supply                                                                        ~ £6   UK        (26LT)
 

2012-11-07

HTC one V







http://www.htc.com/www/smartphones/htc-one-v/


1. hands free & self unlock  at the end of the call. I use hands free, headphones&mic with wire, HTC original, came with the phone, I put the phone in the pocket & lock the screen, so when a call is over, it unlocks it self and then the phone going on the menu by random pocket touch...


2. forced sms spelling, next to language selection button defiantly  should be option for "no spelling"!

I use slang, or several languages in sms, and spelling just mess everything!
Almost nobody sms use for official stuff. I don't care how many grammatical mistakes I made,
 the important part the recipient understand my message!
It's a lame feature for most people, with hidden or non existing OFF switch.
If I find it, definitely will disable this feature!


3. sms sound can not be set by selecting a file. Why???
So I have to use a different app for sms, cause non of the default sounds are suitable...

4. ring tone , can be set by selecting mp3 file (GOOD),
    bud it's listed by the mp3 tags not by file names.

I have a large music mp3 library in a single folder (32GB micro sd card), and I gave another folder for a ringtones (10 files inside), Everything is mixed together, list is just very very large! And mp3 tags not sync with a file names, so searching for those 10 files is a Tragedy!!!

Moral dilemma:

I have no time play with tags... I love to listening for the music, I know ware may favorite music file's is, A don't care about tags... maybe it works fine for some one how have nothing to do in life... Or he edit tags as a type relaxation, after work... Or have only couple albums in the phone...



For People who sort music library by files, really good Android app "Folder player"!

5. Time zone ISSUE - (I believe it will be fixed sun)

Home Location shows the right time , bad the clock in the top right corner not. Solution - disable automatic time sync, and set time manually (it also will effect the home location time ). Phone time now ok, but app's get time not form one place, example sms listed not in the right order...
Incoming sms get's time form Home Location (so it's wrong), Outgoing form the phone. Sms list will look like the response send previously then the request.
 

6. FM radio - BAD, always jumping white nose, even in the City, no volume down feature during white nose, very annoying!
For Compare, Iriver Clicks in the same places - works just fine and even the place where radio signal is poor it has volume down control during withe noise


The newest "USER FRIENDLY TOPIC" - "let's hide file browser" - IT'S JUST SUPER IDIOTICALLY STUPID!!!! 




**************************************************************************

I tiered wait for fixes, I will do it by my self xda-developers.com , by by HTC...
I will post the results! Yet it is only decision! Friends did that, so it can be hard!

**************************************************************************





2012-11-05

GIT getting started on Linux



Intro:

If You start using GIT with a GUI, and did not study concept of GIT, most likely You using it wrong! Or if You trying to use it as some other software that You already know, most likely wrong idea to!
I tried a few git GUI's, and if You don know the idea how it should work, its definitely not obvious from the GUI! In Other cases GUI is just a CRAP and it's impossible to use it.


     Why GIT?   Tech Talk: Linus Torvalds on git (Youtube Video)



     GIT workflow...  Introduction to Git with Scott Chacon (Youtube Video)

 
Basic git config:


$ git config --global user.name "User"

$ git config --global user.email "user@mail.com"

$ git config --global color.diff auto

$ git config --global color.status auto

$ git config --global color.branch auto

$ git config --global core.editor "nano"

Global settings stored in file:

$ cat ~/.gitconfig

Adding a project:

Enter project dir and

$ git init



$ git status

Adding & Commiting:

$ git add file.c

$ git commit

Commit message list:

$ git log


Add all files to staging area

$ git add .

Helpful note for a people, who is not a vim fan's
To exit vim
:q

Doing backup to a flash drive:

Enter dir where git remote will be created

$ git init --bare

Now back to project dir:

$ git remote add {nameOfTheRemote} {PathToRemote}
$ git remote add {nameOfTheRemote} \
             ssh://{user}@{url}:{port}/remote/path/

Push to empty remote:

$ git push {NameOfTheRemote} {BanchName}

Push all branches to remote:

$ git push {NameOfTheRemote} -a

List remotes:

$ git remote -v

Get a source copy from remote


$git clone {PathToRemote}

List your available branches:

$ git branch

Create a new branch:

$ git branch {newBranchName}

$ git branch testing

Switch to a branch:


$ git checkout testing

Merge testing to master, make sure you are on a master branch:

$git branch

*master

testing

$ git merge testing

Delete a branch:

$ git branch -d {branchName}

$ git branch -d testing

Delete remote branch

$git push origin --delete {branchName}



Difference between HEAD and the index;
what would be committed if you "commit" now.

$ git diff 

A brief per-file summary of the above.

$ git status

Get info about your local folder content versus remote content


$ git remote show {nameOfTheRemote}

Check all branches:

$ git branch -a

$ git branch -r

Get updated from remote

$ git fetch

Show git branch chart:

$ git log --oneline --graph --all --decorate

Make "com" alias for "commit":


$ git config alias.com commit

Switch to your other branch:

$git checkout {branchName}

Show log with file'e change summary:

$git log --stat

Compare branches. What is in branch called "master" that is not in the "bug_fix":

$git log master ^bug_fix

Usually binary files excluded from source. With Git it can be done by make a file ".gitignore" in the project directory:

Content of gitignore
exclude file by extension:
*.txt
exclude all folders named “Debug” in the soure tree:
*/Debug/
exclude single folder:
/output

Patching:

If you want to create a patch file via "git diff" that can be applied using "patch -p0 < patchfile" use the following command:

$ git diff --no-prefix > patchfile

then apply the patch:

$ patch -p0 < patchfile

If you have an existing "git diff" patch file that was created without the "--no-prefix" option, you can apply that patch via:

$ patch -p1 < patchfile

this will ignore the default a/ b/ source prefixes.
 
To make a complete patch not only modified files bud new files to.
You have to staged all files for patch, you can unstage after you create a patch, don't have to commit!

$ git diff --no-prefix --staged > patchfile

Replace local branch "master" to the remote branch "master"

$ git checkout origin/master
$ git branch -d master
$ git checkout -b master



Visualize git repo with web gui

$ git instaweb


Git on server

$ cd gitproject.git
$ mv hooks/post-update.sample hooks/post-update
$ chmod a+x hooks/post-update
$ ./hooks/post-update

Patching
$ git diff master  main.h main.c file.h >>  main.patch
$ patch --binary -p1 < main.patch

After failed pull, if you decide to step back instead of resolving the comfits 
$ git reset --hard HEAD
 



2012-11-03

lighttpd instalation & configuration on Debian Squeeze

Install package's: 
lighttpd
php5-cgi
libsqlite3-dev
sqlite3
php5-sqlite
php5

All dependencies:
libonig2 (version 5.9.1-1) will be installed
libqdbm14 (version 1.8.77-4) will be installed
libsqlite0 (version 2.8.17-6) will be installed
libsqlite3-dev (version 3.7.3-1) will be installed
libterm-readkey-perl (version 2.30-4) will be installed
libterm-readline-perl-perl (version 1.0303-1) will be installed
lighttpd (version 1.4.28-2+squeeze1) will be installed
php5-cgi (version 5.3.3-7+squeeze14) will be installed
php5-common (version 5.3.3-7+squeeze14) will be installed
php5-sqlite (version 5.3.3-7+squeeze14) will be installed
php5-suhosin (version 0.9.32.1-1) will be installed       
sqlite3 (version 3.7.3-1) will be installed
php5 (version 5.3.3-7+squeeze14) will be installed


Enable fastcgi, by creating symbolic link:



# ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf

 10-fastcgi.conf need's to be updated:

$php-cgi -v



 PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cgi-fcgi) (built: Aug  6 2012 20:09:06)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH



$which php-cgi
$/usr/bin/php-cgi

#nano /etc/lighttpd/conf-enabled/10-fastcgi.conf


Content of file:
--------------------------------------------------------------------------------------------
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

server.modules += ( "mod_fastcgi" )

fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php-cgi",
                     "socket" => "/tmp/php.socket"
                 )))
--------------------------------------------------------------------------------------------
or 
--------------------------------------------------------------------------------------------
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

server.modules += ( "mod_fastcgi" )

fastcgi.server = ( ".php" => ((
            "bin-path" => "/usr/bin/php-cgi",
            "socket" => "/tmp/php.socket",
            "max-procs" => 2,
            "idle-timeout" => 20,
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "4",
                "PHP_FCGI_MAX_REQUESTS" => "10000"),
            "bin-copy-environment" => (
                "PATH", "SHELL", "USER"),
            "broken-scriptfilename" => "enable"
                 )))
 --------------------------------------------------------------------------------------------
The module  fastcgi is added, and path to php-cgi is set! Good!

Restart server
# /etc/init.d/lighttpd restart

Create the file "index.php" to /var/www/
With Content:
--------------------------------------------------------------------------------------------
<?php phpinfo(); ?>
--------------------------------------------------------------------------------------------




This, helped me:

http://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html


2012-11-01

Automatic Login On Debian squeeze




System->Administration->LoginScreen





System->Preferences->Password and Encryption Keys
or in terminal
$ seahorse





Right Click with mouse and select "Change Password",
new password lave empty.




2012-10-29

How to share a folder on VirtualBox between Host and Guest


Host Debian 6 <> Guest Debian 5



Host:
#nano /etc/rc.local
add line
mount -t vboxsf SHARED /home/user/SHARED


Guest:
You need to add the user name to the vboxsf group on the guest. (the user name that you use to login to the guest).



A minimum of log off and back in is required when permissions are changed.



Host Windows 7 <> Guest Linux Mint 17


Add shared folder




On guest you have to add your user to vboxsf group, otherwise shared folder will be accessible only by root.

# adduser {user} vboxsf




Reboot guest.






2012-10-26

How to NAT eth0 to eth1 on Debian squeeze?





echo "1" > /proc/sys/net/ipv4/ip_forward

You will need to edit /etc/sysctl.conf and change the line that says net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1.


#!/bin/sh
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT


/etc/init.d/isc-dhcp-server restart


cat /etc/resolv.conf
namservers


static ip on eth1 192.168.0.254 (option routers 192.168.0.254)
/etc/resolv.conf (option domain-name-servers 172.29.129.214;)



/etc/dhcp/dhcpd.conf

subnet 192.168.0.0 netmask 255.255.255.0 {
    interface eth1;
    range 192.168.0.15 192.168.0.50;
    default-lease-time 6000;
    max-lease-time 7200;
    option subnet-mask 255.255.255.0;
    option time-offset -3600;
    option routers 192.168.0.254;
    option domain-name-servers 172.29.129.214;
}


/etc/init.d/isc-dhcp-server restart

2012-10-24

StarCraft II: Wings of Liberty on Ubuntu

Hardware:

   Intel Core 2 Duo CPU E7500 @ 2.93 GHz x 2
   RAM  8 GB
   GeForce GT 630 PCI-E 2.0  2048MB

OS:

    Ubuntu amd64 12.10  Kernel Linux 3.5.0-17-generic
    Gnome 3.6.0


Back to simple panel Desktop meniu:
sudo apt-get install gnome-panel
Before login, click circle and select "Gnome Classic , No effects"

Set custom time format for the clock in the right top corner,
 Default is just not right!
gsettings set com.canonical.indicator.datetime time-format custom
gsettings set com.canonical.indicator.datetime custom-time-format "%Y-%m-%d  %A <b>%H:%M</b>"


Install Nvidia driver:

Nvidia module should be build during installation, so it needs:

sudo apt-get linux-source-3.5.0
sudo apt-get linux-headers-3.5.0-17-generic
sudo apt-get build-essential

If this part is skipped (install driver without building tools), it result (poor resolution) and nevidia-settings:




sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current


Install wine:
sudo apt-add-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine
(wine-1.5.15)

Set graphic memory size, to prevent, related crashes:

run regedit
got to
 HKEY_CURRENT_USERS create a "Direct3D" key under "HKEY_CURRENT_USER/Software/Wine".
 Within "Direct3D", create a string value "VideoMemorySize" and set the value, in my case 2048 (2 gb)

And Now! The Most Important part Install StarCraft-II-Setup-enGB.exe :)


Summary:

Unfortunately It not perform as well as I would want...
At the beginning of the game it works almost perfect, problem begins at the fight moments!
Generally You can not properly organize Your army during The fight, cause the view is freezing.
I like everything else on Linux better, bud for this game a have to use Windows XP .
From time to time I will check performance with software updates...
The day when the Issue will be resolved, it will be the same day when Windows XP no longer on my PC... =)
P.S. graphics settings on both systems was equal 

StarCraft II: Wings of Liberty on Ubuntu **UPDATED**


Terran techtree...

2012-10-23

post number 1 

no usefull info ...