Image vs Containers for Docker

Not many developers explain technologies clearly, either intentionally or incapably. the post here however is one exception:

from: http://blog.codesupport.info/docker-images-vs-containers/

 

IMAGE :- An image is an inert, immutable, file that’s essentially a snapshot of a container. Images are created with the build command, and they’ll produce a container when started with run. Images are stored in a Docker registry such as registry.hub.docker.com. Because they can become quite large, images are designed to be composed of layers of other images, allowing a miminal amount of data to be sent when transferring images over the network.
 CONTAINER :- To use a programming metaphor, if an image is a class, then a container is an instance of a class—a runtime object. Containers are hopefully why you’re using Docker; they’re lightweight and portable encapsulations of an environment in which to run applications.

The RPC didn’t feel so long ago

It didn’t seems like a century old ago, when the stub and skeleton was widely used, and WSDL2Java & Java2WSDL was pretty convenient and “cool”:

  1. A Java program executes a method on a stub (local object representing the remote service)
  2. The stub executes routines in the JAX-RPC Runtime System (RS)
  3. The RS converts the remote method invocation into a SOAP message
  4. The RS transmits the message as an HTTP request

it’s now an Optional in Java EE7, but good to see it’s still there.

https://java.net/projects/jax-rpc/

Android React native app

Have played around react native, and published an android app earlier.

some thoughts:

  1. navigator

    this would normally be the entry point, which define the landing page, and how routing to different pages works.


<Navigator
    initialRoute={{ title: 'Tap Scene', id: 'default' }}
    renderScene={this.navigatorRenderScene}
/>

 

Scene

2. For each scene, its a Component, where the life cycle of constructor, componentDidMount, componentUnmount, can be used to trigger specific actions. on each scene, you can use JSX to create the page/view, which could link to functions, like normal js binding:

onActionSelected
onIconClicked
handleClick() {
    if(!this.state.favnumber)
        LocalToastAndroid.show('Please set up your favorite number first', LocalToastAndroid.SHORT);
    else
        LocalToastAndroid.call(this.state.favnumber);
};

Additional actions

3. native react native modules wont cover all functions you request, to create custom module, you can register additional

ReactContextBaseJavaModule

then exposing the method to JS

@ReactMethod
public void call(String number){
.....
}
module.exports = NativeModules.CustomizedModule;

here is the app: https://play.google.com/store/apps/details?id=com.best2lwjj

AI for system support

Have tried to build an AI bot since almost 3 years back, finally did a prototype, in case anybody would like to do something similar:

Technologies:

Java, Scala, Python, Anaconda, Scikit Learn,  EWS, BootStrap, AngularJS/JQuery

Components:

Data Set

  1. I have built a scala web crawler, to download all historical support issues.
  2. at the same time, have manually cleaned up/read through each of the thousand of support issues, put in corresponding resolutions corresponding to each
AI
  1. have leveraged on anaconda & scikit learn, to NLP, to tokenize each support issue (text), remove stop words, stemmed each, remove punctuations
  2. have leveraged on anaconda & scikit learn, bag each token of the text as feature vs class, to feed into linear regression classifier, tried SLDA, so far working at 72% accuracy
AI Exposer
  1. have exposed AI as a service
Issue Feeder
  1. have leveraged EWS to read in all issues, post to AI service
UI
  1. have built a web user interface, on top of HTML5 + JQuery + Bootstrap, to show the support emails + AI responded resolutions
  2. have a option on UI, to provide user feedback to AI, to keep its intelligence updated
Notifier
  1. leverage on Java Mail API, Chat API, to post alerts for critical issues

Datetime issue

The nasty datetime format issue seems like is universal. In c# world, depends on the locale, it would format to string and parse to datetime differently and could wrongly as well.

For example, for cultureinfo (“ja-JP”), datetime.tostring() could be yyyy/MM/d format which not recognized by a lot other systems or places.
While for same locale, it would parse 04Apr16 as 2004-04-16.

To solve and avoid the issues, invariantculture should be the cure. Always use invariantculture for parsing and for formating:
Datetime.parseExact(dateString, format, invariantculture).tostring(format, invariantculture).

Visual studio debug

I was trying to debug some ms office add in, then noticed this cool featurr of VS 2010.

Instead of starting the project in debug mode, which someitmes could have various issues, just start the ms office, then through VS debug –> attach process, to link the project source code is quick and effective option.

 

 

Unbrick LG G3

If you are a LG G3 user, you might be tempted to update to marshmallow, seeing the updates available through LG PC suite. Please don’t !

If it happened you already did, you might now end up in a situation like a lot other LG G3 users, where the phone would bricked at bootloop. Basically, the phone would infinitely restart. However, it never restart completely, where it just keep relaunching till the boot screen, then off and reboot till the boot screen again.

If you are already in above situation, my experience here might help. I have encountered this during the weekend, and almost gave up to customer service centre for last resolt. Then somehow below trial worked !

(Leave the power button aside, you never need to touch that button during this whole procedure.)

  1. power off the phone by removing the battery
  2. with the phone still off, plug the usb, connect the phone with PC
  3. with LG PC suit opened on the PC, and the phone still off, just hold the Power UP button for few seconds, this move the phone into download mode
  4. At LG PC Suite, Under “Mobile Devide” menu, there is this option called “Restore upgrade errors”. click it, it will try to connect the phone, download the patch to revert previous update. wait till it finish, your phone would be auto restarted.

In case above steps didn’t work out on first try, try another one or twice. It could have patched multiple times, if you phone is moving from lower lollipop version.

Let me know if it helps !