Friday, December 29, 2006

Algorithms project

The day before yesterday was our Algorithms project discussion.. Our project was to implement Prim's (Minimum spanning tree) algorithm..
Well, There isn't much to say.. Thank Allah, It was good (at least for me), Dr Abdalah didn't ask me a question actually.. The only bad thing was that we had to wait a lot till an assistant is free to ask us.. & also we waited a looot again for the Dr for the oral exam..

Anyway, I'm dial-up now.. so I'll upload the exe & put a link for it here when the DSL is back in sha2 Allah...
(Actually, the DSL is back.. but I dont feel like uploading things & putting links.. later on isAllah.. )

Tuesday, December 26, 2006

Assembly Project..

Today, was our Assembly project discussion..
First, About the project.. we were intending to make a text editor (Windows Application) then we were afraid that the Dr may not like that (as most code is invoking & using for Windows APIs using Assembly which is new for him -for sure).. so we decided to include Encryption & Decryption in it (just in case).. Anyway, we called our project "Texryptor" (Text Editor that encrypts & decrypts).. It doesnt look very nice --esp made in buttons not in menus cause we didn't have much time :( --
(but after all its windows application by Assembly ;) )

Anyway, Thank Allah the project discussion was good (Dr Kareem & Dr Mahmoud Hossam.. wt do u expect).. & Thank Allah that the Dr was praying when we entered...

I just want to mention sth.. sth that happened today to our colleagues.. They made a very nice project.. & when the Dr saw it.. he became angry & shouted at them "I didnt require that from u.. seems u got it from somewhere online.. & .. bla bla bla... !!!"
Really I'm very very angry.. I really can't find words to say but "7asby Allah w na3ma al wakeel"..

Anyway, Still the Algo is left tom isAllah... Allah Al Mosta3an...

Sunday, December 24, 2006

Prolog Project..

Today was my prolog exam & project discussion... Thank Allah, I did well..
Our Project is an implementation to A* Algorithm..
Here's a link to view our prolog project.. (of course, after my team mates permission ;) )
A* Algorithm Implementation using Prolog (5.2)
(Note: you must also download the pictures from here & unzip them to the D:\ directly)

Project Documentations

BTW, today was the best project discussion for me (since I entered FCIS).. I mean "best" by HOW the assistants discuss the project.. Today, I was not asked much neither was I left after hearing nth but "nice project..it looks nice".. but instead we had a discussion about the Algorithm, some observations like "you'd better have done so & so....", how A* is used in games... etc.. (Dr Mahmoud showed me sth like our project idea made in C++ & animated.. it looked really gr8).. bgd Thanks a lot Dr Mahmoud Zeidan...

Anyway, Hope next projects are better isAllah..
oh, I almost forgot.. Waiting for ur feedbacks :)

Wednesday, December 20, 2006

My Memorizer..

Well, This is one of the best services I ever found in the online services world..

My Memorizer.. Its a web calendar with a very nice feature, which is that you can make the reminder by "sending sms" to ur mobile to remind you with the things you set on ur calendar (2 sms/day) & it also sends u a mail (if u want)..
I tried this today & I recieved the sms on my mobile on the time I specified...

Give it a try, its really good.. http://www.mymemorizer.com

Sunday, December 17, 2006

You are a Programmer IF...

1- You have more than a document file on your desktop called "To Do"..
2- You start counting from zero...
3- You can find some code in a folder on ur PC & you wonder when & how you made this code !?
4- You may stay awake a whole night trying to fix a bug, then when u go asleep, you dream of the solution...
5- You don't like most of the softwares in the market...
6- You forget to eat or sleep cause you were too busy writing some piece of code..
7- You stress the words IF, THEN .. ELSE.. while speaking..
8- You always search for the undo button (ctr+z) when u mistake in doing any handwritten stuff..
9- Most of your speech is not understood except by your colleagues in college or work..
10-You find yourself writing a semi-colon at the end of any sentence instead of a full stop;
11-You estimate lengths better in pixels than in meters & centimeters..
12-You use the eye-drops as frequent as you use the toothpaste...
13-The First words you write when trying sth new are "Hello World"...
14-You never used that device that looks like a computer screen & called "TV"
15-You -every now & then- wake up with the keyboard imprinted on your face..

(To be Continued...)

(Some Copied & some written... Copyright reserved)

Friday, December 15, 2006

Projectsss

Nowadays, we are at the end of the first semester & there are projects that we should do before the practical exams..
Time is really so limited & also the Doctors are not helpful at alll..

