MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

India’s Isro launches 104 satellites in a single mission to create world record

Posted by Venkatt Guhesan on February 18, 2017

India’s Isro’s [] PSLV-C37 in a single payload, included the Cartosat-2 series and 103 co-passenger satellites, together weighing over 650kg

Great achievement especially considering only three of the 103 satellites belonged to India making this mission one of the most business sense launch of this century! Kudos to India!

Read more about it at the link below.

Source: Isro launches 104 satellites in a single mission to create world record – Livemint

Posted in Business, In the News, Inspirational, Science and Technology, Technology | Leave a Comment »

Materials science: How to keep cool without costing the Earth

Posted by Venkatt Guhesan on February 16, 2017

The new film works by a process called radiative cooling. This takes advantage of that fact that Earth’s atmosphere allows certain wavelengths of heat-carrying infrared radiation to escape into space unimpeded. Convert unwanted heat into infrared of the correct wavelength, then, and you can dump it into the cosmos with no come back.

…their film, placed atop an average American house, would be enough to keep the internal temperature at 20°C on a day when it was 37°C outside. [17° difference]

Source: Materials science: How to keep cool without costing the Earth | The Economist

Posted in Business, In the News, Inspirational, Outdoors & Nature, Technology | Tagged: , | Leave a Comment »

Going off-heap to improve latency and reduce AWS bill

Posted by Venkatt Guhesan on February 16, 2017

java_logo_2bGreat read – shows you the power of Java and Chronicle Map.

Describing how going off-heap with the help of Chronicle Map helped us to get rid of the latency hiccups and cut our Amazon AWS bill in half.

Source: Going off-heap to improve latency and reduce AWS bill – Plumbr

Caution: Before you go diving into using the open source version of Chronicle Map, there are some gotchas to be aware of from a features point-of-view.

Chronicle Map could be persisted to disk. Durability with Chronicle Map is provided by another level of architecture, for example all requests are sent to several nodes – master and hot standby. Clustering/distributed architecture is out of the scope of the Chronicle Map project, there are projects on top of Chronicle Map which address these questions, e. g. Chronicle Enterprise.

If your needs are to persist off-heap data on the local JVM to disk (and to have multiple processes interact with data within one physical machine) then you can use the open-source edition but if your needs are to talk across JVMs that are across IPs (physical/virtual machines) for synchronization/replication features then you are looking at the closed source (paid) version of their product stack as seen from this link. Your needs may vary.

Posted in Java | Tagged: , , | Leave a Comment »

What is Blockchain Technology? A Step-by-Step Guide For Beginners

Posted by Venkatt Guhesan on January 1, 2017

blockchain_smlBlockchain technology is not a technology solely for Bitcoin but rather a creative way to keep a digital ledger of economic transactions. This technology can be applied in a variety of fields such that the chain cannot be owned by a single entity and has no single point of failure. It provides a backbone with transparency and incorruptibility. Imagine a world where every transaction, whether it is a real-estate property transaction or a work-contract or an acknowledgement receipt of a email or an acceptance of work or payment or a medication delivery system releasing a medication into a patients blood-stream can be recorded such that it is indisputable and irrevocable. Furthermore, tampering a single unit or transaction in this chain of information will require a huge amount of computing power.

To learn more about Blockchain see the following article on BlockGeeks:

What is a blockchain technology?
http://blockgeeks.com/guides/what-is-blockchain-technology/

 

Posted in Great Ideas, Technology | Tagged: , , , | Leave a Comment »

Happy New Year 2017

Posted by Venkatt Guhesan on January 1, 2017

happynewyear2016


தங்களுக்கும், தங்கள் குடும்பததினொறுக்கும் எங்கள் புத்தாண்டு நள்வாழ்த்துக்கள். (Tamil)

Wishing you and your family a happy new year 2017.


Cheers!

Today’s inspirational quote:
bust_of_marcusaurelius

Take inventory of this past year. Realize what is up to us and what is not up to us.

We can control our emotions, our decisions, our perspectives, and our desires. We have a say in how these things go. These are things that are up to us. We can’t control what other people think, the state of the economy, the president elect, the traffic, and so on.

Between the two, we face a choice on what we focus on – what is under our control or what is not.

If we choose to focus on the things that we can control, we can make progress, we can grow and learn and reach our goals.

