Saturday, June 25, 2011

Npackd Automatically Downloads & Installs Windows Software


One program that handles the downloading, installing and updating of software. That’s the goal of Npackd (pronounced as unpacked), possibly the first package manager for Windows. With lots of favorites already available, this program is growing quickly and will in all likelihood continue to get better.
Ubuntu has its software center; Apple, its app store; Android, its marketplace. Although different in many ways, all serve the same purpose: giving users a central place to download, install and upgrade applications. Windows however, lacks anything close to this. Npackd, a third party program, aims to give Windows a similar hub.
There’s a lot of work to do if this is going to be as useful as other applications managers, but this program is already good enough to make your life better.

 

Getting Started

As always, you need to download Npackd to get started. Don’t worry; once you get this program set up you won’t need to mess around with so many downloads anymore! Fire the program up and you’ll see an interface Linux users will find familar:
npackd-main

Don’t worry if it doesn’t seem familar to you; it’s easy enough to use. Scroll to browse the applications, and double-click to see a quick summary of a given piece of software:
npackd-info

Like what you see? Feel free to install the application, then. Once you’ve highlighted a piece of software you can click the “Install” button on the toolbar to start the installation process. Unlike most Windows installation tools, there’s no need for you to click “Next” several times. Just let the installation start and the software will download and install for you, hands free:
npackd-installing
This makes installing software a much less time-consuming process, as you can imagine, and there’s a lot of software to choose from.

 

Supported Software

Browse the list and you’ll find some familiar tools. Some favorites are included, such as:
  • Dropbox
  • OpenOffice
  • CCleaner
  • FoxIt Reader
  • Google Chrome
  • AutoRuns
  • VLC
This is just a sample; there’s over 200 completely free programs to choose from and more being added all the time. Take a look and you’ll find a bunch of apps you know and love. It’s a far cry from Ubuntu’s thousands of free apps, but it’s a start for Windows.

 

Warning!

There’s a warning on this program’s website, and it should be heeded. Do not use Window’s Control Panel to remove software you’ve installed using Npackd, because this can cause a mess. Instead, use Npackd to remove software you’ve installed using it.

 

Conclusion

I discovered this piece of software via a blog post on TechHamlet, and have been enjoying it ever since. As a Linux user I obviously like anything that makes Windows more Linux-like, but I think longtime Windows users will appreciate the idea as well. Anything that makes life simpler is good, and this program makes finding, installing and keeping free software up to date a great deal easier.

Sunday, May 15, 2011

Download YouTube videos from Terminal


If you are a YouTube fan, and have always wanted to download the tons of videos available online from Linux based distros, there are quite a few good options available, like Flashgot (Firefox plugin), etc.
However, if you are of the CLI-types, and prefer a Terminal based solution, just download and install youtube-dl
su -c ‘yum install youtube-dl’
And you are done.. now use it in the following way and enjoy :-)
youtube-dl video_url

Multiple commands from a single Keyboard Shortcut


After doing the keyboard binding, i wanted to experiment further and try to run multiple commands from the single keyboard shortcut. Basically, the inspiration was managing the OLD style eject operation found in Gnome, wherein the notification daemon used to show : “Ejecting Media Drive” followed by the eject operation.
After alot of tricks (even trying putting semi-colon between commands in the keyboard shortcut assigning window, which grandly failed !!), i zeroed in onto creating a simple bash script :
#!/bin/bash
notify-send -i /usr/share/icons/gnome-colors-common/scalable/notifications/notification-device-eject.svg “Eject” “Ejecting Media Device”
eject
NOTE THAT you need the libnotify-cil or libnotify-cli package in your distro to make the above shown notification happen.
Thats it. Save the file (name = script.sh) in your homefolder somwehere, say : /home/laptop/Public/
Now, perform the following steps:
  1. in your terminal, type : chmod +x /home/laptop/Public/script.sh
  2. Now, open Keyboard Shortcut Window from preferences menu
  3. Click on ADD button
  4. Name the entry as Eject CD Drive
  5. Enter the command as : /home/laptop/Public/script.sh
  6. Click OK
  7. Click on extreme right of the new entry you  just made
  8. Specify your keyboard binding for this entry.
And its done.. When you press the key combinations you just specified, it’ll show up the notification as shown in the image above. ENJOY !!!

Broken Eject keyboard shortcut in Gnome 2.30


