Archive

Author Archive

How to SSH Tunneling in Windows and Linux

November 9th, 2009 sadegh No comments

If you ever wanted to ssh tunnel your traffic here is how to do that on Linux box or Windows box.

On Linux box then just enter the following line :

ssh -fND localhost:3443 ServerUName@Server

You gotta change ServerUName to Username and Server to the IP or the name of server you are logging into.

On Windows Box you need to download putty ( Download ) then Open it up

It doesn’t require any installation just double click on putty.exe after it opened up in the left menu select SSH in the “Preferred SSH protocol version” choose 2 and above it check the “Enable Compression”

Figure 1

Figure 1

Then click the plus sign beside SSH in left menu to expand it, then select “Tunnels” afterward in the right section in “Source port” enter for example 3443 and below the destination choose dynamic as in the below figure. ( Sorry in this figure I entered 9191 instead of 3443 but it doesnt matter you can enter whatever you want but you gotta change all the others 3443 as well if you change it)

Figure 2

Figure 2

Then hit “Add”, Now in forwarded lists you would see “D3443”.

Now scroll up the left menu and choose “Session” in the “Host Name” enter the IP Address or the host name and then click on “Open” button

Figure

Figure

Then it will ask your credential enter them.

Figure 4

Figure 4

So now in Firefox I go to Edit → Preferences → Advanced → Network → Settings → Choose Manual proxy configuration , Uncheck Use this proxy server for all protocols and clean HTTP proxy and its port Field and all the other fields then go to SOCKS Host and enter localhost into that field and in the port field enter 3443.

Figure 5

Figure 5

Then click on ok and close all the window ,

Now all the traffics in Firefox first go to your server and then from that server goes to outside world or to your Computer.

You can confirm that by going to ipchicken.com, You should see the IP Address of the server that you just set for tunneling not your own IP Address.

How to start your own country ?

October 24th, 2009 sadegh No comments

Have you ever thought or wanted to start your country ? Or at least wanted to know whether its possible or not ? Are there any other people who thought about it before or did they take action ?

If your answer to any of above question is Yes then read the rest ;)

I really wondered to see whether am I able to start my own country, suddenly one day I found “How to start your own country” BBC TV series. Actually its a comedy but its inspiring , it shows that not only others are thinking about it, but also they created a documentary comedy based on this idea !

Then I started googling about this thought, In the “How to start your own country” , Danny introduced a micronation called Sealand

Sealand

Sealand

Its far from what I thought to be my country. But its a country ! And there are other micronations

but I want something bigger than just a micronation.

Then I found this article that teaches you how to start your own country in just four easy steps.

The first step is “Make sure your are eligible”

and the fist item in this step is to have a defined territory.

Unfortunately my search for a territory failed, On one hand it costs a lot and on the other hand it must be somewhere that the current government accept it unless I’ve got enough army power to defend my country.

So we go to second item which says I should have enough permanent population. I think if I find enough population then I can establish my own army and then I can define my territory and defend it, so it must be the first Item.

I thought to start a web site that let people to register themselves to be citizens of my country , It seemed good thought until I find “Cyber Yugoslavia”.

Its a site that ask citizen of Yugoslavia to register and when their registered member reached 5 million they are gonna apply to the UN for member status and then they start to establish their physical real country. This site launched in 1999 and till now ( 2009 ) only 16768 person registered. For ten years 16768 means 1677 per year and 139 per month and 4 and half per day ( in their site they claim that they receive 600 application per day :) ).

For an army I need at least 5-10 thousand man and with my calculation It takes 6 years even if I become as successful as “Cyber Yugoslavia” !

Well I think I should investigate more and its not appropriate time for me to starting a country, Coz I dont have enough money and population.

Beside that I wanna establish a developed country not a micronation like Sealand.

Categories: fun, non-programming Tags:

The Best VNC Software

October 13th, 2009 sadegh 1 comment

I really like VNC, It helps me in my every day work. Most of the time I wanna share screen to see my Colleagues screen and help them out or vice versa.

There are different VNC software which you can use, for example, TightVNC , RealVNC and UltraVNC. So lets see which one is the best.

TightVNC

tightvnc

tightvnc

I didn’t use this one very much, because of the other ones ;) but it seems quite cool software beside its Open Source and free. But it has ~ like many other remote screen software, problem with multiple monitors.

