Write this
sudo service gdm restart |
Write this
sudo service gdm restart |
Write binary numbers to a file. This is helpful if you want to test your VHDL code with numbers generated by Matlab.
function [] = bin2text(a,hedef) % bin2text(a,hedef) % a : the array of binary numbers % hedef : the target file name fid = fopen(hedef,'wt'); len = length(a(:,1)); for ii = 1:len fprintf(fid, '%s\n',a(ii,:)); end fclose(fid); |
Again Matlab does something that is not processable when you convert signed numbers to binary numbers. This function is for this purpose. Compatible with R2007 some small retouches needed for R2009
function [result] = signed2bin(a,len) % signed2bin(a,len) % a : an array of the signed decimal number % len : the length of the bits you want to represent the signed numbers b = dec2bin(a,len); slas = find(b == '/'); if isempty(slas) result = b; else b(slas) = '1'; result = b; end |
As I am doing some signal processing stuff on FPGA I needed a function showing me the signed version of the binary numbers. In simulator it is easy but in Matlab it is not. I hope you find it useful.
function [result] = bin2signed(a) % bin2signed(a) % a is a matrix of binary numbers and result is signed representation of a birler = find(a == '1'); sifirlar = find(a == '0'); len = length(a(1,:)); cikan = 2^(len-1)-1; b = bin2dec(a); cokbuyukler = find(b>cikan); if isempty(cokbuyukler) else b(cokbuyukler) = b(cokbuyukler)-2^len; end eksitamlar = find(b == 2^(len-1)); if isempty(eksitamlar) else b(eksitamlar) = -2^(len-1); end result = b; |
taken from http://doctus.org/showthread.php?t=41474
a good lesson about use of bashrc. Functions and aliases a final code snippet is here.
echo -en "\033[1;36m" echo " /\ _ _ _ " echo " / \ __ _ _ __ ___| |__ | (_)_ __ _ ___ __ " echo " /' \ / _\` | '__/ __| '_ \| | | '_ \| | | \ \/ / " echo " /_- ~ -\ | (_| | | | (__| | | | | | | | | |_| |> < " echo " / \ \__,_|_| \___|_| |_|_|_|_| |_|\__,_/_/\_\ " echo " / _- - _ '\ " echo " /_-' '-_\ " echo -en "\033[0m\n" # Fortune echo fortune echo # Check for an interactive session [ -z "$PS1" ] && return PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[m\] ' #bash completion. if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi # Aliases # General Aliases alias fontup="sudo fc-cache -v" alias ls="ls --color=auto" alias reboot="sudo reboot" alias rconf="sudo nano /etc/rc.conf" alias shutdown="sudo shutdown -h now" alias source="source /home/wargasm/.bashrc" alias xorgconf="sudo nano /etc/X11/xorg.conf" # Pacman Aliases alias ins="sudo pacman -S" alias pacclean="sudo pacman -Rs $(pacman -Qtdq)" alias pacinfo="pacman -Qi" alias paclocs="sudo pacman -Qs" alias pacs="pacsearch" alias rem="sudo pacman -R" alias syscl="sudo pacman -Scc" alias sync="sudo pacman -Sy" alias sysup="sudo pacman -Syu" # Yaourt Aliases alias yains="yaourt -S" alias yarem="yaourt -R" alias yainfo="yaourt -Qi" alias yaup="yaourt -Syu --aur" # Functions arsivle () { FILE=$1 case $FILE in *.tar.bz2) shift && tar cjf $FILE $* ;; *.tar.gz) shift && tar czf $FILE $* ;; *.tar.lzma) shift && tar --lzma cf $FILE $* ;; *.tgz) shift && tar czf $FILE $* ;; *.zip) shift && zip $FILE $* ;; *.rar) shift && rar $FILE $* ;; esac } ayikla () { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x -v $1 ;; *.gz) gunzip $1 ;; *.tar) tar xvf $1 ;; *.tbz2) tar xvjf $1 ;; *.tgz) tar xvzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "don't know how to extract '$1'..." ;; esac else echo "'$1' is not a valid file!" fi } pacsearch () { echo -e "$(pacman -Ss $@ | sed \ -e 's#core/.*#\\033[1;31m&\\033[0;37m#g' \ -e 's#extra/.*#\\033[0;32m&\\033[0;37m#g' \ -e 's#community/.*#\\033[1;35m&\\033[0;37m#g' \ -e 's#^.*/.* [0-9].*#\\033[0;36m&\\033[0;37m#g' )" } twit () { echo "User: " read user echo "Pass: " read -s pass echo "" curl -u $user:$pass -d status="$1" http://twitter.com/statuses/update.xml } |
This is taken from http://www.anand-iyer.com/blog/?p=22 (thanks). The steps are.
1. Install necessary tools for building:
sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3 |
2. It turns out that otcl does not like the version of gcc installed by default in Lucid. So go ahead and change ns-allinone-2.34/otcl-1.13/Makefile.in. Find the line that says:
CC= @CC@ |
and change it to:
CC= gcc-4.3 |
3. Now try doing ‘./install’ from the ns-allinone-2.34 directory. It should work.
Then I added the following in command line
export LD_LIBRARY_PATH=<YOUR_NS_PATH>/ns-allinone-2.34/otcl-1.13:<YOUR_NS_PATH>/ns-allinone-2.34/lib export TCL_LIBRARY=<YOUR_NS_PATH>/ns-allinone-2.34/tcl8.4.18/library export PATH=$PATH:<YOUR_NS_PATH>/ns-allinone-2.34/bin:<YOUR_NS_PATH>/ns-allinone-2.34/tcl8.4.18/unix:<YOUR_NS_PATH>/ns-allinone-2.34/tk8.4.18/unix |
if you want these paths be permanent you must do something in the bashrc file.