Monday, July 18, 2016

fatal error: 'openssl/ssl.h' file not found on Mac

Correcting the problem - 

First make sure Command Line tools are already installed. 

xcode-select --install

xcode-select: error: command line tools are already installed, use "Software Update" to install updates


using Brew to update openssl - 
sudo brew update
sudo brew install openssl
sudo brew link --force openssl

Sunday, July 17, 2016

Adding curl library in C project in Xcode

Steps:
1. Click over the project name in Xcode.
2. Go to "Build Phases" and expand "Link Binary with Libraries".
3. Click "+" sign and "Add Other". 
4. Click "Shift" + "Command" + "G". This will launch a folder select dialogue.
5. Go to "/usr/lib" and then select "libcurl.dylib".

Friday, May 13, 2016

Setting System properties using ADB and accessing in #android code

ADB command to set system properties-

adb shell setprop test.android.Sysprop Sandeep 




Android code:

 try {

            Class clazz = Class.forName("android.os.SystemProperties");

            //Parameters Types
            @SuppressWarnings("rawtypes")
            Class[] paramTypes = new Class[1];
            paramTypes[0] = String.class;
            Method get = clazz.getMethod("get", paramTypes);

            //Parameters
            Object[] params = new Object[1];
            params[0] = "test.android.Sysprop";
            String ret = (String) get.invoke(clazz, params);
            Log.i(TAG,"ret:"+ret);
        }catch(Exception e){
            Log.e(TAG,e.getMessage(),e);
        }

Thursday, December 17, 2015

Remove .idea or some not needed files from remote


git rm -r --cached .idea
git rm -r --cached
git commit -m "Removing not necessary files"
git push origin  

To create an empty branch from master - local and remote


git checkout --orphan  EmptyBranch
git rm -rf .
git commit --allow-empty -m "initial commit"
git push -u origin EmptyBranch

Friday, December 11, 2015

Clash of Gradle classes for different versionsin #Android Studio - inactive functions


If your gradle path in Project Properties is pointing to one version of gradle like gradle 2.4


And the gradle wrapper file, gradle-wrapper.properties
in gradle/wrapper folder

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

there will be clash.

Result- You will not be able to see active gradle function links in build.gradle.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+'
        classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
    }
}

If you Press Command+ Mouse Over on "buildscript" in build.gradle, you will not see an active link.

Thursday, December 10, 2015

Some Flume Configurations


FLUME_LOG_DIR=/var/log/flume-ng
FLUME_CONF_DIR=/etc/flume-ng/conf_${FLUME_AGENT_NAME}
FLUME_RUN_DIR=/var/run/flume-ng
FLUME_HOME=/usr/lib/flume-ng

Starting flume in background
nohup flume-ng agent -n CollectionFlume -c conf -f conf/flume-conf.properties > /dev/null 2>&1 &

or better

 "nohup /opt/cloudera/parcels/CDH/lib/flume-ng/bin/flume-ng agent -c /opt/cloudera/parcels/CDH/lib/flume-ng/conf -f /opt/cloudera/parcels/CDH/lib/flume-ng/conf/flume-conf.properties -n agent >/dev/null 2>&1 "


Process 

ps auxwww|grep -i 'flume-ng'


Tuesday, September 29, 2015

Helllo World In #Erlang on Mac

Store

-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").

in a hello.erl file. You can use Sublime as an editor.
[hello_world/0] means function hello_world with zero argument.




Compile the file


erl -compile hello




Open the Erlang Terminal
erl

You can also compile the program in terminal by
c(hello) compiles the file hello.erl




Run the program

hello:hello_world().


Output:
hello, world
ok



To shut a system down cleanly, use init:stop().
Some quick ways are evaluating halt(). or control+\.
control+C a give you access to menus.








Installing #Erlang on mac

brew install erlang

