Express your feeling with actions.

پاکستان ایک عشق ایک جنوں

Pakistan Zindabad!

Express Your Love by you.


تلاش کرتا ہو خود میں ایسا جذبہ جسے اندیشہ زوال نہ ہو

مگربہت تلاش پر بھی نہ ملا جس پر یہ سوال نہ ہو

By AimsLife






Given code can help you to compute checksum.

/* pseudo header for checksum calculation */
typedef struct pseudoh {
    guint32 src_addr;
    guint32 dest_addr;
    guint8  zero;
    guint8  protocol;
    guint16 length;
} PSEUDO_HDR, * PPSEUDO_HDR;

/* Compute Checksum for TCP packets */
GUINT16 ComputeChecksum(PGUINT16 pseudo_hdr, PGUINT16 ptcp_hdr, PGUINT16 pdata, GUINT32 dataSize) {

  guint32 checksum = 0;
  guint32 nleft = 0;

  nleft = SIZE_PSEUDO_HDR;
  while(nleft > 1) {
    /*  This is the inner loop */
    checksum = checksum + *(pseudo_hdr++);
    nleft = nleft – sizeof(guint16);
  }

  nleft = SIZE_TCP_HEADER;
  while(nleft > 1) {
    /*  This is the inner loop */
    checksum = checksum + *(ptcp_hdr++);
    nleft = nleft – sizeof(guint16);
  }

  nleft = dataSize;
  while(nleft > 1) {
    /*  This is the inner loop */
    checksum = checksum + *(pdata++);
    nleft = nleft – sizeof(guint16);
  }
  if(nleft)
    checksum = checksum + *((pguint8)pdata);
  /*  Fold 32-bit sum to 16 bits */
  checksum = (0xFFFF&(checksum >> 16)) + (checksum & 0xffff);
  checksum = (checksum & 0xffff) + (0xFFFF&(checksum >> 16));
  return (guint16)(~checksum);
}


Pakistan Win! الله اکبر

Icc-world-twenty20-2009 by you.


This setting will enables for you to control automatic rebooting of the system after the crash. After the crash, you must be able to check the reason of the crash and for that, the system should not reboot. Therefore, it is very necessary to control the automatic rebooting of the system.

Path:  [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\]
Location: Local Machine
Value Name: AutoReboot
Data Type: DWORD (DWORD Value)
Enabled Value: 0
Disabled Value: 1
Action Type: Modified


While working on Microsoft Device Driver domain, I found following most active and helpful forums,

1) OSR-Online: http://www.osronline.com
You can configure OSR-Online forum on email client and given client will be helpful for you.
http://www.osronline.com/page.cfm?name=NewsReaderInfo

2) Microsoft NNTP Server: msnews.microsoft.com
Following groups are available on Microsoft forum,
1. microsoft.public.development.device.drivers
2. microsoft.public.windowsxp.device_driver.dev
You can configure Microsoft NNTP server on email-client using above “OSR-Online Forum Configuration” process but you will use “msnews.microsoft.com” for Microsoft NNTP Server address. You will not need authentication cardinality to connect Microsoft NNTP Server.

NOTE: Some time few consultants will discourage you to use forums for help and will ask you to get consultancy from them. Please do not underestimate yourself and try google and other forums for help because “Everything possible but nothing is impossible”.


I faced given compilation error after convert “Komodia Project” from “VC6” to “VS2K5”.

Error    1    Command line error D8004 : ‘/D’ requires an argument    cl

Solution:

Remove “/D” from “Additional options” (Example image is given below).
Path of “Additional options” is “Project Properties” >> “Configuration Properties” >> “C/C++” >> “Command Line”

Komodia_Project_Error by you.





# synergyc –f –d ERROR –daemon <server_ip_address>

I recommend to add this command on “/etc/rc.local” file for automatic start synergy client at login time.

[Synergy]


For uninstall/repair Windows Live Messenger 2009, you have to use "Windows Live Essentials" from “Add/Remove Programs”. Image will help you a lot.

Windows Live Messenger by you.


This is my first blog testing with "Windows Live Writer". Download information is given blow,
[Download link]

It has cool interface and good option for Blog Writing…


You can use given command on prompt.
# tar -zxvf <name>.tar.gz


Command:

# find -name .svn -exec rm -rf {} \;

OR

# find -name “\.svn” -exec rm -rf {} \;


QUAID-E-AZAM by you.

“Do your duty and have faith in God. There is no power on earth that can undo Pakistan. It has come to stay InshAllah.”
(Quid-e-Azam)


package com.Web;

import java.io.*;
import java.net.*;

public class WebServer extends Thread {
    String filePath;
    OutputStream out;
    Socket sock;
    public WebServer(String pathString, OutputStream outStream, Socket s) {
        filePath = pathString;
        sock = s;
        out = outStream;
    }
    public void run() {
        PrintWriter writer = new PrintWriter(out, true);
        try {
            filePath = (new File(filePath)).getAbsolutePath();
            InputStream in = new FileInputStream(filePath);
            int val;
            writer.println(“HTTP/1.0 200 OK”);
            writer.println(“”);
            System.out.println(“<Client> Uploading : ” + filePath);
            while ((val = in.read()) != -1) {
                out.write(val);
            }
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            writer.println(“<html><body><b>” + e.getMessage()
                    + “</b></body></html>”);
            System.out.println(“<Client> ” + e.getMessage());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            writer.println(“<html><body><b>” + e.getMessage()
                    + “</b></body></html>”);
            System.out.println(“<Client> ” + e.getMessage());
        }
        writer.println(“”);
        System.out.println(“<Client> Uploading : Complete”);
        System.out.println(“<Client> “);
        try {
            sock.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.out.println(“ERROR: ” + e.getMessage());
        }
    }

    public static void main(String[] args) throws Exception {
        ServerSocket server = new ServerSocket(80);
        while (true) {
            Socket s = server.accept();
            OutputStream out = s.getOutputStream();
            InputStream in = s.getInputStream();
            InputStreamReader inReader = new InputStreamReader(in);
            BufferedReader reader = new BufferedReader(inReader);
            String line = reader.readLine();
            while (line != null && !”".equals(line)) {
                System.out.println(“<Client> ” + line);
                String splitString[] = line.split(” “);
                if (splitString[0].equals(“GET”)) {
                    WebServer webServer = new WebServer(“.” + splitString[1],
                            out, s);
                    webServer.start();
                }
                line = reader.readLine();
            }
            System.out.println(“<Client> “);
        }
    }
}

It is your duty to compile and make it working condition… use JDK1.6 and eclipse…