An Operator in Java

The answer for ? : question in Java

Suddenly, I’ve missed Java programming and I just posted this.
The value of a variable often depends on whether a particular boolean expression “is” or “is not true” and on nothing else. For instance one common operation was setting the value of a variable to the maximum of two quantities.

In Java we might code as below

--
if (a > b) {
  max = a;
}
else {
  max = b;
}
--

And setting a single variable to one of two states based on a single condition, was such a common use of if-else that a shortcut has been devised for it, the conditional operator, ?:.
Using the conditional operator you can rewrite the above example in a single line like this:

--
max = (a > b) ? a : b;
--

(a > b) ? a : b; was an expression which returns one of two values, a or b.
The condition, (a > b), is tested. If it is true the first value, a, is returned. If it is false, the second value, b, is returned. Whichever value is returned is dependent on the conditional test, a > b. The condition can be any expression which returns a boolean value.

Thanks for reading.

Reference: Logic course

Advertisement

Big Data, Bitcoin, and Blockchain

When i learn about big data, i got the future of big data. According to http://www.imovingtolondon.com, there is possibility that blockchain as the future trend of big data. Why…. blockchain started with a crypto currency called Bitcoin, around 2010 or about 6 years ago. In the beginning, it was appealing to a specific crowd but then interest grew. People made money out of investing in it, and many cases related with it. However the more interesting part about Bitcoin came recently, and that was not the currency itself but the technology (and the concept) it is built upon – no central ownership. The rebellious idea of it as a currency, turns out to be a genius idea when it comes to data. It almost seems like the currency is just a byproduct of the amazing data architecture.

Until i have signed up at coinstarter.com. Many people talk about cloud technology, and all of the amazing things about that. Until has founded about its limitiation, at the end of the day it is a case of hard drive ownership. With blockchain that somewhere and someone does not exist – everything is shared within the blocks creating the chain. Blockchain as the storage of Bitcoin transaction data. While it immutable, non reversible, and non forgeable database. Any other database, server, or storage medium is not tamper resistant. The blockchain is an interesting type of data set, and not exactly a database, but more a referral layer.

Reference: imovinglondon.com

Data Analytics with Python and Its Aggregate Function

Hi, today i want to post my personal project notes about data analytics with Python.

This post based on data source that i got from Github’s account the ebook writer on this URL. I have used the dataset sample on path ch02/movielens, while there are 3 datasets (in DAT format file) consist of users.dat, ratings.dat, and movies.dat.

These below are my history Python script that hopefully can be useful.

#import pandas library
import pandas as pd

#unames, is variable as frame of users.dat
unames = ['user_id','gender','age','occupaton','zip']
users=pd.read_table('ch02/movielens/users.dat',sep='::',header=None,names=unames)
#rnames, is variable as frame of ratings.dat
rnames = ['user_id','movie_id','rating','timestamp']
ratings = pd.read_table('ch02/movielens/ratings.dat',sep='::',header=None,names=rnames)
#mnames, is variable as frame of movies.dat
mnames = ['movie_id','title','genres']
movies = pd.read_table('ch02/movielens/movies.dat',sep='::',header=None,names = mnames)

#data, is a variable that i've filled with merge result of dataset ratings, users, and movies
data = pd.merge(pd.merge(ratings,users),movies)

#i want to got MEAN view about my data, based on Gender column, and row/index Title
#and i've used aggregate function MEAN
mean_ratings = data.pivot_table('rating',index=['title'],columns='gender',aggfunc='mean')

Code Again, for Small Business 3d Printing

Since Sept 2016, my friends and I had launched http://www.bikin3d.com, the small business at Karawaci which had product about 3d printing services.

As Co-founder and CIO, my job desc were decide the supporting system and technology that make the small business more effective, include at area marketing, pricing, sales and many more.

There was an initiative from the Founder (Lead of Operational) “How about the website visitors can upload their 3d model into our website ?”

This challenge, make me so curious. In my mind there was statement “I have to prove this!”. Finally, this curiosity made me To Do Web-Code Again. I had involved in many activities for feature upgrade on http://www.bikin3d.com. I had to built some scripts, in order to 3d model should be uploaded into website, beside email into sales@bikin3d.com.

Until, I have found some references to do this. My deadline for this update is 4th week on June 2017. Hopefully, based on these references it could be done on-time ^_^.

References:Web-based STL Viewing: Three.js, WebGL, and Javascript Typed Arrays
Full code from tonylukasavage-github

Thank you,
Nice to share