Algorithms project --> Minimum Spanning Tree (Prim's algo)
Assembly project --> still not done & also we are having many problems cause we are afraid from the Dr's reaction..
Prolog project --> Not Determined yet.. please if u have a good idea, let us know..

I just wanted to write this post as a kind of motive to myself cause I'm really upset from many things & I'm losing my spirit...
Pray for us please...
isAllah, I will send links for the projects after they are delivered..

Tuesday, November 21, 2006

Zamzar.. online file conversion

Zamzar is a free online file converter.. It can convert files to another formats without need to install any software on ur PC..
It can convert images, music, documents & vidoes to & from different formats.. U can check the files format list here : Conversion Types
Try it .. its really easy & nice.. Zamzar

Friday, November 17, 2006

Scrybe

Another gr8 service added to the online world.. Scrybe, the online/offline organiser ;) ..
Scrybe is an online organizer that has also the capability to work offline.. I think its the best online calendar & task manager (rated better than Google calendar .. althought its still in Beta)

I was really in bad need of sth like Scrybe (I think also every programmer with a gr8 memory like mine ;) ).. I really like their service so much..
Sign up if u want to give it a try : Scrybe ..

Saturday, October 21, 2006

Programming Language Inventor or.... ???

This is really so funny & coool quiz.. I couldn't hold myself from putting a link for it here..
Take the Quiz

Enjoy ;) .. & tell me ur scores.. I got 10/10.. I'm safe, thank god :D ..

Sunday, October 08, 2006

Google Code Search !!

Google labs is making sth innovative as usual.. 'Google Code Search'

Now, you can search billions & billions lines of code for code samples, similar functions u want to code... etc
U even can custom the search for a specific language (C#, java, C++..)

Thanks Google.. :)

Thursday, September 21, 2006

Google Egypt

Google Egypt Campaign
Our mission is to facilitate the creation of a Google Development Center in Egypt...

What??
* Attract Google to open a branch in Egypt.
* This means many IT jobs for Egyptian developers.
* Participating in the development of Google's latest high techs.
* Give a chance to Egyptian Developers to work at World Class level.
Read more...

Gr8 news.. Seems Google is going to open a branch here in Egypt finally... horray...
http://www.itp.net/news/details.php?id=21702
http://stravinskyss.blogspot.com/2006/06/google-opening-middle-east-regional.html
http://googlified.com/2006google-to-open-office-in-egypt/
http://www.ginside.com/buzz/egypt

Tuesday, September 19, 2006

PHP vs ASP.NET

I read that article comparing PHP & ASP.NET for building web applications.. its a good comparision, check it out PHP vs ASP.NET

Monday, September 11, 2006

The only logical answer...

Why do u need Microsoft Excel while u have Google SpreadSheets , NumSum , IRows ??

Why do u use Microsoft Word if u can use Writely, ThinkFree, Windows Live Writer , Zoho Writer ??

Why do u install Msn Messenger, G-Talk or Yahoo Messenger while u can replace them by Meebo, E-Messenger, MSN WebMessenger or Yahoo WebMessenger ??

Why don't u use BasePortal web-based database platform for the creation of databases for simple webpages??

Why do u keep attaching files many times to send them in e-mails while u can just type links to the files in ur Box account or Google pages??

Why do u need "My Videos" folder while u have now Google Video & YouTube ??

Why do u have problems sharing pictures while u have Picasa WebAlbums , Windows Live Gallery & Web Gallery Mate ??

Why don't u use a Web Operating System like YouOs & EyeOS to customize & access ur desktop from anywhere ??
or maybe use EyeOS Virtual Desktop ??

& many more "Why" questions.......

I think the ONLY logical Answer to all the previous WHY-Questions can be...
"I don't have an internet connection" :) ..

Saturday, September 09, 2006

Trying Box.net

Box.net is an online storage service.. There's a feature here where u can send ur files to ur blog, I'm just trying it...
Anyway, its nice (althought is only 1 GB), try it urself www.box.net

BTW, This is "Art of Programming contests" book for anyone interested in ACMing :)



Friday, September 08, 2006

Dual-Core & HyperThreading

Many of us heard about 'Dual core' processors that intel has recently made.. wt's new in this processor?? Actually this processor is sth like two single-core processors working together.. dual-core enable twice the thread-handling capability of any other processor...