RealVNC

RealVNC

RealVNC

I used this one for quite long time and I really enjoyed using it But you gotta purchase it.

It has also free version but free-version is featureless and has nothing compared to other free VNC software.

Like TightVNC it has problem with multiple monitors.

UltraVNC

UltaVNC

UltaVNC

Now I use this guy. I think its The best one. First of all its Open Source and free and the other one it doesn’t have any problem with multiple monitors.

UltvaVNC has cool Addons, you may like to check them out here.

One of them is called singleclick. Its awesome , you can create a single file and send it to your customer, this file is just 166k. When they click on it and run it you can connect to their computer remotely. Its better than Remote Assistance or any other solutions

VNC Software in other environments


PortableVNC ~ PSP

There is a application called portablevnc, Its vnc viewer for psp

PalmVNC ~ Palm

Its vnc viewer for Palm OS® platform.

SymVNC - Symbian

Its VNC viewer for Symbian 3rd Edition .

J2ME VNC ~ J2me

Its VNC viewer that uses j2me api. Theoretically it must run on every smart phones.

JaaduVNC ~ iPhone

Its VNC viewer for iphone

Automating your tasks , AutoIT

August 19th, 2009 sadegh 1 comment
MsgBox(0, "nothingelz.com", "Hello World!")

The above line is a simple code which shows a Message Box. You just need to open notepad write it down and save it with “.au3” extension, oh I was almost forgetting before that you need to go to http://www.autoitscript.com/autoit3/downloads.shtml and download AutoIt . Unfortunately Windows is only supported operation system.

AutoIt

AutoIt

Well thats it, You created your first AutoIt script.  It’s cool, isn’t it  ? AutoIT is actually really good for small daily work, you can write small script in AutoIt to do your daily chores

e.g. I use following script everyday morning when I arrive at work :

$answer = MsgBox(4, "nothingelz.com", "Good morning , do you want me to start Visual Studio and SQL Server Management Studio and Firefox ?")

If $answer = 7 Then

MsgBox(0, "nothingelz.com", "OK.  c ya!")

Exit

EndIf

Run("C:\Program Files\Mozilla Firefox\firefox.exe") ; firefox huh ?

Run("C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe") ;visual studio

Run("C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe") ;sql …

It will ask me whether or not I want it to run Firefox , Visual Studio and Sql Server Management Studio ( these are application that I use everyday at work ) so I do not need to put all of these apps short cut on my desktop and also with one click all of them will be lunched ;)

So lets analyze Above code , in first line I called MsgBox function and put its returns value to variable called $answer. MsgBox accepts three parameters , the first one is called flag which indicate which kind of Message box we want with which kinda buttons combination

0 OK button
1 OK and Cancel
2 Abort, Retry, and Ignore
3 Yes, No, and Cancel
4 Yes and No
5 Retry and Cancel
6 ** Cancel, Try Again, Continue

This table shows  possible value for flag parameter, as you see we used 4 which means that we want Yes/No MsgBox.

The second parameter is Message Box Title and the third one is its message. This function return a value , possible returned values includes :

Button Pressed Return Value
OK 1
CANCEL 2
ABORT 3
RETRY 4
IGNORE 5
YES 6
NO 7
TRY AGAIN ** 10
CONTINUE ** 11

In  conditional statement ( If statement ) we check whether user clicked on “No” or not ( in the above table you see that if our return value is 7 , it means user clicked on “No”) . if it was correct we move on next line and show a message to user and then we call “Exit” which exit our script otherwise we skip it and go to the whatever comes after “Endif” .

Then we call Run function, it accepts a path to a file and run it. We just call it three times with path to Firefox , Visual Studio and Sql Server Management Studio.

That’s it, You can change parameter of “Run” and point it to the application which you use. Almost everything else in AutoIt is the same as above code.  A Complete Help comes along with AutoIt which contains list of all function and their parameters and return value and purpose of them which is really helpful.

AutoIt is really cool scripting language you can learn it very soon and it has a rich library, full of useful functions.

Categories: programming, windows Tags: ,

Running Homebrew Application

August 18th, 2009 sadegh No comments

