Running an HTTP server in default port 80 on Windows
Summary: SQL Server Reporting Services is listening on port 80 from within System (PID 4) process.
I tried to run a HTTP server on my Vista box. It couldn’t bind to that port. So I looked around a bit.
Engin@Engin-PC ~ $ netstat -n -a -p tcp -b -o Active Connections Proto Local Address Foreign Address State PID TCP 0.0.0.0:22 0.0.0.0:0 LISTENING 3816 [sshd.exe] TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 Can not obtain ownership information
From Process Explorer I can tell that it is System process. So why does such a core part of my OS listening on port 80. A rather easy way to find out is to simply netcat to that port.
$ nc localhost 80 help HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Thu, 31 Mar 2011 08:44:26 GMT Connection: close Content-Length: 326 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Invalid Verb</h2> <hr><p>HTTP Error 400. The request verb is invalid.</p> </BODY></HTML>
Server: Microsoft-HTTPAPI/2.0 hmm. A little bit googling told me that this is due to SQL Server Reporting Services. When you stop this service, port 80 will be available again.
Restoring MySQL Databases from an HDD Image
UPDATE: There’s an update to this MySQL Workbench fetching… problem solved
I don’t know what is the proper way of handling this but this is rather a cumbersome process apparently.
You can see your datadir by issuing:
select @@datadir;
Replace this directory with your backed up datadir. Datadir can also be found in my.ini (or my.cnf in GNU/Linux I guess).
When I did, I got the following error while trying to start the MySQL server:
110331 9:56:57 [Note] Plugin 'FEDERATED' is disabled. 110331 9:56:57 InnoDB: The InnoDB memory heap is disabled 110331 9:56:57 InnoDB: Mutexes and rw_locks use Windows interlocked functions 110331 9:56:57 InnoDB: Compressed tables use zlib 1.2.3 110331 9:56:57 InnoDB: Initializing buffer pool, size = 128.0M 110331 9:56:57 InnoDB: Completed initialization of buffer pool InnoDB: Error: log file .\ib_logfile0 is of different size 0 55574528 bytes InnoDB: than specified in the .cnf file 0 5242880 bytes! 110331 9:56:58 [ERROR] Plugin 'InnoDB' init function returned error. 110331 9:56:58 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 110331 9:56:58 [ERROR] Unknown/unsupported storage engine: InnoDB 110331 9:56:58 [ERROR] Aborting 110331 9:56:58 [Note] C:\PROGRA~2\EASYPH~1.0\MySql\bin\mysqld.exe: Shutdown complete
I’ve added “innodb_log_file_size = 53M” parameter to my my.cnf and the server started just fine. You see the 55574528 in the above error log ? That is precisely 53M (55574528/(1024*1024)=53). Though MySQL Workbench still can’t browse the databases in the UI, it tells me
Error: Time: 10:56:43 Message: Error Code: 1548 Cannot load from mysql.proc. The table is probably corrupted Details: Get schema contents
Though I can use the databases as below:
use myolddb; select * from atable;
Even though Workbench is not happy with this, it works. I’ll update if I find anything useful.
Update to SharkIt
My brother told me SharkIt stopped working, I’ve updated it to work again.
Changes include:
- Again compatible with Grooveshark
- Faster session retriving, hence you can log in faster!
- Handles bad file names
- More cross platform file handling.
Wireless module of Sony VAIO VGN-Z790 broken
Me and my partner got two Sony VAIO VGN-Z790DIB notebooks 1.5 years ago. Admittedly, I still think it is the best PC notebook out there (P9700 CPU, 4G RAM, 1.47kg, ~6h battery). Though, wireless module of my partner’s notebook stopped working in the first month. The wireless module got physically broken, completely disappeared from system as it is not connected at all.
Today, it turned out that these notebooks have some kind of design fault, as mine also got broken. It literally disappeared all of a sudden. It is not a software problem as it is not seen by GNU/Linux or anything.
I tried to order another Wireless Module for VGN-Z790 but all my searches failed. Then, I decided to disassemble it, in hope that I could find a part number etc. After all, I have changed broken parts of my previous notebooks anyway.
It is a very painful task to disassemble this notebook. It took almost 1h to disassemble and assemble the notebook back. Here’s the service manual for VGN-Z series, it is almost impossible to work on this notebook without this. I’d expect a much better service manual from a company such as Sony, but it was quite low quality if you ask me. Dell’s service manuals were way better.
Anyway, I got it! The wireless module of VGN-Z790 is 512AN_HMW. You can see the pictures below.


