For smart Primates & ROBOTS (oh and ALIENS ).

Friday, October 17, 2014

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>


Share:

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.



Share:

Friday, October 03, 2014

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);
        }
    }
}





Share:

Friday, September 26, 2014

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
}
//////////////////////////////////////////

Share:

Thursday, September 25, 2014

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







Share:

Wednesday, September 24, 2014

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();
Share:

Sunday, September 21, 2014

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>

Share:

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());
    }
    }
}

Share:

Saturday, September 20, 2014

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

Share:

Friday, September 19, 2014

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

Share:

Ads Inside Post

Powered by Blogger.

Archive