21 Aralık 2012 Cuma

Save HDD Space Without Deleting Anything (hardlinks)

You can save hard disk space without deleting anything! Yes, it is possible thanks to hardlinks.

You can think a hardlink like a pointer to actual data in the disk. Multiple hardlinks pointing to the same data don't take redundant space on the disk. If your actual data is 1GB, then total size of all of your hardlinks is 1GB regardless of the number of hardlinks:


Sometimes you have to keep several copies of some files in various locations. May be you don't want to delete them or you are lazy to select proper ones to delete :) How about to converting them to hardlinks? Hardlinks look like actual files but don't take extra redundant space in the disk. So, only you need is to figure out which files are replicates of each others and convert them to hardlinks.

Duplicate File Detective makes a good job in finding duplicate files. Various comparison options are really useful to find what you want:



After scanning for duplicates, select files to process manually or using SmartMark features and then click to "Delete Marked" button. Check "Replace moved or deleted duplicates with link to unmarked siblings" checkbox and then select "Create hard links" option. You done:

8 Ekim 2012 Pazartesi

Batch - Run A Command Repeatedly In Each N Seconds

Sometimes you need to execute some command repeatedly in each n second(s). May be, you are listening a change on a file, a database or something another. If you don't want to fire same command again and again manually, you can use my listen.bat script. For example, you can check count of needles in the :
listen 3 grep "needle" "haystack.txt" -c

Script is below (gist here):
@echo off

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: This script executes given command repeatedly.
:: Waits specified amount of time between two executions.
:: First parameter MUST be sleep time.
:: Rest of the parameters will be executed as a command.
:: This script relies on sleep command from GnuWin32 package.
:: 
:: usage: (1 minute = 60 seconds intervals. More info: sleep --help)
::    listen 60  grep -w needle "haystack.txt"
::    listen 60s grep -w needle "haystack.txt"
::    listen  1m grep -w needle "haystack.txt"
::
:: @author: mmdemirbas@gmail.com
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: First argument is expected to be sleep time
set SLEEP_TIME=%1

:: Other arguments will be a command with or without some parameter(s)
set command=
:init
shift
if [%1]==[] goto exec
set command=%command% %1
goto init

:exec
 call %command%
 sleep %SLEEP_TIME%
goto exec

How to Boot Last Used Boot Entry in Ubuntu & Windows Dual-boot?

Every time I installed Linux in my machine, I want to set Windows as default boot entry in the GRUB. So, I have not to wait GRUB screen to boot Windows and I have to wait only when I want to boot Ubuntu.

While searching how to do it, yesterday I came up to an askubuntu.com answer explaining a very useful tip about the subject. Do you want to boot Ubuntu as default at every boot time until selecting Windows manually; and then boot Windows as default until selecting Ubuntu deliberately?

Manual Way

This tip explains very simple steps to make GRUB boot last saved (last used) boot entry:

1. Open /etc/default/grub file to modify:
sudo vi /etc/default/grub

2. Change GRUB_DEFAULT value to 'saved'
GRUB_DEFAULT=saved

3. Add a new variable GRUB_SAVEDEFAULT:
GRUB_SAVEDEFAULT=true

4. Update GRUB configuration to reflect these changes:
sudo update-grub

Now, GRUB loader will boot last used entry as default until you select another entry.

Automatic Way


Here is a simple script to do this for you in one-click (gist here):

filename=/etc/default/grub

# Replace GRUB_DEFAULT value to 'saved'
echo :: Setting GRUB_DEFAULT=saved
sudo sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' $filename

# Append GRUB_SAVEDEFAULT=true after deleting old GRUB_SAVEDEFAULT's
echo :: Setting GRUB_SAVEDEFAULT=true
sudo sed -i '/GRUB_SAVEDEFAULT=.*/d' $filename
sudo sed -i '$aGRUB_SAVEDEFAULT=true' $filename

# Update config
echo :: Calling update-grub
sudo update-grub

23 Eylül 2012 Pazar

beep.bat

Sometimes you need to wait a certain amount of time before doing something. But you don't want to check the time constantly. It will be nice if the computer alerts you when the time is up. So, I created a simple BATCH script to achieve this task. All you need if to fire this command:
beep 1:30
And your computer will beep after 1 minute and 30 seconds.

Batch file is below (or here as gist):
:: usage:
::   beep           -- beeps immediately
::   beep 1         -- beeps after 1 sec
::   beep 1:2       -- beeps after 1 min,  2 sec
::   beep 1:2:3     -- beeps after 1 hour, 2 min,   3 sec
::   beep 1:2:3:4   -- beeps after 1 day,  2 hours, 3 min, 4 sec
::
:: invalid usages:
::    beep 1::2
::    beep :1
::    beep 1:
::    beep :1:

@echo off

set part1=
set part2=
set part3=
set part4=

for /f "tokens=1-4 delims=:" %%a in ("%1") do ^
set part1="%%a"& ^
set part2="%%b"& ^
set part3="%%c"& ^
set part4="%%d"

if not x%part4%==x"" (
 sleep %part1%d %part2%h %part3%m %part4%s
) else (
 if not x%part3%==x"" (
  sleep %part1%h %part2%m %part3%s
 ) else (
   if not x%part2%==x"" (
   sleep %part1%m %part2%s
  ) else (
   if not x%part1%==x"" sleep %part1%s
  )
 )
)

echo  ^G

Important note: '^G' represents bell ring character, not two characters '^' and 'G'. You need to replace this two characters with actual bell ring character: [Ctrl+G] (ASCII Code=7). You can generate this character using Notepad++, TextFX > TextFX Tools > Insert ASCII Chart or Character menu option and deleting rest of the table. A bit redundant work :)

Note 2: This implementation relies on sleep command from GNU Win32. This can be implemented also using timout instead of sleep, but you need to convert time to seconds before passing to timeout command.

Make it system command

You need to cd into the directory which beep.bat located in to execute it. If you want to execute it from anywhere, copy the bat file into Windows folder simply.

14 Eylül 2012 Cuma

Downloading MIT OCW (Open Course Ware) Course Materials

I want to download some course materials from MIT OCW, but I need to make much of single clicks to download large number of materials. Instead, I followed the procedure below:

1. Open the course pages which are subject of interest in the Chrome (in separete tabs).

2. Save the session using FreshStart Chrome extension.



3. Export the session just saved.


4. FreshStart will give you a JSON like below:


5. Now, we will generate actual download links from home page URL's. Paste the JSON string to your favorite regex editor. I am using RegexBuddy, and strongly recommend it.

