Sunday, November 17, 2013

C# System wide shortcut keys | Global Hot-key in C#

  1. using System;
  2. using System.Runtime.InteropServices;
  3. using System.Windows.Forms;
  4. namespace WindowsFormsApplication1
  5. {
  6.         public partial class Form1 : Form
  7.         {
  8.                 private static int _hookHandle = 0;
  9.                 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
  10.                 public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, intthreadId);
  11.                 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
  12.                 public static extern bool UnhookWindowsHookEx(int idHook);
  13.                 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
  14.                 public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);
  15.                 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
  16.                 public static extern short GetKeyState(int nVirtKey);
  17.                 public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
  18.                 public const int WH_KEYBOARD_LL = 13; 
  19.                 public const int VK_LCONTROL = 0xA2;
  20.                 public const int VK_RCONTROL = 0xA3;
  21.                 public Form1()
  22.                 {
  23.                         InitializeComponent();
  24.                         SetHook();
  25.                 }

Tuesday, November 12, 2013

Port Check Tool In C#

Simple port check tool for windows









Tool Download here...


Link Type Size
7z
  12KB 
exe
 75KB

C# Source download

  1. using System;
  2. using System.Windows.Forms;
  3. using System.Net.Sockets;
  4. namespace PortCheck
  5. {
  6.     public partial class Form1 : Form
  7.     {
  8.         public Form1()
  9.         {
  10.             InitializeComponent();
  11.         }
  12.         private void btnCheck_Click(object sender, EventArgs e)
  13.         {
  14.             TcpClient cli = new TcpClient();
  15.             int port = 0;
  16.             string ip;
  17.             try
  18.             {
  19.                 port = Convert.ToInt32(txtPort.Text.Trim());
  20.                 ip = txtIP.Text.Length > 7 ? txtIP.Text : "0.0.0.0";
  21.                 cli.Connect(ip, port);
  22.                 MessageBox.Show(cli.Connected == true ? "Port Opened" : "Port Closed"this.Text);
  23.             }
  24.             catch (Exception ex) { MessageBox.Show(ex.Messagethis.Text); }
  25.         }
  26.     }
  27. }




Monday, November 11, 2013

Limitations of SQL Server 2008 R2 Express

1. Maximum 10 GB per database.
2. Uses no more than 1 processor.
3. Uses no more than 1 GB of internal memory.
4. NO Maintenance plans
5. NO Database mail
6. NO User instances
7. SQL Server Agent
8. NO Full-text search

Google Start Rewards Program

Program Rules

On October 9, 2013, we announced a new, experimental program that rewards proactive security improvements to select open-source projects. This effort complements and extends our long-running vulnerability reward programs for Google web applications and for Google Chrome.

Reward amounts

Rewards for qualifying submissions will range from $500 to $3,133.7. The final amount is always chosen at the discretion of the reward panel and is based on our judgment of the complexity and impact of the patch.

Monday, October 21, 2013

Speeding Up the Android Emulator on Intel Architecture

This article will guide you through installing the Intel Hardware Accelerated Execution Manager (Intel HAXM), a hardware-assisted virtualization engine (hypervisor) that uses Intel Virtualization Technology (Intel VT) to speed up Android development on Windows. It also explains how to setup a hardware-assisted KVM on Linux and best known methods in compiling natively and submitting apps to the Google Play Store for x86.
2. Installation
2.1. Prerequisites
You need to have the Android SDK installed.
Your computer must have an Intel processor with support for Intel VT-x, EM64T and Execute Disable(XD) Bit functionality enabled from the BIOS.
2.2. Installation on Windows
After you have installed the Android SDK, open the SDK Manager. In the extras section, you can find the Intel HAXM.
File Path : \sdk\extras\intel\Hardware_Accelerated_Execution_Manager
Check the box and click the ‘Install packages…’ button, once you have installed the package, the status will appear as ‘Installed’, which is misleading as this is not the case. The SDK only copies the Intel HAXM executable on your machine, and it is up to you to install the executable.
To install the Intel HAXM executable, search your hard drive for IntelHaxm.exe (or IntelHAXM.dmg on Mac OS X). If you left everything to default, it should be located at C:Program FilesAndroidandroid-sdkextrasIntelHardware_Accelerated_Execution_ManagerIntelHaxm.exe.
Intel HAXM only works in combination with one of the Intel Atom processor x86 system images, which are available for Android 2.3.3 (API 10), 4.0.3 (API 15), 4.1.2 (API 16), 4.2.2 (API 17). These Intel system images can be installed exactly the same way as the ARM-based images via the SDK manager.