You have power over your mind – not outside events. Realize this, and you will have strength.

– (summarized from) Emperor Marcus Aurelius in Meditations

Posted in General, In the News, Inspirational, Life 101 | Tagged: | Leave a Comment »

Developing email applications on Windows, targeted for Linux environment – email, mailx, sendmail

Posted by Venkatt Guhesan on December 11, 2016

linux_centos_logoIf you’re developing on a Windows platform for an application targeted for Linux or Unix that deals with email, then this article will be useful.

Let us begin by  understand the problem.

Problem

If you are a Java/Spring developer, (developing in Java is platform independent – runs on any platform where a JVM is available) then you have two options in front of you for sending emails from a Java application:

Option #1: JavaMail API

Option #2: Linux sendmail or mailx invoked via Runtime.getRuntime().exec(invoke – linux – mail – command) [example here]

If you are a PHP or Ruby or Bash or Python developer, you can do the same using a native library available within the language or invoke a native Linux execute-command to invoke either sendmail or mailx.

What happens if you are developing a hybrid library that needs to send email both from Java and Python. Then most likely you want to leverage a common library accessible to all the various libraries. In this case, you’re going to depend on either sendmail or mailx.   Now let us throw in a additional problem into this mix. Suppose you are developing on a Windows platform but the end application is targeted to run on Linux. This now creates a new additional problem. Sendmail or Mailx do not exist for Windows. Well, this article provides a way to develop on Windows by invoking execute mailx calls from your native code to the underlying emulation of Linux on Windows.

Now that we have established the problem, let us walk through a solution.

Please note that this is not the only solution but a potential solution. If you know of other mechanisms, feel free to send me a link and I’ll add them in.

Solution

Step-1: Make sure that you have Cygwin installed (with email tool selected additionally) on your Windows computer.

# Download  setup-x86_64.exe from https://cygwin.com/setup-x86_64.exe
# and run it.

# When you run the setup, please additionally select "email" tool additionally. It is not added by default.

Once Cygwin is installed, most people traditionally use all the Cygwin tools from within a Cygwin Command-Prompt. The executables are located under “\bin\**” directory. Which means that if you run a “ls” in a DOS command-prompt, it will error saying “command not found”. There is a undocumented\not so known secret to emulating Linux commands natively in Windows. This is where your true Linux power comes in under native Windows.

Step-2: Add Cygwin\bin path natively to Windows PATH.

# In my computer, I have Cygwin installed at the following path: c:\cygwin64\

To add "c:\cygwin64\bin" the system path, perform these steps:

1. Start the System Control Panel applet (Start - Settings - Control Panel - System).
2. Select the Advanced tab.
3. Click the Environment Variables button.
4. Under System Variables, select Path, then click Edit.
5. Add c:\cygwin64\bin to the path.

Once Step-2 is completed. If you start a new DOS command-prompt and run a “ls” command, you should see the directory listing (same as a ‘dir’ command under Windows).

Step-3: The send email application uses “c:\cygwin64\etc\email\email.conf” for SMTP and other email properties.

# Edit c:\cygwin64\etc\email\email.conf and add your SMTP details (domain/server name, user-id, password)
# For this example, I have setup a *special* GMail Email account specially to test [Don't use your private GMail] so I will use the user-id and password for that Gmail account.

SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = '587'
USE_TLS = 'true'
SMTP_AUTH = 'LOGIN'
SMTP_AUTH_USER = 'YOUR_TEST_GMAIL_ADDRESS@gmail.com'
SMTP_AUTH_PASS = 'YOUR_GMAIL_PASSWORD_GOES_HERE'
MY_NAME  = 'Venkatt Guhesan'
MY_EMAIL = 'foobar7634@gmail.com'

Step-4: Let’s test this under a DOS command-prompt.

# Open a DOS Command-Prompt and run the following:

echo "Test from Cygwin in Windows under DOS command-prompt" | email -s "Testing Email from Windows DOS" recipient_email_address@gmail.com 

# Within minutes, you should see an email in the Gmail inbox as expected.

# If you are not seeing it, then you can use the example below where you can pass in the SMTP arguments for validation. Maybe you typed in the password for the Gmail account incorrectly or you entered one of the parameters incorrectly in the c:\cygwin64\etc\email\email.conf file.