The Q here is 'wt do I -as a developer- have to do with this??'
well.. when u have a dual-core processor & u don't make ur application HyperThreaded its the same as when u have a car that can run on the fifth gear while u insist driving it on the first gear... so, we -developers- must learn how to make any application hyperthreaded in order to full use the cababilities of the hardware & have high performance for our applications..

Talking about HyperThreading.... I'd like first to clarify the difference between Multi-tasking, Mutli-Threading & Hyper-Threading:
Multi-tasking is the ability of the OS to execute more than one program simultaneously, but in reality no two programs can be executed in the single processor at the same time.. The CPU just switches bet programs so quickly that appears as if the programs are executing at the same time..
Multi-Threading is when the OS can execute different threads of a program at the same time..
Hyper-Threading is simultaneous Multi-threading allowing two threads to be run in parallel..

You can check the following link to understand more about HyperThreading: Introduction to HyperThreading

How to make an application hyperthreaded??.. actually, I'm still a beginner in that.. but wait for a coming post containing some code samples so soon isAllah..

That's all for now..
c u next post isAllah..

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

btw, This topic was introduced to me in the 'HyberThreading' session that was made for us in ShadiSystems company by eng/Ramy (intel developer)

Friday, September 01, 2006

3D Desktop


DGP has developed their own 3D desktop prototype that uses physics to arrange the icons...
It's 3D, physics-ruled environment looks like an actual desktop where you can pile ur icons, stretch them everywhere on the screen, Drag & cross... etc...
It really amazed me.. althought it might not be of any use (at least for me)...

Watch the Video

Sunday, August 20, 2006

Pair Programming

Weeks ago, They made us a session at the company... The session was about Software Engineering techniques.. It was mainly about "Extreme Programming"...

Extreme Programming (“XP”) is a new, lightweight approach to developing software... I wont talk in details about that cause that's not the title of the post :) .. The thing that attracted my attention was a new aproach in software engineeering called "Pair Programming"...

Pair programming is the practice of having two people working together on all production code. They do this as full partners, taking turns typing and watching, to provide constant design and code review..

Imagine u r a manager of a company... u have 10 developers working on 10 PCs... with Pair Programming.. u can have 10 developers working only on 5 PCs with better results... This is not the main point.. but .. the REAL benefit in 'Pair programming' is that its really so productive.. & also gives more efficient results... also its sth related with the nature of the brain of human beings... There is something about the brain that makes it very difficult to think at a high level at the same time that you are doing a lot of hand-eye coordination... so that's why Pair Programming is always more productive...

Also, for me -as a developer- I prefer Pair Programming so much.. its really so fun & also it saves a loooot of time... the funny thing that we always prefer pair programming without knowing that this is a known technique..
but unfortunatly not many people are convinced with it (Here in the company for example)...

That's all now.. Hope the post wasnt that boring..
c u next post isAllah..

Tuesday, August 08, 2006

A Bug in Atlas..

Yesterday, while I was working on some ASP pages @ work.. I finished a screen that was required from me, I used some atlas features in that.. It was working just fine.. I just changed in some code to make my page a content page to a master page..
The code looked sth like that:

< % @ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CodeFile.aspx.cs" Inherits="_Default" Title="Examinations & Remedies" % >


Then CTL + F5.. I tried any control in the page (that was in an updatepanel) & I got a msgbox with "UnKnown Error ! "
Anyway, I tried everything... the reason was clear that its sth from Atlas as the page worked after removing the updatepanel..
After a lot of search..I found out the nice reason... Actually the reason was in that part "Title="Examinations & Remedies"
cause simply atlas doesnt support the "&" character in the titles of content pages & that causes Atlas to stop working...

Atlas doesn't support some characters in the titles.. Althought the "&" works in titles of normal asp pages using atlas, it doesnt with content pages using atlas..
Anyway, for anyone who will use atlas, I recommend reading this Unofficial Bugs b4 spending half a day trying to figure out wt's wrong in ur code..

Good Luck everybody..
c u next post isAllah...

Friday, August 04, 2006

Atlas framework

What is Atlas?
This is a new web development technology from Microsoft that integrates cross-browser client script libraries with the ASP.NET 2.0 server-based development framework.. Its even considered an extension for ASP.NET...
Atlas is Microsft implementation of Ajax.. instead of using Ajax & sometimes writing a lot of javascript code, Atlas has same Ajax techniques with more simple & easy use...
I will write here about the 3 MOST nice features I found in Atlas..

Using Update Panel:
This is a gr8 thing really.. Anything you will put in an update panel will work without refreshing you page.. This can be done by using 2 simple steps..
1- Enablepartialrendering=true in the scrip manager part
2- Put ur controls in the 'content tempate' in the Updatepanel & events in the 'triggers'

