Categories
Article Hardware Operating System

Upgrading your system Disk

I am using windows from my first computer in 1997. Since then, whenever a problem arise in system, our hardware expert suggest one thing. Format the system and start fresh. I kinda like the idea at that time, as it give me more time to play with core system things. I remember formatting windows 95/98 PC was complicated, as you have to create some text files, boot with floppy disk and then run from CD.

Time passes, and process become simpler, and I grow in programmer. Now, my machine handle, Visual Studio, Andriod Studio, Nodejs, SQL server, MySQL, apache and IIS, and lot of utilities. Previously I used to keep CD of my software. But every week we have few updates on either of those software and burning CD is not possible. Now, formatting means wasting my 2-3 days to just install everything. Formatting itself take 45 minutes max on my machine, but pre-formatting backup, and restoration after formatting is no fun.

But my primary disk is full and only 5 GB space is left on my C:\, It is only NVMe disk in system and I have to upgrade it to large capacity disk. I don’t want to format PC. So, I find this fine software recommendation from a google search, Macrium Reflect (from https://www.macrium.com/ ). I download their free version, and install on my Home PC. Install it on very drive that needs upgraded, yes my C:\. Install my new Disk on other slot. Now, I run software, and clone my disk to new Disk. Since they are NVMe disk they copy fast, it took about 20 minutes to clone 225 GB of disk to new 500 GB disk.

After 20 minutes, I realise that cloning use only old size from new disk and rest of space is empty, unused still. So everything is waste for me. But then Windows’ Disk management comes handy and allow Extending my new soon going to be C: drive to use remaining space from disk. [Right click on partition and click extend]. It use all left over space.

After swapping old disk with new one. [I tool old out of system to test if cloning was good or not], It works with extended disk. then I put my old disk and format it to use as secondary disk.

It took me 1 hr to do all these stuff, and certainly save my 2-3 days of effort, and save my weekend.

Categories
Blog: My thoughts Operating System PHP Server Configuration

Linux Upgrade from 12.04 to 14.04: Save the day

So, this fine sunday, I think I wake with “lets spoil the day” mood. I start by checking my server to see how it is doing. A regular log view and updates I perform on my VPS. all was good, until I realise an update is available for my billing software. I decide to purchase an update for it. Before buying I forgot to check system requirement. Well it is just an update, and we install it every here and there for other things. So, I have updated copy of my billing software, which I follow the steps of upgrade and upload to my live server. All went well until I reach for software to suggest install PHP 5.6 instead of version I had. Well no problem how hard it is to update PHP in ubuntu 12.04, just matter of running apt-get.

Soon, I realise PHP 5.6 was never release for OS, and I need to use PPA. Found an old tutorial teaching me how to use PPA as it is my first time for it, the blog explain everything good, found couple more article but they are nearly the same. So, I went on and install the PPA and update the PHP 5.6. I run a command line to see what version of PHP is there and it correctly shows 5.6. So far so good, but suddenly “If anything goes wrong will go wrong” statement hit me. It only update CLI PHP not apache version. Damn, what is wrong with it.

PPA on Ubuntu 12.04 LTS need Apache 2.4 and Apache 2.4 never makes to Ubuntu 12.04. So, again there is PPA for apache but that doesn’t work for me well. I mean it does update few things, but cannot make PHP’s Lib for Apache to get installed. At this very moment, I have two options. Either I rollback all updates to my Backup Copy, or I move ahead to upgrade OS to 14.04 LTS. I choose later one.

Simply run “do-release-upgrade” and follow the course of stream. but it stuck as VestaCP’s APT repo didn’t work with upgrade. Not sure why, I just remove them from APT repo’ List and all goes well. All updated nothing is broken but Apache. It is broken because my previous attempt of PPA apache upgrade leave it broken and in conflicting state.

I remove and try reinstall apache without PPA, but that cause more conflict. After hit and trial with PPA and non PPA apache, I end up getting it upgrade and everything running.

There is no technical details shared in this post, as this post is not for Step on how to do it, but what not to do it. And that is only one thing, never miss reading about what upgrades you are going to do, never miss system requirement before paying someone. It only took me 4 hrs to get it all going, and frankly it turns out to be Positive for me, as it get my pending upgrade of OS done. But, I would have save my day if I read the simple requirement before buying the upgrade for billing software. I would have avoided unnecessary upgrade path, and reduce the down time to say 1 hr at most instead of 4 hrs. Good thing my blog is not a business, but never try that at client server.

Categories
C#.NET Concept/algorithm Operating System

Refreshing USB ports using C#

Finished a project in which I need to refresh the USB ports by just before we start some particular benchmarking application my client has. Seems pretty easy job, if you know to gain access of system resource. But, it become fun job, when I found that knowledge of system is not even necessary for this job. Thanks to Microsoft’s `Devcon` utility, that already take care of it. So, in all what I have to do is just pass the correct parameter to it. The parameter is pretty easy, just pass the Hardware ID of USB port to refresh.

Yeah, that’s pretty easy. But …

Yes, but how we get the hardware id of USB port? Do we still need access to system resource for that? Well, it seems so. So we are back to square one. Well not really. I found a solution on web that points to `System.Management` namespace in .NET. What it does is it give you the list of all resources that are otherwise available through Computer management or such system resources. Here is main piece of code from article

public static List GetUSBDevices()
{
	List devices = new List();

	ManagementObjectCollection collection;
	//Win32_PnPEntity
	//Win32_USBControllerDevice
	using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"))
		collection = searcher.Get();

	foreach (var device in collection)
	{
		devices.Add(new USBDeviceInfo(
		(string)device.GetPropertyValue("DeviceID"),
		(string)device.GetPropertyValue("PNPDeviceID"),
		(string)device.GetPropertyValue("Description"),
		device.ToString()
		));
	}

	collection.Dispose();
	return devices;
}

This provide the list of all USB port in system, and then you can pass the “DeviceID” to devcon and we are done.

For further clarification:

Categories
Operating System

Windows System Repair

I just install Windows 8.1 on my home PC, installing SQL Server on it and found that activeds.dll file was missing. I haven’t install anything, just regular MS products and updates. So, how can a file is missing. On searching I found that DLL was present, but seems corrupted, maybe some disk writing fails or something. I start thinking to reinstall machine, as it is just been installed and got corrupted. But at last minute I found a command that not only detect all corrupted files in windows system but repair them as well. Here is steps

  1. Open CMD with Admin rights
  2. run sfc /scannow
  3. Enjoy.

It repairs few basic windows DLL that got corrupted maybe for any reason, disk fail, some program change them or whatever. It save me few hours to re-install and then update 4GB on internet again.

Categories
Operating System PHP Server Configuration

PHP Upgrade on Plesk/Linux

Well if you search topic on google you will find lot about it. But here is quick guide for me with little explanation.

1. Plesk do not ship PHP as it’s integrated part, so it ask you to upgrade outside plesk and they do not provide support on it.

2. On Linux you can use default APT or YUM to upgrade PHP. In my case it is CentOS/Red hat flavour so this article apply to that mainly. Now when I try to upgrade from PHP 5.1 to PHP5.3 I cannot do that as default CentOS repo shows PHP53 as different package and do not come under default upgrade. And it though gets in conflict with PHP5.1’s current install.

3. I try to Erase existing package and thought to install PHP 5.3 afresh. But it shows a list of 110 dependencies which mainly consist of Plesk’s module. Otherwise it was fairly okay to YUM ERASE PHP. So, I have to opt for this solution which works 100% for where I read about it.

4. Atomic Corp create a script then on Red Hat favour enable 5.1 to 5.3 upgrade (Their WIKI: http://www.atomicorp.com/wiki/index.php/PHP ) Once you run this SH script you can re-run YUM to do the update. Steps are:

# wget -q -O -http://www.atomicorp.com/installers/atomic.sh
# yum upgrade php
# service httpd restart

Bingo !!! PHP upgraded. No server restart needed.

Categories
Operating System

Windows Developer Preview : First look

Okay, so everyone is sharing their thoughts on Windows 8 aka Windows Developer Preview. I thought to do so. So, if I talk all about in one word. Awesome !!!. This is cool, easy ..err, not really easy at first. But really great. So, what make it feel like it is not easy. Well, the metro application, was great to go there, but when I am on metro apps I miss the “multi-tasking” as I do not see the other application. This is explainable as metro style is for general user who love to do saying painting or if you just want to view facebook. Most home user are of that type. But as a software developer, this isn’t the scenario with us and I believe even a banker won’t like that when they often switch between different apps etc.

But that doesn’t mean we cannot work without metro, they have classic desktop to suite our habitual old style. But now in classic desktop I miss two important things. The Start menu which show multiple option if you take mouse over it diagonally, but if you go from taskbar to new start menu it shows nothing and clicking it doesn’t open your software but open the metro apps dashboard. Not good. The second thing I found missing is that I cannot add the “myComputer” or “Computer” on Desktop. I am in habit of having that icon since time of Windows 95. Not a big thing to miss but always a good to have on my desktop.

OS is touch centric, but a traditional PC or laptop for office work doesn’t suite it as mostly users are 18″ away from monitor and they are in parallel to eye. So if you have to work 8 hrs in office desk you cannot touch your monitor to move around. And you cannot work on Tablet from office either. With above missing option for Start Menu, [or maybe I didn’t find that menu yet]. It is hard to adopt it for me as developer. But as a normal user, I am more than happy to have those cluster removed for me.

So, I gave 10/10 as user, but will give 7/10 as full day computer user. Though the best thing I love about this preview is it’s Speed. I mean I use preview on computer with just 1 GB RAM in 3/4yr old processor. And I run faster than Windows 7 on that machine. Application opening and closing is very fast and noticeable for me and my colleagues. Must give 100% marks to microsoft for this.

In all it is great, but have to change few habits to adopt it.

Categories
Operating System

Deleting a Folder with Error “Path not found”

Okay after using computer for 13 yrs, I encounter a problem in deleting a empty folder in my system. Interesting ..huh? Whenever I press delete button on folder it says “Folder not found”. I try to delete it from command prompt, with same result. When I try to take ownership of folder, yet again it didn’t allow me as “folder doesn’t exists” so it cannot read the permission to set or reset. So I found this method to work for me.

On Windows Command prompt simply look for ShortName of folder by

dir /x

it shows Old age Shortname [DOS Name ?]

now use regular rmdir command with shortname

rmdir <folder’s shortname> /s

And it is done.