############### HERE IS AN EXAMPLE WITH SMTP PARAMETERS PASSED IN AS ARGUMENTS #######################
echo "Test from Cygwin in Windows under DOS command-prompt" | email -s "Tetsing Email" recipient_email_address@gmail.com -r smtp.gmail.com -p 587 -m login -u YOUR_TEST_GMAIL_ADDRESS@gmail.com -i YOUR_GMAIL_PASSWORD_GOES_HERE -tls
######################################################################################################

ss1

Once you have confirmed a successful email then the next step is to create a mailx application.

Step-5: Create a mailx.exe (mailx) within Cygwin’s bin directory.

For emulating mailx from Cygwin’s email.exe, you’re in luck. The format for mailx is identical to the email.exe’s arguments. All you are missing is mailx.exe. So simply copy email.exe under Cygwin’s bin directory to mailx.exe under the same Cygwin’s bin directory. And you’re all set!

# simply copy email.exe under Cygwin's bin directory to mailx.exe under the same Cygwin's bin directory

cd c:\cygwin64\bin
cp email.exe mailx.exe

# Now just like you running email (without the .exe suffix) you can run mailx (without the .exe suffix)

Step-6: Test sending an email using mailx


echo "Test from Cygwin-mailx in Windows under DOS command-prompt" | mailx -s "Testing Email from Windows DOS" recipient_email_address@gmail.com 

ss2

As a last step, now within your Java application, test Runtime.getRuntime().exec(“mailx command”);

Runtime.getRuntime().exec("echo 'Test from Cygwin-mailx in Windows under DOS command-prompt' | mailx -s 'Testing Email from Windows DOS' recipient_email_address@gmail.com");

Now your Java application as well as any Python, Bash, Linux shell applications and/or scripts are now leveraging the common “mailx” and your development is now consistently the same using one common mailx library.

Cheers!

Today’s inspirational quote:
theodore-roosevelt
  • We must all either wear out or rust out, every one of us. My choice is to wear out.
– Theodore Roosevelt, an American statesman, author, explorer, soldier, naturalist, and reformer who served as the 26th President of the United States from 1901 to 1909.

Posted in Bash, CentOS 6.X, CentOS7, Grails, Groovy, Java, Linux, Spring, Windows | Tagged: , , , , , , | Leave a Comment »

CentOS7 missing Net-Tools Package and why you should not install it moving forward

Posted by Venkatt Guhesan on December 9, 2016

centos_logoIn CentOS 7, a lot of the command-line utilities for configuring and troubleshooting network properties like arp, ifconfig, iptunnel, iwconfig, nameif, netstat, route – are no longer there in the new CentOS 7 version. While still included in many Linux Distributions, (and you may be tempted to run – ‘yum install net-tools’ – to get them back into your Linux footprint). But they are considered deprecated and therefore should be phased out in favor of more modern replacements. If you visit the link to net-tools project [and here] you will see that the last build of the tar.bz2 file was sometime back in October 14th, 2011.

This opens up some possibility for security vulnerabilities that may not get adequately patched. When you are developing applications for the Linux Platforms or running server configurations on Linux out in the cloud, you should move away from leveraging the net-tools as part of your portfolio. You will also notice that the modern tools leverage multi-core processing & parallelization (in some cases) to speed things up and you may notice a slight performance improvement in some of the commands. If your script is iterating through a collection running a certain net-tools command, your script will see a noticeable difference in time.

The CentOS 7 team has decided to move to iproute2 but some of the commands are not as trivial and requires a bit of familiarization before you can readily use it.

For example, the ss command that aids in determining if a port is open or used when compared with netstat can yield faster results because it directly queries the kernel using Netlink and the classic sockets API rather than going through the proc-fs file system (/proc/net/tcp) to acquire the system network information. So this approach makes the results come back faster. You can see the fun and gory code details here.

Here is a quick table that summarizes the older net-tools command and it’s new IPRoute2 equivalent:

Net-Tool *old* Command IPRoute2 *new* Command Purpose/Notes
arp ip neigh (ip neighbor) Neighbors
ifconfig ip addr, ip link, ip -s Address and Link Configuration
route ip r, ip route Routing Tables
iptunnel ip tunnel Tunnels (but simplified)
nameif ip link, ifrename Rename Network Interfaces (very useful since CentOS 7 names tdem like enp0s3 instead of tdaditional etd0)
netstat ss, ip route (for netstat -r), ip -s link (for netstat -i), ip maddr (for netstat -g) Display networking statistics (good for monitoring your net stack)
ipmaddr ip maddr For multicasting – very useful for all tde micro-services, auto-discovery protocols etc

