Tuesday, April 17, 2007

!C#, But Still Kung Fu :: JavaBilliards



Here is a small billiards game, developed for an OOP class:

Ball.java
GlobalVar.java
Hole.java
Main.java
Table.java

Jimmy is still my hero...

Wednesday, February 21, 2007

Knight's Tour

Description

Knight's tour is a popular chessboard puzzle and the problem is to find a sequence of moves by a knight that will visit every square of the board exactly once. Such a sequence is generally referred to as a knight's tour. Our task is to write a program that uses backtracking to find such a tour. Each square on the chessboard should have a number that indicates its position in the tour. Assume that the first position, position "1", is in the top left corner of the board.

Before we start we will need couple of classes to solve the task

1.Knight - representing the knight

2.Square - representing a cell from the board. Also this Square class will be used to compose the chess board

3.Main - to run everything




Friday, February 09, 2007

aMusaic Final Release

How to use the program:
Download any of the zip files according to your preferences.

-------------------

aMusaic.zip (250 KB)

Extract the files into a directory. Start the aMusaic.exe and add a folder/folders of your choice. After the process is done, load an image, adjust settings and start the program. Good Luck!

-------------------

aMusaic + Image Library.zip (27 MB)

Extract the files into a directory. Start the aMusaic.exe and add the folder Image Library. Image Library is a special collection of images, pre-resized, in order to boost the performance of the createion process. After the process is done, load an image, adjust settings and start the program. Good Luck!

-------------------

This application has been written in C# .NET 2.0. In case you do not have the .NET 2.0 framework, please refer to the download section of microsoft.com

Monday, January 22, 2007

Remove object from ArrayList by Property

TileInfo is a class representing a tile from an image mosaics. By overriding the Equals method we can remove arbitrary objects from a data structure - an ArrayList in this case.

TileInfo.cs

Get Image Files From Directory

There is a simple way in .NET framework to retrieve all image files in a certain directory

GetImgeFiles(); method

Friday, January 12, 2007

Microsoft Intermediate Language




[diagram taken from samspublishing.com]


Article 1:



All .NET code, regardless of the language syntax used, compiles to
Intermediate
Language (IL) code. IL code is the only code the CLR
understands; it doesn't
understand C#, Visual Basic, or any other
developer
syntax. It's IL that gives
.NET its multilanguage
capabilities; as long as
an original source language can
be compiled to
IL, it can become a .NET
language. [full article here]

Article 2:



Simplest Program written in IL
We will start our journey with the classic
example of Hello World, but with a little twist. Open your favorite text editor,
create a new text file and name it HelloWorld.il and punch in the following
lines of code:
.method void HelloWorld()
{
ret
} [full article here]


Wednesday, January 10, 2007

HowTo: Associate your c# program with a filetype

I found these couple of posts in the Microsoft forum. Take a look at them. Might be useful!

1. RizwanSharp writes:
Create an installer for your application, Right Click Setup Project in Solution Explorer, a menu will open Go to View -> File Types. In the left side a new pan will open right click on File Types on Target Machine, add a new item, Select the newly creating file type and in property window set a property for its extenssion.....

Compile and build the application and its associated.

Note: Now when you click an image it'll open up you application but that image in it, for that you have to see Main(string[] args) that what file name is coming in constructor so load that file.

2. farshad.A writes:

All the job is some registry entries:

Create an entry under HKEY_CLASSES_ROOT for the extension you wish - with the leading period (in your case, .jpg and .gif do exist).

Set a name for your filetype as the default value(jpegfile or giffile in this case, if you take a look in the windows registry).

Then create the mentioned name's key(under HKCR again), and create shell\open\command subkeys under it(that is this: HKCR\jpegfile\shell\open\command or HKCR\giffile\shell\open\command).

Set as default value your executable's path and the command-line argument to pass to it, which would be simply %1 if you want the filename to pass to your program: "c:\myapp.exe" %1

Thursday, January 04, 2007

Rands: Getting through the first 90 days of a new job

This is an article I came across while reading the Joel blog @ reddit.com ....
Here is a small excerpt, you might find useful...

#1) Stay late. Show up early. You need a map of the people you work with and I find the best way to start scribbling this map is to understand people and their relation to the day. When do they get there? How long until they engage in what they do? Coffee run? Wait, no. Late arriver. Doesn't leave until he gets something done. Makes his coffee run at 4:30pm. Doesn't drink coffee? Really? Why? These long days of watching give you insight and they give you tools for understanding what each of your team members want.

#2) Accept every lunch invitation you get. People are stretching themselves for you the first few weeks you show up. They're going to go out of their way to include you and no matter who they are, you've got to take the time to reciprocate. The lunch invite from that guy in the group you pretty sure you'll never interact with will result in stories and you have a stunning lack of stories right now.

#3) Always ask about acronyms. It's great that we're all speaking English, but why is it that you're sitting in your first staff meeting and not understanding a word? It's because every team develops acronyms, metaphors, and clever ways to describing their uniqueness which you must understand. Cracking the language nut is absolutely essential to assessing the hand you've been dealt and you're going to need to ask a couple of times.

#4) Say something really stupid. Good news, you're going to do this whether it's on this list or not. I'm saying it's ok. This stupid thing that you're going to say is going to demonstrate your nascent engagement in your job and when they stop giggling, the team is going to know you're desperately trying to figure it all out.

#5) Have a drink. Similar to the lunch task, but more valuable. No barrier is crossed when someone invites you to lunch, but when you get the drink invite, someone is saying, "C'mon. Let's go try a different version of honesty." Stories are revealed over drinks, not lunch.

The full article you can find here.