Tuesday, November 24, 2009

Some Helpful CLI Utilities

These are mainly from this thread:

gt5 -- cli gui for du

autojump -- jumping to most used dirs

iptraf -- network monitor

Monday, November 23, 2009

git clean

git has a nice switch to clean untracked and/or ignored files. git help clean for more info.

Saturday, November 14, 2009

Adding All Subfolders to the Path in MATLAB

This is a quick tip:

addpath(genpath(pwd))

adds the current dir and its subfolders (recursively) to the path in MATLAB.

Thursday, November 12, 2009

Git GUI Fails to Load on OS X and How to Solve It

I don't use git gui much, I mainly prefer the command line or magit or GitX, but git gui might be useful sometimes, especially with the OpenInGitGui Finder extension. 

When installed, git gui by default doesn't work (at least on my Macbook running Leopard); and fails with the message: 

dyld: Library not loaded: /Library/Frameworks/Tk.framework/Versions/8.5/Tk Referenced from: /usr/local/git/share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish Reason: image not found error: git-gui died of signal 5

Clearly, the Tk framework 8.5 is missing and can be downloaded from here. (Also see here) Once that is installed, everything works properly.

Thursday, November 05, 2009

Connecting to ssh servers running on non-standard ports

If you are running your ssh server on a port different than 21, for example 22, you can connect to the machine like this:

ssh mymachineip:22

or 

ssh mymachineip -p 22

However, there is an easier way:

Create the file  ~/.ssh/config, then fill it like this:

Host mymachineip

Port 22

Now you can just ssh to the machine: ssh mymachine

Monday, November 02, 2009

Reconnecting to a screen session

When there is only one screen session, screen -raAD attaches to the running screen. So far so good.  

However, if for some reason, there are more than one screen sessions, (screen -ls should give you those), screen suggests that you need to do screen -r  [[pid.]tty[.host]] to reattach. 

However, this simply doesn't work at first and yields weird errors like:

There is a screen on: 5541.pts-1.shannon (11/02/2009 04:40:02 PM) (Attached) There is no screen to be resumed matching 5541.pts-1.shannon.

This is utterly confusing, since it first says that there is a screen, but there is no screen to be resumed. What this means actually is just that however: one first has to detach that screen in order to attach to it. So, yes, there is a screen and that screen is not a screen one can connect directly.

The solution is to give the -d parameter to detach it at first, so

screen -d -r  5541.pts-1.shannon

should work. In fact, I guess screen -r -d 554 works too. That 554 portion has to be unique though, so screen -r -d 5 works too if no other screen session starts with a 5.

Sunday, November 01, 2009

Some Git Tips

  1. git add -u to add all modified files in the index.
  2. git checkout -f to trash all uncommitted changes. Useful before pulling.
  3. git stash as an alternative to above.
  4. git diff --cached to see the added changes.
  5. git rebase to squash multiple commits into a commit before pushing. Rebasing is useful for other stuff, but that needs more exploration.   git rebase -i origin/master to merge all unpushed commits.
  6. git commit --amend might be an alternative for that as well. 
  7. See here for some other tips.

Friday, October 30, 2009

How to make forward-word, backward-word, treat underscore as part of a word?

This tip is via here. For MATLAB, the corresponding command is:
(modify-syntax-entry ?_ "w" matlab-mode-syntax-table)

Batch Conversion of Image Files

To convert eps files to png, one can use imagemagick's convert and the good old find along with the -exec option: find -name '*.eps' -exec convert {} {}.png \; However, there is an easier command: mogrify -format png *.eps will do the job more elegantly. Using the -path png will output the images in a folder named png instead of the current folder. Imagemagick has some other useful commands: - display : Displays the image - montage : Concatenates several images - animate : Animates several images man imagemagick for more.

Tuesday, October 27, 2009

Saturday, October 24, 2009

Flex ve Türkçe Karakterler

