Friday, September 4, 2009

Setting Default OS to boot in Vista and Windows 7

To set the default OS (in case of dual boot Windows OS) to be either Vista or Windows 7, do the following
1. Click "My Computer" - > Properties (You can also go here from "Control Panel"->"System")

2. Click on "Advanced System Settings" on the left side panel (This will open "Advanced" tab in "System Properties" dialog)


3. Click on "Settings" of "Startup and Recovery" group


4. Select the "Default Operating System" in "System Startup" group

Cannot open Control Panel or My Computer Properties

If you are using Vista or Windows 7, and if when you try to open Control Panel or "My Computer"->Properties, sometimes it wont open it. It appears to be loading for few seconds and after that it wont load.
This is due to the corrupted .cpl files.

To resolve this issue, do the following

1. Type "services.msc" in the run command
2. Restart "Software Licensing" service

Now you should be able to open the Control Panel and My Computer Properties.

Thursday, September 3, 2009

Socket Programming - ASYNCHRONOUS

What is Asynchronous Socket Programming?
  • "Event-driven" programming or "select()" based multiplexing
  • A concept of "handling" multiple connections in "single thread/process"
When do we need this?
  • Assume you have to write a server that will be "hit" by "n" number of clients with some requests
  • You would prefer any of the follow
  • synchronous: you handle one request at a time, each in turn.
    pros: simple
    cons: any one request can hold up all the other requests
  • fork: you start a new process to handle each request.
    pros: easy
    cons: does not scale well, hundreds of connections means hundreds of processes.
    fork() is the Unix programmer's hammer. Because it's available, every problem looks like a nail. It's usually overkill
  • threads: start a new thread to handle each request.
    pros: easy, and kinder to the kernel than using fork, since threads usually have much less overhead
    cons: your machine may not have threads, and threaded programming can get very complicated very fast, with worries about controlling access to shared resources.
  • The best solution would be "select" system call.
How "select" works?
  • The normal heirarchy of socket programming calls in the server side would be "socket()->bind()->listen()->accept()".
  • If you notice, here "accept" is the blocking call. In order to avoid this blocking stuff, we use "select" which will "run" through all the connected sockets to check if there are any requests pending for "reading, writing or error conditions".
  • If any requests pending, "select" will return the number of requests pending to be processed.
  • Hence the heirarchy would be "socket()-> bind()->listen()->select()->accept()"
  • But here the disadvantage is that, we need to iterate through all the "connections" (descriptors) connected to check "Are you the one with pending requests?" questions.

To diable Firewall

1. Run "services.msc" in command prompt
2. Go to "Windows Firewall"
3. Right click - > Properties. Then you stop it.
4. Then you "disable" it in the startup type and then exit.

Wednesday, September 2, 2009

Socket Programming

SOCKET:

Glibc, SVN and Qt

SUSE:
Installation Guidelines: http://doc.trolltech.com/4.4/install-x11.html
SVN:

unresolved external symbol

































unresolved external symbol __imp___CrtDbgReportW:
1. When u get this error, go to visual studio project settings -> C/C++ ->
Code Generation -> RunTime Library has the "debug" enabled (ex: Multi Threaded Debug DLL).
If not enabled, enable it and rebuild again.
2. Also check if Linker->Debugging->Generate Debug Info is on or not

Sunday, August 16, 2009

Good Quotes

  1. “It’s supposed to be hard; if it wasn’t hard everyone would do it. The hard is what makes it great.” -- Tom Hanks
  2. "Being in the right place at the right time won’t make you a success – unless you’re ready. The important question is: Are you ready?” -- Johnny Carson
  3. If at first you dont' succeed, cal it version 1.0
  4. If you are willing to admit faults, you have one less fault to admit

Thursday, August 13, 2009

Mentioning Library path for .lib (s)

If you have dependency on some .libs, you cannot specify this path of .libs in "Include" path of your project. In order to specify the path, you need to specify the path of .libs in "Linker" as shown, in "Additional Library Directories" of General Category.

Changing the user name while inserting comment



1. Go to Review Tab.
2. Select the "Track Changes" combo
3. Select "Change User Name"
4. In the "Popular" page, at the bottom you wud find "Initials". Enter your initials there.