If you got a psp with a CFW higher than 1.5 ( Mine  is 5.00 ),  You can not run Homebrew ( HomeMade) Application on it . If you want to run Homebrew application ( Apps like Bookr or psppdf or … ) you gotta downgrade it to CFW version 1.5.  Here is two way to achieve that :

1.You can use Time machine , here is instruction how to install it.

If you wanna try Time machine , You need a lot of stuff including : JigKick Battery ( Pandora’s Battery) . 1.50 EBOOT.PBP download, 3.40 EBOOT.PBP download, 360.PSAR download , Time machine itself download
Consider that Time machine currently just support :> Classic PSP: Offical 1.50, 3.40 OE. Slim PSP: Modified 1.50 (with 3.40 modules for Slim support), 3.60 M33 Dark_AleX a

I got a 5.00 M33-6 so time machine is not an option to me ;)

2.Using LEDA

In my idea best solution is  LEDA ( Legacy Software Loader )
You can download it easily from here its just about 72 KB ( think of time machine for a moment , time machine and all of the stuff it needs are about 52 MB ). Okay When download finished just extract it and Copy the “LEDA” folder to ms0:/PSP/GAME/ , alright now disconnect your psp from your computer and go to Game and Run LEDA , it will process something for a less than a minute and then you will see “finished” then it will automatically close. Congratulation its finished, just go and get some homebrew and copy them to your psp and enjoy them.

VirtualBox - Sharing

August 14th, 2009 sadegh 2 comments
VirtualBox

VirtualBox


VirtualBox OSE 2.1.4 comes along with Ubuntu jaunty jackalope.
Its a great virtualing solution but one part of it may bother you and that is Sharing.
Actually Sharing files & folders is not that much hard or annoying but sometimes it can be and it really bothered me.
I installed windows xp in virtual box easily and just wanted to share my folders with it. So under Devices menu I choosed Shared Folders and I added folder which I wanted to be shared but it did not work , after some googling I noticed that I should install Guest Addition ( its also an Item in Devices menu ) so I selected Install Guest Additions and It downloaded and asked me whether I want it to mount to my virtual machine and I just selected YUP.

Devices menu

Devices menu

But when I clicked on my cd drive on virtual machine it said that “windows cannot read from this disk the disk might be corrupted or it could be using a format that is not compatible with windows”
I googled more and more and it seemed that I am the only person on earth having this issue
in a thread in Ubuntu Forums one of the post contained the virtual box download link , I thought that I should get a new and clean version of virtual box and install it from scratch so I clicked on that link and suddenly instead of starting Kget firefox opened a page that contained a big forbidden message. Afterward I realized that because my ip address is from Iran and VirtualBox is a Sun product so they forbided me as an iranian to download their package , and more importantly I realized that windows was saying can not read the mounted disc because it was not actually a image of a disc but it was a html page that contained forbidden message coz when I click install guest addition it also try to download it from sun web site , instead of package it just download a forbidden web page.
Eventually I found a alternative link to download it and now it works great

ps : download Guest Addition 2.1.4 from here : http://www.dward.us/software/VBoxGuestAdditions_2.1.4.iso

Ubuntu ME edition

July 28th, 2009 sadegh No comments

I just bought a version of Ubuntu middle east edition
The first sign after installing , was the fact that you got a green color rather than decent brown color
Afterward , Beside the cursor you would see some Islamic terms , its really bothering and the worst part is that you cant change it , its a damn bug , the only workaround is to changing your visual effect to non.
I will write about it more later

——————————————————-
Okay Actually When I let Ubuntu to download its latest update everything works just great.

Using foxpro database file (dbf) with c#

July 15th, 2009 sadegh 1 comment

Have your ever needed to connect to foxpro databases ?

Hopefully not , but sometimes you need , and the last day I needed.

Well you can easily OleDb classes defined in System.Data.OleDb namespace

to connecting and working with your database

But beforehand you need to installVisual FoxPro Ole DB Provider , you can get it from here

Well now its easy to connect to you dbf file with OleDbCommand and OleDbConnection and … dont forget to specify that you are using foxpro in your connection string , a simple connection string would be

Provider=vfpoledb.1;Data Source=C:\db\


c:\db\ is where your database file resides, but be careful that if you have a database file called mydb.dbf and its in c:\db\ then if you wanna get all rows of it you should just put database file location in connection string and database file name itself is a table name so in OleDbCommand we write

