An online directory of free sites to submit RSS Tools

Today to find a free online directory sites to submit RSS tools, can be automatically submitted to 27 RSS directory sites, now supports 2RSS, Google, Daytimenews, Devasp, Feedboy other popular directory site of the RSS Feed.
http://www.cpworld2000.com/RssSubmitTool/

Capture Video from ip camera using JMF

Following is the java code – which gets video from D-Link DCS900 (ip-camera) & display in frame. This is pure java class. (NO JMF)
Please give ur DCS900’s ip-address on line no. 27/28

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
import java.net.;
import com.sun.image.codec.jpeg.;
import java.io.;
import java.awt.;
import java.awt.event.;
import java.awt.image.;
import javax.swing.;
import java.applet.;
 
public class AxisCamera extends Applet implements Runnable
{
public boolean useMJPGStream = true;
String appletToLoad;
Thread appletThread;
 
//URL for Axis 2420
//public String jpgURL="http://www.easemarry.com/axis-cgi/jpg/image.cgi?resolution=352x240";
//public String mjpgURL="http://www.easemarry.com/axis-cgi/mjpg/video.cgi?resolution=352x240";
 
//Following 3-lines added
//URL for D-Link DCS-900
public String jpgURL = "http://www.easemarry.com/IMAGE.JPG";
public String mjpgURL = "http://www.easemarry.com/video.cgi";
 
DataInputStream dis;
private Image image=null;
public Dimension imageSize = null;
public boolean connected = false;
private boolean initCompleted = false;
HttpURLConnection huc=null;
Component parent;
 
/* Creates a new instance of AxisCamera */
public AxisCamera (Component parent_)
{
parent = parent_;
}
 
 
public void connect()
{
try
{
URL u = new URL(useMJPGStream?mjpgURL:jpgURL);
huc = (HttpURLConnection) u.openConnection();
//System.out.println(huc.getContentType());
InputStream is = huc.getInputStream();
connected = true;
BufferedInputStream bis = new BufferedInputStream(is);
dis= new DataInputStream(bis);
if(!initCompleted)
initDisplay();
}
catch(IOException e)
{
//incase no connection exists wait and try again, instead of printing the error
try
{
huc.disconnect();
Thread.sleep(60);
}
catch(InterruptedException ie)
{
huc.disconnect();connect();
}
connect();
}
catch(Exception e){;}
}
 
public void initDisplay()
{
//setup the display
if (useMJPGStream)
readMJPGStream();
else
{
readJPG();
disconnect();
}
imageSize = new Dimension(image.getWidth(this), image.getHeight(this));
//setPreferredSize(imageSize);
//parent.setSize(imageSize);
//parent.validate();
initCompleted = true;
}
 
public void disconnect()
{
try
{
if(connected)
{
dis.close();
connected = false;
}
}
catch(Exception e){;}
}
 
public void init()
{
System.out.println("Starting Applet");
appletToLoad = getParameter("appletToLoad");
setBackground(Color.white);
}
 
public void paint(Graphics g)
{
//used to set the image on the panel
if (image != null)
g.drawImage(image, 0, 0, this);
}
 
/public void run()
{
try {
 
connect();
readStream();
 
Class appletClass = Class.forName(appletToLoad);
Applet realApplet = (Applet)appletClass.newInstance();
//realApplet.setStub(this);
setLayout( new GridLayout(1,0));
add(realApplet);
realApplet.init();
realApplet.start();
}
catch (Exception e) {
System.out.println( e );
}
validate();
}
 
public void start()
{
appletThread = new Thread(this);
appletThread.start();
}
 
public void stop()
{
appletThread.stop();
appletThread = null;
}
 
public void readStream()
{
//the basic method to continuously read the stream
try
{
if (useMJPGStream)
{
while(true)
{
readMJPGStream();
//parent.repaint();
}
}
else
{
while(true)
{
connect();
readJPG();
//parent.repaint();
disconnect();
}
}
 
}
catch(Exception e){;}
}
 
public void readMJPGStream()
{
//preprocess the mjpg stream to remove the mjpg encapsulation
 
//Following commented on 07/08/2006
//readLine(3,dis); //discard the first 3 lines
 
//Following added on 07/08/2006
readLine(4, dis); //discard the first 4 lines for D-Link DCS-900
 
readJPG();
readLine(2,dis); //discard the last two lines
}
 
public void readJPG()
{
//read the embedded jpeg image
try
{
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(dis);
image = decoder.decodeAsBufferedImage();
}
catch(Exception e)
{
e.printStackTrace();disconnect();
}
}
 
public void readLine(int n, DataInputStream dis)
{
//used to strip out the header lines
for (int i=0; i<n ;i++)
{
readLine(dis);
}
}
 
public void readLine(DataInputStream dis)
{
try
{
boolean end = false;
String lineEnd = "\n"; //assumes that the end of the line is marked with this
byte[] lineEndBytes = lineEnd.getBytes();
System.out.println("lineEndBytes....."+lineEndBytes);
byte[] byteBuf = new byte[lineEndBytes.length];
System.out.println("byteBuf......."+byteBuf);
 
while(!end)
{
//dis.read(byteBuf,0,lineEndBytes.length);
String t = "";
if(byteBuf != null)
{
dis.read(byteBuf,0,lineEndBytes.length);
t = new String(byteBuf);
}
//System.out.print(t); //uncomment if you want to see what the lines actually look like
if(t.equals(lineEnd))
end=true;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
 
public void run()
{
connect();
readStream();
}
 
/*public static void main(String[] args)
{
JFrame jframe = new JFrame();
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
AxisCamera axPanel = new AxisCamera();
AxisCamera axPanel = new AxisCamera(jframe);
new Thread(axPanel).start();
jframe.getContentPane().add(axPanel);
jframe.pack();
jframe.show();
}
*/
}

Use to ajax for php page

AJAX Code:

ajaxpg.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
var http_request=false;
 
  function send_request(url){
 
    http_request=false;
 
    if(window.XMLHttpRequest){
 
     http_request=new XMLHttpRequest();
 
     if(http_request.overrideMimeType){
 
       http_request.overrideMimeType("text/xml");
 
     }
 
    }
 
    else if(window.ActiveXObject){
 
     try{
 
      http_request=new ActiveXObject("Msxml2.XMLHttp");
 
     }catch(e){
 
      try{
 
      http_request=new ActiveXobject("Microsoft.XMLHttp");
 
      }catch(e){}
 
     }
 
    }
 
    if(!http_request){
 
     window.alert("XMLHttp object creation failed");
 
     return false;
 
    }
 
    http_request.onreadystatechange=processrequest;
 
    http_request.open("GET",url,true);
 
    http_request.send(null);
 
  }
 
  function processrequest(){
 
   if(http_request.readyState==4){//Object state
 
     if(http_request.status==200){//return Successful 
 
      document.getElementById(reobj).innerHTML=http_request.responseText;
 
     }
 
     else{ //Exception Errors
 
      alert("Exception Errors!");
 
     }
 
   }
 
  }
 
  function dopage(obj,url){
 
   document.getElementById(obj).innerHTML="Loading...";
 
   send_request(url);
 
   reobj=obj;
 
   }

index.php:

I am a content div on the display, when the flip action arises, the use of AJAX to update DIV to achieve the effect of this is the contents page shows the page code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
< ?php header("Content-type: text/html;charset=utf-8"); ?>
 
<html>
 
<head>
 
<script language="javascript" src="ajaxpg.js"></script>
 
</head>
 
<body>
<div id="result">
 
< ?php
 
$page=isset($_GET['page'])?intval($_GET['page']):1; 
 
$num=10;  
 
$db=mysql_connect("www.easemarry.com","root","root"); 
 
mysql_select_db("cr_download"); 
 
$result=mysql_query("select * from cr_userinfo");
 
$total=mysql_num_rows($result); 
 
$url='test.php';
$pagenum=ceil($total/$num);
$page=min($pagenum,$page);
 
$prepg=$page-1;
 
$nextpg=($page==$pagenum ? 0 : $page+1);
 
$offset=($page-1)*$num;  
 
$pagenav=":<B>".($total?($offset+1):0)."-<b>".min($offset+10,$total)."</b>,Total:$total";
 
if($pagenum< =1) return false;
 
$pagenav.=" <a href=javascript:dopage('result','$url?page=1');> < < </a> ";
 
if($prepg) $pagenav.=" <a href=javascript:dopage('result','$url?page=$prepg');> < </a> "; else $pagenav.=" < ";
 
if($nextpg) $pagenav.=" <a href=javascript:dopage('result','$url?page=$nextpg');> > </a> "; else $pagenav.=" > ";
 
$pagenav.=" <a href=javascript:dopage('result','$url?page=$pagenum');> >> </a> ";
 
$pagenav.=" page,Total page: $pagenum";
 
If($page>$pagenum){
 
       Echo "Error : Can Not Found The page ".$page;
 
       Exit;
 
}
 
$info=mysql_query("select * from cr_userinfo limit $offset,$num"); 
 
While($it=mysql_fetch_array($info)){
 
       Echo $it['username'];
 
       echo "";
 
} 
 
  echo"";
 
  echo $pagenav;
?>
</div>
 
</body>
</html>

test.php:

The key to flip when the flip is called dopage() function, and then use the callback information to update the content div. The core server-side code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
< ?php
header("Content-type: text/html;charset=utf-8");
 
$page=isset($_GET['page'])?intval($_GET['page']):1; 
 
$num=10;  
 
$db=mysql_connect("www.easemarry.com","root","root"); 
 
mysql_select_db("cr_download"); 
 
$result=mysql_query("select * from cr_userinfo");
 
$total=mysql_num_rows($result); 
 
$url='test.php';
 
$pagenum=ceil($total/$num);
$page=min($pagenum,$page);
 
$prepg=$page-1;
 
$nextpg=($page==$pagenum ? 0 : $page+1);
 
$offset=($page-1)*$num;  
 
$pagenav=":<B>".($total?($offset+1):0)."-<b>".min($offset+10,$total)."</b>,Total:$total";
 
if($pagenum< =1) return false;
 
$pagenav.=" <a href=javascript:dopage('result','$url?page=1');> < < </a> ";
 
if($prepg) $pagenav.=" <a href=javascript:dopage('result','$url?page=$prepg');> < </a> "; else $pagenav.=" < ";
 
if($nextpg) $pagenav.=" <a href=javascript:dopage('result','$url?page=$nextpg');> > </a> "; else $pagenav.=" > ";
 
$pagenav.=" <a href=javascript:dopage('result','$url?page=$pagenum');> >> </a> ";
 
$pagenav.=" page,Total page: $pagenum";
 
If($page>$pagenum){
       Echo "Error : Can Not Found The page ".$page;
       Exit;
}
 
$info=mysql_query("select * from cr_userinfo limit $offset,$num"); 
 
While($it=mysql_fetch_array($info)){
 
       Echo $it['username'];
 
       echo "";
 
} 
 
  echo"";
 
  echo $pagenav;
 
?>

Generate the Guid use for php class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
< ?php
class   System
{
	function   currentTimeMillis()
	{
		list($usec,   $sec)   =   explode("   ",microtime());
		return   $sec.substr($usec,   2,   3);
	}
}
class   NetAddress
{
	var   $Name   = 'easemarry.com';
	var   $IP   = '69.65.10.199';
	function   getLocalHost()   //   static
	{
		$address   =   new   NetAddress();
		$address->Name   =   $_ENV["COMPUTERNAME"];
		$address->IP   =   $_SERVER["SERVER_ADDR"];
		return   $address;
	}
	function   toString()
	{
		return   strtolower($this->Name.'/'.$this->IP);
	}
}
class   Random
{
	function   nextLong()
	{
		$tmp   =   rand(0,1)?'-':'';
		return   $tmp.rand(1000,   9999).rand(1000,   9999).rand(1000,   9999).rand(100,   999).rand(100,   999);
	}
}
 
class   Guid
{
	var   $valueBeforeMD5;
	var   $valueAfterMD5;
	function   Guid()
	{
		$this->getGuid();
	}
	//
	function   getGuid()
	{
		$address   =   NetAddress::getLocalHost();
		$this->valueBeforeMD5   =   $address->toString().':'.System::currentTimeMillis().':'.Random::nextLong();
		$this->valueAfterMD5   =   md5($this->valueBeforeMD5);
	}
	function   newGuid()
	{
		$Guid   =   new   Guid();
		return   $Guid;
	}
	function   toString()
	{
		$raw   =   strtoupper($this->valueAfterMD5);
		return   substr($raw,0,8).'_'.substr($raw,8,4).'_'.substr($raw,12,4).'_'.substr($raw,16,4).'_'.substr($raw,20).'_'.time();
	}
}
?>

Google AJAX Language API php class

This class allows you to use the Google AJAX Translation API to translate arbitrary text to the many languages supported by the Google API.

Source versioning added to:
http://code.google.com/p/php-language-api/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
< ?php /** * Translating language with Google API * @author gabe@fijiwebdesign.com * @version $id$ * @license - Share-Alike 3.0 (http://creativecommons.org/licenses/by-sa/3.0/) *  * Google requires attribution for their Language API, please see: http://code.google.com/apis/ajaxlanguage/documentation/#Branding *  */class Google_Translate_API { 	/**	 * Translate a piece of text with the Google Translate API	 * @return String	 * @param $text String	 * @param $from String[optional] Original language of $text. An empty String will let google decide the language of origin	 * @param $to String[optional] Language to translate $text to	 */	function translate($text, $from = '', $to = 'en') {		$url = 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q='.rawurlencode($text).'&langpair='.rawurlencode($from.'|'.$to);		$response = file_get_contents(			$url,			null,			stream_context_create(				array(					'http'=>array(					'method'=>"GET",					'header'=>"Referer: http://".$_SERVER['HTTP_HOST']."/\r\n"					)				)			)		);		if (preg_match("/{\"translatedText\":\"([^\"]+)\"/i", $response, $matches)) {			return self::_unescapeUTF8EscapeSeq($matches[1]);		}		return false;	} 	/**	 * Convert UTF-8 Escape sequences in a string to UTF-8 Bytes	 * @return UTF-8 String	 * @param $str String	 */	function _unescapeUTF8EscapeSeq($str) {		return preg_replace_callback("/\\\u([0-9a-f]{4})/i", create_function('$matches', 'return html_entity_decode(\'&#x\'.$matches[1].\';\', ENT_NOQUOTES, \'UTF-8\');'), $str);	}} // example usage$text = 'Welcome to my website.';$trans_text = Google_Translate_API::translate($text, '', 'it');if ($trans_text !== false) {	echo $trans_text;}  ?>< ?php
 
/**
 * Translating language with Google API
 * @author gabe@fijiwebdesign.com
 * @version $id$
 * @license - Share-Alike 3.0 (http://creativecommons.org/licenses/by-sa/3.0/)
 * 
 * Google requires attribution for their Language API, please see: http://code.google.com/apis/ajaxlanguage/documentation/#Branding
 * 
 */
class Google_Translate_API {
 
	/**
	 * Translate a piece of text with the Google Translate API
	 * @return String
	 * @param $text String
	 * @param $from String[optional] Original language of $text. An empty String will let google decide the language of origin
	 * @param $to String[optional] Language to translate $text to
	 */
	function translate($text, $from = '', $to = 'en') {
		$url = 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q='.rawurlencode($text).'&langpair='.rawurlencode($from.'|'.$to);
		$response = file_get_contents(
			$url,
			null,
			stream_context_create(
				array(
					'http'=>array(
					'method'=>"GET",
					'header'=>"Referer: http://".$_SERVER['HTTP_HOST']."/\r\n"
					)
				)
			)
		);
		if (preg_match("/{\"translatedText\":\"([^\"]+)\"/i", $response, $matches)) {
			return self::_unescapeUTF8EscapeSeq($matches[1]);
		}
		return false;
	}
 
	/**
	 * Convert UTF-8 Escape sequences in a string to UTF-8 Bytes
	 * @return UTF-8 String
	 * @param $str String
	 */
	function _unescapeUTF8EscapeSeq($str) {
		return preg_replace_callback("/\\\u([0-9a-f]{4})/i", create_function('$matches', 'return html_entity_decode(\'&#x\'.$matches[1].\';\', ENT_NOQUOTES, \'UTF-8\');'), $str);
	}
}
 
// example usage
$text = 'Welcome to my website.';
$trans_text = Google_Translate_API::translate($text, '', 'it');
if ($trans_text !== false) {
	echo $trans_text;
}
 
 
?>