When you click on the IntelHaxm executable, a welcome screen is displayed like this:
You can adjust how much RAM memory is allocated to Intel HAXM. After you do this, click Next. The next screen confirms the memory allocation. If everything is as you wish, click Install.
In order to be able to install the Intel HAXM, you need to have Intel VT-x enabled in your BIOS, otherwise you will get an error like this during install:
If you get this error, go to your BIOS and enable this feature.
The second option to download the Intel HAXM and x86 Emulator System image is to go directly to the web site: http://software.intel.com/en-us/android and download the necessary components from there.
2.3. Installation on Linux
The steps to accelerate the Android emulator for Linux are different than for Windows and Mac OS X as Intel HAXM is not compatible with Linux so you would need to use KVM (kernel-based virtual machine) instead. The steps below were carried out using Ubuntu* 12.04 and may differ slightly with other Linux distributions.
As with Windows (and Mac OS X), first you need to download the Android SDK from the Android developer site. You will find an ADT (Android Developer Tool) bundle that contains both Eclipse* IDE and the Android SDK. Download the zip file and extract it to your Linux machine. Make sure you choose the right version for your Linux distribution, either 32- or 64-bit. You can check this easily by using the command:
file /sbin/init
Before you start installing the packages required for KVM, it is recommended to make sure you have the latest repository, and you can do this by typing:
sudo apt-get update
2.3.1. Installation of KVM
To install and run KVM, which is a full virtualization solution for Linux on x86 hardware (i.e., Intel VT), you first need to check if your CPU supports hardware virtualization, you can do this by typing:
egrep –c ‘(vmx|svm)’ /proc/cpuinfo
If the result is 0, that means your CPU does not support hardware virtualization, which is necessary to run the KVM. If you get 1 or more, that means you’re good to go, but still make sure it is enabled in your BIOS (see Section 2.2).
Next, you need to install KVM unless you already have it installed. You can check if your processor supports KVM by typing:
kvm-ok
If you have KVM, you will see this:
"INFO: Your CPU supports KVM extensions
INFO: /dev/kvm exists
KVM acceleration can be used"
Otherwise, if you see this, you need to go to BIOS and turn on Intel VT:
"INFO: KVM is disabled by your BIOS
HINT: Enter your BIOS setup and enable Virtualization Technology (VT),
and then hard poweroff/poweron your system
KVM acceleration can NOT be used"
The next step is to install the KVM and a few other packages needed. To do so, type
sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
In the next window, you can select No configuration if you want to leave your config unchanged:
Next, add your user to the KVM group and libvirtd group. To do so, type:
sudo adduser your_user_name kvm
sudo adduser your_user_name libvirtd
After the installation, re-login so that the changes take effect. You can test the installation by typing:
sudo virsh -c qemu:///system list
You are now ready to go to the next step, which is creating and running the AVD (Android Virtual Device). This procedure is the same for both Linux and Windows.
2.4. Creating an AVD (Android Virtual Device)
After installing the SDK and Intel HAXM (or KVM with Linux), you can create a virtual device that has hardware-accelerated emulation. To do that, go to the AVD Manager and create a new device. Make sure you select Intel Atom (x86) as the CPU/ABI. The selection appears in the drop-down only if you have the Intel x86 system image installed, for additional graphics smoothness switch on the GPU emulation when creating your AVD.
Click on New and create your x86 AVD. Make sure you select an API that is supported by an x86 system image, CPU/ABI is set to x86, and you have enabled GPU (OpenGL ES) emulation. Once you have done that, click on the Create AVD to create the AVD.
You can launch the x86 AVD by clicking on Start, then Launch.
If you are successful with the installation, when the emulator is starting, you will get a dialog box showing that Intel HAXM is running in fast virtual mode.
If you need further convincing that you are using an x86 system image, you can always check the details in the ‘About phone’ within the emulator.
The performance gain that you’ll see with Intel HAXM or KVM depends on your PC, drive, memory, etc., but should be between 5x to 10x order of magnitude. The screen shot below shows a side-by-side comparison from an x86/HAXM enabled-AVD versus an ARM-based AVD. The x86 AVD booted to the lock screen within 15 seconds whereas the non-Intel AVD took 40 seconds – a big difference.
[The performance gain that you’ll see with the Intel HAXM (or KVM) should be between 5x to 10x depending on your system configuration: Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products. Configuration: Mac Book Pro was used for testing in this case. For more information go to http://www.intel.com/performance”]
3. Best Known methods
3.1. Testing your application with the emulator from Eclipse
Whether it’s an NDK-based application or Dalvik application, you can use Intel HAXM to speed up the emulator where you do testing. If you are developing with Eclipse, you can follow these easy steps to make sure you are using the Intel HAXM when you start the emulator.
First, make sure you created your AVD as described in step 2. If you have the AVD ready, go to Run As -> Run Config as shown below:
You should land on a page like this:
Here, you can select the AVD you want by checking the box. After you have created your AVD and set up your configuration, start compiling your project and debug it with the emulator by selecting Run As -> Android Application. This will automatically start the hardware-accelerated AVD.
After the AVD has started, you should see the home screen of your application (after unlocking the screen).
3.2. Submitting multiple APK's for different ABI's vs. submitting fat binaries to Google Play
In the past, you would submit a fat binary for your developed application, which would contain all of your libraries and NDK file(s), not being able to differentiate between the architectures. That would mean that the users had to download the whole APK containing files that are not relevant to the specific architectures, i.e., x86 users would have ARM code and vice-versa. The downside of this is that if you have a really fat binary, the user was forced to download a big amount of data that would not apply to the device. Typically, this is still acceptable if your APK is under 10 to 20 MB.
Intel/Google have now implemented a CPU filtering mechanism, meaning you can now submit multiple APKs containing the different libs specific for each architecture by following the suggested versioning code shown below.
The first digit refers to the ABI, i.e., 6 for x86; then the API level that you target, i.e., 11; the screen size, 13; and then the version number of your application: 3.1.0.
Make sure that you have at least an 8-digit version number and assign the highest first digit to the x86 version. In the example above, you would put 6 for x86, 2 for ARMv7 and 1 for ARMv5TE. Doing so will make x86 versions preferred on the x86 devices and ARM versions on ARM devices.
By following these guidelines, you can make sure that your users get the best performance out of the device they own. Furthermore, you may avoid users trying to run applications on specific devices due to code translation problems.
More info can be found here: http://software.intel.com/en-us/articles/google-play-supports-cpu-architecture-filtering-for-multiple-apk.
3.3. Compile your NDK for x86
This section will show you how to compile your application’s NDK part for x86.
In order for your NDK-based application to run on an x86 AVD, you need to compile your NDK lib for the x86 architecture. To do so, follow these simple steps:
Open a command prompt and navigate to the folder of your NDK files, like below:
Make sure you have set the Environment Variable Path so you can use the ndk-build script from anywhere.
3.3.1. Adding the path of NDK to your Environment Variable
In order to setup your environment variable for the NDK, you need right-click on Computer, and select Properties. Go to Advanced system settings and find Environment variables. Select Path and click Edit. At the end of the ‘Variable Value’ string, add the path to your root folder of NDK, the one that contains the ndk-build.cmd file as in the image below:
3.3.2. Compiling with the NDK
After you have navigated with the command prompt to your NDK folder, execute:
ndk-build APP_ABI:=all
This will compile your NDK file for each architecture available, i.e., ARMv5TE, ARMv7, x86, and mips.
To compile for a specific architecture, replace ‘all’ with the different architectures. For example:
ndk-build APP_ABI:=armeabi armeabi-v7a x86 mips
Make sure you refresh your project in Eclipse in order to capture your latest settings, i.e., latest folders created by the ndk-build script. In the Folder libs of your projects, you should now see four folders, one for each of the architectures.
You are now ready to use the x86 AVD with your NDK application.
3.3.3. Another way of compiling with the NDK
Another way of compiling your native code for all the architectures, including x86 is to modify your Application.mk file which you would find in the jni folder. If you do not have an Application.mk file, you can create one yourself and add the instruction below:
APP_ABI:=armeabi armeabi-v7a x86 mips
This way, when you run the batch file, i.e., the ndk-build script, it will compile the libraries for all the architectures available.
Also, for easier use, instead of listing all the architectures, you can just put ‘all’:
APP_ABI:=all

Wednesday, October 16, 2013

PHP Database Backup Script

Mysqldump is a small utility that allows you to export a MySQL database to a text file for backup or transfer between two servers. This utility is very useful, is not always available on shared hosting as it embarks on the command line.

This article therefore discusses how to export a MySQL database in PHP.

Called "export" the fact of formatting in a file (a dump) all the information needed to create the table and populate.

The following code allows for an export of a database in SQL file. The Setup section allows you to configure the connection information to the database (user name, password and server address) and the name of the database ($ dbname).


As you can see, the script regularly dump the memory by recording the information as and in the dump file. This process is required for export of large databases.

Note also that the export of a large BDD can take a long time. If you can, consider raising the maximum execution time of your script at the beginning of file:

set_time_limit (0)
Attached, find the source code of mysqldump.php :http://pastebin.com/nzzn8JAa

Force Files to Download (Not Open in Browser) using htaccess

Remove File Extention from URLs using htaccess


That little bit will make 
http://blogger.com/about.php into  http://blogger.com/about

Force Correct content-type for XHTML Documents using htaccess



Reference

SLT USAGE METER

USERNAME :








Tuesday, October 8, 2013

How to configure IIS to run in different port than 80

Microsoft Internet Information Server versions 1.0 to 2.0

  1. Start Regedt32.exe and locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceProvider\ServiceType\W3SVC
  2. Find the TCP Port value and double-click it.
  3. The DWORD Editor dialog box should appear with the default value (0x50 Hex; 80 Decimal) listed. Change the decimal value to the number of the port that you want the World Wide Web Publishing Service to listen to.

    NOTE: You can also follow steps 2 and 3 to change the following services:
    • MSFTPSVC: FTP Publishing Service
    • GOPHERSVC: Gopher Publishing Service
  4. Exit Regedt32.exe.
  5. Stop and Restart the IIS Services by Using the Internet Service Manager.

Microsoft Internet Information Server version 3.0

  1. Open Internet Service Manager.
  2. Double-click on the computer corresponding to the WWW service.
  3. On the Service tab, change the TCP Port field to the desired port number.
  4. Click OK.
  5. Using the Internet Service Manager, stop and restart the IIS Services.

Microsoft Internet Information Services versions 4.0 to 6.0

  1. Open Internet Service Manager or Internet Information Services (IIS) Manager.
  2. If necessary, expand the Web server that you want, and then expand Web Sites.
  3. Right-click the Web site that you want to change.
  4. Click Properties.
  5. Click the Web Site tab.
  6. Change the TCP Port Number in the TCP Port edit box (or click Advanced for multiple Port settings).
  7. Click OK to save the changes.

Microsoft Internet Information Services 7.0

  1. Open Internet Information Services (IIS) Manager.
  2. Select the Web site that you wish to configure.
  3. In the Action pane, click Bindings.
  4. Click Add to add a new site binding, or click Edit to change an existing binding.
  5. Click OK to apply the changes.
Read More on windows IIS Web Page 

Friday, October 4, 2013

How to change target build on Android project ?



Right click the project and click "Properties". Then select "Android" from the tree on the left. You can then select the target version on the right.

hint:Sometime IDE need to restart
Change Android build target

Wednesday, October 2, 2013

C++ Hello World In Visual Studio



Without using namespace std; when you write for example cout <<; you'd have to put std::cout <<;

Friday, September 13, 2013

Facebook Get Profile Information using https://graph.facebook.com/

Try  This:

https://graph.facebook.com/{your profile id}

tip : to find facebook profile id try this

ex : 
https://graph.facebook.com/4

it will display something like this:
{
"id": "4",
"name": "Mark Zuckerberg",
"first_name": "Mark",
"last_name": "Zuckerberg",
"link": "http://www.facebook.com/zuck",
"username": "zuck",
"gender": "male",
"locale": "en_US"
}
Have Fun!!!

Saturday, September 7, 2013

Android Web Request Sample

Simple Android web request (POST Method) sample application







Add User Permeation to manifest file




Php File Content



Saturday, August 10, 2013

Easy Windows Password Recovery with Ophcrack live USB


Recovering Windows Passwords coulnd’t be easier with Ophcrack Live on USB. Whether it’s your sister’s forgotten XP account or [insert other legit reason] a little USB booting and Rainbow Table loving’s got you covered.
Preparing an Ophcrack USB key is as simple as formatting your drive for FAT32 with the HP USB format tool. Downloading and launching USBOphcrack.exe and running the included batch file. The program will download a small set of rainbow tables and prepare your USB drive.
For even higher password recovering accuracy I recommend finding a larger set of Ophcrack compatible rainbow tables.