Code:

Using UpdateProgress:
This is a very nice thing actually.. its mainly for displaying stuff, but it looks nice.. After the Update Panel.. u can add this to show to the user that the page is updating & sth is working.. & the output should like like this pic..

Code:



Using Auto-complete Extender
Instead of writing a loooot of JavaScript Code to make an auto-complete textbox.. now with atlas, its really so simple... I just couldn't believe I can do it by ONLY 3 lines of code!!!!
Just make a [Web Method] that returns array of strings that are suppose to appear in the txtbox..& specify the Method Name & path in the code... simple, right??? ;)

Code:

That's all for now... I hope this was of any use to anyone.. for further reading & downloading the framework, check the Link ..
c u next post isAllah...

Saturday, June 24, 2006

A new Experience

Last sunday was my first day to work at Shadi Systems company.. This week was just a training & real work will begin isAllah next sunday...

It is a totally new experience, I really did learn a lot the past 5 days.. & isAllah looking forward to learn more... I will send about the new things I leant here so soon isAllah...

From the most important things I learnt the past days..
1) xml.. javascript.. html... etc are VERY important to be very WELL known & understood..

2) One has to keep up-to-date & read a lot about the new technologies & tools that comes by every now & then..


isAllah, I will edit this post frequently...

Sunday, June 18, 2006

Minesweaper

u know minesweaper??
who doesn't know minesweaper :D... I like that game.. anyway,during the college days I decided to make my own minesweaper -with big cells cause my eyes hurt me from those tiny one :D- (actually it wasnt my idea, I just heard some collegeues talking about that w tala3o el mawdoo3 fe dema3'y).. so I started in it & later, one became so busy & I left it...
During exams, I just thought about completing it & wish to leave studying to complete it... so this was the first thing to do after taking the vacation.. (I completed it thursday morning ;) )
I finished it, but actually NO UI interface at all... that's why I am not putting a screen shot here ;)

well, its so simple to be implemented... maybe the main problem that you will face is that there is no 'right click' event handler in c#.. so u will have to make one yourself ;)
(I dont know why didnt Microsoft make an event for the right mouse click.. even in .net 2005 ^o) .. )

About handling the mines.. a good ACMer will do that (cause there is a problem called minesweaper in the problemset in the OJ ;) )...

Maybe later I will send a screen shot here, but I dont think I will waste my time for making a good UI for this.. :huh..

c u in next posts isAllah.. There will be a looot of posts coming isAllah..
Keep in touch :)

Saturday, June 17, 2006

Trying Office 2007 (Beta)

I am using Office 2007 (beta)... I like the layout so much… its my favorite blue color… :)I am just trying to publish a post through this office… hope it works…

Really, I like it so much… I like the new features…Anyway, if any of my dear blog readers would like to try it, just let me know, I will send it to u as soon as u want… or maybe you can sign up at Microsoft’s web site for trying the Betas… I really do wish to try the windows vista… so soon isAllah…gtg now… salamo 3alikom….

Friday, May 26, 2006

OOP Project 2

Here I am again...
I took a break 4 a while & just thought about completing the post..
btw, I heard today that there is competition or sth like that for the projects & a friend confirmed that... I dunno, but maybe I will think of enrolling.. I dunno if its too late or wt.. 8-)

Anyway, back to the proj.. still I wanna show u 2 more things.. The print preview & the notification...

About the printpreview... sure u will wonder what's new in that.. actually I posted before a post here about "Multipages" printing.. I couldnt before support that in any application I made.. but this was solved.. mmm.. just make a function that returns bool to check ur current y ... & in case its true, make the e.HasMorePages = true;
//here is the imp part:
if((CurrentY > pageHeight - pageMarginBottom)&&(!pageLandscape))
{
return true;
}

Here comes the last thing in the proj that deserves watching..
Its a notification at the right side of the screen (as that of msn , yahoo.... ).. its idea is soooo simple, but the output looks nice..... now in order to make a notifier, we need to know the resolution of out screen in order to determine where will our form apear.. actually this can be solved easily with the function: Screen.GetWorkingArea(this) then with little math calculations & good use of timers to make the moving effect, u will get wt u need.. :)

I gtg now to complete studying a small part then go to sleep ISA.. :)

Exams are coming &.... Hope we all do well ISA.. :)

Friday, May 19, 2006

OOP Project 1

