Tuesday, November 11, 2014

Multi Line comment in Shell Script

We know that we can comment a line using '#' in Shell Script, but what if we want to comment a huge block of code? If we use '#' to comment that block then this can be very tedious task. Rather than using single line comment we can use multi line comment. In this tutorial i will show you how to use multi-line comment in Shell Script.

In Shell Script multi line comment can be of form 

<<'COMMENT'

what ever written here is a comment

COMMENT

Let see example of multi line comment

  1. #!/bin/bash
  2. echo "Hii guys"
  3. #starting of mullti line commnent
  4. <<'COMMENT'
  5. read a
  6. echo "No line in this block will execute"
  7. COMMENT
  8. echo "Hello Guys"
  9. exit

Wednesday, January 15, 2014

Plugged in, not charging Windows 7 solution

There are multiple solutions proposed, and here are the steps that fixed it for me:
  1. Disconnect AC
  2. Shutdown
  3. Remove battery
  4. Connect AC
  5. Startup
  6. Open Device Manager, Under the Batteries category, right-click all of the Microsoft ACPI Compliant Control Method Batterylistings, and select Uninstall (it’s ok if you only have 1).
  7. Shutdown
  8. Disconnect AC
  9. Insert battery
  10. Connect AC
  11. Startup

Monday, August 26, 2013

Windows Remote Desktop


I can't log on to the remote computer

If you can see the logon screen of the remote computer but you can't log on, add yourself to the Remote Desktop Users Group or to any group with administrative rights on the remote computer (or ask the administrator of the remote computer to do this).

To add a user account to a group

  1. Open Microsoft Management Console by clicking the Start button Picture of the Start button, typing mmc into the search box, and then pressing Enter.‌ Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
  2. In the left pane, click Local Users and Groups.

    If you don't see Local Users and Groups

    If you don't see Local Users and Groups, it's probably because that snap-in hasn't been added to Microsoft Management Console. Follow these steps to install it:
    1. In Microsoft Management Console, click the File menu, and then click Add/Remove Snap-in.
    2. In the Add or Remove Snap-ins dialog box, click Local Users and Groups, and then click Add.
    3. In the Choose Target Machine dialog box, click Local computer, and then click Finish.
    4. Click OK.
  3. Double-click the Groups folder.
  4. Right-click the group you want to add the user account to, and then click Add to Group.
  5. Click Add, and then type the name of the user account.
  6. Click Check Names, and then click OK.


For More Detail

http://windows.microsoft.com/en-sg/windows7/why-can-t-i-connect-using-remote-desktop-connection

Sunday, August 4, 2013

Auto reconnecting Cisco VPN client

As good as Cisco Systems is at developing cutting edge products, sometimes the products will leave you quite frustrated when certain basic feature are left out. Case in point is their VPN client software.
There is no GUI feature for automatically reconnecting to your V{PN server if your client happens to disconnect (which could be frequently). If you cleint PC is wireless or at a remote or branch office with flaky internet, diconnections could be frequent and annoying.
Here’s how you can confiogure your VPN client to automaticall reconnect to the VPN if it looses it’s connection:
Edit C:Program FilesCisco SystemsVPN Clientvpnclient.ini in Notepad.
The additions to this configuration file that enable autoreconnect are highlighted in bold.
Start of INI file
=====================================
[main] ClientLanguage=
AutoInitiationEnable=1 (Turns on the feature)
AutoInitiationRetryIntervalType=1 (1=Seconds, 2=minutes)
AutoInitiationRetryInterval=10 (Sets it to 10 second intervals)
AutoInitiationList=NetworkAll (Specifies what network to watch for auto-reconnect. This list can all the different VPN networks you connect to)
[NetworkAll] (This corresponds to your previous entry. Each network has to be in it’s own bracket with it’s specifics)
Network=0.0.0.0 (indicates any network)
Mask=0.0.0.0
ConnectionEntry=Lavallette Office (points to a connection profile named Lavallette Office.pcf in C:Program FilesCisco SystemsVPN ClientProfiles)
Connect=1
[GUI] DefaultConnectionEntry=Lavallette Office
=====================================
End of INI file

Friday, July 26, 2013

GD::Graph Perl

Welcome to GDGraph.com. This site contains help and information on the Perl GD::Graph module. This site exists because I found that the GD::Graph sample scripts and images didn't generate in an easy-to-view format. Rather than making something temporary that only I could benefit from, why not throw it up on the web so maybe I'll save someone else some time too.

Sunday, March 24, 2013

Windows DLL Explicit Linking

Explicit Linking

The harder way to load a DLL is a little bit more complicated. You will need function pointers and some Windows functions. But, by loading DLLs this way, you do not need the .lib or the header file for the DLL, only the DLL. I'll list some code and then explain it.
 Find more about DLL from here
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. typedef int (*AddFunc)(int,int);
  5. typedef void (*FunctionFunc)();
  6.  
  7. int main()
  8. {
  9. AddFunc _AddFunc;
  10. FunctionFunc _FunctionFunc;
  11. HINSTANCE hInstLibrary = LoadLibrary("DLL_Tutorial.dll");
  12.  
  13. if (hInstLibrary)
  14. {
  15. _AddFunc = (AddFunc)GetProcAddress(hInstLibrary, "Add");
  16. _FunctionFunc = (FunctionFunc)GetProcAddress(hInstLibrary,
  17. "Function");
  18.  
  19. if (_AddFunc)
  20. {
  21. std::cout << "23 = 43 = " << _AddFunc(23, 43) << std::endl;
  22. }
  23. if (_FunctionFunc)
  24. {
  25. _FunctionFunc();
  26. }
  27.  
  28. FreeLibrary(hInstLibrary);
  29. }
  30. else
  31. {
  32. std::cout << "DLL Failed To Load!" << std::endl;
  33. }
  34.  
  35. std::cin.get();
  36.  
  37. return 0;
  38. }