This file contains 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
edit /etc/security/limits.conf | |
# non-root users | |
* soft nofile 40000 | |
* hard nofile 40000 | |
# root users | |
root soft nofile 40000 | |
root hard nofile 40000 |
This file contains 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
package gzip; | |
import java.io.BufferedReader; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.InputStreamReader; | |
import java.util.zip.GZIPInputStream; | |
import java.util.zip.GZIPOutputStream; | |
public class GzipTest { |
This file contains 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
// origin : askubuntu.com (http://askubuntu.com/questions/351879/how-to-create-a-service-on-ubuntu-lts-12-04) | |
// about upstart manual : http://upstart.ubuntu.com/cookbook | |
Upstart scripts have to placed at /etc/init, ending with .conf. | |
Basically they require 2 sessions: one to indicate when to start, and another with the command to exec. | |
The easiest script to start with your sample is: | |
# myprogram.conf |
This file contains 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
# via http://wiki.apache.org/couchdb/Installing_on_Ubuntu | |
sudo apt-get install --yes build-essential curl git | |
sudo apt-get install --yes python-software-properties python g++ make | |
sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets | |
sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool | |
# via http://ftp.fau.de/apache/couchdb/source/1.6.1/ | |
cd /tmp |
This file contains 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
error like this | |
error: object file .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0 is empty | |
fatal: loose object 3165329bb680e30595f242b7c4d8406ca63eeab0 (stored in .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0) is corrupt | |
here you go. | |
Step 1: Make a backup of .git (in fact I do this in between every step that changes something, but with a new copy-to name, e.g. .git-old-1, .git-old-2, etc.): |
This file contains 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
{ | |
"analyzer": "class org.apache.lucene.analysis.standard.StandardAnalyzer", | |
"etag": "136aa9854e3df", | |
"fetch_duration": 0, | |
"limit": 31, | |
"plan": "BooleanQuery(TermQuery(desc_upc_cat_sup:koka,boost=1.0)+TermQuery(default:kola,boost=1.0)+TermQuery(locid:88c6b2ca7d76cc613907149e505c5eff,boost=1.0),boost=1.0)", | |
"q": "desc_upc_cat_sup:koka +default:kola +locid:88c6b2ca7d76cc613907149e505c5eff", | |
"rows": [], | |
"search_duration": 0, | |
"skip": 0, |
This file contains 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
// you can set border / cellpadding and other stuffs so that this content fits JTable or JLabel | |
"<html><table width=\"115\"; border=\"0\"; cellpadding=\"0\"; cellspacing=\"0\"; margin-top=\"0\"; margin-bottom=\"0\"; padding=\"0\" \"><tr><td align=\"center\">" + work_hour + "</td></tr><tr><td align=\"center\"><font size=\"2\">" + startTimeAMPM + "~" + endTimeAMPM + "</font></td></tr></table></html>" |
This file contains 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
function getDateObjectFromTimeOnlyPart(default_date, timeString) { | |
// default_date : date object, timeString format "11:00" or "03:00 pm" | |
var time = new Date(default_date); | |
var hhmm = undefined; | |
var ampm = undefined; | |
if(_.str.contains(timeString.toLowerCase(), "m")) { | |
// am/pm format ex) 04:00 am | |
var timeStringArray = timeString.split(" "); | |
hhmm = (timeStringArray[0]).split(':'); | |
ampm = timeStringArray[1].toLowerCase(); |
This file contains 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
/** GET TABLE COLUMN MODEL AND SET CELL RENDERER **/ | |
Color LIGHT_BLUE = new Color(176, 196, 222); | |
EmployeeDetailScheduleTableCellRenderer cellRenderer = new EmployeeDetailScheduleTableCellRenderer(LIGHT_BLUE); | |
TableColumnModel tcm =tableListDetailSchedule.getColumnModel(); | |
for(int i=2; i<=8; i++) { | |
TableColumn tm = tcm.getColumn(i); | |
tm.setCellRenderer(cellRenderer); | |
} | |
/** CREATE CELL RENDERER **/ |
This file contains 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
//User Defined | |
DateTimeZone dtz = DateTimeZone.forID("America/New_York"); | |
//System Default TimeZone | |
DateTimeZone dtzz = DateTimeZone.forID(TimeZone.getDefault().getID()); |