select * from mydb

now you can do whatever you want with your database

but just memo field in foxpro needs a trick

you can easily set any value to your memo field , but that value must be lower than 255 character

and we all know that Memo fields are limited only by the amount of available disk space so its a lot bigger than 255 character

the workaround is dividing your value into 255 charactered values.

I mean that “update mydb set memofield = ‘ string with more than 255 character ‘” wouldnt work but if you divide string into 255 charactered values like this “update mydb set memofield = ‘ string with 255 character ‘ + ‘ string with 255 character ‘ + ‘ string with 255 character ‘ ”

it would work

here is a sample code in c# , it gets all rows of mydb database

var oConn = new OleDbConnection(@"Provider=vfpoledb.1;Data Source=C:\db\");

oConn.Open();

using (var oCom = new OleDbCommand("select * from mydb", oConn))

{

var oReader = oCom.ExecuteReader();

while(oReader.Read())

{

// do what you wanna do !

}

}

oConn.Close();

well , till next time ;)

p.s. DBFView is a cool tool for opening dbf file , check it out here
Categories: C#, programming Tags: , , ,

Dr. UFD is a Life Saver

June 10th, 2009 sadegh 8 comments

Yesterday was a nightmare for me coz I needed a memory storage device for highly needed information and suddenly my memory stick stopped working, I was shocked .

my Cell Phones memory is always full and they were quite big files ( about 6 gig ) and it wasn’t possible to upload them somewhere on net.

God thanks I knew something called Dr. UFD that once before helped me to surviving my Memory Stick , I googled and googled ( ah bing really sucks J ) and finally I found Dr. UFD

And this little tool easily Survived my Memory Stick in less than a minute ( my memory stick is Transcend JF V85 even Transcend own tools and Hp and others didn’t helped)

So I do recommend to having a copy of this cute tool almost everywhere with yourself

You can download it directly from here

Categories: non-programming Tags:

Delphi Short Cuts

May 30th, 2009 sadegh No comments

Last night i started using delphi again , but this time delphi 2009
Its a really speedy and light weight IDE in comparison to Visual Studio
But i dont like its code editor , specially delphi color highlight and becoz i use ViEmu in visual studio , i really missed it when i started coding in delphi so i googled and i found some good Delphi short-cuts which you can use :

  1. ESC selects the parent control of the current selected control in the designer.
  2. Ctrl+Drag the mouse to select a group of controls without selecting/moving the parent. When controls are in a panel for example.
  3. Shift+Arrows to resize controls.
  4. Ctrl+Arrows to move controls.
  5. CTRL+SHIFT+I indents selected code CTRL+SHIFT+U unindents selected code
  6. CTRL+K+N converts the selection to UPPERCASE CTRL+K+O to convert it to lowercase
  7. CTRL-J invokes live templates
  8. CTRL + Shift + C generates method header from body description and vice-versa.
  9. CTRL + Shift + Space gives a hint with method signature when editing a method call
  10. Ctrl-Shift-0 .. Ctrl-Shift-9 sets marker (or clears if caret is in marked line)
  11. Ctrl-0 .. Ctrl-0 jumps to marker
  12. Ctrl-Shift-Enter finds references for current symbol (where caret is) in the project
  13. CTRL+SHIFT+G to generate / insert a new GUID at the cursor position
  14. CTRL+ALT+P to activate Pallete Window and do component filtering depend on the text you entered
  15. Press Ctrl+Shift+R to begin recording a macro.
  16. To play back the macro, press Ctrl+Shift+P.
  17. Ctrl-Shift + Up/Down jumps between declaration and implementation of a routine
  18. Alt+End: to navigate through opened windows in the IDE (undocked view).
  19. Ctlr+Y: to delete the current line
  20. Alt+Up: same as Ctrl+Click or Find declaration
  21. Alt+Arrow Left/Right: navigate through your ‘Find declarations’
  22. Ctrl + Alt + F12 opens up the top-right dropdown menu of opened units
  23. CTRL+SHIFT+V - Declare variable
  24. CTRL+SHIFT+E - Rename identifier
  25. CTRL-E for “search-as you type”

Categories: delphi, short-cut Tags: