Friday, August 07, 2009

nasm in Mac OS X

I was trying to compile a simple assembly program in Mac OS X (Leopard).

I was getting an error message

ld: could not find entry point "_start" (perhaps missing crt1.o) for inferred architecture i386

A simple asm program for FreeBSD and MacOS
(we have to use the stack for system call, from http://asm.sourceforge.net//howto/Assembly-HOWTO.rtf)

section     .text
global _start ;must be declared for linker (ld)

_syscall:
int 0x80 ;system call
ret

_start: ;tell linker entry point

push dword len ;message length
push dword msg ;message to write
push dword 1 ;file descriptor (stdout)
mov eax,0x4 ;system call number (sys_write)
call _syscall ;call kernel

;the alternate way to call kernel:
;push eax
;call 7:0

add esp,12 ;clean stack (3 arguments * 4)

push dword 0 ;exit code
mov eax,0x1 ;system call number (sys_exit)
call _syscall ;call kernel

;we do not return from sys_exit,
;there's no need to clean stack
section .data

msg db "Hello, world!",0xa ;our dear string
len equ $ - msg ;length of our dear string

In Mac OS X we should use format macho
nasm -f macho hello.asm

and for the linker (we need to specify the entry point)
ld -e _start -o hello hello.o



resources:
http://asm.sourceforge.net//howto/Assembly-HOWTO.rtf
http://zathras.de/angelweb/blog-intel-assembler-on-mac-os-x.htm

Saturday, April 18, 2009

recover kopete password

I was trying to recover a password from a kopeterc file.

Open the kopeterc file in a hex editor
In the password location you will find three-byte chunks: [EF][BE][XX]. The first two bytes stay most of the time same.
Just subtract each third byte from 0x1001F then you will get the character value from ASCII table.

everything was working fine as mentioned in Raphman's blog

But I had a little problem with numeric value. My combination was "EF BE XX" but before the numeric value it was "EF BF XX".

For the numeric value I have to subtract 0x40 again to get the original value.

It worked for me at last...

src: http://my.opera.com/raphman/blog/2008/02/01/kde-pasword-obfuscation?cid=7484288

Saturday, December 13, 2008

Bengali in LaTeX in Mac OS X

I have installed LaTeX for Mac OS from http://www.tug.org/mactex/

I was trying to write Bangla in LaTex. Found two ways to write bangla in LaTeX.


Unicode Standard

written by Golam Mortuza Hossain. Here I am just writing how to do this in Mac OS.

First download freefont-ttf-xyz.tar.gz from

http://savannah.nongnu.org/download/freefont/

or
ftp://ftp.gnu.org/pub/gnu/freefont/


which containing
-------------------------
FreeSerif.ttf
FreeSerifBold.ttf
FreeSerifItalic.ttf
FreeSerifBoldItalic.ttf


Paste these fonts in your "Macintosh HD/Library/Fonts/"

Now try sample document in TeXShop

\documentclass{article}
\usepackage{fontspec}
%
% This file is a based on the sample tex file to illustrate use of
% XeTeX in typesetting Bengali document.
% License under GNU FDL by Golam Mortuza Hossain, 2008
%
%url: http://methopath.wordpress.com/2008/06/26/writing-unicode-bengali-in-latex/
%
\font\serif="FreeSerif:script=beng"
\font\serifbb="FreeSerif:script=beng" at 24pt
\font\deffont="FreeSerif:script=beng" at 14pt

\title{\bf\serifbb সত্যজিৎ রায়}
\author{\bf\serif উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে}
\date{}
\begin{document}
\deffont %Default font used for the document
\maketitle
সত্যজিৎ রায় (২রা মে, ১৯২১ – ২৩শে এপ্রিল, ১৯৯২) একজন বাঙালী চলচ্চিত্র নির্মাতা ও বিংশ শতাব্দীর অন্যতম শ্রেষ্ঠ চলচ্চিত্র পরিচালক। কলকাতা শহরে সাহিত্য ও শিল্পের জগতে খ্যাতনামা এক বাঙালী পরিবারে তাঁর জন্ম হয়। তিনি কলকাতার প্রেসিডেন্সি কলেজ ও শান্তিনিকেতনে রবীন্দ্রনাথ ঠাকুরের প্রতিষ্ঠিত বিশ্বভারতী বিশ্ববিদ্যালয়ে পড়াশোনা করেন। সত্যজিতের কর্মজীবন একজন বাণিজ্যিক চিত্রকর হিসেবে শুরু হলেও প্রথমে কলকাতায় ফরাসি চলচ্চিত্র নির্মাতা জঁ রনোয়ারের সাথে সাক্ষাৎ ও পরে লন্ডন শহরে সফররত অবস্থায় ইতালীয় নব্য বাস্তবতাবাদী ছবি লাদ্রি দি বিচিক্লেত্তে (ইতালীয় ভাষায় Ladri di biciclette, "সাইকেল চোর") দেখার পর তিনি চলচ্চিত্র নির্মাণে উদ্বুদ্ধ হন।
\end{document}



Select "XeLaTeX" from drop down menu and click "Typeset" button for Output in TeXShop.




reference: http://methopath.wordpress.com/2008/06/26/writing-unicode-bengali-in-latex/






Bangtex

First Bengali typesetting system using LaTeX. Which use a non-standard approach to write bangla.

example:

\centerline{\bngxxv ra\*g*er OShudh}
\centerline{\bngxviii sukumar ray}

-----------------------------------
which give output
-----------------------------------
রোগের ওষুধ
সুকুমার রায়

download bfonts.tar.gz, bsty.tar.gz, bsample.tar.gz from
http://www.saha.ac.in/theory/palashbaran.pal/bangtex/bangtex.html


Installing the font files
cd /usr/local/texlive/2008/texmf-dist/fonts/source
sudo mkdir bangla
extract bfonts.tar.gz in /usr/local/texlive/2008/texmf-dist/fonts/source/bangla/
Installing the macro files for LaTeX
cd /usr/local/texlive/2008/texmf-dist/tex/latex
sudo mkdir bangla
extract bsty.tar.gz /usr/local/texlive/2008/texmf-dist/tex/latex/bangla/
Initializing the files
sudo texhash

reference: http://www.saha.ac.in/theory/palashbaran.pal/bangtex/install.html#linux

Thursday, November 06, 2008

Probhat Installer for MacOS

I have created Probhat installer for MacOS.

You can download it from Ankur website click here.




Details on Ankur Wiki

Saturday, September 20, 2008

get database structure using PHP

I was facing problem to connect a mysql host, as it was only accepting connection from a specific server. But I need to know the database structure to design some report.

At last I have written a simple php code to print the table name along with the structure.


<?php

mysql_connect("host_name","user","password") or die(mysql_error());
mysql_select_db("database_name") or die(mysql_error());


$result = mysql_query("SHOW TABLES;") or die(mysql_error());

while($row = mysql_fetch_array($result)){

echo $row[0]; //print the table name

$result2 = mysql_query("DESCRIBE ".$row[0].";") or die(mysql_error()); //get details schema for each table

echo "<table border='1' width='70%'>";
echo "<tr><td>Field</td><td>Type</td><td>Null</td><td>Key</td><td>Default</td><td>Extra</td>";

while($row2 = mysql_fetch_array($result2)){

for($i=0; $i<6; $i++){
if($row2[$i] == "" || $row2[$i] == NULL){
$row2[$i] = " ";
}
}

echo "<tr>";
echo "<td>".$row2[0]."</td><td>".$row2[1]."</td><td>".$row2[2]."</td><td>".$row2[3]."</td><td>".$row2[4]."</td><td>".$row2[5];
echo "</tr>";
}

echo "</table>";
echo "<br/>";
}

?>


Just change your database configuration then upload in your server. Browse the url and you must delete the file from server after get the structure. Be safe...

Sunday, August 31, 2008

function call in javascript

I was studying russkey.mozdev.org source code to learn how to write Firefox extension.

Found this style of function call in javascript.


var collection = {

hello : function() {
document.write("Hello World!");
},

understand : function() {
document.write("<br/>Understand!");
},

bye : function() {
document.write("<br/>bye!");
}

};


var m = new collection.hello();
var n = new collection.understand();
var o = new collection.bye();



The output will

Hello World!
Understand!
bye!

Saturday, August 30, 2008

My Facebook application



apps.new.facebook.com/circle_of_blood/
or
apps.facebook.com/circle_of_blood/


Special thanks to Dr. Hamza for joining in this project and sponsor the hosting.