Showing posts from 2014

Script : Merging two file lines using python

I had two file containing some information per line. I wanted to merge the line from file one and line form file two as a single line and print on the console. 
I came up with below  script to do that. It takes the input as two file and print the output as merge of two files data per line.

import sys
def merge_files(argv):
f1 = open(argv[0], "r")
f2 = open(argv[1], "r")
lines1 = f1.readlines()
lines2 = f2.readlines()
count = 0
for line in lines1:
line =  line.rstrip() + lines2[count].rstrip()
print line
count = count + 1

if __name__ == "__main__":

Save the above code to file in python file.  Now you just have to execute the on command line as "python <filename>.py   file1 file2".

Error : NS_ERROR_FACTORY_NOT_REGISTERED The VirtualBox COM server is not running or failed to start.

If you are facing issue with VirtualBox version 4.3.12 on Mac/Linux and above as posted below, most likely your tmp permissions are not correct.
ERROR: failed to create a session object!
ERROR: code NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) - Class not registered (extended info not available)
Most likely, the VirtualBox COM server is not running or failed to start.
Update the /tmp directory permissions for the user which is trying to use the VirtualBox with the below command and it should resolve the issue.

chmod 1777 /tmp

Error : LNK2001 :unresolved external symbol __CrtDbgReportW

Building a Microsoft Visual C++ project you may get error "LNK2001: unresolved external symbol __CrtDbgReportW".
If you have recently changed the VS runtime, check if the runtime library settings (under C++ -> code generation settings ) are same for the project and all the libs you are linking to.

If there is a single project rebuilding should solve the error.

Error : LNK2001: unresolved external symbol ___CxxFrameHandler3

Building a Microsoft Visual C++ project you may get error "LNK2001: unresolved external symbol ___CxxFrameHandler3".
__CxxFrameHandler3 is the exception handler in the CRT.  Linking with wrong lib path may raise this error. 
To resolve this error verify and correct the lib path. You can enable verbose switch of the linker which will tell you the path from where the lib are searched/linked. 
Include /verbose switch in the linker command line and rebuild the project and correct the lib path.

How to save the credentials for Remote desktop connection

Sometimes the remote desktop connection credentials does not get saved even if you check "Allow to save the credentials" option on Remote desktop connection dialog.
You can use the credentials manager to save the different remote desktop credentials.
Under the category view  Go to Control Panel-> User Accounts -> Credential Manager.
If you dont have the classic/category view then  go to Control Panel-> Credential Manager.
The add the generic credentials. On the generic credentials dialog add the ip/name of the remote computer and enter the credentials for the same and click Ok.  Now here after you will not be asked for the credentials for that computer. 
You can even save the credentials for shared location as well.

Adding home screen on Android Kitkat stock launcher

There is no direct setting to set the number of home screens for Android Kitkat stock launcher. 
To add the new home screen you simply hold the home screen it will show you the options for adding widget or changing wallpaper or adding application to home screen as shown below.

Now just select any widget and you will see automatically created new home screen for making room for new widget to place as shown below.