This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.lang.reflect.*; | |
| import java.io.File; | |
| class CallerWithParams{ | |
| /** | |
| @param o the object which contains the method to call, | |
| when passing 'this' from within the processing main sketch, | |
| all functions in your main sketch will be recognized | |
| (setup(), draw(),..., custom methods) | |
| @param m the name of the method to call without "()" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Author: Tim Pulver | |
| * Date: 2013 | |
| * Tested with Processing 2.0 | |
| * original code by jungalero (processing.org forum) | |
| */ | |
| import java.awt.AWTException; | |
| import java.awt.Robot; | |
| import java.awt.Rectangle; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.*; | |
| import java.io.*; | |
| public static class IpFromUrl { | |
| // Returns the IP address of an URL | |
| // i.e. http://www.facebook.com -> 123.456.789.10 | |
| public static String getIp( String hostname ) throws IOException { | |
| try { | |
| InetAddress ipaddress = InetAddress.getByName(hostname); | |
| System.out.println("IP address: " + ipaddress.getHostAddress()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.AWTException; | |
| import java.awt.Robot; | |
| KeystrokeSimulator keySim; | |
| void setup(){ | |
| keySim = new KeystrokeSimulator(); | |
| } | |
| void draw(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Graphics2D; | |
| import java.awt.image.BufferedImage; | |
| import java.io.BufferedReader; | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.InputStreamReader; | |
| import java.io.OutputStreamWriter; | |
| import java.io.UnsupportedEncodingException; | |
| import java.net.HttpURLConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * make sure, you have activated stereomix as your recording device in your system settings! | |
| */ | |
| import ddf.minim.*; | |
| import ddf.minim.signals.*; | |
| Minim minim; | |
| AudioInput in; | |
| SineWave sine; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Sometimes we need the path to the Processing data directory. | |
| // creates a virtual file within the data directory | |
| File file = new File(dataPath("") + File.separator + "a_filename.txt"); | |
| //using dataPath("..."), the path can be altered, too (when using "", this is not the case). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Returns the current date as Int in this form YYYYMMDD | |
| */ | |
| int getCurDate(){ | |
| String month = String.valueOf(month()); | |
| if(month.length() == 1) month = "0" + month(); | |
| String day = String.valueOf(day()); | |
| if(day.length() == 1) day = "0" + day(); | |
| return Integer.parseInt(year() + "" + month + "" + day); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Execute external program and get the return value | |
| // Params have to be stored inside a string array | |
| String[] params = {"cmd.exe", "/c", "dir"}; | |
| Process process = Runtime.getRuntime().exec(params); | |
| // Don't forget to close all streams! | |
| process.getErrorStream().close(); | |
| process.getInputStream().close(); | |
| process.getOutputStream().close(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void CFile::search(fstream &FS) { | |
| char savepath[MAX_PATH]; // zur Zwischenspeicherung des Pfades | |
| int len; | |
| WIN32_FIND_DATA FindFileData; | |
| HANDLE hFind; | |
| strcpy(savepath, path); // Sicherung des Pfades | |
| strcat(path, "\\*"); | |
| hFind = FindFirstFile(path, &FindFileData); |