Thursday, October 7, 2010

Surviving the monster: A programming problem

Comments
I encountered this programming problem some time ago-

Inside a room, there is a monster with N heads, and a human (with 1 head). The human has two laser guns. The first gun, A destroys C1 heads when fired and the second gun,B destroys C2 heads when fired [The guns may destroy both the monster's as well as human heads, but the guns prioritize monster heads over human ones].

Also, if after the firing of the gun the monster has a positive non-zero number of heads left, the monster will grow additional heads. The monster grows G1 heads when gun A is used and it grows G2 heads when gun B is used.

The problem is to input N, C1, C2, G1 and G2, then find out what would be the shortest combination of gun-choice(A or B) the human must use to kill the monster(the monster dies when No. of heads=0).


I asked for help on the Codecall Forums to solve it, and a member, zoranh has solved the problem for me in C++. The solution makes use of Dijkstra's algorithm and it works with any number of guns. You can download the solution here.

And of course, if you have found an alternative method do post it here!!

Interested in solving more C++ puzzles? Get your copy of Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions

Stuxnet: The dawn of cyber warfare?

Comments

Who in this digital age hasn’t heard of computer viruses? They seem to get into computers all the time. They slow down the system, disrupt our privacy and sometimes nastily delete our files. They get categorized into creepy names like worms and malware; and get called infections. Why, then, is there such a big fuss about something called Stuxnet? The answer is that the media and security organizations around the world are fussing over the Stuxnet worm because they believe that the Stuxnet worm may have commenced a new era of cyber warfare. 

So, what exactly is Stuxnet? Stuxnet is an entirely new kind of malicious program. Unlike other viruses and worms that attacks our PCs and even web servers, it targets industrial infrastructure instead. The media and security companies such as Symantec are worried because as a result of such malicious code, an attacker could control machinery such as pumps, motors, alarms to cause havoc in factories. Even worse, safety systems at nuclear stations could be switched off, the consequences of which would be doubtlessly disastrous.
Up until now, in the pre-Stuxnet era, industrial computers were considered relatively safer because they are controlled by computers which are different from the computers we use.  They use dedicated systems called programmable logic controllers, which have been crucial to the economy as they have heavily automated industries.  

To get a worm into an industrial system is not easy because the firms which manufacture PLCs have their own programming languages, which are made tricky for hackers to crack it. However, there now seems to have been a way for worms to get into PLCs through a Windows system. Stuxnet exploited four vulnerabilities in the Microsoft Windows to inject malicious code into the system. 

The Stuxnet infection’s first appearance is known to be in a USB memory stick in Iran. It has also been speculated that nuclear facilities in Iran may have been attacked by Stuxnet. 

The Stuxnet worm is believed to be written very professionally. This new worm could be the first of what is to be a new generation of cyber weaponry, commencing a new chapter in modern warfare; and thus becoming the greatest social menace of our times.

Further reading-


Wednesday, October 6, 2010

Maverick Meerkat: Ubuntu 10.10

Comments
I just wanted to remind you guys that the latest version of Ubuntu, version 10.10 (dubbed Meerkat Maverick) is set to release on the 10th of October, which is four days from today. Most Ubuntu users will definitely want to upgrade to this version. For those of you who do not already use Ubuntu, now is a great time to start. You can download it for FREE from http://www.ubuntu.com.Ubuntu 10.10 will certainly be a great starting point for those of you who want to begin their journey on open source software and Linux.

You can also read the review of the beta version here by Linoob.com here- http://www.linoob.com/2010/09/ubuntu-10-10-first-impressions/ . Stay tuned for more Linux and open-source news!

New blog design and IntenseDebate integration

Comments
As you might have noticed by now, this blog has been redesigned. The blog now uses the Pro theme for Blogger, designed by BloggerThemes. I chose the theme because I think it looks really  neat. It also seems to have a ton of features embedded onto its design, thus making it even more appealing.

I also integrated the Intense Debate, which is a powerful commenting system, into this blog. It provides features such as Twitter and Friendfeed integration, comment threading, moderation, and more. Intense Debate is also a strong community of readers, who love to discuss.So, if you write a blog or follow one, it might be a good idea to join the Intense Debate Community. It's entirely free!

With these two enhancements, I hope that you will have a fun time at this blog. Please do not forget to provide your valuable feedback on the changes I have made on the blog. See you next time!

Monday, October 4, 2010

KhanAcademy.Org- An Open Source Education Initiative

Comments
I've recently discovered this website called Khan Academy, where you can find lots of educational videos relating to Physics, Chemistry, Biology, Mathematics, Finance and many more topics. I, as a student, found the videos very useful and easy to understand, so I wanted to share this great website with you guys.

The website is the brainchild of Salman Khan[not be mistaken with the Indian actor, Salman Khan], a Bangladeshi born American citizen. A short profile of Khan and how Khan Academy came to be is mentioned in the following excerpt from the Wikipedia article about Khan Academy-
Khan holds three degrees from the Massachusetts Institute of Technology: a BS in mathematics, a BS in electrical engineering and computer science, and an MS in electrical engineering and computer science. He also holds an MBA from Harvard Business School. In late 2004, Khan began tutoring his cousin in mathematics using Yahoo!'s Doodle notepad. When other relatives and friends sought his tutorage, he decided it would be more practical to distribute the tutorials on YouTube. Their popularity there and the testimonials of appreciative students prompted Khan to quit his job in finance in 2009 and focus on the Academy full-time.

As of December 2009, Khan's YouTube-hosted tutorials receive a total of more than 35,000 views per day. Each video runs for approximately ten minutes. Drawings are made with SmoothDraw, which are recorded and produced using video capture from Camtasia Studio. Khan eschewed a format that would involve a person standing by a whiteboard, desiring instead to present the content in a way akin to sitting next to someone and working out a problem on a sheet of paper: If you're watching a guy do a problem [while] thinking out loud, I think people find that more valuable and not as daunting. Offline versions of the videos have been distributed by not-for-profit groups to rural areas in Asia, Latin America, and Africa. While the Khan Academy's current content is mainly concerned with pre-college mathematics and physics, Khan states that his long-term goal is to provide "tens of thousands of videos in pretty much every subject" and to create "the world's first free, world-class virtual school".
Salman, in my view, has begun a revolution by changing the way students access educational material online. Besides being easy to understand, the videos are also extremely small in size, which means that even students in rural communities with slow Internet connections will have access to Khan's educational videos.

The Khan Academy has recently been in the spotlight with Khan speaking on numerous interviews on major news channels. Bill Gates, founder of Microsoft and philanthropist, has also been promoting this initiative. 

Needless to say, I recommend this great educational resource to everybody. I also would like to request all of you to support this great initiative.

Saturday, October 2, 2010

Awaiting the NEW Kindle 3

Comments
Amazon.com recently released the third version of the Kindle ebook reader. I've already ordered it from Amazon and hope to get it by the fifth of October. 

This device just seemed the perfect device for my reading purposes, and after reading all those reviews, I could stop myself from ordering it. [Amazon doesn't ship to my country, Nepal, so, I've used a 'third party'(harilo.com) to get it]. To find out more about the latest generation of Amazon's e-reader, click here- Kindle Wireless Reading Device, Wi-Fi, 6" Display, Graphite - Latest Generation.

I've even been thinking of making a cover for the Kindle; it surely would be a great DIY experience and a good way to protect my Kindle. [If you have some tips for the cover, please share them with me through  comments]

I'll post my experiences with my Kindle soon as I get my hands on it, so stay tuned.

Friday, October 1, 2010

Hello World!

Comments
This is the first post at #samrat, the blog of a student interested in computing, science, and technology. Since I spend a lot of time on my computer using the web, I just recently came up with the idea of creating my own space in the blogosphere, and hence #samrat was born.

Currently living in Nepal, I am a student doing my A-levels. I am a C++ beginner and I do intend to learn other programming languages (at this point, Python really sounds interesting to me). I also enjoy both reading and writing.

I am also thinking of working on my electronics-skills, through some DIY projects(I'm currently waiting for an Arduino to be shipped). I'll keep you informed on these projects through my blog.

To stay up to date with my life and activities, you can always visit this blog. Also, any feedback is most appreciated.