xqx_utemp.sh
#!/bin/bash
#Creates temporary folder with unique name (current date and time).
DATE=`date +%Y.%m.%d_%H.%M.%S.%N`
mkdir $DATE
Also, it is possible to create temporary directory via mktemp utility, but my script is more suitable for me.
xqx_utemp.sh
#!/bin/bash
#Creates temporary folder with unique name (current date and time).
DATE=`date +%Y.%m.%d_%H.%M.%S.%N`
mkdir $DATE
ChatPortlet.java
public class ChatPortlet extends GenericPortlet {
AtomicInteger counter=new AtomicInteger(0);
protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {
renderResponse.setContentType("text/html");
PrintWriter writer = renderResponse.getWriter();
writer.println("<script language='javascript' src='" + renderRequest.getContextPath() + "/xqx.web.chat.Chat-xs.nocache.js'></script>");
writer.println("<div id='xqx_web_chat_Chat-"+counter.incrementAndGet()+"'></div>");
writer.close();
}
...
}
Chat.java
package xqx.web.chat.client;
...
public class Chat implements EntryPoint {
...
private FlowPanel messagesPanel = new FlowPanel();
private ScrollPanel messagesScrollPanel = new ScrollPanel(messagesPanel);
private TextArea inputTextArea = new TextArea();
private ScrollPanel inputScrollPanel = new ScrollPanel(inputTextArea);
...
public void onModuleLoad() {
messagesScrollPanel.setStyleName("xqx_messagesScrollPane");
messagesScrollPanel.addStyleName("xqx_etchedBorder");
inputTextArea.setStyleName("xqx_input");
...
String slotId = getEmptySlotId(RootPanel.getBodyElement(), "xqx_web_chat_Chat");
RootPanel rootPanel = RootPanel.get(slotId);
if (rootPanel != null) {
...
rootPanel.add(messagesScrollPanel);
rootPanel.add(inputScrollPanel);
rootPanel.add(sendButton);
...
}
...
}
private String getEmptySlotId(Element element, String idPrefix) {
int count = DOM.getChildCount(element);
if (count == 0) {
String id = DOM.getElementAttribute(element, "id");
if (id != null && id.startsWith(idPrefix)) {
return id;
}
} else {
for (int i = 0; i < count; i++) {
String id = getEmptySlotId(DOM.getChild(element, i), idPrefix);
if (id != null)
return id;
}
}
return null;
}
private void printMessages(Message[] messages) {
...
}
}
xqx_ubackup.sh
#!/bin/bash
if test -z "$1"; then
echo "Create backup archive with unique (depended on date) name."
echo "Usage: $0 <target file or folder> <(optional) path, where to put archive>"
exit
fi
DATE=`date +%Y.%m.%d_%H.%M.%S.%N`
if test -z "$2"; then
tar -cjf ./"$1"-$DATE.tar.bz2 "$1"
else
tar -cjf "$2"/"$1"-$DATE.tar.bz2 "$1"
fi
set JAVA_OPTS=-Dhttp.proxyHost=<Proxy Host> -Dhttp.proxyPort=<Proxy Port>
JAVA_OPTS="-Dhttp.proxyHost=<Proxy Host> -Dhttp.proxyPort=<Proxy Port>"
You should replace values "Proxy Host" and "Proxy Port" with actual data for your network.
xqx_teleport.sh
#!/bin/bash
if test -z "$1"; then
echo "Create local copy of http site."
echo "Usage: echo $0 <target URL>"
exit
fi
DATE=`date +%Y.%m.%d_%H.%M.%S.%N`
LOG=~/`basename $0`-$DATE.log
touch $LOG
if test ! -w "$LOG"; then
LOG=/dev/stdout
fi
wget --continue --recursive --no-parent --relative --convert-links $1 |tee $LOG
xqx_teleport.sh http://www.w3.org/TR/xhtml11