e7l.. the project has been delievered yesterday.. I won't talk in details about the delivery for many reasons.. the main is that I didn't do it for just taking marks + this has nth to do with wt that blog is made for + I wasn't happy with wt happened....

Talking about the project... Actually I didn't add more functionality to the project...(simply cause I wasn't convinced with the design they made & I didnt want to add any tables to it...), I did nth more than the requirments.... just some short reports at the main page (actually, it wasn't my idea.. Thanks for suggesting :) .. ) I was much concerned with the interface & making the other requirments so perfectly...

what are the new things I learnt from that project ?
- some GDI+
- Dealing with events handlers & delegates more flexible.
- Code reusability (make good use of wt others do instead of doing it from scratch) .
- Making good use of the controls & components of the .net to produce sth that looks good.

----------------------------------------------------
This is the Interface of the application... Hope its clear enough :) .. mmm.. There are buttons on the left for moving between forms.. I think buttons are more practical esp for things that are required a lot for the user (as making a reservation & checking rooms availbility).. I added some menus at then end cause almost All people told me "its better to make menus".. don't know y!! .. anyway.. I still don't like menus.. but maybe I can add both & the user have to choose (as many applications we use in daily life...)
BTW.. I used a class that was made by someone on code project to play sounds.. I used it in to make some effects for the mouse moving on the buttons + some few visual effects...



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

Here comes the most important form in the application & the most one that made me tired (esp as a functionality)...mmm... about the shape.. (simple use of GDI+)... & added some mouse event handlers to be able to move the form freely...

I'm now so tired.. I will go to sleep now..

To be continued ISA..

Monday, May 15, 2006

Changing Forms Shapes..

I decided to take some rest b4 studying so I thought of writing somthing useful here...

Sometimes we get bored from standard forms.. Learning GDI+ helps a lot in making cool shapes for forms.. Here, I'm not going to talk about how to use GDI+ to reshape ur forms (maybe I'll do next post).. I will talk now about a very simple way that can change the way ur form looks..

Let's begin..
First Design a nice picture for ur form...Here, I downloaded a pic from google images :) (I'm a programmer not a designer ;) )
After designing.. set the background of ur image to a unique colour that u will never use in ur form or in any font in ur application (simply cause anything having this colour will disappear)
ok.. that's the pic I chose & I set the background to dark grey...

Now, Go to ur form & set the background of ur form to this image...
& then u have to change some properties in ur form..
FormBorderStyle = None
Transparency Key = "colour u chose for ur pic background" (& this doesn't work in most cases due to sth related to screen colour quality.. I'll tell u how to manage that in the coming lines)

ok.. now done..
we have to add some things.. the Most imp thing is a button to close our application.. & this can be done easily by adding a button with mark "X" & in its action this.Close();
ok.. now ur form is almost ready..

now, if u run it, the transparency key doesn't work...so.. here is a piece of code to make this thing work just fine.. but first don't forget to put ur pic beside the .exe

System.Drawing.Bitmap Img = new Bitmap("background.bmp");
Img.MakeTransparent(Img.GetPixel(0,0));
this.BackgroundImage = Img;
this.TransparencyKey = Img.GetPixel(0,0);

I think the code is clear.. he sets the image to the form backgournd & gets the colour of the first pixel in ur image & set that to the transparency key...

Now, not finished yet.. :D .. there is still adding some Mouse event handlers so that u can move ur new form.. (I will leave u do that cause I have to go to study :D , its 11:00)

now I will just show u the final view of our form...


just remmeber that ur final form look depends on ur image quality...

Hope u enjoyed it..

Wednesday, April 19, 2006

Running my 'OTC code' application

sure, anyone read the title wondered what is the 'OTC code' (maybe its sth related to programming 8-)??!) , Actually No... It's an application I made for my sister & her collegeus in college, They wanted to make a program that can be used in any pharmacy to check on the Drugs interactions.. (As some drugs may interact & cause toxic doses & many commplications w 7agat kedah...) & that is sth VERY common here in Egypt..
Anyway, they collected the Data & it was my task to make the program.. Actually it was not complicated at all, but it really made me feel Happy... cause its my first time to make sth -u know- USEFUL...

Anyway,back to my main point (the reason that made me write that post)... After I finished the application, I gave it to them to show it to their DR.. but.. ops.. I forgot.. We all know that any program made on .net won't run unless there is .net installed on that device...
mmmmm... I thought.. what should I do then.. I really worked hard on it.. so, I got an idea...mm... just make the CD containing the program an autorun that asks the user to install just the FrameWork of the .net... & after installation, everything will work just fine...
I tried that method & e7l.. my application worked :) .. & ISA they will deliver it next saturday...

