Postingan

Display Image on Panel after transfered via Socket :: Java

import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.IOException; import java.net.Socket; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; /** * * @author ipopp */ public class imageClientPanel { public static BufferedImage image; public static JPanel panel; public static void main (String[] args) { JFrame frame = new JFrame("test"); frame.setSize(800,600); frame.add(panel = new JPanel() { @Override public void paintComponent(Graphics graphics) { super.paintComponents(graphics); if(image != null) { graphics.drawImage(image, 0, 0, this); } else { graphics.setColor(Color.black); graphics.fillRect(0,0,800,600); } } }); frame.setDefaultCloseOperation

Sending Image Through Socket with Java

SERVER import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.net.*; public class imageServer { public static void main(String[] args) throws IOException { File testF = new File("/home/ipopp/Public/smalltest/tes.jpg"); ServerSocket server = new ServerSocket(9090); try { System.out.println("reading file"); Socket socket = server.accept(); FileInputStream file = new FileInputStream(testF); BufferedInputStream ins = new BufferedInputStream(file); BufferedOutputStream outs = new BufferedOutputStream(socket.getOutputStream()); byte[] buffer = new byte[4096]; long bytesRead; while( (bytesRead = ins.read(buffer)) != -1) {

Perl directory watcher and sender using pscp

This perl program is use for monitoring directory, and doing upload if any matched kind of file using pscp.exe. This program is running on Win32 platform #! perl use warnings; #use strict; use feature "switch"; use Win32::OLE qw(in); use File::Copy; my $app_dir = "C:/EXEC_NEW"; my $raw_dir = "C:/RAW_EOS"; my $arch_npoess = "C:/ARCH_NPOESS"; my $arch_fy = "C:/ARCH_FY"; my $dest = "192.168.20.101"; my $dest_dir = "/raid/raw"; my $dest_acc = "ipopp"; my $dest_access = "*****"; my $dest_addr = "ipopp\@192.168.20.101:/raid/raw"; my $uploaded_file = ""; chdir $app_dir or die "Directory not found"; PARENT: while() { #check pscp #check EOSingest sleep(6); if(matching_processes (qr/EOSingest/)) { print "Retreiving RAW file, please wait ...\n"; next; } if (matching_processes (qr/pscp/)) { print "Uploading $uploa

Perl Directory and Process Watcher

Directory watcher to monitor uploaded files in a server, and do some data extraction after upload process is complete   #!/usr/sbin/perl -w #use strict; use warnings; use POSIX; use feature "switch"; use File::Copy; my $dir = "/raid/raw"; my $rtstps_dir = "/home/ipopp/drl/rt-stps"; my $processed_file = ""; my $config_file = ""; my $rtstps = 0; my $rtstps_file = ""; print "starting ... \n"; chdir $rtstps_dir or die "Cannot find RTPSPS directory"; #daemonize(); PARENT: while () {     sleep(6);     if (check_rtstps()) {         print "rt-stps is running, please wait ....! \n";         next;     } elsif ($rtstps == 1 && $rtstps_file ne "") {         move("$dir/$rtstps_file","$dir/arch/$rtstps_file");         $rtstps = 0;         $rtstps_file = "";     }     if ($processed_file eq "") {         opendir (DH, $dir) || die "Cannot open dire

JQM Designer online

Gambar
http://jqmdesigner.appspot.com/

VSFTPD Anon

    # # Sample anonymous FTP server configuration # # Mandatory directives # listen=YES local_enable=NO anonymous_enable=YES write_enable=NO anon_root=/var/ftp # # Optional directives # anon_max_rate=2048000 xferlog_enable=YES listen_address=192.168.0.100 listen_port=21   Sumber :: http://www.g-loaded.eu/2008/12/02/set-up-an-anonymous-ftp-server-with-vsftpd-in-less-than-a-minute/

Perl Daemon

http://search.cpan.org/~deti/Proc-Daemon-0.14/lib/Proc/Daemon.pod use Proc :: Daemon ; $daemon = Proc :: Daemon -> new ( work_dir => '/my/daemon/directory' , ..... ); $Kid_1_PID = $daemon -> Init ; unless ( $Kid_1_PID ) { # code executed only by the child ... } $Kid_2_PID = $daemon -> Init ( { work_dir => '/other/daemon/directory' , exec_command => 'perl /home/my_script.pl' , } ); $pid = $daemon -> Status ( ... ); $stopped = $daemon -> Kill_Daemon ( ... );