Showing page 23 of 37.


 

Awesome Powershell

PowerShell showing the paths of the currently running processes

Almost every week I get excited about a new tool. The tool of choice for the last week was Microsoft’s PowerShell. After my exposure to the linux shells, I started disliking the command prompt because of it’s simplicity. I am really happy that Microsoft has finally come up with something at least as good as the linux shells (I have not spent enough time to make any conclusions on whether it is better). Some things that I still don’t like is that there is no easy way to delete a complete word, like the CTRL-W in some of the shells, or event better the vi mode! :) Anyways, back to PowerShell. For those of you who have had early exposure to this product, PowerShell was originally called Monad, and has been around a little while. PowerShell is an object based shell, and one of its best features is the object pipelining support. I don’t want to explain all the PowerShell things because there are quite a few articles and documents on the web that do that; instead here are some uses.

So, the other day I was playing around with writing an expect script to quickly upload a file to a client FTP server. During this process I had to kill the expect process a few times, not realizing that every time it was actually leaving ncftp running in the background. Today my computer became a little slow because I had a lot of programs running. So, I started Task Manager by pressing CTRL, SHIFT, and ESC. Oh, that reminds me; the other day, I was surprised to find out that this shortcut key for running Task Manager is fairly unknown. Memorize it, it comes in handy! ...Task Manager comes up and I see a ton of ncftp.exe processes running. I made this an exercise to learn PowerShell and decided that I was going to kill these processes using a PowerShell command. Well, after a few minutes and a few glances of the Quick Reference (part of the PowerShell install) I had a command to kill all of the ncftp process.

Get-Process | Where {$_.ProcessName -eq "ncftp" } | ForEach-Object { Kill %_.Id }

I know I could have saved a few minutes this time by individually killing the twelve or so instances of ncftp.exe, but where is the fun in that! No, more seriously, I made this an opportunity to sharpen the saw. I can see this knowledge coming in handy down the road.

Similarly, run the following command if you are curious about the actual paths of the executables that are currently running.

Get-Process | Format-Table -Property ProcessName, Path -AutoSize

Update: as mow points out in the comments, there is an easier way to accomplish my first task of stopping all instances of ncftp.

Get-Process ncftp | Stop-Process
Read more

Web Ascender

A few weeks ago Ryan Doom and Kevin Southworth launched the website for their company, Web Ascender. I was curious about their final product, and my curiosity was finally fulfilled by the video demos that they have put on the site. SiteCTO looks pretty cool, if you are looking for a website solution, make sure to at least consider SiteCTO. I have not actually used SiteCTO but I have worked with both Ryan and Kevin, and one thing I can say is that they know what they are doing and know it pretty well. Also, I am sure their customer support will be very good.

Read more

Removing all Contacts, Appointments and Tasks from Windows Mobile 5

ActiveSync showing the successful synchronization with Exchange

After I accidentally deleted one of my key notifications using MemMaid I spent quite some time trying to get it back. Several days of unsuccessful attempts passed and I finally decided that I would hard reset and start from scratch. Yesterday I started from scratch and setup all the programs. In the midst of the overhaul I accidentally messed up the appointments that I had synchronized with Exchange. So, now I was ten steps ahead and eight steps back! Now looking for ways to completely clear out the Pocket Outlook database so I could resynchronize with the Exchange server and get everything back to normal.

I spent the last hour or so looking around for ways to do this, which ranged from deleting all items on the desktop (not something that I felt comfortable with) to finding programs that were written specifically for deleting things. Finally, a few minutes ago I found a solution here, which worked perfectly. Basically, it seems that all your contacts, appointments and tasks are stored in a file called pim in the root folder of the device. To clear everything, you have to either delete or rename this file, and soft-reset the device. The next time that the device starts, you will have a fresh (i.e. empty) database for contacts, appointments and tasks. All I had to do after that was setup the Exchange source and synchronize!

Read more

expect