6. Search for this regex (newlines added to adjust layout, delete them when using):
"title":"(?:MIT OpenCourseWare \| ([^\|]+) \| (\d+)\.\S+ ([^,]+),[^"]+|[^"]+\bResource\b
[^"]+)","url":"http://ocw\.mit\.edu/(?:courses/([^/]+)/|resources/res-)(\d+-\w+)-([^/]+)
-(spring|fall|\w+-iap)-(\d+)/

7.  Use following replacement regex to generate links for courses:
http://ocw.mit.edu/ans15436/ZipForEndUsers/\2/\5-\7-\8/\5-\7-\8.zip

8. Use following replacement regex to generate links for resources:
http://ocw.mit.edu/ans15436/ZipForEndUsers/RES/res-\5-\7-\8/res-\5-\7-\8.zip

9. Simply copy both course and resource links and JDownloader automatically grab them from your clipboard. Then click "Continue with all" to start downloads.

10. After dowloads completed, you will obtain files that whose names consists of course code, semester and year:
6-046j-fall-2005.zip

You probably want to know human readable couse name, right? This was the main reason to use FreashStart. In this way, we obtained actual course names from page titles and will rename files with them:
6-046j-fall-2005 - Introduction to Algorithms (SMA 5503).zip

Use following replacement regex to generate proper renaming commands for courses:
ren \5-\7-\8.zip "\5-\7-\8 - \3.zip"

11. Unfortunately, we can not obtaine course name from the resource page titles like we do with courses:
Free Online Course Materials | Resource Home | MIT OpenCourseWare

But we can still obtain them from links, but in lowercase and dashes instead of spaces.
res-6-004-spring-2009 - principles-of-computer-system-design-an-introduction.zip

Use following replacement regex to generate proper renaming commands for resources:
ren res-\5-\7-\8.zip "res-\5-\7-\8 - \6.zip"

12. Copy all the generated rename commands and save as filename.bat. Attention! Replace illegal characters (like colon ':') in file names, otherwise they will be skipped.

13. After downloads completed, put all downloaded files and the filename.bat into the same folder and then double-click to  filename.bat.

HTH someone else..

8 Eylül 2012 Cumartesi

vi Commands: Basic and Useful

Basic Commands

To open a file in vi fire following command from terminal:
vi myFile.txt

Be patient! Don't start to write immediately, because you are not in so called "Insert" mode. Use one of the followings to enable editing:
i
a
Using i causes to insert all what you type before the cursor position. Using a causes to insert after the cursor position.

Edit file as you wish, then just press to ESC to leave the insert mode and you are in command mode again.

Saving and Closing

To write changes to disk:
:w

To write changes to disk and close the file:
:x

To close the file if no change made:
:q

To close the file without writing changes to disk:
:q!

To write changes to disk, when root permission required but vi not opened with this permission:
:w !sudo tee %

Navigating

When editing a file, you need to navigate inside the file frequently. For example, you need to going to end of the file:
:$
Or, you need to going to a specific line number, say 123:
:123
Of course you want to display line numbers in this case (use one of the followings):
:set nu
:set number

Displaying

If you don't like 8 as tab size like me, you can change it to 4 with this command:
:set ts=4
If you want to apply last two commands to all files which will be opened in future without retyping for each file, write this command in shell prompt (not in vi):
EXINIT="set nu|set ts=4"; export EXINIT
You can add other commands separating with the pipe: |

Editing

To cut a line:
dd
To copy a line:
yy
To paste a line after current line/cursor position:
p
To paste a line before current line/cursor position:
P
To undo last change:
u

Selecting

To start visual selection:
v
To start visual line selection:
V
To start visual block selection:
Shift+V
To select three lines, current and next two:
Vjj
To select three lines, current and previous two:
Vkk
To select up to end of line:
v$

Useful Commands

Swap current line with next line:
ddp
Swap current line with previous line:
ddkP

5 Eylül 2012 Çarşamba

Mesleğimi Seviyorum

Hayat boyu kahredeceğin bir mesleği seçme! Maddi tatmini bir şekilde sağlarsın. Ancak sevmediğin ya da sevmeye kendini alıştıramayacağın bir işi hiç yapma daha iyi..

Türkiye'de bilgisayar mühendisleri için çalışma şartları çok değişken. Bunu gösteren kendi yaşadığım iki örneği paylaşabilirim.

İlk Örnek: Süreçsizlik

İlk çalıştığım yerde patronlarımız güler yüzlü idi, çalışanlarla ilişkileri adeta abi-kardeş gibiydi. İş arkadaşlarımdan da oldukça memnundum. Zaten 3-5 kişi idik, bir aile gibiydik. Ancak biraz patronların bilgisayar mühendisliğinden gelmemelerinin etkisiyle 'buna ne gerek var' diye yaklaşmalarından, biraz da ticari kaygılar sebebiyle işi hemen bitirmek istemelerinden ötürü şirkette yazılım süreçleri diye bir kavram yoktu. Yani tamamen sistemsiz, düzensiz, garantisiz bir çalışma yapılırdı. Yapılan şeyin çalışacağı meçhuldü, tekrar yapılmaması ise düşük bir ihtimaldi. Günü kurtarırdık. Bir hastane için yapılan yazılım diğer hastane için değiştirildiğinde hiçbir versiyonlama sistemi kullanılmaz, sonuçta ilk hastaneye yeni bir sürüm konulacağı vakit oradaki ihtiyaçlar ve tercihler unutulmuş olurdu. Kullanıcılar da haklı olarak 'önceki daha iyiydi, bari X özelliği çalışıyordu' derdi.

Çok mesai yapar, çok yorulur, çok yıpranır, mesailerde pizza yer, ama nisbeten az kazanırdık. Yazılımcılığın entropi prensibini yaşardık: "Minimum paraya maksimum çalışma". Sektörde yeniydim, mesleğime dair herşeyi öğrenmeye azimliydim ve karşılığında para aldığım bir işin hakkını vermek istiyordum. Arkadaşlarım kolaylıkla daha iyi bir iş bulabileceğim konusunda tahşidat yapadursun, halimden memnun, mutlu-mesut yaşıyordum.

Zamanla yapılan işin çok allengirli olmadığını anlamaya, dahası kendimi geliştirememeye başladım. Evet evet, asıl noktay buydu! Kendime değer katamıyordum. Sonuçta çalıştığım işe karşı hevesim azalmaya başladı, ama mesleğime karşı değil. Hem az para alıp hem aynı yerde sayıyor olmanın üstüne, insan olarak sosyal varlığımı yok sayarcasına başka şehirlerde günlerce iş kovalamak da eklenince, işte çok çalışıp az kazanmak o zaman koymaya başladı.

Tüm bunlara rağmen ilk çalıştığım şirkette birçok şey öğrendim. Bu arada bahsettiğim şirket hayalinizde canlandığı gibi başarısız bir şirket değildi. Hatta sıfırdan geldiği noktayı düşündüğümüzde gayet başarılı idi. Evet, patronlarımın süreçle ilgisi pek yoktu belki, ama iş yapmayı bilmiyor da değillerdi. Onlardan öğrendiğim, kulağıma küpe olarak kalacak basit görünen ama önemli olduğuna inandığım iki şey: "Biz ödev yapmıyoruz, iş yapıyoruz", "Birşey çalışıyorsa dokunma!".

İkinci Örnek: Köyden Şehire

İkinci şirketim apayrı bir dünyaydı. Çalışanlar yan yana sıkıştırılıp ekranları gözlenmiyor, sürekli başlarının etleri yenmiyor, sabahın seherinden gecenin sessizliğine kadar mesai yapmaları beklenmiyor ve ilk şirkette  kalsam kısa bir süre içinde ulaşmayı düşünemeyeceğim maaşlar veriliyordu. Yol yardımı, yemek yardımı adı altında şirketin paraları çalışanlara peşkeş çekiliyordu!

Şaka. Sadece çalışanların insan oldukları ve memnuniyetle çalışırlarsa daha iyi iş çıkaracakları fark edilmişti. Durun, benim için can alıcı olan kısma henüz gelmedim. Burada Android, Güvenlik, Veri Madenciliği, Görüntü İşleme gibi popüler ve heyecan verici çeşitli konularda çalışmalar  yapılıyor ve çalışanlar eğitiliyordu. Yetmez gibi işe girdikten 6 ay kadar sonra şirket kendini revize etme ihtiyacı hissetti, çalışan memnuniyetini artırma yollarını aradı. İlk olarak maaşlara zam yaparak başladı. Tam bir yıl önce neredeyse iki katı çalışmayla, iki katı stresle aldığım paranın yaklaşık iki katını memnuniyetle almaya başlamıştım.

Hülasa

Maddi tatmini herkes ister, ben de... Ancak birşeyler  üretmiyorsanız, birilerinin kullandığı birşeylerde tuzunuz olmuyorsa ya da birileri tarafından bir takdir emaresi görmüyorsanız maddiyat tatmin etmemeye başlayacaktır. Öğrenerek, kendimizi geliştirerek bir süre oyalanabiliriz, ama sanatımızı icra etme imkanı bulamadıkça huzurumuz yine kaçacaktır parça parça...

Daha iyi imkanlar sunan olabilir. Ancak daha iyisinin olması, insanı iş değiştirmeye iten bir saik değildir, başka sebeplerle beslenmediği müddetçe...

İş değiştirmek ayıp değildir, eski iş sahibine ihanet değildir (çok kritik bir noktada yüz üstü bırakmadığınız müddetçe), eşinden boşanmakla ya da sevgilisinden ayrılmakla eş değer bir olgu değildir. İş değiştirmek, hayatın akışı içerisinde yaşanabilen normal bir olaydır.

Her iş bir tecrübedir, belli bir vakte kadar yaşanması gereken bir tecrübe.. İleriye dair hayallerim var, ancak geriye baktığımda pişmanlıklar değil tecrübeler görüyorum. Şükür.


10 Ağustos 2012 Cuma

Improvements on Code syntax highlighting for Blogger dynamic views

I have wrote about snytax highlighting in Blogger dynamic views recently. In this post, I will try to improve a few things.

1. Quick style change

Highlight.js is providing 20 style themes currently. You may want to change your theme from time to time, or may want to choose a best-fit theme seeing in action. With the method I explained in previous post, you have to modify HTML template for your blog each time you want to change the theme. Lots of work!

Similiar to helper.js trick, we can reference a style.css file inside the blog template, then import the style whichever we want in this file.

Firstly, Create a stylesheet file (style.css) near to your other files (helper.js etc.). Content of the file will be:
@import url("styles/ir_black.css");
Put relative path of the your desired CSS here.

Then, Change stylesheet target in the blog template to:
<link href='http://my.domain.com/highlight/style.css' rel='stylesheet'/>

2. Font type of some code parts

Some code blocks couldn't be formatted in Courier font. For example, a code block looks like this:
<script>format()</script>
or like this:
class Greeter
def initialize(name)
...

But, we want this:
<script>format()</script>
or this:
class Greeter
def initialize(name)

...
As you see, we want to format Greeter, initialize, script and other "title"s in Courier (not Sans) as well as other parts. So, I realized that all of this problematic parts has a common point: All of them located inside a span of class "title":
<span class="title">...</span>
It looks like our CSS file lacks a definition for
pre .title
So, we need to add it. Instead of adding this to all styles we were given by Highlight.js, it is enough to add to only our style.css which we just created.

Result

Resulting content of the style.css here:
@import url("styles/ir_black.css");

pre .title {
  font-family: Courier;
}

2 Ağustos 2012 Perşembe

Code syntax highlighting on Blogger dynamic views

Highlight.js is a simple code syntax highlighter, namely formats source codes on web pages as in your favorite editor. Currently 51 languages supported and 20 style themes provided. You should view Demo page for a quick overview. If you think to use it with small number of languages, you can choose only interested languages from download page to include in your version.

I want to use Highlight.js with Blogger's dynamic views to format source codes. I did a bit research effort to make it work, so I am writing a quick tutorial for records and others.

Step 1: Download Highlight.js

Go to download page, select your desired languages and tap to download.

Step 2: Host files somewhere public like Dropbox

They will give you a zip file contains highlight.pack.js and styles. You have to host them somewhere public. So, whenever someone's browser needs the files, it must be able to access them. I put them under my Dropbox account.

Step 3: Write the little helper method and host it too

Save following function as helper.js and host near to other files:
function format(){
    var b=document.getElementsByTagName("pre");
    for (i=0;i<b.length;i++)
        hljs.highlightBlock(b[i],null,false)
}

Why you should do this? Because, without this, you have to add id="code" attribute to pre elements of code blocks and also append following lines to all the posts needs source code formatting :
<script>hljs.highlightBlock(document.getElementById('code'), null, true);</script>

Doing this for each post is ugly and also hard to write. Fortunately, we can shorten this to easy to remember form below and also get rid of id="code", thanks to helper.js:
<script>format()</script>


Step 4: Link files modifying Blogger template


Go to Blogger control panel, select Template and click to Edit HTML. Blogger will warn you:
Because you know what you do and you are expert, take risk and click Continue.

Find closing head tag (</head>). Link your CSS and JS files writing corresponding markup before the </head> tag:
<!-- Code syntax highlighting -->
<link href='http://yourdomain.com/highlight/styles/solarized_light.css' rel='stylesheet'/>
<script src='http://yourdomain.com/highlight/highlight.pack.js'/>
<script src='http://yourdomain.com/highlight/helper.js'/>

Step 5: Try it

After that moment, all your pre tags treated as source code and attempted to be formatted properly. For example if you write this:
<pre><code>
# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end
 
  def salute
    puts "Hello #{@name}!"
  end
end
 
# Create a new object
g = Greeter.new("world")
 
# Output "Hello World!"
g.salute
</code></pre>
<script>format()</script>


You and your visitors will see as this (after browser executes javascript and reformats pre tags):
# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end
 
  def salute
    puts "Hello #{@name}!"
  end
end
 
# Create a new object
g = Greeter.new("world")
 
# Output "Hello World!"
g.salute

Important usage notes!
Note 1: You have to replace little than mark (<) in the code with  &lt; if exists.
Note 2: You should put  <script>format()</script>  to a page only once after all  pre tags.
Note 3: You should read next post I wrote about some improvements on styles.

Step 6: Mastering Highlight.js

If you write only pre tags, language will be detected heuristically. However, you can specify language explicitly using <pre class="ruby">. Visit Highlight.js site for further details.

Tips for this blog - Blog Language

I am writing some post in Turkish and others in English. I know this is a bit dirty way, but this is the case :)
So, you may want to read articles only in one language. I will give you a little tip for your comfort.

For Turkish posts, visit:

For English posts, visit:


You can extend this feature to other tags which you will see under articles:


Clicking a tag also does same thing:

Hopes to help...


Bu blog için ipuçları - Blog Dili

Bazı gönderileri Türkçe, bazılarını İngilizce yazıyorum. Pek düzgün bir yöntem olmayabilir, ama durum bundan ibaret :) Belki sadece bir dildeki yazıları okumak isteyebilirsiniz. Şimdi bunun için size küçük bir ipucu veriyorum.