Cheers!

Today’s inspirational quote:
bust_of_marcusaurelius
  • The impediment to action advances action. What stands in the way becomes the way.
  • Here is one way to think of hardship: I am a failure. I have met the end. Finito. I’m stupid. or
    Here is another way to think of the same hardship: A chance to learn about endurance, patience, resilience, struggle. An opportunity to prove. An opportunity to learn from the mistakes.When faced with an obstacle, think of it as the way forward. Until you acknowledge it and accept it as defeat within your confines of your mind, it remains as an opportunity and a way forward!

Posted in CentOS7, Linux | Tagged: , , , , , , , , , , | Leave a Comment »

Grails No profile found for name [web] illegalstateexception

Posted by Venkatt Guhesan on November 29, 2016

GrailsMost likely you’ve landed on this page because you’ve searched for the error in a search engine and it brought you here.

Symptom: When you run “grails” under an existing project that you previously had (either on a different PC or from a source-control like GIT or SVN and you’ve mistakenly included the “build” directory).

The associated error would have been one of the following:

Grails No profile found for name [web]

or

java.lang.IllegalStateException: No profile found for name [web].
at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:507)
at org.grails.cli.GrailsCli.initializeApplication(GrailsCli.groovy:308)
at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:271)
at org.grails.cli.GrailsCli.main(GrailsCli.groovy:162)
| Error Error occurred running Grails CLI: No profile found for name [web]

Either way, here’s how you can quickly resolve this issue and get back in business.

Solution:

Step-1: Remove “.grails” under your “home” directory.

rm -rf ~/.grails/

Step-2: Create a temporary *new* project

cd /temp/</pre>

grails create-app bookstore
# This will create a new scafolding and download the dependencies

Step-3: Remove the “build” directory under your *original* Grails project where you had the problem to begin with.

cd ~/my_original_grails_project/;
rm -rf ./build/
# Remove the old "build" directory

Step-4: Run Grails once again under your *original* Grails project

cd ~/my_original_grails_project/;
grails

You should see a whole bunch of dependencies being downloaded for this project like the following and you will end up with the Grails prompt:

Download https://repo.grails.org/grails/core/com/google/guava/guava/18.0/guava-18.0.pom
Download https://repo.grails.org/grails/core/com/google/guava/guava-parent/18.0/guava-parent-18.0.pom
Download https://repo.grails.org/grails/core/net/java/dev/jna/jna/4.1.0/jna-4.1.0.pom
Download https://repo.grails.org/grails/core/org/eclipse/jetty/jetty-util/9.2.18.v20160721/jetty-util-9.2.18.v20160721.pom
Download https://repo.grails.org/grails/core/org/eclipse/jetty/jetty-io/9.2.18.v20160721/jetty-io-9.2.18.v20160721.pom
Download https://repo.grails.org/grails/core/org/eclipse/jetty/websocket/websocket-common/9.2.18.v20160721/websocket-common-9.2.18.v20160721.pom
Download https://repo.grails.org/grails/core/org/eclipse/jetty/websocket/websocket-api/9.2.18.v20160721/websocket-api-9.2.18.v20160721.pom
Download https://repo.grails.org/grails/core/org/grails/grails-plugin-testing/3.1.10/grails-plugin-testing-3.1.10.jar
Download https://repo.grails.org/grails/core/org/grails/grails-test/3.1.10/grails-test-3.1.10.jar
Download https://repo.grails.org/grails/core/org/springframework/boot/spring-boot-starter-test/1.3.7.RELEASE/spring-boot-starter-test-1.3.7.RELEASE.jar
Download https://repo.grails.org/grails/core/org/seleniumhq/selenium/selenium-support/2.47.1/selenium-support-2.47.1.jar
Download https://repo.grails.org/grails/core/org/seleniumhq/selenium/selenium-remote-driver/2.47.1/selenium-remote-driver-2.47.1.jar
Download https://repo.grails.org/grails/core/org/eclipse/jetty/websocket/websocket-client/9.2.18.v20160721/websocket-client-9.2.18.v20160721.jar
Download https://repo.grails.org/grails/core/org/seleniumhq/selenium/selenium-api/2.47.1/selenium-api-2.47.1.jar
Download https://repo.grails.org/grails/core/com/google/guava/guava/18.0/guava-18.0.jar
Download https://repo.grails.org/grails/core/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar
Download https://repo.grails.org/grails/core/org/eclipse/jetty/jetty-util/9.2.18.v20160721/jetty-util-9.2.18.v20160721.jar
Download https://repo.grails.org/grails/core/org/eclipse/jetty/jetty-io/9.2.18.v20160721/jetty-io-9.2.18.v20160721.jar
Download https://repo.grails.org/grails/core/org/eclipse/jetty/websocket/websocket-common/9.2.18.v20160721/websocket-common-9.2.18.v20160721.jar
Download https://repo.grails.org/grails/core/org/eclipse/jetty/websocket/websocket-api/9.2.18.v20160721/websocket-api-9.2.18.v20160721.jar
Download https://repo.grails.org/grails/core/org/grails/profiles/web/3.1.9/web-3.1.9.pom
Download https://repo.grails.org/grails/core/org/grails/profiles/base/3.1.9/base-3.1.9.pom
Download https://repo.grails.org/grails/core/org/grails/profiles/web/3.1.9/web-3.1.9.jar
Download https://repo.grails.org/grails/core/org/grails/profiles/base/3.1.9/base-3.1.9.jar
| Enter a command name to run. Use TAB for completion:
grails>