==> Installing dependencies for erlang: openssl, unixodbc, jpeg, libpng, 
==> Installing erlang dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.b
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2d_1: 464 files, 18M
==> Installing erlang dependency: unixodbc
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.2_1.yosemite.b
######################################################################## 100.0%
==> Pouring unixodbc-2.3.2_1.yosemite.bottle.1.tar.gz
🍺  /usr/local/Cellar/unixodbc/2.3.2_1: 31 files, 1.0M
==> Installing erlang dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.yosemite.bottle.2.t
######################################################################## 100.0%
==> Pouring jpeg-8d.yosemite.bottle.2.tar.gz
🍺  /usr/local/Cellar/jpeg/8d: 18 files, 776K
==> Installing erlang dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.18.yosemite.bott
######################################################################## 100.0%
==> Pouring libpng-1.6.18.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.18: 17 files, 1.2M
==> Installing erlang dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.6.yosemite.bott
######################################################################## 100.0%
==> Pouring libtiff-4.0.6.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/libtiff/4.0.6: 259 files, 3.9M
==> Installing erlang dependency: wxmac
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.2.yosemite.bottle
######################################################################## 100.0%
==> Pouring wxmac-3.0.2.yosemite.bottle.11.tar.gz
🍺  /usr/local/Cellar/wxmac/3.0.2: 777 files, 41M
==> Installing erlang
==> Downloading https://homebrew.bintray.com/bottles/erlang-18.1.yosemite.bottle
######################################################################## 100.0%
==> Pouring erlang-18.1.yosemite.bottle.tar.gz
==> Caveats
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

Access them with `erl -man`, or add this directory to MANPATH.
==> Summary

🍺  /usr/local/Cellar/erlang/18.1: 7465 files, 287M

Monday, July 13, 2015

Useful commands - ADB and other

ADB commands:

To list sdk packages
android list sdk --all
android update sdk -u -a -t 

logcat current package thread-

adb logcat | grep `adb shell ps | grep -E u0.*com.package.name | awk '{print $2}'`

print UID of app

adb shell dumpsys package com.sandeep.app | grep userId=

enable wifi -
adb shell svc wifi enable

command to kill an app from adb
adb shell ps | grep com.app.sandeep | awk '{print $2}' | xargs adb shell kill


version of app installed
adb shell dumpsys | grep -A18 "Package \[com.sandeep.packageName\]"

disable wifi -
adb shell svc wifi disable

if you are using volley in your application for http request
adb -s "deviceID" shell setprop log.tag.Volley VERBOSE

LCD density is in the build.prop:
adb shell getprop ro.sf.lcd_density
adb shell wm size
Physical size: 1080x1920

Launch settings -
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.Settings

To find location of package in android 
adb shell pm path

send intent

adb shell am broadcast -a -c --ei  

