Friday, October 14, 2016

That pesky ?: Operator from the Exam!

So far our operator arsenal have been mostly related to arithmetic or booleans. However, there is still a huge library of operators we have yet to learn, and I'm not even sure we'll get to them.
The third bonus question on our midterm, something our professor said we hadn't seen before, asked to explain what the ?: operator was. I'm guessing most of my classmates' responses were identical to mine: "I have no clue," but I'll try to break it down as best I can here.



The ?: operator, or the ternary operator, gives options. For example:

System.out.print("I have " + x + " apple" + (x==1 ? "" : "s");

Essentially, it analyzes a boolean (x == 1) and if it's true (?) it prints nothing after "apple". However, if the boolean is false, the ":" acts as an "else." If you have any amount other than 1 of apples, the correct sentence would be "I have x apples," whether x is less than or greater than 1. There are definitely other ways to do this with if-else statements, but this operator can help us shorten our code.






Image source:
http://stackoverflow.com/questions/19827668/does-java-have-identical-comparison-operator-example

Friday, October 7, 2016

Self-Driving Cars: The Actual Best Option?

People are starting to warm up to the idea of autonomous cars. An initial concern was safety; skeptics weren't sure a car could react to obstacles as quick as a human. However, with our level of programming and technology, safety shouldn't be an issue given normal driving conditions and circumstances. Even before self-driving cars were suggested, manufacturers were implementing automated safety features into newer models of their cars. Lane assist alerted drivers if they were to stray from the middle of the lane. Some lane assists would actually follow the lanes with sensors and move the steering wheel (this isn't exactly self-driving, just assisted driving). Some cars can parallel park on their own, some have blind spot monitoring. However, pure autopilot had yet to be introduced.

Recently, Tesla Motors has led the new self-driving trend. 130 million miles driven after the release, a Tesla driver died in a crash, and Elon Musk insisted that updates to the software would improve safety, even though one crash in 130 million miles is technically safer than the national average, one crash for every 94 million miles.


Safety aside, I'm not so sure I'd use a self-driving feature other than for sleeping. Again, I'm assuming the code guarantees no accident. For one, I enjoy driving, so if I have the option to take control of the car, I will. Further, the self-driving software would work with a GPS to pick the fastest route to the destination. The flaw I see here is that the computer won't weigh options for the smoothest and easiest ride. I'd rather give up two minutes at a red light than go down a road with six sharp speed bumps, but the road with the speed bumps would be more appealing to the computer because it is the shortest distance. Until the computer inside the car can think like a human, I'll keep my hands on the wheel.





References:
http://www.yaleclimateconnections.org/2016/04/electric-cars-pros-cons-and-unknowables/

Images:
http://www.edn.com/design/automotive/4368069/Automobile-sensors-may-usher-in-self-driving-cars

http://www.dailymail.co.uk/news/article-3275167/Self-drive-cars-weeks-Electric-car-maker-Tesla-says-waiting-approval-autopilot-capacity-British-roads.html

Friday, September 30, 2016

Ditch the Plastic!

In October 2014, Apple announced and released Apple Pay, a new accessory that came with the fingerprint reader on the home button that came with the 5s and 6 models. At first, a large majority, myself included, didn't see the point of Apple Pay when I carry my wallet around with me everywhere I go already.

However, ever since the release of the first iPhone model, Apple's ultimate goal is for its consumers to be able to leave the house with one object in hand. Whether it be a phone or a watch (or kinda both), Apple strives to be our be all end all. They introduced Apple Wallet, a handy app providing a place to safely store your cards, coupons, etc. The keyword here is "safe," and people soon began to see why. Apple claims that Apple Pay is a safer alternative to paying by card.

The way Apple pay works is this: you enter your credit card information into your Apple Wallet, and press the home button twice when near a payment scanner. Holding the home button to affirm your identity via fingerprint, the payment is approved. It feels like the future. The hidden advancements, however, are even more impressive. When you enter your info into your phone, neither your phone nor Apple receives any of your financial information. Instead, each time you use Apple Pay, your credit card company sends a phony number to your phone, which transfers that phony number to the card reader. Only the last 4 digits of this phony number match your actual credit card number, and there is no way to decipher your real number due to the fact that the phony is randomly generated.

The old method, swiping via magnetic strip, gives the retailer enough information where a hacker can access a scarily large amount of financial information. While the recently implemented method of small chips rather than magnetic strips is being adopted by all major credit card companies, Apple Pay is a fool-proof safe option.

References:
http://bgr.com/2014/10/23/is-apple-pay-safer-than-credit-cards/

Image:
http://www.digitaltrends.com/mobile/iphone-6-nfc-for-apple-pay-only/

Friday, September 23, 2016

Ray Tomlinson: Father of Email

       The late Ray Tomlinson, who passed away in March 2016, worked at BBN Technologies for decades; my dad worked there in the late 1990s and through part of the 2000s and knew Ray during his 14 years there. Ray, however, joined BBN in 1967, working there for over 30 years.
       From both my dad's stories and the internet, Ray's most famous accomplishment is the invention of email, but that came after multiple other developments. While at BBN he developed the TENEX operating system, which included the ARPANET Network Control Program. The ARPANET, put simply, led to the development of the internet. Ray wrote a program that could transfer files via the ARPANET, called CPYNET, and was asked to change and improve a program called SNDMSG. SNDMSG operated on a time-sharing computer at BBN; it essentially acted as a bulletin board where users could send messages to each other on the computer. 

In Ray's version of fun, he went a bit further with development and added code from CPYNET to SNDMSG which allowed the message files to be transferred to and from separate computers. This is essentially the same way emails work to this day, but Ray did it for the first time in 1971. 
       Now is where we switch from Wikipedia information to what my father has told me about Ray over the years. Each user on the original SNDMSG computer had a username. Since everything was running on the same machine, that's all the specification each user needed. However, after Ray sent the first email--something insignificant, Ray doesn't remember what it was exactly--there needed to be another layer of specification for each user to their own separate computer. This is how Ray came to implement the @ sign and invent its modern use: the sign marks a location for an individual server that hosts that particular user. For example: username@usercomputer.com refers to the username that is hosted by "usercomputer."
       It really is a shame Ray doesn't remember his initial test emails; he had quite the sense of humor. After being asked if he could remember them, he responded that the "test messages were entirely forgettable and I have, therefore, forgotten them." He also urged the small number of coworkers he let in on his project to not "tell anyone! This isn't what we're supposed to be working on." What started as a fun test project turned into the foundation for modern professional communication, and even one of the major topics in this year's election debates! In all seriousness, founding a program that modern society could now not live without has left a great legacy for a long and successful career.









Sources:
https://en.wikipedia.org/wiki/ARPANET
https://en.wikipedia.org/wiki/Ray_Tomlinson
images:
http://marketingland.com/segmentation-personalization-automation-runs-data-126428

Any quotes were from the sites above, neither me nor my dad have a verbatim memory of what Ray had to say on the subject.

Thursday, September 8, 2016

Modern Dating: An Introduction to the Logic Behind Tinder

As the old school dating methods such as meeting people in person and offering to take them out die off, new modern dating methods are on the rise. The most commonly known modern dating method is Tinder, a dating app with a fresh dose of harsh honesty. Tinder is comparable to Hot or Not, another superficial dating app. In Tinder, the user sets a radius; any person that both fits the user's sexual orientation and is within the user's radius will show up to the user's screen. The user then swipes right if interested, left if not interested. If both parties, the user and the person within the radius that is also swiping, swipe right, the pair is matched and have the opportunity to chat.




The logic behind the app is straightforward and can be broken down into programming terms. If PersonA likes Person B && PersonB likes PersonA, there is a match. Else, nothing happens. For an app that reports around 50 million users per month with 12 million matches per day, it seems like the code required to create Tinder was not all that complicated when only considering the underlying function of the app (not the performance, graphic effects, or other extra code put into the app). Expressing logic in Java or any other programming language is very natural and free of clutter, and I think that shows here. The logic behind an entire style of dating and networking can be summed up in a few lines of code.


Sources:
Tinder User Count info:
https://en.wikipedia.org/wiki/Tinder_(app)
Image:
https://techcrunch.com/2015/11/11/tinder-matching-algorithm/
Image:
http://www.hercampus.com/school/pace/6-tips-tinder-dating













Thursday, September 1, 2016

Progression of Manufacturing via Technological Advancement

Advancements in technology have allowed for advancements in all other fields. Technological advancements are actually rooted in economic theory; once human and physical capital reach capacity, technology is the only factor that can increase output in the long term (until new maximums of capital are introduced).

For example, let's take a look at how cars have been manufactured over the years. Before the early 1900's, cars were built by hand, piece by piece, and efficient factories could only build a couple dozen per day. However, Henry Ford came along and invented the assembly line, taking advantage of the idea of specialization and speeding the process of automobile production up.


Over the years, programmers and companies realized the men on those assembly lines, while possibly great people, were perfectly replaceable. Ideally, they'd be replaced by something the company didn't have to pay hourly. Modern assembly lines are run by machines that operate under the direction of programs, as seen as these robotic arms tending to a new Ferrari chassis:


There's no doubt that these new methods of production pay for themselves both through lack of labor costs and new speeds of production.

Knowledge on the timing of Ford and the assembly line:
http://www.scaruffi.com/politics/cars.html

Ford Assembly Line image:
http://ophelia.sdsu.edu:8080/ford/12-30-2012/our-company/heritage/heritage-news-detail/heritage-model-a-production-begins-at-rouge.html
Ferrari Assembly Line image:
http://www.bbc.com/news/business-19544906

Wednesday, August 31, 2016

Hip-Hop and Programming

While most people wouldn't think to use the two words in the same sentence, Hip-Hop and programming are full of similarities in terms of the outlet they provide to the artist or programmer. Hip-Hop is arguably the most popular modern form of expression; it has rapidly grown as a genre throughout the past two decades. Programming, while getting less mainstream attention, is arguably the most important form of expression, as technology continues to take over the logistics of just about every market, art form, or even day-to-day life. In music, computers and programs have completely changed the way music is made. 50-60 years ago, in the Beatles era, music was either recorded live and laid on a vinyl record, a process that became the norm in the 40's, or recorded onto separate cassette tapes and layered during production, which became popular in the 60's. Now, computer programs make up most of music production.




Above is a music production software, specifically Ableton Live. Ableton is used by producers varying from beginners to professional, famous DJ's and Hip-Hop producers. Music software accepts input and organizes sound while giving home and studio producers thousands of possibilities in transforming their sounds. Obviously, none of this would be possible had Ableton not started with the first few lines of code it took to create it. While complicated and sometimes hard to use, using Ableton or other similar programs is no challenge compared to progressive production methods such as layering primitive tapes with an impressive amount of precision, a tactic used by the Beatles to support the creative phase seen (heard) in their later albums.

Hip-Hop (all music, really) and computer science both offer the artist or programmer creative freedom in expression, but also both operate under strict rules. Writing and rapping verses is a precise art; constructing intricate rhyme schemes that simultaneously tell a story and stay perfectly on beat is, to put it simply, difficult. In my personal experience and observation, the same can be said for programming. Learning to maximize expression within a somewhat limited medium is equally impressive and important in both fields.

Sources:

Knowledge on music production history:
http://www.pbs.org/wgbh/pages/frontline/shows/music/inside/cron.html
Ableton image:
http://benjaminheine.blogspot.com/2012/04/my-new-home-ableton-live.html