Sadece Türkçe yazılar:

Sadece İngilizce yazılar:


Bu özelliği, yazıların altında göreceğiniz diğer yazı etiketlerine de genelleyebilirsiniz:
Faydalı olması dileğiyle...

1 Ağustos 2012 Çarşamba

Reading PDF files in Kindle

PDF Support

My e-book library consists of PDF files mainly. Fortunately, Kindle supports PDF files as well as other formats including DOC, DOCX, PNG, BMP and a few more. Thus, you can view PDF files in your Kindle and zoom in/out if you want.

Problem


This feature will be enough for you, if the PDF file has narrow text columns that fit to the Kindle screen properly and font size is sufficently large to be able to read easily, But this is not the case for all PDF files even in landscape mode. Yes, you can zoom in, but column doesn't fit to screen this time. So, you need to be able to increase font size of PDF keeping column size fixed for reading comfort. Just as with Kindle (AZW) file formats.

Solution: Converting PDF to Kindle (AZW - AZW3)

Method 1: Mail to Kindle Store with "convert" subject


Amazon gives you an email address like [name]@Kindle.com to allow you sending your documents to your Kindle from anywhere. When you send a file to this mail, it will be loaded to your related Kindle automatically whenever the Kindle connected to the Internet. If you send the PDF directly to this mail, it will be loaded as PDF also to your Kindle. But if you send the mail putting "convert" word to the subject, then it will be loaded in Kindle format and you will be able to play with layout and font.

