Just put this string:
set MAVEN_OPTS=-DsocksProxyHost=yourSocksProxyHost -DsocksProxyPort=yourSocksProxyPort
to the beginning of the "apache-maven-2.x.x\bin\mvn.bat" file.
set MAVEN_OPTS=-DsocksProxyHost=yourSocksProxyHost -DsocksProxyPort=yourSocksProxyPort
#!/bin/bash
#Find and copy only unique files (with same size and checksums) from $SOURCE directory to $OUTPUT.
SOURCE=output
OUTPUT=images
rm -rf $OUTPUT
mkdir -p $OUTPUT
uniqProcess() {
echo >xqx_unique.idx
while read; do
echo -ne \\r$REPLY
echo $REPLY $(stat -c%s $REPLY)+$(md5sum $REPLY|cut -f 1 -d ' ')+$(cksum $REPLY|cut -f 1 -d ' ')>>xqx_unique.idx
done
sort -k 2 xqx_unique.idx|uniq -f 1|cut -f 1 -d ' '|xargs -I '{}' cp '{}' $OUTPUT
}
find $SOURCE -type f |uniqProcess
package emc.components {
import mx.controls.TextArea;
public class AutoScrollableTextArea extends TextArea {
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
verticalScrollPosition = textField.numLines;
}
}
}
public function getRoots() {
$roots = array();
for ($i='A'; $i<'Z'; $i++) {
$disk=$i.':\\';
if (is_dir($disk) && is_readable($disk))
$roots[] = $disk;
}
return $roots;
}
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:emc="emc.components.navigator.*">
<?xml version="1.0"?>put this file into the project sources directory and add this argument to the MXML compiler:
<componentPackage>
<component id="Navigator" class="emc.components.navigator.Navigator"/>
<component id="Editor" class="emc.components.editor.Editor"/>
<component id="Console" class="emc.components.console.Console"/>
<component id="SmartTruncableLabel" class="emc.components.SmartTruncableLabel"/>
<component id="AutoScrollableTextArea" class="emc.components.AutoScrollableTextArea"/>
</componentPackage>
-namespace=http://xantorohara.110mb.com/emc,sources/manifest.xmland then use this components in the MXML files via this declaration:
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"and insert component into your application:
xmlns:emc="http://xantorohara.110mb.com/emc">
...
<emc:SmartTruncableLabel id="titleLabel" styleName="filePanelTitleLabel" width="100%" />
...
RewriteEngine on
RewriteBase /worker
RewriteRule worker.xml worker.php
ErrorReportingEnable=1and you will see Flex trace output in the "C:\Documents and Settings\{UserName}\Application Data\Macromedia\Flash Player\Logs\" directory.
TraceOutputFileEnable=1
<?php
function execOutput($command) {
$output = array($command);
exec($command.' 2>&1', $output);
return implode("\n", $output);
}
echo execOutput('help');
?>
192.168.1.1 - - [25/Aug/2008:15:08:11 +0400] "GET / HTTP/1.1" 200 82777
192.168.1.1 - - [25/Aug/2008:15:08:11 +0400] "GET /js/event-debug.js HTTP/1.1" 200 88582
192.168.1.1 - - [25/Aug/2008:15:08:11 +0400] "GET /js/history-debug.js HTTP/1.1" 200 28540
192.168.1.1 - - [25/Aug/2008:15:08:11 +0400] "GET /js/prototype.js HTTP/1.1" 200 126120
192.168.1.1 - - [25/Aug/2008:15:08:11 +0400] "GET /js/json2.js HTTP/1.1" 200 9490
192.168.1.1 - - [25/Aug/2008:15:08:12 +0400] "GET /css/app.css HTTP/1.1" 200 1937
<Engine name="Catalina" defaultHost="localhost">
...
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="access." suffix=".log" pattern="common"/>
...
</Engine>
#!/bin/bash
cat access.log | cut -f2 -d"\"" access.log | cut -f2 -d" " | egrep -v -f ignore.txt | sort
^/$
^/JSON-RPC$
^/JSON-RPC-GET\?
//Any other patterns
#!/bin/bash
IDEA_TAR_GZ=~/downloads/idea-7.0.3.tar.gz
IDEA_HOME=~/idea/idea
export JDK_HOME=/usr/lib/jvm/java-6-sun
export REQUIRED_JVM_ARGS="-Didea.system.path=$IDEA_HOME/system -Didea.config.path=$IDEA_HOME/config"
mkdir $IDEA_HOME
sudo mount -t ramfs none $IDEA_HOME
tar -xz --strip 1 --file $IDEA_TAR_GZ -C $IDEA_HOME
$IDEA_HOME/bin/idea.sh
./idea-clean.sh
#!/bin/bash
IDEA_HOME=~/idea/idea
sudo umount $IDEA_HOME
rm -rf $IDEA_HOME
#!/bin/bash
process() {
while read; do
diff=`identify -format "%m %e" "$REPLY" | tr [A-Z] [a-z] | egrep -v "^(png png|gif gif|jpg jpg|jpeg jpg|jpeg jpeg)"`
test -n "$diff" && echo $diff $REPLY
done
}
find -type f -iregex ".*\.\(png\|gif\|jpg\|jpeg\)$" | process
jpeg png images/rating_0.png
png gif images/left.gif
gif png images/border_tr.png
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
...
public static String fromBase64(String in) throws IOException {
return new String(new BASE64Decoder().decodeBuffer(in));
}
public static String toBase64(String in) {
return new String(new BASE64Encoder().encodeBuffer(in.getBytes()));
}
<script id="source" type="text/javascript">
function wrapString(str) {
return "(" + str + ")";
}
document.write = function(w) {
return function(s) {
w.call(this, wrapString(s));
}
}(document.write);
document.write("Hello");
document.write("world");
</script>
@set path=
@for /R %%i in (*.tmp *.bak) do @del %%i
#!/bin/bash
TEST_URL="http://digg.com/"
FIREFOX_USERAGENT_STRING="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"
GOOGLEBOT_USERAGENT_STRING="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
#get page for firefox browser
wget -c --user-agent="$FIREFOX_USERAGENT_STRING" --output-document=firefox.html "$TEST_URL"
#get page for google bot
wget -c --user-agent="$GOOGLEBOT_USERAGENT_STRING" --output-document=googlebot.html "$TEST_URL"
items.xml
<?xml version="1.0"?>
<items>
<item id="alien-arena">
<name>Alien Arena</name>
</item>
<item id="nexuiz">
<name>Nexuiz</name>
</item>
<item id="openarena">
<name>OpenArena</name>
</item>
</items>
table.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>ExtJS Table Sample</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
var reader = new Ext.data.XmlReader({record: "item"},
[{name: "id", mapping:"@id"}, "name"]);
var store = new Ext.data.Store({url: "items.xml", reader: reader});
var columnModel = new Ext.grid.ColumnModel([
{header: "Id", dataIndex: "id"},
{header: "Name", dataIndex: "name"}]);
var table = new Ext.grid.GridPanel({
store: store,
height: 200,
cm: columnModel,
renderTo: "table"
});
store.load();
});
</script>
<div id="table" style="width:300px; height:200px;"></div>
</body>
</html>
#!/bin/bash #At first, run "wine setup.exe" BROODWAR_HOME=/usr/games/broodwar ipx_interface add -p eth0 802.2 0x39ab0222 cd $BROODWAR_HOME xinit /usr/bin/wine starcraft.exe
#!/bin/bash
#Switch monitor (CRT or LCD) to flash-light mode.
echo -e "\\033[47;30m"
clear
read
echo -e "\\033[0m"
clear
JavaPS.java
import java.util.Set;
import sun.jvmstat.monitor.HostIdentifier;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
import sun.jvmstat.monitor.StringMonitor;
import sun.jvmstat.monitor.VmIdentifier;
public class JavaPS {
private static final String[] vmProperties = new String[]{
"java.property.java.vm.name",
"java.property.java.vm.vendor",
"java.property.java.vm.version",
"java.property.java.home",
"java.property.java.class.path",
"java.rt.vmArgs",
"java.rt.vmFlags",
"sun.rt.javaCommand"};
public static void main(String[] args) {
Set jvms;
MonitoredHost monitoredHost;
try {
monitoredHost = MonitoredHost.getMonitoredHost(new HostIdentifier("localhost"));
jvms = monitoredHost.activeVms();
} catch (Exception e) {
e.printStackTrace();
return;
}
for (Object jvm : jvms) {
int jvmid = (Integer) jvm;
System.out.println("Process ID: \t" + String.valueOf(jvmid));
try {
VmIdentifier id = new VmIdentifier("//" + jvmid + "?mode=r");
MonitoredVm vm = monitoredHost.getMonitoredVm(id, 0);
for (String vmProperty : vmProperties) {
System.out.println(vmProperty + ": \t"
+ ((StringMonitor) vm.findByName(vmProperty)).stringValue());
}
System.out.println();
monitoredHost.detach(vm);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
javac -classpath %JAVA_HOME%\lib\tools.jar JavaPS.java
java -classpath .;%JAVA_HOME%\lib\tools.jar JavaPS >JavaPS.txt
JavaPS.txt
Process ID: 2144
java.property.java.vm.name: Java HotSpot(TM) Client VM
java.property.java.vm.vendor: Sun Microsystems Inc.
java.property.java.vm.version: 1.6.0_03-b05
java.property.java.home: C:\Program Files\Java\jre1.6.0_03
java.property.java.class.path: .;E:\Devel\jdk1.5.0_09\lib\tools.jar
java.rt.vmArgs:
java.rt.vmFlags:
sun.rt.javaCommand: JavaPS
Process ID: 364
java.property.java.vm.name: Java HotSpot(TM) Client VM
java.property.java.vm.vendor: Sun Microsystems Inc.
java.property.java.vm.version: 1.6.0_03-b05
java.property.java.home: C:\Program Files\Java\jre1.6.0_03
java.property.java.class.path: SwingSet2.jar
java.rt.vmArgs:
java.rt.vmFlags:
sun.rt.javaCommand: SwingSet2.jar
Rtf2XML.java
import javax.swing.text.AbstractDocument.BranchElement;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.BadLocationException;
import javax.swing.text.rtf.RTFEditorKit;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.UnsupportedEncodingException;
public class Rtf2XML {
private DefaultStyledDocument rtfSource;
private org.w3c.dom.Document xmlTarget;
private org.w3c.dom.Element xmlRoot;
private void expandElement(javax.swing.text.Element rtfElement) {
for (int i = 0; i < rtfElement.getElementCount(); i++) {
javax.swing.text.Element rtfNextElement = rtfElement.getElement(i);
if (rtfNextElement.isLeaf()) {
try {
addElement(rtfNextElement);
} catch (Exception e) {
e.printStackTrace();
}
} else {
expandElement(rtfNextElement);
}
}
}
private void addElement(javax.swing.text.Element rtfElement)
throws UnsupportedEncodingException, BadLocationException {
String style = new String(rtfSource.getLogicalStyle(rtfElement.getStartOffset())
.getName().getBytes("ISO-8859-1"));
String text = new String(rtfSource.getText(rtfElement.getStartOffset(),
rtfElement.getEndOffset() - rtfElement.getStartOffset())
.getBytes("ISO-8859-1"));
org.w3c.dom.Element node = xmlTarget.createElement("p");
node.appendChild(xmlTarget.createTextNode(text));
node.setAttribute("style", style);
xmlRoot.appendChild(node);
}
public void convert(String sourceFileName) throws Exception {
rtfSource = new DefaultStyledDocument();
RTFEditorKit kit = new RTFEditorKit();
kit.read(new FileInputStream(sourceFileName), rtfSource, 0);
xmlTarget = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
BranchElement rtfRoot = (BranchElement) rtfSource.getDefaultRootElement();
xmlRoot = xmlTarget.createElement("data");
expandElement(rtfRoot);
xmlTarget.appendChild(xmlRoot);
Transformer t = TransformerFactory.newInstance().newTransformer();
t.transform(new DOMSource(xmlTarget),
new StreamResult(new FileOutputStream(sourceFileName + ".xml")));
}
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Usage: *.rtf");
return;
}
try {
new Rtf2XML().convert(args[0]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import javax.sound.midi.*; public class MidiSynthesizerSample { public static void main(String[] args) { int[] notes = new int[]{60, 62, 64, 65, 67, 69, 71, 72, 72, 71, 69, 67, 65, 64, 62, 60}; try { Synthesizer synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); MidiChannel channel = synthesizer.getChannels()[0]; for (int note : notes) { channel.noteOn(note, 50); try { Thread.sleep(200); } catch (InterruptedException e) { break; } finally { channel.noteOff(note); } } } catch (MidiUnavailableException e) { e.printStackTrace(); } } }
package xantorohara.xenoharmonica.samples; import javax.sound.midi.MidiSystem; import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import java.io.FileInputStream; public class MidiPlayerSample { public static void main(String[] args) { try { Sequencer sequencer = MidiSystem.getSequencer(); if (sequencer == null) throw new MidiUnavailableException(); sequencer.open(); FileInputStream is = new FileInputStream("sample.mid"); Sequence mySeq = MidiSystem.getSequence(is); sequencer.setSequence(mySeq); sequencer.start(); } catch (Exception e) { e.printStackTrace(); } } }