Skip to main content

Posts

Showing posts from 2013

Six Principles for Making New Things

Here it is: I like to find (a) simple solutions (b) to overlooked problems (c) that actually need to be solved, and (d) deliver them as informally as possible, (e) starting with a very crude version 1, then (f) iterating rapidly
http://josephmcohen.com/post/71536977591/toyota-manufacturing-principles

Toyota Manufacturing PrinciplesHEART2 NOTES Throughout its history, Toyota has made a habit of labeling its business concepts and guiding values. In learning more about the company, I’ve picked up a few useful concepts from their manufacturing vocabulary: Jidoka:Automation with a Human Touch The idea of jidoka is that humans should work with machines to produce the best possible outcome, leveraging the execution ability of a machine and the judgement of a human. I learned this term on a tour of Toyota’s Nagoya factory, where jidoka is a guiding principle. The concept originally comes from Sakichi Toyoda’s invention of the automatic loop in 1896, back when Toyota was in the textile business. Jidoka will become increasingly relevant as computers continue to do more and more work that humans have historically done. The concept has been ported to English under the name “autonomation,” and the Atlantic recently ran a st…

Sheesh kebab recipe

Serving : 4

Lamb    : 1.5 lb
Yogurt  : 1 cup
Black pepper: 1 tsp
Olive oil       : 3 tbsp
Kothmir       : 3 tbsp
Garlic          : 2 cloves
Salt              : 1 tsp
Onion          : 1
Oregano      :
Red pepper flakes : 2 tsp


6 garlic cloves, crushed3 tablespoons extra-virgin olive oil, plus more for brushing3 tablespoons fresh lemon juice1 teaspoon kosher salt1 teaspoon freshly ground pepper1 teaspoon dried mint1 teaspoon dried oregano1 1/2 pounds trimmed boneless leg of lamb, cut into 1 1/2-inch cubes1 small bunch of fresh mint1 large red onion, cut into 2-inch pieces1 large yellow bell pepper, cut into 2-inch pieces1 large green bell pepper, cut into 2-inch piecesVegetable oil, for the grill

Java Transactions

ACID:
Atomicity: Either should commit all rollback all of its updates in a single unit of work.
Consistency: database should never be left in inconsistent state
Isolation: How protected is uncommitted changes from other transactions, isolation decreases concurrency.
Durability: changes are permanent.

interfaces
UserTransaction begin(), commit(), rollback(), getStatus()
TransactionManager suspend(), resume(), setRollbackOnly(),
Status ACTIVE, COMMITTED, COMMITING, MARKED_ROLLBACK, NO_TRANSACTION, PREPARED, PREPARING, ROLLEDBACK, ROLLING_BACK, UNKNOWN.

Transaction Models

1. Local
2. Programatic
3. Declarative

Local Transaction Model:
Resource manager manages transactions. Developer manages connections.
e.g.
conn.setAutoCommit(false);
try {
  stmt.executeUpdate(sql1);
  stmt.executeUpdate(sql1);
  conn.commit()
} catch (Exception e) {
  conn.rollback();
}

Programatic Transaction Model
Uses JTA, developer uses UserTransaction begin(), commit() or rollback().
UserTransaction tx
tx.begin()
tx…

JVM internals

JRE has JVM, Garbage collector, JIT compiler

JVM - young generation, old generation, permanent generation (metaspace).

Garbage collector - Serial, Multithreaded, CMS, G1

Serial
          - single threaded stop the world young generation collector
          - single threaded stop the world old generation collector

Throughput/Parallel/Multithreaded -
         - Multithreaded stop the world young generation collector
         - Single/multi threaded stop the world old generation collector

CMS
       - Server class machine default collector
       - Multithreaded young & old generation collector
       - 2 GB
       - 2 Virtual CPU's
       - One exception is on Windows 32 bit the default is the serial collector.

G1
     - Supported as of Java HotSpot 7 update 4
     - Region based multithreaded stop the world young generation collector
     - Combination of a mostly concurrent and stop the world old generation collector

JIT Compiler
     - Takes Java bytecode and generates native …

Dynamic configurations on remote clients

Strategy 1:Use server to provide configuration:

Every client will have to use this configuration.
No per client configuration option.
Requires setting jvm params

Strategy 2: Send configuration file to client on default location.

Per client configuration possible
Strategy requires transmitting file to client.
Requires setting jvm params

Strategy 3: Build client handler looking for flags.

Per client configuration possible
Strategy requires building handler.
Not easy to add features later on.
Doesn't require jvm params

Key design rights:

Passing bits to individual client is key rather server side
Use the build-in logback handler is better rather building one.

Rationally:
passing logger:level is the possible, handler will look if logger are set and will use if found.
handler will reset all previous configuration.

Best solution: Key is pass the file.

This will be future proof
Works per client
Requires setting jvm params







Logback know how-to

What is logback? Logback is intended as a successor to the popular log4j project. It was designed by Ceki Gülcü, log4j's founder. 

package chapters.introduction;import org.slf4j.Logger;import org.slf4j.LoggerFactory;publicclassHelloWorld1{publicstaticvoid main(String[] args){Logger logger =LoggerFactory.getLogger("chapters.introduction.HelloWorld1");     logger.debug("Hello world.");}}
Logger, Appenders and Layouts Logback is built upon three main classes: Logger, Appender and Layout. These three types of components work together to enable developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported. The Logger class is part of the logback-classic module. On the other hand, the Appender and Layout interfaces are part of logback-core. As a general-purpose module, logback-core has no notion of loggers.