Method 2: Using Calibre

If conversion result from the Method 1 didn't satisfy you, then try second method: The Great "E-Book Management" Software: Calibre (free, multi-platform).

Load your book and right click it, then select Convert individually. (you can convert multiple files in once using Bulk convert).


A window will pop up to adjust conversion settings. Select desired output format. This will be AZW in this case. Click OK. Wait conversion to complete. Copy your file to Kindle using USB cable.

If result is still not sufficient, retry after enabling Heuristic Processing.


Note: If you converted PDF file using Calibre and your Kindle doesn't show it, then check your firmware version and update if necessary.

Comparison of the methods

In my case, mail method made a better job in document formatting. So I used this version of the document. It may exists a case which Calibre does better. You should use both methods for each single file and compare results to choose one.

Why my Kindle doesn't have landscape mode

I just purchased a new Kindle Touch 3G and started to use immediately. I looked for an option to view files in landscape mode instead of portrait mode, but I couldn't find anything. But wait, I am sure there is such an option in an older model Kindle belongs to a friend. Then I came up to a post on CNET:
Amazon has updated the firmware for the Kindle Touch to version 5.1 and it actually has a few significant feature enhancements, including one that a lot of folks have been clamoring for: a landscape reading mode.
Great. I grabbed the hint. Then I visited the Kindle Touch Software Updates page. Reading the page, I noticed that my firmware version is very old :) So, updated the firmware as the site instructs and now I have landscape mode. Update operation is very easy if you obey the instructions.