specifications include these flags and arguments:
    [-a ] [-d ] [-t ]
    [-c [-c ] ...]
    [-e|--es ...]
    [--esn ...]
    [--ez ...]
    [--ei ...]
    [--el ...]
    [--ef ...]
    [--eu ...]
    [--ecn ]
    [--eia [,
    [--ela [,
    [--efa [,
    [--esa [,
        (to embed a comma into a string escape it using "\,")



Different application manager commands:


am start [-D] [-W] [-P ] [--start-profiler ]
               [--sampling INTERVAL] [-R COUNT] [-S] [--opengl-trace]
               [--user | current]
       am startservice [--user | current]
       am stopservice [--user | current]
       am force-stop [--user | all | current]
       am kill [--user | all | current]
       am kill-all
       am broadcast [--user | all | current]
       am instrument [-r] [-e ] [-p ] [-w]
               [--user | current]
               [--no-window-animation] [--abi ]
       am profile start [--user current]
       am profile stop [--user current] []
       am dumpheap [--user current] [-n]
       am set-debug-app [-w] [--persistent]
       am clear-debug-app
       am monitor [--gdb ]
       am hang [--allow-restart]
       am restart
       am idle-maintenance
       am screen-compat [on|off]
       am to-uri [INTENT]
       am to-intent-uri [INTENT]
       am switch-user
       am start-user
       am stop-user
       am stack start
       am stack movetask [true|false]
       am stack resize
       am stack list
       am stack info
       am lock-task
       am lock-task stop
       am get-config

am start: start an Activity.  Options are:
    -D: enable debugging
    -W: wait for launch to complete
    --start-profiler : start profiler and send results to
    --sampling INTERVAL: use sample profiling with INTERVAL microseconds
        between samples (use with --start-profiler)
    -P : like above, but profiling stops when app goes idle
    -R: repeat the activity launch times.  Prior to each repeat,
        the top activity will be finished.
    -S: force stop the target app before starting the activity
    --opengl-trace: enable tracing of OpenGL functions
    --user | current: Specify which user to run as; if not
        specified then run as the current user.

am startservice: start a Service.  Options are:
    --user | current: Specify which user to run as; if not
        specified then run as the current user.

am stopservice: stop a Service.  Options are:
    --user | current: Specify which user to run as; if not
        specified then run as the current user.

am force-stop: force stop everything associated with .
    --user | all | current: Specify user to force stop;
        all users if not specified.

am kill: Kill all processes associated with .  Only kills.
  processes that are safe to kill -- that is, will not impact the user
  experience.
    --user | all | current: Specify user whose processes to kill;
        all users if not specified.

am kill-all: Kill all background processes.

am broadcast: send a broadcast Intent.  Options are:
    --user | all | current: Specify which user to send to; if not
        specified then send to all users.
    --receiver-permission : Require receiver to hold permission.

am instrument: start an Instrumentation.  Typically this target
  is the form /.  Options are:
    -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT).  Use with
        [-e perf true] to generate raw output for performance measurements.
    -e : set argument to .  For test runners a
        common form is [-e [,...]].
    -p : write profiling data to
    -w: wait for instrumentation to finish before returning.  Required for
        test runners.
    --user | current: Specify user instrumentation runs in;
        current user if not specified.
    --no-window-animation: turn off window animations while running.
    --abi : Launch the instrumented process with the selected ABI.
        This assumes that the process supports the selected ABI.

am profile: start and stop profiler on a process.  The given argument
  may be either a process name or pid.  Options are:
    --user | current: When supplying a process name,
        specify user of process to profile; uses current user if not specified.

am dumpheap: dump the heap of a process.  The given argument may
  be either a process name or pid.  Options are:
    -n: dump native heap instead of managed heap
    --user | current: When supplying a process name,
        specify user of process to dump; uses current user if not specified.

am set-debug-app: set application to debug.  Options are:
    -w: wait for debugger when application starts
    --persistent: retain this value

am clear-debug-app: clear the previously set-debug-app.

am bug-report: request bug report generation; will launch UI
    when done to select where it should be delivered.

am monitor: start monitoring for crashes or ANRs.
    --gdb: start gdbserv on the given port at crash/ANR

am hang: hang the system.
    --allow-restart: allow watchdog to perform normal system restart

am restart: restart the user-space system.

am idle-maintenance: perform idle maintenance now.

am screen-compat: control screen compatibility mode of .

am to-uri: print the given Intent specification as a URI.

am to-intent-uri: print the given Intent specification as an intent: URI.

am switch-user: switch to put USER_ID in the foreground, starting
  execution of that user if it is currently stopped.

am start-user: start USER_ID in background if it is currently stopped,
  use switch-user if you want to start the user in foreground.

am stop-user: stop execution of USER_ID, not allowing it to run any
  code until a later explicit start or switch to it.

am stack start: start a new activity on using .

am stack movetask: move from its current stack to the top (true) or   bottom (false) of .

am stack resize: change size and position to .

am stack list: list all of the activity stacks and their sizes.

am stack info: display the information about activity stack .

am lock-task: bring to the front and don't allow other tasks to run

am get-config: retrieve the configuration and any recent configurations
  of the device

specifications include these flags and arguments:
    [-a ] [-d ] [-t ]
    [-c [-c ] ...]
    [-e|--es ...]
    [--esn ...]
    [--ez ...]
    [--ei ...]
    [--el ...]
    [--ef ...]
    [--eu ...]
    [--ecn ]
    [--eia [,
    [--ela [,
    [--efa [,
    [--esa [,
        (to embed a comma into a string escape it using "\,")
    [-n ] [-f ]
    [--grant-read-uri-permission] [--grant-write-uri-permission]
    [--grant-persistable-uri-permission] [--grant-prefix-uri-permission]
    [--debug-log-resolution] [--exclude-stopped-packages]
    [--include-stopped-packages]
    [--activity-brought-to-front] [--activity-clear-top]
    [--activity-clear-when-task-reset] [--activity-exclude-from-recents]
    [--activity-launched-from-history] [--activity-multiple-task]
    [--activity-no-animation] [--activity-no-history]
    [--activity-no-user-action] [--activity-previous-is-top]
    [--activity-reorder-to-front] [--activity-reset-task-if-needed]
    [--activity-single-top] [--activity-clear-task]
    [--activity-task-on-home]
    [--receiver-registered-only] [--receiver-replace-pending]
    [--selector]
    [ | | ]

Location of java sdk on Mac:
ls /Library/Java/JavaVirtualMachines/








Thursday, July 9, 2015

Installing #Oracle #Weblogic server on Mac

Download Generic weblogic server installer from 
http://www.oracle.com/technetwork/middleware/weblogic/downloads/

Installation command for downloaded jar -
java -d64 -Dspace.detection=false -Xmx1024m -jar fmw_12.1.3.0.0_wls.jar

For starter, select everything default.

Installed Domains-
ls ~/Oracle/Middleware/Oracle_Home/user_projects/domains/

Start the domain server-
cd /Users/sandeepshabd/Oracle/Middleware/Oracle_Home/user_projects/domains/wl_server
./startWebLogic.sh  -Xrs

If Exception comes:

Caused By: java.net.UnknownHostException: hello: nodename nor servname provided, or not known
edit host file at /private/etc/ for all named localhost
127.0.0.1     hello


Also, remove any strange IP address, if present like
:::1     localhost

127.0.0.1   localhost is ok. DO not remove that.

If configurations has to be changed - 

cd  ~/Oracle/Middleware/Oracle_Home/wlserver/common/bin
./config.sh


Eclipse Preferences -> Server -> Installed Runtimes -> Add... -> Download additional server adapters
Once downloaded, select the adapter for the installed version of weblogic.


Server logs at

cd ~/Oracle/Middleware/Oracle_Home/user_projects/domains/wl_server/servers/AdminServer/logs

Wednesday, July 8, 2015

JMS and Advanced Queuing Protocol - Searched from Internet

From Stackoverflow:

The Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. JMS is a part of the Java Platform, Enterprise Edition, and is defined by a specification developed under the Java Community Process as JSR 914. It is a messaging standard that allows application components based on the Java Enterprise Edition (Java EE) to create, send, receive, and read messages. It allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous(From WIKI).
Now 
The Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol for message-oriented middleware. The defining features of AMQP are message orientation, queuing, routing (including point-to-point and publish-and-subscribe), reliability and security
And the most important thing
Unlike JMS, which merely defines an API, AMQP is a wire-level protocol. A wire-level protocol is a description of the format of the data that is sent across the network as a stream of octets. Consequently any tool that can create and interpret messages that conform to this data format can interoperate with any other compliant tool irrespective of implementation language(From WIKI).

Some imp things you should know
1: Keep in mind that AMQP is a Messaging technologies that do not implement the JMS API.
2: JMS is API and AMQP is a protocol.So it doesn't make sense to say that what is default protocol of JMS , Ofcourse client applications use HTTP/S as the connection protocol when invoking a WebLogic Web Service.
3: JMS is only a API spec. It doesnt use any protocol. A JMS provider (like ActiveMQ) could be using any underlying protocol to realize the JMS API. For ex: Apache ActiveMQ can use any of the following protocols: AMQP, MQTT, OpenWire, REST(HTTP), RSS and Atom, Stomp, WSIF, WS Notification, XMPP

List of MQTT broker:
https://github.com/mqtt/mqtt.github.io/wiki/servers


(Extract from http://activemq.apache.org/weblogic-integration.html )
WebLogic 9.2 and above are known to support JMS 1.1. (I don't know what JMS release WebLogic 9.0-9.1 support)
To work with ActiveMQ in one of these release of WebLogic Server, you can use the J2EE Connector included with ActiveMQ (known as ActiveMQ-RA). This will provide full ActiveMQ support to J2EE applications – ActiveMQ can be used to both send messages and to deliver incoming messages to message-driven beans. Your J2EE applications can map connection factory and destination references in JNDI.
I don't have an example of using the J2EE Connector from a J2EE 1.4 application in WebLogic. If someone can contribute one that would be great!

If you're using Spring or another non-J2EE architecture in your application, you may choose to skip the J2EE Connector and just connect directly to ActiveMQ using the technique described in the next section.


On the surface it's not obvious why you might want to run an ActiveMQ broker within WebLogic instead of standalone, but the considerations include:
  • When ActiveMQ is run within WebLogic, it can be deployed, started, stopped, and redeployed like other applications, using the WebLogic console or other tools, while the JVM and WebLogic are still running
  • ActiveMQ can hook into the WebLogic JMX management system (as well as e.g. JRockit) to provide a single management interface to the app server, applications, ActiveMQ, and even the JVM.
  • ActiveMQ can leverage WebLogic security realms for authentication and authorization – not only are there more security realm types available for WebLogic, but they're also easier to configure via the WebLogic console

  • Using the ActiveMQ-RA J2EE Connector – ActiveMQ provides a J2EE Connector that is normally used by clients to connect to a separate ActiveMQ broker. However, the J2EE Connector accepts arguments to run an embedded broker and provide the location of an XML config file for an embedded broker. This is probably the best way to deploy an ActiveMQ broker in WebLogic Server, because ActiveMQ then has access to WebLogic thread pools and other resources.
  • Deploying an ActiveMQ Broker as a WebLogic Application – This is the technique described below for WebLogic Express. It works equally well in WebLogic Server.

ActiveMQ as a WebLogic Application

The easiest type of WebLogic application to configure with all the needed ActiveMQ libraries and configuration and not much else is a web application. The JARs go in WEB-INF/lib/ and config files typically in WEB-INF/. The only necessary configuration for the web application itself is to install a listener that will start and stop ActiveMQ when the web application is started and stopped. There are also a couple optional classes that can be used to integrate ActiveMQ with WebLogic's security system. Additionally, in this example, a simple web page included in the WAR will be available whenever ActiveMQ is running, so a simple HTTP request can determine whether the ActiveMQ module has been started.




Tuesday, July 7, 2015

Install #mosquitto on mac using #homebrew and related commands

$ brew install mosquitto
==> Installing dependencies for mosquitto: c-ares, openssl, libwebsockets
==> Installing mosquitto dependency: c-ares
==> Downloading https://homebrew.bintray.com/bottles/c-ares-1.10.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring c-ares-1.10.0.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/c-ares/1.10.0: 57 files, 540K
==> Installing mosquitto dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2c.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2c.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2c: 463 files, 18M
==> Installing mosquitto dependency: libwebsockets
==> Downloading https://homebrew.bintray.com/bottles/libwebsockets-1.4.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libwebsockets-1.4.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/libwebsockets/1.4: 23 files, 3.3M
==> Installing mosquitto
==> Downloading https://homebrew.bintray.com/bottles/mosquitto-1.4.2.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mosquitto-1.4.2.yosemite.bottle.tar.gz
==> Caveats
mosquitto has been installed with a default configuration file.
You can make changes to the configuration by editing:
    /usr/local/etc/mosquitto/mosquitto.conf


To have launchd start mosquitto at login:
    ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents
Then to load mosquitto now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist
Or, if you don't want/need launchctl, you can just run:
    mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
==> Summary

🍺  /usr/local/Cellar/mosquitto/1.4.2: 28 files, 700K


To run Mosquitto:

/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf


Installing mosquitto on ubuntu
sudo apt-get install mosquitto

In another tab Subscribe , with verbose and debug mode


mosquitto_sub -v -d -h localhost -t sandeep

In another tab Pusblish
mosquitto_pub -d -h localhost -t sandeep -m "Up and Running"

You will see subscribe received message
Up and Running

Running mosquitto process on port 1883

ps -ef | grep mosq && netstat -tln | grep 1883

client id -  default name.hostname




mosquitto_sub [-1] [-A bind_address] [-c] [-d] [-h hostname] [-i client_id] [-I client id prefix] [-k keepalive time] [-p port number] [-q message QoS] [-R] [-S] [-N] [--quiet] [-v] [ [-u username] [-P password] ] [ --will-topic topic [--will-payload payload] [--will-qos qos] [--will-retain] ] [[ { --cafile file | --capath dir } [--certfile] [--key file] [--tls-version version] [--insecure] ] | [ --psk hex-key --psk-identity identity [--tls-version version] ]] [-T filter-out...] -t message-topic...



mosquitto_pub [-A bind_address] [-d] [-h hostname] [-i client_id] [-I client id prefix] [-p port number] [-q message QoS] [--quiet] [-r] [-S] { -f file | -l | -m message | -n | -s } [ [-u username] [-P password] ] [ --will-topic topic [--will-payload payload] [--will-qos qos] [--will-retain] ] [[ { --cafile file | --capath dir } [--cert file] [--key file] [--ciphers ciphers] [--tls-version version] [--insecure] ] | [ --psk hex-key --psk-identity identity [--ciphers ciphers] [--tls-version version] ]] -tmessage-topic

mosquitto_pub [--help]

Monday, June 29, 2015

Working with #Genymotion - Some tips

Kill and Start Genymotion from terminal-
ps ax | grep "Player.app" | grep -v "grep" | xargs kill
VBoxManage list vms
/Applications/Genymotion.app/Contents/MacOS/player --vm-name






To access your localhost through Genymotion is using your mac IP address. To get your IP address type on Terminal -  ifconfig
then search for IPv4, copy the IP and paste it in your URL. 
For example 
inet 192.168.1.81

It should looks like the following:
String exampleURL = "http://192.168.1.81:8080/....";

Monday, June 22, 2015

Git command

 to delete all branched other than master:
git branch | grep -v master | xargs git branch -D

to reset master:
git reset --hard origin/master



Thursday, June 11, 2015

Working with Node.js server

server.js

var http = require('http');
http.createServer(function (req, res) {
var body="";
req.on('data', function (chunk) {
    body += chunk;
  });
  req.on('end', function () {
    console.log('POSTed: ' + body);
    res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('success');
  });

}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');


node server.js start the server

-------------
 Close the server

hello:tcps-service sandeepshabd$ ps aux | grep node

sandeepshabd    60569   0.0  0.0  2432772    672 s003  S+    1:16PM   0:00.00 grep node
sandeepshabd    60542   0.0  0.2  3067496  20056 s001  S+    1:11PM   0:00.18 node server.js


hello:tcps-service sandeepshabd$ kill -2 60542

Proguard change to remove only the log files from android app

proguard-rules.pro
-dontwarn **
-target 1.7
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose

-optimizations !code/simplification/arithmetic,!code/allocation/variable
-keep class **
-keepclassmembers class *{*;}
-keepattributes *

#This will not remove error log
-assumenosideeffects class android.util.Log {
   #public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
   #public static int e(...);
}




-----------------------------build.gradle ---------------------
buildTypes {

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

--------------------------------------