Now you’re all set and ready to go.

Cheers!

Today’s inspirational quote:
bust_of_marcusaurelius
  • When you need encouragement, think of the qualities the people around you have: this one’s energy, that one’s modesty, another’s generosity, and so on. Nothing is as encouraging as when virtues are visibly embodied in the people around us, when we’re practically showered with them. It’s good to keep this in mind.
  • You have power over your mind—not outside events. Realize this, and you will find strength.

Posted in Gradle, Grails, Java, Spring, Spring Framework | Tagged: , , , , , | Leave a Comment »

Mac OS X iDRAC7 FileNotFoundException .java/deployment/security/trusted.certs

Posted by Venkatt Guhesan on November 17, 2016

macosx_blogarticle_100pxWhen you connect with a Dell iDRAC virtual console you may encounter the following exception on a Mac OS X

FileNotFoundException ~/.java/deployment/security/trusted.certs

Here is a simple fix for this:

 

 

mkdir -p ~/.java/deployment/security
cp ~/Library/Application\ Support/Oracle/Java/Deployment/security/trusted.certs ~/.java/deployment/security/

Cheers.

Posted in Mac OS X | Tagged: , , , , | Leave a Comment »

CentOS 6.8 & 7 – Change Timezone

Posted by Venkatt Guhesan on November 6, 2016

centos_logotimezones

Here is a cheat sheet on changing the timezone in a linux system (CentOS 6.8 or 7):

# Remove the current timezone file
rm /etc/localtime

# Create a symbolic link to the new timezone you want
# ls -la /usr/share/zoneinfo/
# ls -la /usr/share/zoneinfo/US/

# For GMT
ln -s /usr/share/zoneinfo/GMT /etc/localtime
# For EST
ln -s /usr/share/zoneinfo/EST /etc/localtime
# For UTC
ln -s /usr/share/zoneinfo/UTC /etc/localtime
# For GMT
ln -s /usr/share/zoneinfo/GMT /etc/localtime
# For New York (Eastern)
ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime
# For Central
ln -s /usr/share/zoneinfo/US/Central /etc/localtime
# For Mountain time
ln -s /usr/share/zoneinfo/US/Mountain /etc/localtime
# For Pacific time
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime

# Set Date and Time (as needed)
# MMDDHHmmYYYY
date 072522172010
hwclock --systohc

# If you're using NTPD Service
# CentOS 6.8
service ntpd stop && service ntpd start
# In CentOS 7 
systemctl stop ntpd && systemctl start ntpd

You may also be interested in NTP Service blog article here.

Today’s inspirational quote:
epictetus
  • Men (people) are disturbed not by events but by their opinion about events.
  • Wealth consists not in having great possessions, but in having few wants.

Posted in CentOS 6.X, CentOS7, Linux | Tagged: , , , , , | Leave a Comment »