Skip to content

Instantly share code, notes, and snippets.

@shaik2many
shaik2many / java-sysout-file.java
Last active August 29, 2015 14:08
java sysout file
public class SysOutToFile {
public void test() {
String line = System.getProperty("line.separator");
PrintStream out = new PrintStream(new FileOutputStream("C:/migration-out.txt"));
PrintStream err = new PrintStream(new FileOutputStream("C:/migration-err.txt"));
System.setOut(out);
System.setErr(err);
out.flush();
err.flush();
@shaik2many
shaik2many / java-file-write-performance.java
Created November 7, 2014 17:31
java file write performance
/**
* http://stackoverflow.com/questions/1062113/fastest-way-to-write-huge-data-in-text-file-java
*
* I have to write huge data in text[csv] file. I used BufferedWriter to write the data and it
* took around 40 secs to write 174 mb of data. Is this the fastest speed java can offer?
* bufferedWriter = new BufferedWriter ( new FileWriter ( "fileName.csv" ) );
*
* You might try removing the BufferedWriter and just using the FileWriter directly. On a modern system
* there's a good chance you're just writing to the drive's cache memory anyway.
* It takes me in the range of 4-5 seconds to write 175MB (4 million strings) -- this is on a dual-core 2.4GHz Dell
@shaik2many
shaik2many / solr-delete-exactmatch
Created November 12, 2014 18:22
solr delete specific content
http://abc.com/seek/comet-binary/update?stream.body={%22delete%22:{%22query%22:%22text:\%22503%20Service%20Temporarily%20Unavailable\%22%22}}&commit=true
http://abc.com/seek/comet-binary/update?stream.body={"delete":{"query":"*:*"}}&commit=true
http://abc.com/seek/comet-binary/update?stream.body={"delete":{"query":"text:\"503 Service Temporarily\""}}&commit=true
@shaik2many
shaik2many / unicode
Created November 19, 2014 15:15
unicode chars
Unicode Symbol Decimal html Description
U+00A1 ¡ ¡ ¡ Inverted Exclamation Mark
U+00A2 ¢ ¢ ¢ Cent sign
U+00A3 £ £ £ Pound sign
U+00A4 ¤ ¤ ¤ Currency sign
U+00A5 ¥ ¥ ¥ Yen sign
U+00A6 ¦ ¦ ¦ Broken bar
U+00A7 § § § Section sign
U+00A8 ¨ ¨ ¨ Diaeresis
U+00A9 © © © Copyright sign
@shaik2many
shaik2many / html-color-contrast.html
Created November 20, 2014 22:57
html color contrast
<table style="width:100%">
<tr>
<td style="background-color:#22436B">22436B</td>
<td style="background-color:#3B73B9">3B73B9</td>
<td style="background-color:#89ABD5">89ABD5</td>
</tr>
<tr>
<td style="background-color:#056083">056083</td>
<td style="background-color:#08A5E1">08A5E1</td>
<td style="background-color:#6BC9ED">6BC9ED</td>
@shaik2many
shaik2many / coding-standards
Created November 20, 2014 23:10
coding standards
1) Try to attain no warning symbol in the code (Unused variables, non-required imports)
2) System.out.println statements
3) Indentation
4) Naming convention
5) Info vs Debug messages
6) Log only when required – goal is easy debugging
7) Exceptional handling chain
8) Front end Exceptional handling (similar to what google does)
@shaik2many
shaik2many / windows-commands
Created December 7, 2014 20:41
common windows commmands
devmgmt.msc
control printers
%temp%
msconfig
@shaik2many
shaik2many / large-excel-xlbs
Created December 8, 2014 15:49
xlbs format
Save time and Space with the excel .xlbs format
Do you have large excel files that take GB of space in your HD, they are impossible to send and take 2 minutes to open?
then wait no more.. save them in .xlbs format:
in excel, select file -> save as, and save them as .xlbs, it's the excel binary format, and it's fully compatible with office 2010... your files will be smaller, and they will take only 25% of the time to load...
@shaik2many
shaik2many / hadoop-install
Last active August 29, 2015 14:11
linux hadoop installation commands
$ sudo -s
$ dpkg -l (gives list of all installed packages)
$ /etc/init-d/networking restart
$ service ssh restart
$ vi /etc/apt/sources.list.d/cdh3.list
(make sure u have "deb http://archive.cloudera.com/debian lucid-cdh3u5 contrib")
$pwd (print working directory)
$clear (clear CLI - command line interface)
$ls -a (list hidden and unhidden files)
$ls -al (combine both a and l flags after - symbol; l - prints all details)
@shaik2many
shaik2many / linux-shell-script-path
Created December 22, 2014 20:16
linux setting shell path
Step1: $vi /home/user1/scripts/my_script.sh
#!/bin/bash
# My first script
echo "Hello World!"
**Setting permissions**
Step2: $chmod 755 my_script (The "755" will give you read, write, and execute permission.
Everybody else will get only read and execute permission. If you want your script to be private (i.e., only you can read and execute), use "700" instead.)