Flex uygulamanızı derlerken şuna benzer bir hata alıyorsanız bu sorun sisteminizdeki Türkçe ayarlarından kaynaklanmakta: Error: Could not resolve to a component implementation. Bunu düzeltmek için birkaç yol var: Windows'ta iseniz Flex SDK'nın bin klasöründeki jvm.config dosyasındaki java.args=-Xmx384m -Dsun.io.useCanonCaches=false satırını java.args=-Xmx384m -Duser.language=en -Duser.region=US -Dsun.io.useCanonCaches=false olarak değiştirin. Mac ya da Linux'ta ise mxmlc dosyasını bir metin düzenleyici ile açıp VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false" satırını VMARGS="-Xmx384m -Dsun.io.useCanonCaches=false -Duser.language=en -Duser.country=US" olarak değiştirin. Ayrıntılı bilgi: http://livedocs.adobe.com/flex/3/html/help.html?content=configuring_environment_3.html Flex Builder kullanıyorsanız, alternatif olarak FlexBuilder.ini dosyasına -Duser.language=en -Duser.location=us satırlarını ekleyebilirsiniz. Mac'te bu dosyayı bulmak için Flex Builder.app'e sağ tıklayın, Show Package Contents'i tıklayın, Contents>MacOS klasörüne gidin.

Monday, October 12, 2009

Currency Conversion in Google

Search for: 20 $ in lira Much more here.

Wednesday, September 02, 2009

KDE Submenu Action For Getting the Public URL of a File in the Dropbox Public Folder

There is yet no equivalent for the nautilus extension for GNOME for KDE, so one can't right click on files in Dropbox's Public folder to get the Public URL. To overcome this limitation, one can use a KDE submenu action. First, create a .desktop file, named dropboxpublic.desktop with the following contents and save it under /usr/share/kde4/services/ServiceMenus or ~/.kde/share/kde4/services/ServiceMenus . The exact location for the parent directory of ServiceMenus is obtained by "kde4-config --path services" output.
[Desktop Action Dropbox Public URL]                                                                                               
Exec=dropbox puburl %u | xclip -selection clipboard                                                                               
Name=Get Public URL

[Desktop Entry]
Actions=Dropbox Public URL;
MimeType=application/octet-stream;
ServiceTypes=KonqPopupMenu/Plugin;
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,
This action requires the xclip program to copy the output of the action to clipboard, so install that using your package manager. Next, when you right click a file in Dropbox/Public folder, and go to Actions-Get Public URL, the URL should be copied to the clipboard. Tip: If you add X-KDE-Priority=TopLevel it will appear in the top level, not under Actions menu.

Saturday, August 22, 2009

Weather Information on Command Line

Weather information can be obtained at command line using a Python script that retrieves the weather information from Yahoo API found here at GitHub.

For Ankara, the location code is TUXX0003 and I aliased it in ~/.bash_profile as:

alias hava='weather.py TUXX0003 -m c -f 2'

Tuesday, August 18, 2009

Compiling Documents via Both LaTeX and XeLaTeX

To compile files that require XeLaTeX-specific options using LaTeX, use the \ifx\XeTeXversion\undefinedcheck.

\documentclass[a4paper,12pt]{report}

\ifx\XeTeXversion\undefined
\usepackage[utf8]{inputenc}
\else
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Gentium}
\fi

\begin{document}


\ifx\XeTeXversion\undefined
Hello World from LaTeX!
\else
Hello World from XeLaTeX!
\fi


\end{document}

Sunday, August 16, 2009

Thursday, July 23, 2009

Setting a Lefty and a Righty Mouse in Linux at the Same Time

If you want to use two mouses in Linux, and want one of them lefty and the other righty: use this:

xinput set-button-map 2 3 2 1
will reverse the buttons of the mouse numbered 2. To get a list of the mouses,
xinput list
or
xsetpointer -l

Combining both, to set the Microsoft mouse as lefty for example, use:

xinput set-button-map `xsetpointer -l|grep Microsoft|cut -c 1` 3 2 1

This is not persistent across sessions.

Tuesday, July 21, 2009

Scroll Lock Mode in Emacs

This is nice for reading a source file, such that the cursor stays always at the right spot.

(global-set-key (quote [Scroll_Lock]) 'scroll-lock-mode)
to map it to the Scroll Lock key.

Also see: Centered Cursor Mode

Saturday, July 18, 2009

Listing Package Contents in Debian

The command

 dpkg -L   
lists the files installed with a package. Ex: dpkg -L iceweasel

Thursday, July 16, 2009

Visualizing the Source Tree of a Project with the Command `tree'

The Unix command `tree' is nice for visualizing a project that spans multiple directories.

I use the following to get the tree structure for a MATLAB project:

tree -P "*.m" > lstree.tex

This creates a file lstree.tex with the tree structure. Then, to give it a XeLaTeX structure, prepend with the following:

 \documentclass[twocolumn]{article}
\usepackage{verbatim}
\usepackage{fullpage}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Gentium}
\setmonofont[Mapping=tex-text]{Gentium}
\begin{document}
\begin{verbatim}