Luckily, if you search with this model number you can find this part from ebay. I’ll order one soon and see if it is the module that is getting broken or it is something else that is affecting it — only if I don’t get a new notebook! This is a pretty damn good excuse to get one, amarite ?
TIM: Time Is Money! Standalone meeting calculator in HTML/Javascript
This is my take on TIM calculator, you can download, modify and run it in any browser (I’ve tested with IE8, Chrome, FF). View, download or use it online.
Modify the currency to your liking. Oh, and of course, best viewed with Chrome.
explorer.exe hard faults excessively and opens way too many file handles — looks like tortoise svn is slowing me down, what a surprise.
UPDATE: It turned out that the reason is not TortoiseSVN, my apologies to the development team.
Recently, more and more often, explorer.exe started to cause excessive hard faults like 13k/min. When I tried to look at what the fuck explorer.exe is doing, I noticed it was opening hundreds of file handles in my Code directory, which has several sub directories with hundreds of thousands of small files (source codes). I saw this a few times but this time it struck me that it could be because of Tortoise SVN. When you open a folder in Windows Explorer, soon you start to see SVN folders are marked with an icon, thanks to Tortoise SVN. To achieve that it must be traversing through subfolders and looking for the infamous hidden .svn folder.
With that in mind, I started to examine opened file handles more closely. Then I realized that most of them are .svn folders. So, I uninstalled Tortoise SVN immediately it asked me for a reboot, I said “no”. I manually restarted explorer.exe process to get rid of the in-memory Tortoise SVN. Now my hard faults looks like stopped.
And it is indeed quite ironic that a software named Tortoise slowed my computer down. So, we found something else SVN is bad at :)
How to develop, install, debug Windows Services
- Create a Windows Service project.
- Read documentation about the methods (OnStart and OnStop) you had to implement and implement them
- Try to debug.
- You’ll get:
Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.
- InstallUtil.exe is in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe for me. There was another InstallUtil before that, in the PATH. Hence I needed the absolute path.
- When you try to install your service, if you look close enough you’ll see:
No public installers with the RunInstallerAttribute.Yes attribute could be found in the c:\Users\Engin\Code\RunawayKiller\RunawayKiller\bin\Debug\RunawayKiller.exe assembly.
- It turns out you need to have a special public class in your assembly to tell InstallUtil.exe what to do. Here’s my class:
using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; using System.ServiceProcess; namespace RunawayKiller { [RunInstaller(true)] public class ProjectInstaller : System.Configuration.Install.Installer { private ServiceInstaller serviceInstaller; private ServiceProcessInstaller processInstaller; public ProjectInstaller() { processInstaller = new ServiceProcessInstaller(); serviceInstaller = new ServiceInstaller(); processInstaller.Account = ServiceAccount.LocalSystem; serviceInstaller.StartType = ServiceStartMode.Manual; serviceInstaller.ServiceName = "Runaway Process Killer"; Installers.Add(serviceInstaller); Installers.Add(processInstaller); } } } - Now, when you InstallUtil.exe your assembly, you’ll see your service in the Windows Services list. You can run it.
- You need to do this InstallUtil installation just once. When you update your assembly (i.e. with new code) just restart the service and your new code will run.
- Debugging is still not straightforward. Documentations tell that you need to go “Debug > Attach to process” and attach to the running service. In my case, it was greyed out.
- A work around is to call System.Diagnostics.Debugger.Launch(); to trigger Windows to launch a debugger to the debug the process. I put this on OnStart
- When you run the service, Windows will ask you to chose a debugger. You instance won’t be listed there unless you run Visual Studio with administrator privileges. I recommend you to do so. Run Visual Studio with administrator privileges and open your Windows Service project. And when you start your service, chose that instance of Visual Studio to debug. It will tell you There is no source code available for the current location. Don’t mind this warning and click OK.
- Now you can set break points in your source code and click Continue to run your service.
Disclaimer: These are my notes from a 45 minute trip during rush hour and not necessarily the best practices whatsoever.
I just diagnosed myself, BAM!: Ulnar Nerve Entrapment
If you work with computers very much, like me, I have an advice for you. Do not rest your elbows (on the desk or chair). This eventually causes some numbness in the little finger. See the perfect explanation here.
gnuplot performance on windows
gnuplot is an unbelievably good tool, if you don’t know it yet, check it out. Though the gnuplot Windows package has performance problems. No matter how much I tweaked the parameters and tried different rendering engines (terminal in gnuplot jargon), I couldn’t fix it. It was taking more than 5 seconds to render 350k data points.
Cygwin is a part of my toolchain. Today I figured I might give gnuplot with Cygwin/X11 a shot. Cygwin also has a gnuplot package which is built for Cygwin environment. Cygwin also has a X11 package, so that you can run a X11 server on your Windows box. Actually there are several other X11 server implementations for Windows out there, even commercial ones. Anyway, I’ve tried to plot my graphs using Cygwin gnuplot and X11. And voila! It was about 5 times faster.
So, having gnuplot performance problems on Windows ? If you don’t mind installing Cygwin (which is simply a double click and next, next, next) you can enjoy a faster gnuplot experience.