so, for anyone making any application on .net... Always remmember that the user is not a programmer like u & doesn't have .net framework to run that application (cause I almost forgot that)...
maybe many who will read that post know that b4, but maybe some doesn't...
Just an experience I wanted to share...
In case anyone has a better solution, Comments are welcomed :)

(BTW, I became a popular character there in the faculty of pharmacy :D)

Saturday, April 15, 2006

Multi-Teaming..

I don't know if there is sth called "multi-teaming" or not.. but I made up that expression from my mind...
Maybe this post is NOT very related to what I usually post here -maybe I'll delete this post later- ,but I just wanted to talk about that issue so much as its related to my programming life...

Let me begin explaining my title first...
Programming field has a very important concept called "Team Work"... I don't have personal experience in real job or work (cause I didn't work till now :) ), but I think college is enough to teach us that concept (through projects, acm ... etc)

All my life, I always like to work in teams (maybe being in a team since 9 increased that inside me...) , When I joined college, I searched for a team mate -althought I have many friends- ,but I found NONE...
later on, I began to find persons having common interests like me.. I joined in with them & made what is called "Teams"...

What is "Multi-teaming" then !!
I'll tell u... When you have the same members with u in a certain task or goal, then u can call yourself a "Team", The idea is that I have many Teams, & Can u imagine that noone is repeated in more that a team!!... mmm.. let me make things more clear...
My ACM team, Hend & Asmaa... My C++ Team, Sally & Shimaa... My Open GL Team, Heba 3essam, Abdel r7man M., Abdel r7man E..... My projects Team, Aya Nabil, Yasmine...etc....

As you can see.. Many Teams & all are different members...
This is what I call "Multi-Teaming"...

Talking About Multi-Teaming... I think it has Advantages & Disadvantages...

About the Advantages:
-"Multi-teaming" widen your thiking (I believe so) cause you think & create new things with different minds & different ways of thinking...
-"Multi-teaming" make you exchange information with different people & that -surely- always teach u sth new...
-"Multi-teaming" make you always enthusiastic about each team's task, I mean when u have new persons in each team.. they always think in one direction towards that team's goal & that always help u keep up in the same performance in each team...
-"Multi-teaming" strengthen you relation with people around u in ur community & helps in the interaction between people..

About the Disadvantages:
-"Multi-teaming" doesn't make you enjoy the taste of "Team work"... Imagine that u have many things to work on today... You go with X & Y to do sth, then after hours.. you go with A & B to do sth else... kind of unsettlement...
-"Multi-teaming" LOADS one so much... If people u work with are with u in everything, you will have the same palns, same tasks (not exactly the same, but I mean ... nearly the same ) ,but in "Multi-teaming", you always have to do many things & in the same quality as your team members (who in most of the time, do nth except that task..)

Till now, I don't prefer "Multi-teaming" so much, maybe "Di-Teaming" or "Tri-Teaming" would be enough :) ,but the problem is that I can't find someone to share me all my interests...

Till now, I'm still so confused about Multi-Teaming... sometimes I adore its advantages & other times, I just hate its disadvantages...

anyway, just wanted to share a personal experience, here in my blog...

Friday, April 07, 2006

Rotating Earth.... Horray...

Now, its one of the happiest moments in my programming life (till now :)) e7l...
I finally could make it.. I made a rotating earth with Open GL...

About MY earth... :)
You can change to Night & Day vision (light/darkness) also you can (zoom in/zoom out)...
with cabability of controlling the rotation in x, y & z directions...

Here is a shot for the earth, zoomed out
& in Day vision..
(rotating for sure,but that isn't clear :D)



While here, the Earth is magnified
in Night Mood...


Hope you enjoyed the screen shots ;)..

There is still a loooooooooot to learn, but I will never forget this moment..

(BTW, now its 2:00 am.. It really worth mixing my timetable)

Wednesday, April 05, 2006

Playing with Open GL..

I was playing with Open Gl... (BTW... I Like it veryyyyy much) .. I made that rotating twinkling star... I know this is an easy task... but I think everyone starts from Zero.. right ;)

The Star rotates in x, y & z axis.. & also changes its colour from red to yellow & vice-versa...

I'm working now on a rotating, translating, keyboard controlled sphere.. so Hope I will make it.. ( I will send it here sure after I finish it ISA... ;) )

