Skip to main content

Posts

Showing posts from January, 2017

Bitcoin

Bitcoin  https://www.youtube.com/watch?v=GiU4b7ldKMs block chain database of bitcoin. every block added every 10 minutes on average may vary. depending if very easy or hard t create hash sha-256 chain should be longest chain so they get reward. Every block gets rewards 10 minutes 50 bitcoin and halves every 4 years. same block can be created at the same time. start working on first block that you see. Chk which form longest chain. Then all blocks stop working on other and starts working on the one that was the largest. Forking of chain is also done. Longest one wins. Transaction in bitcoin:A bitcoin uses elliptic curve(signature is shorter to control length of block chain.). A private key is 32 random bytes.   A public key computed from private key. There is no cryptography in bitcoin. Only signing. Bitcoin addresses are like bank account numbers they are random and long. Calculated from a public key RIPEMD-160(SHA256(public key)). No one knows who owns which. You can have a many bitco

Docker Tutum

Tutum is a platform to provide docker container as a service - cloud. Its equivalent docker universal control plane- on premise. n tutum you BYON and then tutum takes care of plumbing. Available in API,GUI,CLI. If there is any change in git repo code then tutum will automatically redeploy. in the node builder all the builds will occur if do not name a node as builder then all the build will occur on a node that has least amount of containers. All the repository build will happen inside tutum builder. Tutum has its own yaml file tutum.yml similar to docker-compose.yml. You can add a load balancer haproxy which is out-of-box which will automatically scale the application as per the requests. You can add the tags (tags are branches of git where you want to build) only the branches specified in the tag will be built for deployment. Tutum yaml is used when we create a stack in tutum. autoredploy: true

Docker Part 1

currently with docker you are limited to only linux machines and apps. It is like installing various zip files on your os. because of the use of base image we can save space.All the containers use the same base image. If you want 100 containers in traditional vm env you would have needed 100GB space considering 1gb per image but with docker you will need only 1gb of space. Suppose if you need emacs and apache then docker will add to separate images for it on top of each other and with the base image it will form a union image. this image is readonly so to write in it docker will place a writable container and the whole set container:image(apache)+image(emacs)+base image will make a whole container in the docker.  But the writable container is not persistent. Docker boots the image/ image layers on top f each other. apt-cache search docker.io ---will display a list of packages containing docker apt-chache show docker.io ---- will display all details of packaage Check if it is latest ver

Java

A one-dimensional array is, essentially, a list of like-typed variables. To create an array, you first must create an array variable of the desired type. The general form of a one-dimensional array declaration is type var-name[ ]; Here, type declares the element type (also called the base type) of the array. Although this declaration establishes the fact that month_days is an array variable, no array actually exists. To link month_days with an actual, physical array of integers, you must allocate one using new and assign it to month_days. new is a special operator that allocates memory. You will look more closely at new in a later chapter, but you need to use it now to allocate memory for arrays. The general form of new as it applies to one-dimensional arrays appears as follows: array-var = new type [size]; The elements in the array allocated by new will automatically be initialized to zero (for numeric types), false (for boolean), or null (for reference types, which are described in a

Layer and tier

difference between a layer and a tier: q1: web server architecture is a pipelined architecture. q2: cloud archi require end teir design architecture. q3: SOA architecture: component architecture q4: GoF book "design patterns" q5: plugin: type of factory pattern implemented to submit a inversion of control for object. q6: piece of code that runs on its own q7: GoF q8: all hidden q9: encapsulation ensures that the code does not have direct dependencies outside that can be changed at will. q10: Cohesion determines layes q11: cannot be scled easily q12: no of things in piece of code. q13: Favor component design over inheritnce q14: Persistence,caching and optimistic locking cohesive code. q15: Instance separately and consumed has connection with business ligic and comes as a service. q16: sprint methodology (iterative) q17: how implementation is done vs how it was told.

Coding Standards

 Schemaless: Nosql Variable state has different instances that have different values that need to be stored inside them.  Common state when most of the instances have the same value so it is easier to reteive. the above is a method in which we can make our RDBMS system more flexible like NoSQL but make them more rigid then the NOSQL. Then in our traditional schema we need the data that fits the schema. But in the predicate one we can handle different types of data and decide how we are going to handle that data. We can use xml for this pupose. To keep a check on xml data we can use xml schema.. but now a days there is relax compact notation. RELAX NG is a simple schema language for XML, based on [ RELAX ] and [ TREX ]. A RELAX NG schema specifies a pattern for the structure and content of an XML document. A RELAX NG schema thus identifies a class of XML documents consisting of those documents that match the pattern. Consider a simple XML representation of an email address book: <a

Data as Software as Data

Better software for better data. Better data for better software. data chaos in json so for clarity make use of thrift

Linux commands

sudo!! : Forgot to run a command with sudo? You need not re-write the whole command, just type "sudo!!" and the last command will run with sudo. 2. Python -m SimpleHTTPServer : Creates a simple web page for the current working directory over port 8000. 3. mtr : A command which is a combination of 'ping' and 'traceroute' command. 4. Ctrl+x+e : This key combination fires up, an editor in the terminal, instantaneously. 5. nl : Outputs the content of text file with lines Numbered. 6. shuf : Randomly selects line/file/folder from a file/folder. 7. ss : Outputs Socket Statistics. 8. Last: Want to know history of last logged in users? This command comes to rescue here. 9. curl ifconfig.me : Shows machine's external IP Address. 10. tree : Prints files and folders in tree like fashion, recursively. 11. Pstree : Prints running processes with child processes, recursively. 13. stat : Shows the status information of a file as well as of a file system. 15. Pv : outputs

Java

Here is an example of the way that the ? is employed: ratio = denom == 0 ? 0 : num / denom; When Java evaluates this assignment expression, it first looks at the expression to the left of the question mark. If denom equals zero, then the expression between the question mark and the colon is evaluated and used as the value of the entire ? expression. If denom does not equal zero, then the expression after the colon is evaluated and used for the value of the entire ? expression. The result produced by the ? operator is then assigned to ratio. The switch statement works like this: The value of the expression is compared with each of the values in the case statements. If a match is found, the code sequence following that case statement is executed. If none of the constants matches the value of the expression, then the default statement is executed. However, the default statement is optional. If no case matches and no default is present, then no further action is taken. The break statement

REST

REpresentational State Transfer call from client to server get data back hypermedia as a engine to application state. self-descriptive messages http://www.ics.uci.edu/~fielding/pubs/dissertation/introduction.htm

CDN

Many consumers share data, only some part of it is private. Cache data locally. CDN can block traffic like proxy. DDoS Denial of service attack CDN cache whole site even if its down New relic uses cdn for mobile sdks