Menu

UdTool / Blog: Recent posts

quick exit

how to quick exit your app

In android os,there is a way to let you 'exit' your application.
you can new a thread,in the thread cateat Intent to go to homeApp. and then destroy your app in back. note you need use a static object to keep your app state (whether your app has exited the system ). if your app is still runing and you click the app's icon, then you can finish your activity.

Posted by chanser 2012-06-15 Labels: exit quick False exit

android app out of memory

how to check your android app memory leak.

In my project,There is a good way.

Just like this.

~/workspace/android-sdk-linux/platform-tools$

------------------------the file-----------------

1
2
3
4
5
6
#!/bin/bash

while true; do
./adb shell procrank | grep "your app package name"
sleep 1
done
Posted by chanser 2012-06-15 Labels: android oom procrank

some firefox plugins

Some firefox plugins may use in your project!

1.firebug

2.yslow

3.xmarks

synchronized your bookmarks

4.greasemonkey

5.downThemAll

6.proxyTool

7.stylish

change your firefox page theme,very usefull

8.HttpRequester

simulate http request and catch http response.

9.scrapbook

save your ariginal web page but not DOMTree

Posted by chanser 2012-06-15 Labels: firefox pulgin

java simple httpserver

Today when i need a customer httpserver,I find sun's httpserver.

It's very easy to do some test.

Below are the simple code.

package com.chenze.android.httpserver;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;

public class MyHttpServer {

    public MyHttpServer(){

    }

    public void init() throws IOException{
        HttpServer httpServer = HttpServer.create(new InetSocketAddress(8888),0);
        httpServer.createContext("/",new MyHttpHandler());
        httpServer.setExecutor(null);
        httpServer.start();
    }

    public static void main(String[]args) throws IOException{
        MyHttpServer server = new MyHttpServer();
        server.init();
    }

}

class MyHttpHandler implements HttpHandler{
    public void handle(HttpExchange t) throws IOException {
        InputStream is = t.getRequestBody();
        String response = "<h3>Zilla's HttpServer Start!</h3>";
        t.sendResponseHeaders(200, response.length());
        OutputStream os = t.getResponseBody();
        os.write(response.getBytes());
        os.close();
    }
}
Posted by chanser 2012-06-14 Labels: httpserver

java http file upload tickets

Not long ago, I developed a java http file upload model.
One things to notice here.
1.the size limited

-----------------------analysis-------------------------

1.Normally,HttpConnection use BufferedStream to buffer in local,When it's buffer is too big,then it will Out Of Memory.
we see across analysing source code that there are two ways to avoid this.
1.1 public void setFixedLengthStreamingMode (int contentLength){}... read more

Posted by chanser 2012-06-14 Labels: java http fileupload limit

Java Thread Synchronized

When we us java Thread,Sometimes we nedd concurrent visit some resources, in this way,we have to use synchronized.

today what we will talk about is wait and notify.

first have a look at this fragment.

public Class A {
    public static void main(String[]args) {
        ThreadB b = new ThreadB();
        b.start();
        synchronized(b) {
            System.out.println("waiting......");
            b.wait();
        }
        System.out.println("result:"+b.getResult());
    }
}... [read more](/p/udtool/blog/2012/06/java-thread-synchronized/)
Posted by chanser 2012-06-12 Labels: thread synchronized wait notify

Init UdTool App

now the primary code of UdTool were commited to sourceforge

Posted by chanser 2012-05-29
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.