Saturday, April 01, 2006

Some solution paradigms for acm problems...

Here is some things that you need to consider when designing your solution :)

Generating vs Filtering
Programs that generate lots of possible answers and then choose the ones that are correct (imagine an 8-queen solver) are filters. Those that hone in exactly on the correct answer without any false starts are generators. Generally, filters are easier (faster) to code and run slower. Do the math to see if a filter is good enough or if you need to try and create a generator.

Pre-Computation / Pre-Calculation
Sometimes it is helpful to generate tables or other data structures that enable the fastest possible lookup of a result. This is called Pre-Computation (in which one trades space for time). One might either compile Pre-Computed data into a program, calculate it when the program starts, or just remember results as you compute them. A program that must translate letters from upper to lower case when they are in upper case can do a very fast table lookup that requires no conditionals, for example. Contest problems often use prime numbers - many times it is practical to generate a long list of primes for use elsewhere in a program.

Decomposition (The hardest thing at programming contests)
While there are fewer than 20 basic algorithms used in contest problems, the challenge of combination problems that require a combination of two algorithms for solution is daunting. Try to separate the cues from different parts of the problem so that you can combine one algorithm with a loop or with another algorithm to solve different parts of the problem independently. Note that sometimes you can use the same algorithm twice on different (independent!) parts of your data to significantly improve your running time.

Symmetries
Many problems have symmetries (e.g., distance between a pair of points is often the same either way you traverse the points). Symmetries can be 2-way, 4-way, 8-way, and more. Try to exploit symmetries to reduce execution time.
For instance, with 4-way symmetry, you solve only one fourth of the problem and then write down the four solutions that share symmetry with the single answer (look out for self-symmetric solutions which should only be output once or twice, of course).

Solving forward vs backward
Surprisingly, many contest problems work far better when solved backwards than when using a frontal attack. Be on the lookout for processing data in reverse order or building an attack that looks at the data in some order or fashion other than the obvious.

Simplification or in technical terms: Problem Reduction
Some problems can be rephrased into a somewhat different problem such that if you solve the new problem, you either already have or can easily find the solution to the original one; of course, you should solve the easier of the two only. Alternatively, like induction, for some problems one can make a small change to the solution of a slightly smaller problem to find the full answer.

References:-. USACO training gateway

Tuesday, March 14, 2006

Small problem with a MFC application..

While I was coding with MFC with my C++ team mates Sally & Shimaa.. (we were doing the hacking task which was quite an easy one).. we faced a tiny silly problem... The problem was that when displaying an int value in a messagebox, the value appears as strange characters..

For example, if u wrote:
int x = 2;
CString str = x;
MessageBox(str);

then u willl get strange characters in the Message box..
mmm.. I tried type casting.. (static_cast string str = <>(x); ) but.. the same thing happened again... I tried _itoa(x,str,size); ...but again & again.. it doesn't work well in all cases....actually I didn't knew how to fix it till I went home & googled for the solution... & here we go... just made good use of the "CString" class & everything went just fine... (Thanks Google)

I tried this Code as a sample:
int value = 1000;
CString string ;
string.Format(_T("%d"),value);
MessageBox(string);

IT WORKS.. :D ..

Here are some more additional information about the CString::Format method (got it from msdn )
Parameters
nFormatID : The string resource identifier that contains the format-control string.
pszFormat :A format-control string.
argument :Optional arguments.

Remarks
This function formats and stores a series of characters and values in the CStringT. Each optional argument (if any) is converted and output according to the corresponding format specification in pszFormat or from the string resource identified by nFormatID.

Just wanted to write this here in case anyone faced the same problem..
Still enjoying the MFC till now..
Meet u in another problem I face with programming ;)

Sunday, March 12, 2006

Print preview in C#

while I was playing a while with the print preview function that we took in the programming.. I faced a problem in making it "Multi" page... I tried everything... but I failed... so... I googled for a solution for that... & here is what I got from www.codeproject.com

The person who wrote that article made a class called "MultipadPrintDocument " (as his application was called Multipad)

Here is some explanation as mentioned by him for how the print preview works...