30 Temmuz 2012 Pazartesi

Open file location from inside Eclipse

We know, we love and we are frequently using "Open Folder in Windows Explorer" in Visual Studio:


Unfortunately, Eclipse lacks a similar option. StartExplorer is an Eclipse plugin to fill this hole. To be honest, it is more than this:
You can visit Github or SourceForge page of the project.


Eclipse update site for impatient:
http://basti1302.github.com/startexplorer/update/

Highlighting log files in Notepad++



Popular programmer's editor  Notepad++ provides syntax highlighting for several programming and scripting languages. Because, I don't like reading code as plain text, this is very nice feature for a programmer like me. But better one is that Npp makes extendable this feature allowing you to create custom syntax highlighting:
User-defined language (UDL).


To take advantage of the UDL, open User-Defined Dialogue... under View menu:

A window like below one will pop up:

Now, you can play with the toy or import an existing UDL file (which is an XML file). My custom UDL for LogFiles is below. Save as LogFile.xml (or dowload directly):

<NotepadPlus>
    <UserLang name="LogFile" ext="log">
        <Settings>
            <Global caseIgnored="yes" />
            <TreatAsSymbol comment="no" commentLine="no" />
            <Prefix words1="no" words2="no" words3="no" words4="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Delimiters">[(0])0</Keywords>
            <Keywords name="Folder+"/>
            <Keywords name="Folder-"/>
            <Keywords name="Operators">&apos; - ! &quot; # $ % &amp; ( ) * , . / : ; ? @ [ \ ] ^ _ ` { | } ~ + &lt; = &gt;</Keywords>
            <Keywords name="Comment">1 2 0</Keywords>
            <Keywords name="Words1">ERROR</Keywords>
            <Keywords name="Words2">WARN WARNING</Keywords>
            <Keywords name="Words3">DEBUG</Keywords>
            <Keywords name="Words4">INFO</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="FFFFFF" 
                        bgColor="FF0000" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="FFFFFF" 
                        bgColor="FF8000" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="FFFFFF" 
                        bgColor="FF80FF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="FFFFFF" 
                        bgColor="0080FF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="FF0080" 
                        bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" 
                        bgColor="FFFFBF" fontName="" fontStyle="1" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="800000" 
                        bgColor="FFFFFF" fontName="" fontStyle="2" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
        </Styles>
    </UserLang>
</NotepadPlus>



Press Import... button and select LogFile.xml you just saved:



OK. Whenever you want to highlight a file according to LogFile UDL rules, you can select it under Language menu:


But, this is impractical. You want to see log files highlighted everytime you open a file with .log extension, don't you? So, you should associate log extension with LogFile UDL. Just write the extension to the box labeled as Ext. Note that you can write multiple extension separating them with spaces:


You will end up a log file like below:

Nice, isn't it?

WSO2 ESB + ClientAccesPolicy.xml + CrossDomain.xml

ClientAccesPolicy.xml and CrossDomain.xml files have to be found at root of your services Silverlight and Flex clients to be able to acce...