Tuesday, July 11, 2017

how to download source of app hosted on Google cloud

Fire below cmd 

appcfg.sh -A janews-151415 -V 1 download_app "C:/Temp"

Monday, November 28, 2016

Quick cmd to POST data to remote server over HTTP in Powershell


--------------------------------------------------------------------------
create a file  named test.ps1

write below cmds 
body=@"< a >name< / a>< b>password< / b>"@

 $URL = "http://www.computerperformance.co.uk"

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", 'text/xml')
$headers.Add("SOAPAction", '')
$response
 = Invoke-WebRequest -Uri $Url -Body $body -Headers $headers -Method POST


$reponse.StatusCode

Run the script with FQDN

&; "C:\Scripts\test.ps1"


----

$response = Invoke-WebRequest -Uri "http://somesite.com/oneendpoint" -Method Post -Body $JSON -ContentType "text/xml"
$uri = 'https://www.myWebsite.com/ext/ext/ext'
$data = Get-Content "kronos_ping.xml"
$result = Invoke-WebRequest -Uri $uri -Body $data -ContentType 'text/xml' -Method POST


$result.RawContent
----

Tuesday, August 9, 2016

Design Pattern - SingleTon

SingleTon class must be threadsafe , must produce only single instance per application per JVM. ENUM are immutable constants and hence  very easy to use for SingleTon class.


Method Injection  in Spring  IOC 


  < bean id="claimServiceManager" class="com.hp.eclaims.service.manager.ClaimServiceManager" > < property name="claimServiceDao" ref="claimServiceDao" /> < property name="claimServiceUtil" ref="claimServiceUtil" /> < lookup-method name="createNewTaskExecutor" bean="taskExecutor" /> < lookup-method name="createNewTask" bean="tasks" />
</ bean >
                 < bean id="tasks" class="com.hp.eclaims.service.util.ServiceTasks" scope="prototype">
                 < bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" scope="prototype" init-method="initialize" destroy-method="shutdown">


Above example shows how spring IOC achieves method injection (DI) .
Every time new objects of taskexecutor and tasks will get instantiated and passed into ClaimServiceManager thorugh abstract method createNewTaskExecutor and createNewTask . Those two are defined as  prototype scope in DD .

It is  helpful in  passing  prototype  scope object to singleton object type . 

Tuesday, March 8, 2016

Auth Provider mechanisms

http://www.mythics.com/about/blog/what-to-consider-when-integrating-authentication

some basic terminology around authentication:
1. Identity – Describes who you are.
2. Credential – Something that proves who you are.
3. Identity Provider – A trusted system that collects your credentials and provides your validated identity to a service.
4. Service Provider – Some kind of service provided to the user that requires knowledge of the user's identity.
5. Trust – How does a service provider establish the integrity of an identity provider?


Protocol Identity Credential Identity Provider Service Provider Trust
SAML2 XML "Assertion" Multiple SAML2 Identity Provider
SAML2 Service Provider
Established by digitally signing assertions of identity with pre-shared keys or pre-trusted certificate authorities
OAuth JSON "Token" Multiple but current standards for specifying OAuth endpoint OAuth endpoint OAuth verified identity providers using pre-shared "tokens" that are hard to guess, but not cryptographically verified
SSL Certificate Authentication Digitally signed certificate Digitally signed certificate Certificate authority Web server running SSL Established through the trust of certificate authorities
BrowserID Email address Certificate BrowserID provider Any web application Trust is established when a user is granted a certificate for authentication from their email provider

Thursday, March 3, 2016

Most wanted string programs

Program to count highest occurrence character in a string .

Program to print  all permutations of a string characters  like  
123
213
312
321
231
132

Program to find anagrams 
Program to find first non repetitive character in a string
Program to reverse a string .
Program to remove occurrence of a character from a string  ( recursive )
Program to find longest palindrome in a string .

Saturday, October 17, 2015

Interview Question

difference between abstract and interface
How to save transient data
why externalisation when serializable exists
Internal implementation of hash map and hashset
Normalisation why it is required
explain 1st 2nd 3rd normal form
How to get thread result back - through callable interface
are serialised and deserialised object are the same object instances ?
Read about serialisation in one file and in multiple files and see the heap space .
Answer is No if heap spaces are different.
How to validate JSON
What is difference between merge and inverse
Object state in hibernate
would there be several instances of singleton class in different JVM
// yes different JVM have different class loader hence different objects would get instantiated.
--------------------------------------------------------
when to use second level cache in Hibernate 
Why criteria API are used ? - For dynamic invocation of query parameters. 
What are projections ? aggregate funcations
What are restrictions? where conditions 
QBE ? by passing dummy object in criteria
One To Many // give an example
Many To one // give an example
Hibernate Validator pattern 

------------------------
ThreadLocal usage


http://examples.javacodegeeks.com/enterprise-java/rest/jersey/jax-rs-queryparam-example/



Saturday, September 26, 2015

SOAP over JMS

SOAP webservices can be accessed through HTTP  as well as JMS .
SOAP over JMS  gives message delivery guarantee and is  preferred where  message critical application  are deployed.


JMS provide two types of message communication


1) point to point
    (A) once message is received it is removed from Q
    (B) only one receiver can receive the message
2) publish / subscribe
    (A) message stays on topic even after one receiver reads it
    (B) multiple receivers can subscribe to same topic 




JMS webservices can be  developed  with two approaches


1) 1 way request
- web client will get unblock once  the request is  gone to destination  (Q/Topic)
- Q/Topic both can implement it
2) request - response
- web client will get unblock only after response gets back to the client
-Only Q can implement this type of web service