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.

Categories
Article Blog: My thoughts Operating System

Why we don’t need VPS?

Late last year, I was pretty happy to have a budget to take a VPS for my company. This was first server that we own. What a great feeling to have it. But soon the great feeling becomes a nightmare. It was not that hosting company is not that good, it was just that the VPS are not good in general. I am talking about it after using atleast 10 VPS server from 3-4 different companies. Fortunately I invest only in one of them.

Coming back to topic, here are reasons why I hate VPS now:
1. VPS is said to be cheaper, But for whom? You or hosting companies? Companies with good reputation or resources gives a VPS starting at $60 per month for just a 1GB RAM, with 30GB HDD. IF you compare it with Dedicate server with low end they ends up with 160 GB HDD and 2 GB RAM. for about $100. But to get that configuration you need to spend over $100. So comparatively they are not cheap.

2. When I buy a VPS I read that my VPS will be hosted on Cloud network and hence if a VPS fails for some reason it get up again on next node in network and reduce the downtime. Unfortunately my VPS Hosting GRID failed and it dump my data for 48 hrs, before they can fix the node. I was not alone but all people having their VPS on that grid lost valuble 48hrs waiting for their server. Later it took 15 days to get my hosting to move my VPS to new GRID as even after 48 hrs they said they still need to do few maintenance and my VPS will do roller coaster during that time. If I have Dedicated server and if some hardware fails it took less than 2 hrs to get it up live. But if VPS grid’s hardware fails who grid gets overloaded from other VPS and reduce performance. Plus changinge their hardware wasn’t easy. This is what I had experience on my server and unfortunately on client’s hosting when their Hosting [different my mine] fails for them too.

3. VPS should not be confused with Cloud Hosting. VPS are virtual machine, and even if they are hosted on Cloud Network they are not Cloud hosting for your purpose, they are as good as dedicate machine. IF your VPS fails, or shutdown, your website will be down. You won’t get shifted or reboot, becuase machine is down not a network. It is like notepad crashing on your computer. It do not effect computer otherwise. Cloud hosting are like shared hosting, where multiple computers store data, and a data replication happens on fallback node. then your webserver runs on different hardware on same grid and other application as well. So if say one web server fails there are other webserver available to take load of your application. But this is note the case with VPS machines. IF you take VPS you take a 1990’s computer as server don’t expect too much.

4. VPS is a concept of running more than one Operating system on given hardware. Like running Parallel to run Widows on Mac. Though it is been said that they share resources, but actually if you have a computer with 4 GB RAM running 2 VM with 2 GB RAM. do you think you get full 2GB RAM performance? the answer is NO. because at 4GB RAM there are 3 OS running. and one is using 4GB, while other 2 are using 2GB each, so they need 8GB in total, but it is not possible because we have 4GB. So the host operating system scarifice some of his RAM, maybe 3GB but it still be a 5GB. Same happens with CPU processing, Same with HDD. A HDD writes a 1xX speed if it has to write it for 3 OS will it write faster? no it still write 1xX and each os get only 1/3xX of speed.

In nutshell, if you are trying to save money by using VPS, then you better reconsider using a Shared hosting or a Dedicated server. Hosting 10 site on VPS will cost you $6 per month with no performance, where as shared hosting from decently good host will cost your just about same, but much better performance. And if you have enough money why not a Dedicated server or a Cloud hosting like Microsoft Azure, or Amazon S3 like services ?