and append the following:

\end{verbatim}
\end{document}
 

Compile with the command xelatex.
You will need xelatex, tree and gentium packages installed for these to work.

Opening Files from the Command Line via the Default Application

Files can be opened from the command line as if they were double clicked.

  1. On Windows, simply typing the name of the file should work IIRC.
  2. On OS X, there is the open command.
  3. On KDE and Gnome, there are kde-open and gnome-open respectively.

I have created a function in my .bashrc, so that I can open files by the command o. Just add it to ~/.bashrc and source .bashrc or reboot(!)

function o
{
  kde-open "$@" &>/dev/null &             
}

This sends all stdout and stderr to outer space in order to save you an Enter press, so beware.

Bonus: Actually, all this was done so that I can open the files in dired mode in emacs by their default application, pdf, jpg, mp3 files etc.

(define-key dired-mode-map "o" 'dired-launch-command)
(defun dired-launch-command ()
  (interactive)
  (dired-do-shell-command
   (case system-type
     (gnu/linux "kde-open") ;right for gnome (ubuntu), not for other systems
     (darwin "open"))
   nil
   (dired-get-marked-files t current-prefix-arg)))

Now in dired mode, pressing 'o' will open the file in the default application.

See here if that doesn't work.

Ans in Bash: Using the Output of the Latest Command in Bash

MATLAB shell has a sometimes useful variable called ans which you can use in your current calculations as a variable. My TI-83 had one as well actually, but Bash doesn't have one. :)

So, suppose you want to make use of the latest Bash command output. Using !! will redo the previous command. Using !! inside backticks (` `) or $( ) will give its output, as any other Bash command. (Although the $ notation is preferred, the backtick is more convenient in this particular case.)

So, operating on the last output is as simple as:

command_name `!!`

Note that this redoes the previous action, doesn't actually make use of the latest output.

One example:

$ which firefox
/usr/bin/firefox
#This is usually the symlink, we want to learn where the actual target is.
$ ls -l `!!`

Another one:

$ find -name "*.org"
$ emacs `!!`

Note that the -exec option of find or feeding to xargs might be more suitable in most cases, but this is just for demonstration.

Of course, C-p C-a command_name ` C-e ` is an option, but this seems easier.

Inspired via: http://feedproxy.google.com/~r/Command-line-fu/~3/mvkfpS8SZfw/edit-list-of-files-in-last-command

Emacs Shortcuts on Command Line

Via readline, some of Emacs' keybindings are available on the command line.

I was aware some shortcuts like C-a, C-e, C-r were already working; but was surprised to discover that even more are available, like undo, capitalize word etc.

Via:

http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-sheet/ and from "man readline"
 "C-@"  set-mark
 "C-A"  beginning-of-line
 "C-B"  backward-char
 "C-D"  delete-char
 "C-E"  end-of-line
 "C-F"  forward-char
 "C-G"  abort
 "C-H"  backward-delete-char
 "C-I"  complete
 "C-J"  accept-line
 "C-K"  kill-line
 "C-L"  clear-screen
 "C-M"  accept-line
 "C-N"  next-history
 "C-P"  previous-history
 "C-Q"  quoted-insert
 "C-R"  reverse-search-history
 "C-S"  forward-search-history
 "C-T"  transpose-chars
 "C-U"  unix-line-discard
 "C-V"  quoted-insert
 "C-W"  unix-word-rubout
 "C-Y"  yank
 "C-]"  character-search
 "C-_"  undo
 " " to "/"  self-insert
 "0"  to "9"  self-insert
 ":"  to "~"  self-insert
 "C-?"  backward-delete-char

 Emacs Meta bindings

 "M-C-G"  abort
 "M-C-H"  backward-kill-word
 "M-C-I"  tab-insert
 "M-C-J"  vi-editing-mode
 "M-C-M"  vi-editing-mode
 "M-C-R"  revert-line
 "M-C-Y"  yank-nth-arg
 "M-C-["  complete
 "M-C-]"  character-search-backward
 "M-space"  set-mark
 "M-#"  insert-comment
 "M-&"  tilde-expand
 "M-*"  insert-completions
 "M--"  digit-argument
 "M-."  yank-last-arg
 "M-0"  digit-argument
 "M-1"  digit-argument
 "M-2"  digit-argument
 "M-3"  digit-argument
 "M-4"  digit-argument
 "M-5"  digit-argument
 "M-6"  digit-argument
 "M-7"  digit-argument
 "M-8"  digit-argument
 "M-9"  digit-argument
 "M-<"  beginning-of-history    "M-="  possible-completions    "M->"  end-of-history
 "M-?"  possible-completions
 "M-B"  backward-word
 "M-C"  capitalize-word
 "M-D"  kill-word
 "M-F"  forward-word
 "M-L"  downcase-word
 "M-N"  non-incremental-forward-search-history
 "M-P"  non-incremental-reverse-search-history
 "M-R"  revert-line
 "M-T"  transpose-words
 "M-U"  upcase-word
 "M-Y"  yank-pop
 "M-\"  delete-horizontal-space
 "M-~"  tilde-expand
 "M-C-?"  backward-kill-word
 "M-_"  yank-last-arg

 Emacs Control-X bindings

 "C-XC-G"  abort
 "C-XC-R"  re-read-init-file
 "C-XC-U"  undo
 "C-XC-X"  exchange-point-and-mark
 "C-X("  start-kbd-macro
 "C-X)"  end-kbd-macro
 "C-XE"  call-last-kbd-macro
 "C-XC-?"  backward-kill-line

PS: C-/ also works for undo. Note that C-w is not the same as the Emacs default.

PPS: This is my current .inputrc, mostly the same as /etc/inputrc, except the last 8 lines.

# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.

# Be 8 bit clean.
set input-meta on
set output-meta on

# To allow the use of 8bit-characters like the german umlauts, comment out
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.

# set convert-meta off

# try to enable the application keypad when it is called.  Some systems
# need this to enable the arrow keys.
# set enable-keypad on

# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys

# do not bell on tab-completion
# set bell-style none
# set bell-style visible

# some defaults / modifications for the emacs mode
$if mode=emacs

# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert

# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history

# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

$if term=rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
$endif

# for non RH/Debian xterm, can't hurt for RH/Debian xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line

# for freebsd console
# "\e[H": beginning-of-line
# "\e[F": end-of-line

$endif
"\e[A": history-search-backward
"\e[B": history-search-forward
"\M-o": "\C-p\C-a\M-f "
set match-hidden-files off
set completion-ignore-case on
set visible-stats on
set show-all-if-ambiguous on
"\M-s": menu-complete

Wednesday, July 01, 2009

Latest version of MATLAB.el for Emacs

The file in the goodies package in Debian is old, and doesn't support parfor. The latest is here: http://sourceforge.net/scm/?type=cvs&group_id=154105

Saturday, June 20, 2009

Engin Ardıç RSS Beslemesi

Yahoo Pipes ile hazırlanmış RSS beslemesi şurada. Kaynağı incelemek için: http://pipes.yahoo.com/ustun/QO8GJWdd3hGo9ZcjfKAMnA Sabah surekli RSS sistemini degistirdigi icin sorun cikartabiliyor bazen, sonra tekrar duzeliyor. Su adres de alternatif olarak kullanilabilir. Sabah - Engin Ardic Arsivi

Elisp Codebook

Snippets from the emacswiki are here

Wednesday, June 17, 2009

Monday, June 15, 2009

Shell-fu

Here are top 25 tips from Shell-fu.

Sunday, June 14, 2009

Make OS X Terminal Behave

Just choose dtterm as Terminal declaration. Delete sends Ctrl-H might help too. http://hans.fugal.net/blog/2008/02/12/os-x-terminal-emulation-woes

Do NOT export CDPATH

See: http://thread.gmane.org/gmane.comp.version-control.git/13521/focus=13736 I had Makefiles breaking due to this, with silly errors like:
cd: blt: No such file or directory

Saturday, June 13, 2009

Bash tips on apt-get

1. Bash completion for aliased commands 2. ustun ALL=NOPASSWD: /usr/bin/apt-get in /etc/sudoers for the commands that shouldn't ask for password.

Git Tips

Some useful pages on Git: 1 - http://blog.ericgoodwin.com/2008/4/10/auto-completion-with-git 2 - http://www.benmabey.com/2008/05/07/git-bash-completion-git-aliases/

Monday, May 25, 2009

Nvidia + Debian Sid

m-a update

m-a prepare

m-a clean nvidia (?)

m-a a-i nvidia

apt-get install nvidia-glx

Maintainer's home page

Thursday, May 21, 2009

Some MATLAB Tricks - II

  1. Use cellfun to operate on each element of a cell. See also: arrayfun
  2. Use shg to call the latest figure front.
  3. Use dbstop if error for entering debug mode upon error. Use dbclear if error to reverse the behaviour.
  4. Use F4 to track M-files inside the code editor.
  5. Use dataset to show simple tables.
  6. See http://undocumentedmatlab.com/

Cd'ing to the Parent Dir of a Symlink

Once inside the symlink, issuing cd .. to go to the parent dir doesn't work. It returns to the dir where the symlink resides.

To go to the parent dir of the actual dir where symlink points to, use "cd -P .."

Wednesday, May 20, 2009

Tuesday, May 12, 2009

Improve Focus-Follows-Mouse Behaviour under Emacs

Just use the file here so that focus follows the window the pointer is on.

Ramazan Bayramı Hangi Ay Kutlanır?

Kime sorsam bilemedi, size sorarsam bilin, Ramazan Bayramı Şevval ayında kutlanır, Ramazan ayında değil.

Not: Bu sene şu tarihte: -19 Eylül 2009, Cumartesi Ramazan Bayramı Arifesi -20 Eylül-22 Eylül 2009, Pazar-Salı Ramazan Bayramı

Thursday, May 07, 2009

Modifying Frame Buffer Size in TTY's

  1. Use hwinfo --framebuffer to get the code.
  2. Append it to the kernel line as vga=0x0368 for 1680x1050 resolution.

Saturday, April 25, 2009

youtube-mp3

I have written a Python script that converts Youtube videos to mp3's using youtube-dl, ffmpeg and id3v2.

Details are on the youtube-mp3 website here

Tuesday, April 21, 2009

Sort Directories by Disk Usage

du -sm * | sort -rg
Calculates the disk usage in MB's and sorts in reverse order.

Sunday, April 05, 2009

Opera'da NTVMSNBC, Radikal, BBC'deki Reklamlardan Kurtulmak

Öncelikle Fanboy'un adblock listesini yükleyin. Bunu yükledikten sonra çoğu reklam engellenecektir, kaldıramadıklarını da reklama sağ tıklayıp Block Content'e tıklayarak diyerek kaldırın.

Daha sonra şu userscripti kullanarak reklamlardan doğan boşlukları kaldırabilirsiniz. Scriptin içine nasıl değişiklik yapılacağıyla ilgili bilgileri de koydum.

Opera'da Userscript kullanmak için dosyaları bir klasöre atıp Preferences-Advanced-Javaşcript Options bölümünden en alttaki UserJavaScript files değer yerine scripti içine koyduğumuz klasörü tanıtmamız gerekiyor.

Betik Firefox'ta da Greasemonkey ile çalışıyor olmalı.

Benzer bir seyi eksisozluk icin yapan, HuzursuZ'un yazdigi bir betik icin: cleansozluk Zaten kodu da bu scriptten esinlenerek yazdim.

cleansozluk'u Greasemonkey olmadan bir Firefox eklentisi olarak kullanmak icin daha once bir Firefox add-on hazirlamistim. Su an daha onaylanmadigi icin deneysel asamada, Mozilla'nin sitesinden yuklemek icin giris yapmak gerekiyor. Isteyen Softpedia'dan dogrudan indirebilir.

Saturday, March 21, 2009

Pretty Printing Wikipedia Articles

PrinceXML allows for converting HTML or XHTML documents into publishable PDF documents. You can also use it to print Wikipedia articles to nice looking PDF's via the instruction here on Opera CTO howcome's page.

Auto Numbering Headers in Google Docs

Google Docs allows generation of table of contents, but doesn't by default number the headers. This inability can be overcome via some CSS magic.

Simply put these into the CSS file, opened from Edit menu's Edit CSS item. This will autonumber header 2,3 and 4. (H2, H3, H4)


body {
counter-reset: chapter;
}

h2 {
counter-reset: section;
counter-increment: chapter;
}
h3 {
counter-increment: section;
counter-reset: part;
}
h4 {
font-weight: bold;
counter-increment: part;
}
H2:before {
content: counter(chapter) "." " ";
}
H3:before {
content: counter(chapter) "." counter(section) " ";
}
H4:before {
content: counter(chapter) "." counter(section) "." counter(part) " ";
}

Saturday, March 14, 2009

MATLAB'da Anonim Fonksiyonlar

Az bilinen MATLAB özelliklerinden biri anonim fonksiyonlar.

Normalde betikler (script) içinde ve komut satırında fonksiyon tanımlaması yapılamaz. Bu kısıtlamanın üstesinden gelmek için anonim fonksiyonlar kullanılabilir.

Anonim fonksiyonlar sayesinde tek ifadeli fonksiyonlar oluşturabilirsiniz.

Anonim fonksiyon taslağı şu şekildedir:

fonksiyon adı = @ (giriş parametreleri) ifade; Örneğin: myfun = @(x) log(x) + x; myfun(3) Böyle bir fonksiyonu, giriş parametresi olarak fonksiyon handle'i alan fplot, quad gibi fonksiyonlarda kullanmak mümkün. Örneğin: a = 1; b = 2; c = 3; myfun = @(x) a*x.^2 + b*x + c; fplot(myfun, [-10 10]) Anonim fonksiyonlar içerisinde, üst kapsamda (betik içerisinde daha yukarıda) tanımlanmış değerleri kullanabiliriz; ancak bu değerler fonksiyon tanımlandıktan sonra değiştirilirse fonksiyona etki etmezler. Fonksiyonun yeni değerleri kullanabilmesi için bir kez daha tanımlanması gerekmektedir.

Wednesday, March 11, 2009

Some MATLAB Tricks

These are some MATLAB tricks I will be compiling over time.

  1. Use get(0,'ScreenSize') to get screen size, and use figure('OuterPosition',[left bottom width height]) to set figure size and location.
  2. Use dynamic fields name in structs instead of eval commands. Ex: Instead of eval(['a.', 'first', '=', i]); use str = 'first'; a(str) = i;
  3. Use cells to create multi-line titles. Ex: plot(1:10), title({'First Line','Second'}) 
  4. Use uitable to visualize some matrices. Ex: a = uitable, set(a,’data’, magic(3))
  5. Use isequal to compare arrays for equality.
  6. Use hold all to hold subsequent plots and automatically switch line color and marker styles.
  7. To set marker every N lines, draw three plots. h = plot(NaN,NaN,'b-*',x,y,'b-',x2,y2,'*'); legend(h(1),'signal');
  8. Close all figures including GUI's with close all hidden . Note that if the HandleVisibility of a GUI is set to off or callback, it cannot be closed by close all only, the extra parameter 'hidden' is needed in this case.

Also, see the MATLAB questions at StackOverFlow.

Tuesday, March 10, 2009

Some Nice MATLAB FileExchange Files

  1. print_pdf : Save figures to high quality pdfs with cropped borders and embedded fonts. 
  2. textbp : Automatically locates text annotation to minimize figure obscuration
  3. hline and vline : Draw vertical and horizontal lines
  4. easygui : Create GUIs easily
  5. newfcn : Create new function template 
  6. any2csv : Convert struct to csv files
  7. anymate : Make animations in MATLAB easily
I discovered these via the MATLAB File Exchange Pick of the Week blog.

Monday, March 02, 2009

GeceGece - Turk Indie Pop Grubu




http://www.myspace.com/gecegece

http://www.last.fm/music/gecegece

http://sozluk.sourtimes.org/show.asp?t=gecegece

Sibel Emek Ortaç: lead vocals
Gökçe Bayrakçeken Tüzel: acoustic guitars , backing vocals
Alper Sarioglu: electric guitars
Özgür Sari: keyboards, backing vocals
Murat Tüzel: bass guitar
Onur Ertem: drums

Simulating Sample Spaced Rayleigh

A nice and informative article about simple channel simulation in Matlab: http://dspdotcomm.blogspot.com/2008/11/simulating-sample-spaced-rayleigh.html


Sunday, March 01, 2009

Markdown ve ReStructuredText: Hafif Siklet Isaretleme Dilleri (Lightweight Markup Languages)

Dökümentasyon ya da basit belgeler oluştururken HTML ya da XML gibi bir işaretleme dili kullanmak zor gelebilir. WYSWYG türü Word benzeri programlarda belge hazırlamak da bazı konularda özgürlüğünüzü kısıtlar.

Bu gibi durumlarda İngilizce lightweight markup language olarak tabir edilen hafif sıklet işaretleme dillerini kullanmak uygun bir çözüm. Bu belgelerde metnin nasil gorunecegiyle ilgili kucuk isaretler kullanilmakta ve bu sekilde duz metin de olsa okunakli bir gorunum elde edilmekte. Daha sonra bu metinler bazi parserlardan gecirilip diger formatlara aktarilabilmekte.

Ben önceden reStructured Text kullanıyordum. Bugün markdown adı verilen (markup vs markdown ;) bir işaretleme diliyle karşılaştim. İkisi birbirine oldukça benziyor; genel kanı, LaTeX ya da PDF gibi formatlara dönüştürme hedefiniz yoksa ve inline (kaynak kod içi) dökümentasyon hazırlamıyorsanız, yani sadece HTML çıktısıyla ilgileniyorsanız markdown'in daha kolay bir çözüm olduğu yönünde. 

Ayrica rst'nin kullanımı emacs'te oldukça kolay olmakla beraber markdown daha metin editör bağımsız bir ortam sunuyor gibi.

Markdown'da belge hazirlama

Baslik ve altbasliklar

Bunlar baslik ya da altbaslik metninin basindaki # isaretlerinin sayisiyla belirleniyor. Ornegin en ust baslik (h1) icin, # Ana Baslik yazmaniz yeterli. Bir alt baslik (h2) da bu durumda ## Alt baslik olarak yaziliyor.

Kalin ve italik yazilar

Italik yazilacak metinlerin soluna ve sagina * isareti koymak gerek. Kalin olmasi icin ise sola ve saga ** koymak gerek. Ornegin, *bu metin italik*, ** bu metin kalin olacak**.

Listeler

Liste olusturmak icin her ogeyi alt alta yazip satir basina -, * gibi isaretleri koymak gerekiyor. Icice liste olusturmak icin de iki satir iceriden yeni bir isaretle baslamak gerek. Ornegin:

- elma
  * golden
  * starking
  *grannysmith
- armut
- muz

Link (baglanti) verme

Satirici ve referans olarak ikiye ayriliyor. Ayni linki birden fazla kullanacaksaniz referans turunu tercih edebilirsiniz.

Satirici link vermek icin Bu [ornek link](http://example.com/) kullanin. Referans linki vermek icin ise su kalibi kullanin. Ornek:

[gorunmesini istediginiz metin][referans adi]

Daha sonra, asagida bir yerde referanslarin hangi URL'e isaret ettigini gostermek icin,

[referans adi] http://www.cnn.com kismini ekleyin.

Kod bloklari

Kod bloklari icin basa ve sonra ` isareti koyun.

Daha fazla bilgi icin: Markdown Basics'e goz atin. Markdown'i aninda HTML'e donusturen bir online editor icin: http://attacklab.net/showdown/

Diger Kaynaklar

  1. http://en.wikipedia.org/wiki/Lightweight_markup_language

  2. Bir karsilastirma - http://stackoverflow.com/questions/34276/markdown-versus-restructuredtext

  3. Markdown'la ilgili kaynaklar:
  4. http://en.wikipedia.org/wiki/Markdown
  5. Online markdown derleyici: http://daringfireball.net/projects/markdown/dingus

  6. reStructuredText ile ilgili kaynaklar:
  7. http://docutils.sourceforge.net/rst.html

Saturday, February 21, 2009

Being and Nothingness

İnsanın kesin seçim yapması gereken anlar vardır: Kendi yaşamını tümüyle, eksiksiz, dopdolu yaşamak mı, yoksa ikiyüzlü bir dünyanın istediği yapmacık, sığ, onur kırıcı bir varoluşa sürüklenmek mi?


There are moments when one has to choose between living one's own life, fully, entirely, completely-or dragging out some false, shallow, degrading existence that the world in its hypocrisy demands.



Oscar Wilde

Tuesday, February 17, 2009

Convert Youtube Videos to mp3

1. Use youtube-dl to download the flv file. Add -b -o '%(stitle)s.%(ext)s' parameters to get maximum quality and proper naming.

To download a list of videos, use youtube-dl -a list.txt

2. Use ffmpeg to convert the file to an mp3 file.
ffmpeg -i 0-_h1gaZA48.flv -ac 2 -ar 44100 -ab 192k 0.mp3

To convert all at once,

for nam in *.mp4; do ffmpeg -i "$nam" -ac 2 -ar 44100 -ab 192k `basename $nam .mp4`.mp3; done


3. Finally tag the mp3's using id3v2.
for name in *.mp3; do id3v2 $name -t `basename $name .mp3`; done

Wednesday, January 28, 2009

kazanmayı öğrenmek

bazen tam kaybettim derken en güzel şeyi kazanıyorsun diyalektiğini sevdiğimin dünyasında.

Monday, January 12, 2009

Kaybetmeyi Öğrenmek

Kaybetmeyi öğrenmek hakkında bir yazı yazayım dedim, sonra şuna rastgeldim. Güzel bir yazı, ama daha denecek çok şey var kuşkusuz.

Thursday, January 08, 2009

Exit Music - Enter En Guzel Juliet

Blogum hit alamıyor. En son mevzuyu Elif Vargı™'ya açtım, dedi yardımcı olurum, dedim sağol, sonuçta popüler bir insan kendisi, istifade edelim fena olmaz. Derken asıl sorunu buldum, bu blogta bir şeyler eksik, ama ne eksik. Bir kere bloğun teması yok, konusu yok, resmen eskiz defteri, aklıma ne eserse yazıyorum, koyuyorum. Tam bi çöplük. Ama baktım aynı şey Hürriyet'in, Milliyet'in internet sayfası için de geçerli, ama onlara giren çıkan eksik değil. Sonunda anladım gerçek nedeni, bu blogda güzellik eksik, ondan yalnızlığı. Açığı hızla kapatmam gerek. En eskisinden başladim, aşkı yeni öğrendiğimiz zamanlardan bir hatıra. Lisede Zeffirelli'nin Romeo ve Juliet'ını izlerken parça parça, ilk yarım saat sonunda sınıftan uğultular yükselmişti. Kesintisiz izlemiyorduk filmi, kitabı okudukça sanırım, ilgili bölümü izliyorduk. Bu nedenle birkaç gün sürdü filmi izlemek. Tartışıldığını hatırlıyorum. O zamana kadar zihinlerimize bir İsveçli manken olsa gerek diye kazıdığımız Juliet, bambaşka bir formda çıkmıştı. Bu nasıl Juliet, bu ne İsveçli manken olamayıştı. Sonrasında... Sonrasında herkes aşıktı Olivia Hussey'e. En güzel Juliet'e. Sınıftan uğultular yükseliyordu, "haaa" diyordu tüm erkekler, "demek Juliet bu kadar güzel bi karaktermiş".

Wednesday, January 07, 2009

Entering Turkish Characters in Mac OS X without Changing the Keymap

It is possible to enter some Turkish characters using the English character map in Mac OS X.
  • ı : Option + Shift + b
  • ü : Option + u, then, u
  • ö : Option + u, then, o
  • ç : Option + c
  • î : Option + i, then i : This is for accented ı's, as in: Rumî.
  • â: Option + i, then a : As in kâğıt.
So, in general, for umlauts, you first press Option + u, then the characters for which the umlaut is missing. Similarly, for circumflex (inceltme i$areti), first Option + i, then the letter. Unfortunately, there are no shortcuts that I know of for entering other characters ğ, ş. Also, see Turkish Text Deasciifier. UPDATE: It turns out that there actually is a much better way. Selecting Turkish QWERTY as keyboard will make the keyboard US, and to insert the Turkish equivalents, for example ü instead of u, one has to press the character with the Option (alt) key.

Tuesday, January 06, 2009

A Stockhausen Interview


I love how he answers the first question, and ends the conversation!

last.fm normalizer

This tool generates a normalization on your last.fm stats, based on the median track length of each artists. It therefore resorts the charts according to the time you spent listening, not merely according the number of tracks as last.fm does.

There is also another tool which uses this data so that you can embed in your last.fm profile -- but I can't remember the address now.

See also here for other last.fm mashups.

Music I Discovered This Week

A fruitful week for my music exploration:

1. Steve Reich
2. DJ Shadow
3. More of Aphex Twin ( The Tuss)
4. Squarepusher
5. The Orb
6. My Bloody Valentine
7. Public Enemy

Note to self:
More of Reich, more of minimalism, some Stockhausen in the following weeks.
Later: More trip-hop maybe, then PJ Harvey, Tori Amos etc.

Sunday, January 04, 2009