I have an Actiontec linux-based modem/router. The default configuration for this router saves the last fifty-so host names that anyone on your network looked up. This is cool but not something that I normally use or prefer to have. So I looked up instructions on disabling this feature on this site. The only problem was that since /var is mapped to the RAM, my changes would get reset every time I restarted the modem. Me being the type of person that I am, had to come up with a way to automate this.

Read more

All New Frontpage!

I have just finished publishing a new version of the home page (a.k.a. front page) for this site. Previously there was no difference between the main blog page and the home page. Now the home page is totally different, and I am proud! :) I also noticed that the captcha module had an issue which was preventing the comments from being added. I was just too excited tonight, after spending a lot of time studying today I decided to take on the challenge. This just shows my squiggly nature!

That’s correct, that is the Eiffel Tower in the background, and it’s not fake! :) This picture was taken on my trip to Europe in March of 2006.

Read more

Microsoft Word and a Vim Tip

MS Word displaying a field code

A few days ago I noticed that somehow the links and images that I was putting in my e-mails and MS Word documents were changing into { HYPERLINK "http://www.thebitguru.com" } or similar texts. I put up with it for a few days but then it became annoying enough that I had to find a solution. After some research I found out that somehow Word’s configuration was changed to display the “Field codes.” To bring it back to the original state, I had to uncheck “Field codes” on the “View” tab of the options.

To turn off field codes: Tools menu, Options menu, Uncheck Field codes

On a second note, I was looking around for finding a way of deleting every other line in Vim to clean up a text file that I generated. Guess what I found out about, the normal command. To accomplish my specific goal I had to run :%normal jdd or the shorter version :%norm jdd; which deleted every other line. The normal command executes everything after it as a “normal” command, which in this case is, go down one line and dd, or in other words, delete it. That is just one way of using the normal command. I am excited to make this discovery because I can see myself utilizing this command in so many other ways. If you are curious, this is where I found about this specific command. Vim is truly an awesome editor!

Read more

ProcessMonitor

The new ProcessMonitor filter window

Majority of my job revolves around analysis and implementation of HL7 interfaces. Friday, I got a unique opportunity to test my skills. Basically, our front-end GUI application was instantiating a third-party object using the CreateObject call but it was not able to instantiate the object. Unfortunately, the application error logging did not point to anything specific, and since this was on a Citrix server, it would not be easy for easy to install the IDE and debug through the code. So, we had to look at alternatives. The first two things that were brought up were FileMon and RegMon. After spending about an hour analyzing the calls that were going and verifying almost each one we found out that the cause was a Windows Registry permission.

Just thinking about it, my “almost jack of all trades” quality proved to be of great use :) What I mean is that, most of the times when I am working on something, in addition to doing the basic things I also do things around it, a lot of time on things that you wouldn’t normally do. For instance, I was working on an application that created a few DLLs, so there were times when I had to verify the locations and versions of these DLLs. I looked around on the internet and found a few applications, but I had to work around the quirks of these applications to get the information that I needed. Well, guess what I did? After a few uses of these applications, I went and wrote one for my specific needs. In order to write this app I had to learn the ins and outs of COM components and how it was laid out in the Windows Registry. At that time it was probably overkill, but this knowledge became very useful when I was helping troubleshoot the issue on Friday. I always knew that this extra knowledge was not a waste of time; it’s just a fairly long term investment! =D

Coming back to the topic: ProcessMonitor. Sysinternals has recently released the next version of FileMon and RegMon utilities, called ProcessMonitor. I have been playing around with ProcessMonitor and it is a very good progression of these utilities. If you use either FileMon or Regmon, you have to checkout ProcessMonitor.

Read more

.htaccess Updated

I finally took some time and wrote the simple .htaccess rule for redirecting traffic from farhan-ahmad.net to thebitguru.com. Both the domains are served through the same directory so I just updated the .htaccess file and added the following rules above the Rails rules.

RewriteCond %{HTTP_HOST} (www.)?farhan-ahmad.net$ [NC]
RewriteRule ^(.*)$ http://www.thebitguru.com/$1 [L,R]
Read more