Search

'64'에 해당되는 글 3건

  1. 2017.02.28 Java Applet 설정
  2. 2016.09.27 Windows7 Redis 설치 및 실행
  3. 2016.09.27 OpenSSL x64 Build

Java Applet 설정

Programming/JAVA,JSP 2017. 2. 28. 12:58 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Java Applet 설정





Java Applet 구동 시





Apache 서버에




AmitApplet.java 를 AmitJavaApplication.jar 로 Export(Java->JAR file) 한다.


package test.Amit;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class AmitApplet extends JApplet {

	public void init() {

		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(AmitApplet.class.getName()).log(java.util.logging.Level.SEVERE, null,
					ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(AmitApplet.class.getName()).log(java.util.logging.Level.SEVERE, null,
					ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(AmitApplet.class.getName()).log(java.util.logging.Level.SEVERE, null,
					ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(AmitApplet.class.getName()).log(java.util.logging.Level.SEVERE, null,
					ex);
		}
		// 

		try {
			java.awt.EventQueue.invokeAndWait(new Runnable() {
				public void run() {
					initComponents();
				}
			});
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	private void initComponents() {

		// String defaultCmd = "\\\\192.168.10.17\\tt\\notepad.exe";
		final String defaultCmd = "notepad.exe test.jsp";
		commandTextField = new JTextField();
		logTextArea = new JTextArea();
		runtimeButton = new JButton("getRuntime");
		processBuilderButton = new JButton("processBuilder");
		JPanel topPanel = new JPanel();

		setLayout(new BorderLayout());

		topPanel.setLayout(new GridLayout(4, 1));
		topPanel.add(new JLabel("Command"));
		topPanel.add(commandTextField);
		topPanel.add(runtimeButton);
		topPanel.add(processBuilderButton);
		add(BorderLayout.NORTH, topPanel);
		add(BorderLayout.CENTER, logTextArea);

		runtimeButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				if (commandTextField.getText().length() == 0) {
					try {
						Runtime.getRuntime().exec(defaultCmd);
					} catch (Exception e1) {
						// TODO Auto-generated catch block
						logTextArea.setText(e1.getMessage());
						e1.printStackTrace();
					}
				} else {
					try {
						Runtime.getRuntime().exec(commandTextField.getText());
					} catch (Exception e1) {
						// TODO Auto-generated catch block
						logTextArea.setText(e1.getMessage());
						e1.printStackTrace();
					}
				}
			}
		});
		processBuilderButton.addActionListener(new ActionListener() {
			public synchronized void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				if (commandTextField.getText().length() == 0) {

					try {
						ProcessBuilder launcher = new ProcessBuilder();
						Map environment = launcher.environment();
						launcher.redirectErrorStream(true);
						launcher.directory(new File("\\\\192.168.10.17\\tt\\"));

						// environment.put("test.jsp", defaultCmd);
						launcher.command("notepad.exe");
						Process p = launcher.start(); // And launch a new
														// process

					} catch (Exception e2) {
						logTextArea.setText(e2.getMessage());
						e2.printStackTrace();
					}
				} else {
					try {
						ProcessBuilder pb = new ProcessBuilder(commandTextField.getText());
						pb.start();

					} catch (Exception e1) {
						// TODO Auto-generated catch block
						logTextArea.setText(e1.getMessage());
						e1.printStackTrace();
					}
				}
			}
		});
	}

	@SuppressWarnings("unchecked")
	public void launchScript(String cmd, String args) {
		try {
			System.out.println("args value : = " + args);
			System.out.println("cmd value : = " + cmd);
			System.out.println("Full command:  = " + cmd + " " + args);
			if (cmd != null && !cmd.trim().equals("")) {
				if (args == null || args.trim().equals("")) {
					final String tempcmd = cmd;
					AccessController.doPrivileged(new PrivilegedAction() {
						public Object run() {
							try {
								Runtime.getRuntime().exec(tempcmd);
							} catch (Exception e) {
								System.out.println("Caught exception in privileged block, Exception:" + e.toString());
							}
							return null; // nothing to return
						}
					});
					System.out.println(cmd);
				} else {
					final String tempargs = args;
					final String tempcmd1 = cmd;
					AccessController.doPrivileged(new PrivilegedAction() {
						public Object run() {
							try {
								Runtime.getRuntime().exec(tempcmd1 + " " + tempargs);
							} catch (Exception e) {
								System.out.println("Caught exception in privileged block, Exception:" + e.toString());
							}
							return null; // nothing to return
						}
					});
					System.out.println(cmd + " " + args);
				}
			} else {
				System.out.println("execCmd parameter is null or empty");
			}
		} catch (Exception e) {
			System.out.println("Error executing command --> " + cmd + " (" + args + ")");
			System.out.println(e);
		}
	}

	JButton runtimeButton;
	JButton processBuilderButton;
	JTextField commandTextField;
	JTextArea logTextArea;
}






test.jsp 를 준비한다.




<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>My first WebApplication using NetBeansIDE</title>

    </head>

    <body>

        <h1>Hello World!</h1>

        <br />

        <p>WebApplication using NetBeansIDE...</p>

        

        <!-- Embedding Applet -->

<applet code="test.Amit.AmitApplet" archive="AmitJavaApplication.jar" width="400" height="350"></applet>

    </body>

</html>









Apache 는 Apache 비트에 맞는 Java 를 연결시키고


Applet 은 32비트에서 돌아간다

(컴퓨터에 32비트 Java JRE가 설치되어 있어야한다.)








Apache ROOT 폴더의 구조






Config















Windows7 Redis 설치 및 실행

Programming/Redis 2016. 9. 27. 14:21 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Redis


Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as stringshasheslistssets,sorted sets with range queries, bitmapshyperloglogs and geospatial indexes with radius queries. Redis has built-in replicationLua scriptingLRU evictiontransactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.



1. Windows 용 redis


https://github.com/dmajkic/redis/downloads





2. execute redis-server.exe



3. execute redis-cli.exe




'Programming > Redis' 카테고리의 다른 글

Redis Client Connect Test  (0) 2016.10.26
Hiredis Subscribe/Publish with CWinThread  (0) 2016.10.05
How to use Pub/sub with hiredis in C++?  (0) 2016.09.29
hiredis fatal error C1853:  (0) 2016.09.29
hiredis MFC import Visual Studio 2013  (0) 2016.09.28

OpenSSL x64 Build

Programming/C,CPP,CS 2016. 9. 27. 11:51 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

OpenSSL x64 Build


Windows7 64bit


Visual Studio 2013






1. download openssl 

openssl-1.0.2j.tar.gz


http://openssl.org/source/





extract to D:\openssl-1.0.2j






2. download/install ActivePerl for Win64 


http://www.activestate.com/activeperl/downloads





C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts


execute VS2013 x86 네이티브 도구 명령 프롬프트, VS2013 x64 Native Tools Command Prompt





change directory to D:\openssl-1.0.2j


3. Setting Target openssldir


perl Configure VC-WIN64A --openssldir=C:\OpenSSL-x64 no-shared no-asm threads





4. Setting complie enviroment


ms\do_win64a.bat








5. Complie


nmake -f ms\ntdll.mak install





'Programming > C,CPP,CS' 카테고리의 다른 글

oRTP  (0) 2016.10.11
log4cxx dll build  (1) 2016.09.27
debug_crt_heap table  (0) 2016.09.19
Programming Memory Error Magic Number  (0) 2016.09.19
openssl error LNK2019: 외부 기호 에러  (0) 2016.09.19