Amol Pujari amolpujari

View egauge_simulator.py
1 2 3 4 5 6 7 8 9 10
push_url = None
auth_string = None
 
register_names = []
 
reporting_interval = 60
min_reporting_interval = 5
max_reporting_interval = 600
 
sampling_interval = 1
View mongodb_data_modeling_and_implementations_notes.md

MongoDb Data Modeling Notes - v1.0

This is a rough document getting prepared for db design and architect level decisions to be made while dealing with area where one wants to consider MongoDB abd web services.

The tools would mainly include mongoDb, RSTful resources, background jobs, and possible queuing engine(RabbitMQ) to provide unit inputs to the background jobs. After measurements caching layers like ElasticSearch can be introduced as require. MySQL can be considered in few cases to support non-relational data storage as per need.

RESTful services and background jobs can be implemented using best frameworks available in Java. Or now a days extreme-service-developers are talking about wonders of Go language, hence would be great if Go language is considered for writing service layer. This is one very nice article about the REST services in Go

View DBCon.java
1 2 3 4 5 6 7 8 9 10
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
View spec_helper.rb
1 2 3 4 5 6 7 8 9 10
require "#{File.dirname(__FILE__)}/../lib/transactions.rb"
include Transactions
 
def capture_stdout(&block)
original_stdout = $stdout
$stdout = fake = StringIO.new
begin
yield
ensure
$stdout = original_stdout
View transaction_spec.rb
1 2 3 4 5 6 7 8 9 10
require 'spec_helper'
 
describe "Transaction" do
it "should handle dummy numerals" do
transaction_input(%{
x1 is I
x5 is V
x10 is X
x50 is L
x100 is C
View mailer_helper.rb
1 2 3 4 5 6 7 8 9 10
module MailerHelper
def highligh_changes_made_to object, options={}
html = ""
attrs = options[:attrs] || object.class.attribute_names
html << "<br/><p>"
attrs.each do |attr|
html << "<p> #{attr.to_s.humanize} : "
 
if object.previous_changes.include? attr.to_s
View mailer_knows.rb
1 2 3 4 5 6 7 8 9 10
# config/initializers/mailer_knows.rb
 
module MailerBefore
def before(hash)
hash.keys.each do |key|
define_method key.to_sym do
eval " @#{key} = hash[key] "
end
end
end
View admin.lightbox.css.scss
1 2 3 4 5 6 7 8 9
body.active_admin #modal_shadow{
z-index: 999998;
position:fixed;
top: 0px; left: 0px;
height:100%; width: 100%;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2NsampKAwAFAgHu04pC4AAAAABJRU5ErkJggg==) repeat;
display:none;
padding: 0; margin: 0;
}
View admin.lightbox.js.coffee
1 2 3 4 5 6 7 8 9
window.admin ||= {}
$.extend window.admin,
 
lightbox:
show: (options) ->
options = {} unless options
buttonDone = options.buttonDone or "Done"
buttonCancel = options.buttonCancel or "Cancel"
focus = options.focus or "input"
View thread_pool.rb
1 2 3 4 5 6 7 8 9 10
class ThreadPool
attr_accessor :threads, :max_size, :wait_time_to_free, :name
 
def initialize max_size=4
@max_size = max_size
@threads = []
@wait_time_to_free = 0.1
end
 
def start *args, &block
Something went wrong with that request. Please try again.