Logger context The first and foremost advantage of any logging API over p…

Cheatsheets

http://www.digilife.be/quickreferences/QRC/vi%20Reference%20Card%20(HP).pdf

http://www.vreference.com/public/vmreferenceVI3card1.3for3.5U3.pdf
http://tutorial.math.lamar.edu/pdf/Algebra_Cheat_Sheet_Reduced.pdf
http://www.mcdonaldland.info/files/designpatterns/designpatternscard.pdf
http://www.digilife.be/quickreferences/QRC/The%20One%20Page%20Linux%20Manual.pdf
http://www.alberton.info/downloads/postgresql-cheat-sheet.pdf
http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_(3.0).pdf
http://media-cache-ak1.pinimg.com/originals/f9/6c/d1/f96cd195bffe99eb90f80ade4b1bb35c.jpg
http://overapi.com/java/

Raspberry PI won at VMware Borathon 2 day event

Idea: Cloud automation through Twitter integration.

Manage entire app lifecycle, deploy, destroy, scale-out & scale-in via Tweets from anywhere anytime.

Manage complex apps like Hadoop cluster,  JEE Cluster, Drupal, High performance DB's (Oracle etc).











Few terms to know before buying apartment in India.

What is Carpet Area, Built up Area, Saleable Area?
Please read this 4 page article few times to understand how builders use the above terms to fool people in thinking about apartment sizes. Technically on paper you can buy 1500 sft apartment with real area far less then that. http://www.ramindiagroup.com/CustomerWelfare-AreaConcepts.html
Summary:
Typical Calculation:  Super Build-up Area = ( Carpet Area + (balcony/terrace) * 0.5 ) * 1.3
Carpet Area - Area within your apartment walls. Balcony - Area with ceiling but without walls on all sides. Terrace - Area without ceiling and without walls on all sides
Why are we multiplying total area by 1.3 ?  Thats called loading factor, builders give exclusive rights to area within your aprt walls but not to stairs, and lifts, and to cover this cost they add 30% more.
P.S: Parking space cost in Hyderabad is around 1-15 Lakhs.

Mere Mehboob movie with english subtitles on YouTube much watch an old cultural gem.

Indian movie in a different genre must watch its free movie with english subtitles on Youtube. 
The film became a "blockbuster" and took the number one position at the box office in 1963.The movie drew a background from Aligarh Muslim University, Aligarh and traditional Lucknow. The famous song "Mere Mehboob Tujhe Mere" was shot in the University Hall and in a couple of places one gets to see the university. The opening scene of the movie shows the famous residential hall and the associated clock tower 'Victoria Gate'.
1/22 part please follow Youtube suggestion for the rest of the parts.

India's maid culture and social implications

Its a very common practice in India specially southern city Hyderabad to have maids helping housewives and elderly people with daily chores. As per the Muqaddimah well known book on economics in IvyLeague circle the author argues that maids/servent profession is not natural to human beings and its hard to find someone with basic qualities being honest and hardworking.

However the major implication of living with maids and servent's is people tend to acquire investigative attitude because of always being in an environment of being mistrust and verification. This leads to several complications and fallouts in one's personal life coz people behave with family and friends in the same attitude.

The Oilman and his Parrot.

STORY II. 
The Oilman and his Parrot.
 An oilman possessed a parrot which used to amuse him with its agreeable prattle, and to watch his shop when he went out. One day, when the parrot was alone in the shop, a cat upset one of the oil-jars. When the oilman returned home he thought that the parrot had done this mischief, and in his anger he smote the parrot such a blow on the head as made all its feathers drop off, and so stunned it that it lost the power of speech for several days. But one day the parrot saw a bald-headed man passing the shop, and recovering its speech, it cried out, "Pray, whose oil-jar did you upset?" The passers-by smiled at the parrot's mistake in confounding baldness caused by age with the loss of its own feathers due to a blow.
Rumi, Maulana Jalalu-'d-din Muhammad (2011-05-16). The Masnavi I Manavi of Rumi Complete 6 Books (Kindle Locations 107-112). OrangeSky Project. Kindle Edition.

Junit 4.11 cheatsheet

Assertion - org.junit.AssertEquals, NotEquals, True, False, Null, NotNull - Arrays, Object & Strings
Test Aggregation importorg.junit.runner.RunWith;importorg.junit.runners.Suite;@RunWith(Suite.class)@Suite.SuiteClasses({TestFeatureLogin.class,TestFeatureLogout.class,TestFeatureNavigate.class,TestFeatureUpdate.class})publicclassFeatureTestSuite{// the class remains empty,// used only as a holder for the above annotations}
Exception Testing @Test(expected=IndexOutOfBoundsException.class)publicvoidempty(){newArrayList<Object>().get(0);} @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void shouldTestExceptionMessage() throws IndexOutOfBoundsException { List
Matchers and assertthat assertThat(x, is(3)); assertThat(x, is(not(4))); assertThat(responseString, either(containsString("color")).or(containsString("colour"))); assertThat(myList, hasItem("3")); Ignoring tests
@Ignore("Test is ignored …