MultipadPrintDocument implements the virtual methods OnBeginPrint() and OnPrintPage(). OnBeginPrint() sets the pointer to the current character (_offset) to 0 and the current page number to 1.
OnPrintPage() has one parameter of type PrintPageEventArgs. When the system calls OnPrintPage(), we have to typeset the page using the Graphics object in the PrintPageEventArgs parameter. We typeset the page by printing lines of text until the page is full or until we reach the end of the text. The PrintPageEventArgs parameter has a property MarginBounds which contains the page size. Unfortunately, the dimensions are expressed in hundredths of an inch.
In .NET, there is no GraphicsUnit which represents a hundredth of an inch. Because we're going to measure strings in GraphicsUnit.Document (1/300th of an inch), we convert the page dimensions by multiplying them with 3. Now we're ready to start printing the lines of the text.

First, we create a StringBuilder which will hold the text of a single line. We also create a GenericTypographic StringFormat object. It's very important to use GenericTypographic because otherwise, MeasureString() and DrawString() wouldn't behave as expected. We also set the tab stops: if a line of text contains tabs, the text will be formatted correctly (the tabs will not be replaced with spaces, they will act as real tabs). Finally, we set the PageUnit property of the Graphics object to GraphicsUnit.Document.

Before we start filling the page with lines, we check to see if there is enough space to print at least four lines: one line of text and three lines for the page number (two empty lines above the page number). If there isn't enough room, we simply leave the page blank. This situation should rarely occur.

Now we're ready to break up the text in lines. We read the text string one character at a time. We add the character to the line buffer (the StringBuilder object), except if the character is a NewLine or Eos (end of string). Note that NewLine is "\r\n" in Windows or "\n" in Unix, so we have to keep in mind that we don't simply skip one character but Environment.NewLine.Length characters (yes, we strive to perfection). If the character is a space or a tab, we save this position because when the line is full, we don't want to break the line in the middle of a word, no, we will print the line up to the last tab or space. For example, if we have the line "The quick brown ... lazy dog." and the line overflows at the 'd' of "dog", we will begin the next line with "dog" instead of "og". If the last character is a space or tab, we continue to add these characters. This way, the next line will never start with white space. If the line overflows or we encounter a NewLine or Eos, we print the text in the line buffer. Then we increment the y position of the next line and empty the line buffer. If there's still room for a new line of text and we still have text to print, we continue the loop; if not, we exit the loop, print the page number at the bottom of the page, increment the page number and set the property HasMorePages of the PrintPageEventArgs parameter to true if there's still text to print, otherwise we set it to false.


Here I am... modifying my code.. still I have some mistakes in the final view, but really my eyes are in their worst state now.. :S (Note: I lost my glasses which makes everything worse)
so.. I will go take a rest now & complete my code later..
sure I will tell u in case i discovered sth new...

Thursday, March 09, 2006

Way to Game Programming...

- A team in my college is starting a game programming project... I'm one of the members in that team.. we are starting ISA in the coming period.. that's y I'm reading about OpenGL..


What is OpenGL? (for those who don't know)
OpenGL (Open Graphics Library) is a specification defining a cross-language cross-platform API for writing applications that produce 3D computer graphics (and 2D computer graphics as well). The interface consists of about 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. It is very popular in the video games industry where it competes with Direct3D (on Microsoft Windows)

OpenGL is a method for rendering 3d images. GL stands for Graphics Language. OpenGL is the "open source" version of GL. id software is a huge proponent of OpenGL because it is platform-independant, unlike DirectX which is Windows-specific.

Why OpenGL?
-Device independence
-Simple, easy to learn
-Powerful, flexible feature set
-Cross-platform portability
-Established: many tools and resources already available
-Performance(varies with hardware...)

To be Continued...

Saturday, March 04, 2006

Some nice statistics..




In conclusion, if we look at the data available to us, especially as presented in the final, normalized chart above, we can see that there are broad patterns in language usage. Beyond the overall ranking, it is also possible to see whether a language is more used (jobs) or promoted (ads), and also whether it is used for open source projects, where presumably the participants have chosen a language because they feel it is truly the best choice, rather than dictated by management or commercial needs. We feel this is an important sector to keep an eye on, because it's where a lot of interesting things are happening, and because software really is a field in constant evolution, where today's niche player may become tomorrow's giant. These results should also be taken with a grain of salt, because it's obvious that our calculations are based on data that is not extremely accurate, nor detailed. That said, I stand by them, because I think they do correspond to what I see and read in my field.

Wednesday, January 18, 2006

A new strategy

I thought about making a good use of the blog... Actually, there are some things that influenced my decision.. most important one of them is seeing another very useful blogs.. I remember one of them is "Spot the Bug"...

I will be publishing articles or any interesting programming topics I read anywhere.. that can help us increase our knowledge in programming & programming-related stuff (as Algorithms..)

so.. wish u enjoy it..