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
import java.awt.KeyEventDispatcher; | |
import java.awt.KeyboardFocusManager; | |
import java.awt.event.KeyEvent; | |
import java.util.List; | |
import java.util.concurrent.CopyOnWriteArrayList; | |
/** | |
* Listener for reading data from the barcode Reader | |
* @author Aravinda | |
* |
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
import java.awt.Color; | |
import java.awt.Component; | |
import javax.swing.JComponent; | |
import javax.swing.JTable; | |
import javax.swing.table.TableCellRenderer; | |
public class CustomJTable extends JTable { | |
Color backgroundColor = getBackground(); |
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
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.Properties; | |
import org.apache.log4j.Logger; | |
/** | |
* Read configurations from property file. | |
* @author Aravinda. |
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
Public Class JTableRowSelector{ | |
public static void selectRow(JTable table, int rowIndex, int vColIndex) { | |
if (!(table.getParent() instanceof JViewport)) { | |
return; | |
} | |
JViewport viewport = (JViewport)table.getParent(); | |
// This rectangle is relative to the table where the | |
// northwest corner of cell (0,0) is always (0,0). | |
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); |
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
import javax.mail.*; | |
import javax.mail.internet.AddressException; | |
import javax.mail.internet.InternetAddress; | |
import javax.mail.internet.MimeMessage; | |
import java.util.Properties; | |
public class SampleMailClient { | |
private static String USER_NAME = "ara123@gmail.com"; // GMail user name (just the part before "@gmail.com") | |
private static String PASSWORD = "pass@1235"; // GMail password |
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
import android.app.Activity; | |
import android.app.Service; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.os.Bundle; | |
import android.os.IBinder; | |
import android.support.v4.content.LocalBroadcastManager; |
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
public class ConfigReader { | |
public static Map<String, String> readConfig() { | |
Map<String, String> config = new HashMap<>(3); | |
Properties prop = new Properties(); | |
CodeSource codeSource = ConfigReader.class.getProtectionDomain().getCodeSource(); |
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
import javax.crypto.Mac | |
import javax.crypto.spec.SecretKeySpec | |
Object HMACgen { | |
def generateHMAC(sharedSecret: String, preHashString: String): String = { | |
val secret = new SecretKeySpec(sharedSecret.getBytes, "SHA256") //Crypto Funs : 'SHA256' , 'HmacSHA1' | |
val mac = Mac.getInstance("SHA256") | |
mac.init(secret) | |
val hashString: Array[Byte] = mac.doFinal(preHashString.getBytes) |
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
require 'uri' | |
namespace :mongo do | |
desc "Dump the production database and restore to development and staging databases." | |
task :dump_and_restore => :environment do | |
dev = URI.parse(ENV["MONGO_URI"]) | |
prod = URI.parse(`heroku config:get MONGO_URI --remote production`) | |
prod_username, prod_password = prod.userinfo.split(':') |
OlderNewer