There  is a configurable and pre-defined keyboard shortcut in GNOME for CD drive eject, suited especially for keyboard junkies who hate to take their hands off the keyboard for any operation.. However, since previous 2-3 releases of GNOME, i have observed that the keyboard shortcut binding is broken.. in the sense, that it doesn’t work.
So, i defined my own custom shortcut from the “Keyboard Shortcuts” window in Preference menu of Gnome based Distro, by the following method :
  1. Click on ADD button in “Keyboard Shortcut” window
  2. Specify a name for the keyboard shortcut you are defining (in my case: EJECT DISC)
  3. in the command text box, specify : eject
  4. Click OK to get a new entry in the shortcuts window (at the bottom)
  5. Click on the entry at extreme right hand side
  6. Press the key combinations you desire for the binding.
And you are done ! try pressing the keyboard combination, and you’ll see it working absolutely fine.
Hope this bug is fixed in upcoming GNOME 3.0 release..

Wednesday, May 4, 2011

Virus Removing Script


There is a set of folders that were affected by virus from a Windows environment. The viruses are in the form of various windows executable formats like .bat, .com and .exe. What separates them from safe windows executables is that malicious ones have same name as their parent directory. Remove all such occurrences. (There can be many levels of folders)

Be careful while reading a code segment

#include<stdio.h>
int main()
{
          int a=10;
          switch(a)
          {
                  case '1':
                      printf("ONE\n");
                      break;
                  case '2':
                      printf("TWO\n");
                      break;
                  defau1t:
                      printf("NONE\n");
          }
          return 0;
}
If you expect the output of the above program to be NONE, I would request you to check it out!!

Thursday, April 28, 2011

Parallelism

Threads and processes:
A computer will often appear to be doing many things simultaneously, such as checking for new e‐mail messages, saving a Word document, and loading a website. Each program is a separate “process”. Each process has one or more “threads”. If a process has several threads, they appear to run simultaneously. For example, an email client may have one thread that checks for new e‐mail messages and one thread for the GUI so that it can show a button being pressed. In fact, only one thread is being run at any given time. The processor switches between threads so quickly that they appear to be running simultaneously. Multiple threads in a single process have access to the same memory. By contrast, multiple processes have separate regions of memory and can only communicate by special mechanisms. The processor loads and saves a separate set of registers for each thread. Remember, each process has one or more threads, and the processor switches between threads.

Titanic Ship Crew Job

Got this code on codechef:
The captain of the ship TITANIC is a little .... off the track. He needs to select the crew for the ship. But everyone seems to be eligible. So to test their intelligence, he plays a game.
The contestants have to stand in a line. They are given the numbers in the order in which they stand, starting from 1. The captain then removes all the contestants that are standing at an odd position.
Initially, standing people have numbers - 1,2,3,4,5...
After first pass, people left are - 2,4,...
After second pass - 4,....
And so on.
You want to board the ship as a crew member. Given the total number of applicants for a position, find the best place to stand in the line so that you are selected.

Wednesday, April 27, 2011

Duplicate character in a given string..

The first solution that comes to mind is to use use nested loops..But then we realize that it's a O(n^2) solution.
So we need to refine this solution. A better option than arrives to have an additional array that stores count of each character. This solution is better off than the previous one as it's running time has reduces to O(n). But this one consumes O(n) extra memory.
Can we do it in linear time with constant memory?
If yes, then how?

Thursday, April 14, 2011

Hats On A Death Row

You are one of 20 prisoners on death row with the execution date set for tomorrow. Your king is a ruthless man who likes to toy with his people's miseries. He comes to your cell today and tells you:
“I’m gonna give you prisoners a chance to go free tomorrow. You will all stand in a row (queue) before the executioner and we will put a hat on your head, either a red or a black one. Of course you will not be able to see the color of your own hat; you will only be able to see the prisoners in front of you with their hats on; you will not be allowed to look back or communicate together in any way (talking, touching.....).

The prisoner in the back will be able to see the 19 prisoners in front of him. The one in front of him will be able to see 18…

Starting with the last person in the row, the one who can see everybody in front of him, he will be asked a simple question: WHAT IS THE COLOR OF YOUR HAT?

He will be only allowed to answer “BLACK” or “RED”. If he says anything else you will ALL be executed immediately.

If he guesses the right color of the hat on his head he is set free, otherwise he is put to death. And we move on to the one in front of him and ask him the same question and so on…

Well, good luck tomorrow, HA HA HA HA HA HA!”

Now since you all can communicate freely during the night, can you find a way to guarantee the freedom of some prisoners tomorrow? How many?