Michael Olivero
The official blog of Michael Olivero, Software Architect & Humble Entrepreneur

Cross Multiply Mental Calculation iPhone App Ver 1.1

Saturday, 12 May 2012 17:33 by Michael Olivero

 

 

This is the latest update to the original cross multiplication application released a few weeks ago -- original posting here

Version 1.1 of the app allowed me to practice with threading as well as state.  The app has an interactive timer which is not intrusive by starting/stopping automatically.  Your best error-free scores are saved so you can challenge yourself to beat it over and over.

 

Cross Multiply Mental Calculation iPhone App

Friday, 27 April 2012 19:42 by Michael Olivero

Update 5/9/2012:

 

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

Yusnier Viera, a former co-worker and current world record holder in calendar mental calculation, brought to my attention the concept of cross multiplying.  After learning the basics and practicing over time, I have been able to successfully multiply upto four digit by four digit computations in my head.  Since the exercise is stimulating and to a certain extent entertaining, I decided to build an iPhone application to easily practice.

Unlike paper and pencil, using an iPhone app allows for immediate feedback while entering the answer.  I've been learning how to develop iOS apps for both iPhone & iPad and I am on the verge of releasing this application.  Since I'm anxious to get it out to the world, I have defer creating the tutorial, the statistics page as well as game center integration, until future updates.

I decided to give the app a representative iconic person, so Einstein fit the bill.

 

Once loaded, you are presented with the home screen where you can link out to a video tutorial or simply start the app.

 

 

Once started, you can interactively create up to 4x4 multiplications to test your mental calculating abilities.  In a future update, I'll hook it up to game center and keep track of best times for each type as well as increase the scale up to 8x8.

 

Tags:   , , , ,
Categories:   iPhone / iPad
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

iPad3 WiFi connection issues resolved

Thursday, 5 April 2012 21:51 by Michael Olivero

I believe I have a solid work around for the the wifi issue where disconnects occur. First it appears only to happen when connecting to wireless-n connections. Wireless-g doesn't seem to have any problems.  Note this is only for the repeated disconnects and has nothing to do with the low signal issue some have mentioned. For the record, I have a 32gb Verizon iPad.

The symptoms are as follows.  

Symptoms:

  • You connect fine and surf fine. Put the iPad to sleep or come back to it later after sleeping automatically and your wifi is not connected.
  • When tapping the previously connected wifi to reconnect you are usually asked to enter the password again.
  • When you connect the first time, it says failed to connect but re-tap the join button it connects.
  • If you turn off wifi and then turn it back on  it doesn't reconnect.
  • Once connected to the wifi, if you click on the right arrow to go to the details you will NOT see the "forget this wifi" button even though you are connected.
 
 

If you fall in any of those scenarios, this WILL solve your problem in the interim until Apple updates software. In short it seems as though the wifi is not stored or remembered.

 

Solution:

Configure wifi manually, explicitly typing your wifi's broadcast name, explicitly choose the security your wifi is using (wep, wpa, wpa2, etc. ) and then proceed to enter your password. Once connected if you go to the details of the connection you should see the "forget this wifi" button. If you do, you can now rest assured it will allways reconnect and  the above symptoms can no longer be reproduced.

4/12/2012 Addendum:

Not sure if this is related or not, however I have the "Ask to Join Networks" feature off in the wifi settings too. 

 

4/13/2012 Addendum:

Here I show how easily I can reproduce the automatic disconnects because the iPad doesn't remember the wifi connection.  My solution, and working now for weeks without a problem, has been to set it up manually.  Interestingly, after setting it up manually, I haven't had to set other networks manually as they connect and remember fine.  It's only the first one it seems or my home one.

5/2/2012 Addendum:

Updating the router firmware has resolved this issue in two separate situations (my home and a friends home).

Good luck!

Tags:   , ,
Categories:   iPhone / iPad | Mac
Actions:   E-mail | del.icio.us | Permalink | Comments (5) | Comment RSSRSS comment feed

When to buy Apple products?

Monday, 26 March 2012 17:05 by Michael Olivero

All electronic devices, with few exceptions, decrease in value over time.  With Apple products, this is notoriously accelerated because Apple tends to release products on a yearly basis across most of their product line.  Take for example iPhone and the five releases thus far from 2007 to 2011.

ModelRelease Date
iPhone June 2007
iPhone 3G June 2008
iPhone 3GS June 2009
iPhone 4 June 2010
iPhone 4S Sept 2011

Apple traditionally upgrades the specifications of their products while keeping the pricing the same.  So a new iMac 27" may still be $1699, however this year's model has a much more powerful video card and larger capacity hard drive.  Apple rarely, only once that I can recall, adjusts their price prior to a new model announcement -- and when they did this, with the original iPhone, it created an uproar in complaints from early adopters despite the price being reduced.

Since Apple normally doesn't adjust the price on their products and is almost guaranteed to have a new model 12 months later, one could argue you get the best bang for the buck buying the product as soon as it's released.  Buying it 6 months later or near the next release sets one up to either delay the purchase again for the next release while at the same time remorse the previous purchase under the pressure of desiring the latest innovation.  It is true there are times where one doesn't want the new one because it is not incrementally more valuable to justify.  I for example didn't move up to the iPhone 4S having the iPhone 4.  Yes, I desire Siri, but I decided to hold off.  In doing so, I went ahead and purchased the Apple care warranty and guess what?  Since i purchased it on launch day, my warranty expired roughly around the time  as the iPhone 4S ( arrived and the extended warranty will cover me through a whole year until the next model arrives.  The warranty purchase couldn't have been more efficiently calculated -- and it was only possible because I purchased as soon as the product was released.

In summary, you'll get the best bang for the buck and the best options when buying right away.

Tags:   ,
Categories:   Mac
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

.NET Framework FileInfo.Delete() method throws UnauthorizedAccessException

Thursday, 1 March 2012 17:03 by Michael Olivero

When deleting a file using FileInfo.Delete() method, the .NET framework sometimes throws an exception as shown below:

 

Yet, when you delete the file manually through explorer its removed fine from the filesystem.  At first I though this was a glitch of some type because the program runs with my login credentials much like the local logged in user credentials applies to windows explorer.  It turns out if the file is marked as ReadOnly it also throws this exception.  Changing the attributes prior to deleting will automatically resolve this problem.

An additional note, since this program was working with a directory where files were continually being created and removed, there was an additional observation with the File.CreationTime.  In very few cases when iterating through the files in the directory, the CreationTime would show a date time value of 1/1/1600 despite the file already existing.  I attribute this to simply a race condition where the FileInfo.CreationTime of my program gets to the file just before the actual creation date of the file is set by the operating system. This would need to be validated as I would expect the creation time of the file to be set in an atomic way along with the file creation.

Tags:   ,
Categories:   Software
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Is China a twisted form of capitalism? -- the world will take notice with Apple at the frontline

Wednesday, 15 February 2012 22:26 by Michael Olivero

Since the reforms some years ago, the general rule of thumb prevailed to all citizens was "don't intervene in our leadership and we will not intervene in your business endeavors".  This started what many consider the biggest boon of domestic growth and prosperity in modern history and fueled into overdrive with president Clinton's signing of the China Trade bill back in 2000.  The trade bill opened mammoth Chinese markets to US business and would be the prequel for China to join the World Trade Organization.  Over a year later, on Dec 2001, China became part of the WTO.

My college professor in database systems, Dr. Wei Sun, even took a sabbatical and left to China foreseeing the vast opportunities -- he never returned and even eventually relinquished his tenured position.

So this is allegedly positive for all, after all free markets cultivates innovation and survival of the fittest making better products accessible at an ever more affordable price.

So what's wrong?  Fast forward to today, we have had enough time to realized China true ambitions in becoming an influential world power  In the last decade, we've seen China launch humans into orbit, built their first aircraft carrier, & even recently launching their own global positioning satellite system similar to US' GPS and Russian's GLONASS.

From an outside perspective, this is all good and compares similarly to the benefits of local capitalism -- except at a world level.  So what's wrong then?  In a nutshell, by observation, China's goals seems to be:

  1. Securing and maintaining party rule (at all cost)
  2. Maximizing opportunities and employment for all citizens abiding by the ruling party (e.g. government is on your side if you abide) 
  3. The dishonest control of their currency rather than letting it float freely in the markets
  4. The squelching of anything deemed a threat to either
  5. Long term becoming a world power with influence both politically, militarily, & monetarily.
And Apple is a victim of these goals and their recent spat with iPad trademark infringement as concluded later on in the post.  Lets first discuss each of these points with some additional detail.
 
Securing and maintaining party rule at all costs.
It's clear China is extremely concerned about freedom of speech and expression.  They incarcerate those who rally against the government.  They force companies to censor sensitive topics such as Tianenmen square revolt.  At one point this even clashed with Google's principle of don't be evil and consequently having to filter search results became more and more contrary to Google's principals of free and accessible information.  The Google vs. China escalated to the point where Google redirected services from mainland china to Hong Kong servers (which are not restricted politically) however this didn't fare well with China and ultimately Google decided it was best to pull out of China all together.  China currently disallows twitter, youtube, Facebook, & a whole slew of services which may help or empower unionization and eventual opposition to current government rule.  The issues is so tightly controlled whereby China had sophisticated internet routers custom configured so they could control internet traffic -- effectively blocking any web site or service, country wide, with a flip of a switch.  A prominent voice by the name of Liu Xiaobo (1) was almost the equivalent to the Chinese as Marin Luther King was to african americans. China incarcerated him on frivolous charges.  The world, long aware of China's human right violations, took notice and even award Liu the Nobel Peace Prize.  It was a defining moment in history when he was not able to receive personally the peace prize award; intentionally putting China on the spot internationally.  His wife was also house arrested and was able to tweet for some time until she was also cut off from communication.  I haven't followed up since then to see there status, but incidentally, internal China news media didn't mention the awarding and simply became another topic of suppression.  China arrogantly decided to start their own peace price initiative months later and awarded Vladimir Putin the first Chinese peace price -- perhaps as an indication of how irrelevant these awards mean(2) or simply to obfuscate the the headlines a bit.
 
Maximizing opportunities and employment for all citizens abiding by the ruling party
Again, the government favors and even protects, as promised, those who express allegiance.  As a consequence the ability to "making a living" has little boundaries and the government typically turns a blind eye to such violations such as copyright & trademark laws -- particularly intellectual property, music, software, and most forms of digital content.  Software piracy at 82% (3) is just a subtle example. There are businesses literally officially open and selling copied movies, music, etc. in major shopping areas.  This "do what you please and we won't bother you" mantra reached a whole new level when duplicate non-official Apple stores started popping up in many parts of china.  These stores were a complete rip with Apple logo, employees dressed in the typical blue jerseys, identical floor layout and even identical product branding and marketing throughout (4).  Go ahead and take a look yourself briefly before you continue reading:
 
 
Clearly the enforcement of trademarks and copyright are very lax if non-existent otherwise entrepreneurs would not take the capital risk in setting these stores up as they did.  Put simply, China doesn't care and will even promote and help business sell and make a living.  Promotion?  Well, take this for example.  Go on eBay and search for some items -- say an iPhone bumper case.  Among all the listings, you'll see what looks like legitimate Apple bumper cases among them -- complete with the metallic buttons and all.  Originally you could find both the white and black versions -- the ones Apple themselves sell at the Apple store, however as of late you can find all color variations except those two solid black and solid white ones.  In either case, the same manufacturer who makes the bumper for Apple is directly or indirectly dumping inventory on eBay and making a killing.  What I find striking here is how cheap the shipment direct from china is -- just 99 cents.   You might think the price of the bumper subsidizes the shipment but I'm not sure how much room there is for subsidizing when the price of the item is also 99 cents.  So, yes, you can buy a full iPhone bumper case for a mere $2 rather than the $30 at the Apple store.  When the package arrived, it was indeed shipped via air mail directly from China.  I really don't understand how any company can cost effectively make and ship a bumper case from half way around the world for $2.  In my humble opinion we have government subsidizing somewhere in between -- all in the spirit to maximize opportunity and employment for Chinese citizens.
 
These are iPhone4's incased in original Apple bumper case and eBay 99 cent version.  There is no discernible difference in build, craftsmanship, measurements, etc.
 
 
 
As another quick example, I ordered some new head phones on eBay recently, rather economically at $35 rather than the retail price of $99.  The auction however has a "Make an Offer" option.  So I did, at $30, and promptly received my headphones a few days later.  This time however a note was included to buy them at another web site as ebay has closed their account for unspecified reasons.  I'm presumably assuming the original manufacturer of the headphones is cracking down on illegitimate sales of their headphones.
 
In overall summary, China is allowing these products, manufactured for companies abroad and cranking up the assembly line to build extra for dumping on alternative channels of distribution for themselves.  Here is a photo of the headphones and letter with enough resolution to read the letter if zoomed in.
 
 
There is no stopping blatant copyright and trademark infringement and China doesn't do much about it -- first in the digital world with music, videos, & software and now in the physical world with the dumping of these products on alternative distribution channels.
 
Part two of this post covering the items below will follow shortly:
The dishonest control of their currency rather than letting it float freely in the markets
The quelching of anything deemed a threat to either
Long term becoming a world power with influence both politically, militarily, & monetarily.
 
 
All references as of 2/14/2012
Tags:   ,
Categories:   General | World
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Gold - To be or not to be?

Friday, 10 February 2012 08:36 by Michael Olivero
Warren Buffet, a few months back, said if a all the gold in the world were to be combined into a large cube, it would measure a paltry 68 feet wide on each side worth $9.6 trillion. With today's valuation he argued you can do much better things with the value rather than own all this gold.  While true, especially long term, there are a few problems with this statement.  The first problem is, no single entity will ever own all the gold of the world -- if so, then it's value will become immeasurable.
 
While true, the only common variable in question is the valuation of currency.  How do you value gold today?  You compare it to the dollar and it would cost you $1750 to buy an ounce of it.  What happens when the dollar appreciates in value?  Gold, relatively stable in quantity, will have to decrease and vice versa increase if the dollar declines in value.
 
So clearly, the value of the dollar is directly inversely proportional to price of gold -- however this is not the only influencing factor.  Using Buffet's analogy on preferring buying a company producing gobs of profit over a century over buy gold which will sit in a vault may sound reasonable.  A better way to compare this is assume the value of currency goes to near zero because of huge debts (ex Greece currency) then what value will a good company, say in Greece today, producing gobs of profits in say greece's old currency, be worth? Little -- no one would want the greek drachma.  Greece had to increase rates to 10, 20, even 30% to sell bonds to investors - the return had to be sufficient to warrant the risk!
 
From my perspective, born as a US citizen, it's unfathomable but if US debts increase (as projected for the next 10 years) it may loose more of its rating and trust around the world and consequently it's value. The only thing allowing it's value to remain, and interest rates to be low, is the perception of the dollar as the universal global currency. Meaning, when the euro's credibility suffers people run to the dollar -  making bond auctions here relatively cheap from the excess demand.  This demand allows the US to keep rates low or even move them lower as dollar investors would buy the bonds anyhow just for the perceived safety.  This in return, allows the US to have a relatively "free ride" in navigating the financial turmoil by simply selling bonds at auctions as needed to meet liquidity needs to prop up the economy in the form of bailouts and the quantitative easing necessary throughout the later part of the last decade. That is the only reason why the US has been able to leverage low interest rates throughout the deepest recession in my lifetime.  
 
As soon as a world currency steps up as an alternative (what many thought the euro to be at one time) then the dollar will drop precipitously to correct for its over leveraged position.  Some of these concerns are clearly present today although stubbornly subdued due to the dollars prominence world wide.  With deficits expected to increase for the next 10 years, the leveraged position slowly erodes with decreasing value and appreciation similar to Greece's fallout -- although much quicker.  These signs are already present in the current price of the gold and should continue for the intermediate future -- how so you may ask?
 
Since world commodities are priced in dollars like oil and gold, these commodities will inevitably adjust inversely to the dollars movement as mentioned earlier.  To stabalize a currency, traditionally countries buy and amass gold (ex Wikipedia the gold standard for the US). Recently there is a huge movement to acquire gold by many countries for its stabilizing effects. Venezuela is shipping its gold from overseas banks; China has increased it's rate of purchasing and Russia has double it's own too.   Overall it's desire has increased as a simple safe haven when instability exists.
 
In conclusion, long long term, say 100 years like Buffet affirms, yes prosperity and opportunity abounds more than owning some gold, short term however it's use as a safe haven is inevitable as are other world commodities. Personally I prefer oil, it's also priced in dollars and is in demand like gold, however unlike gold, it depletes and produces a tangible value in the form of consumption.  A gallon of gas in 10 years, all things remaining equal, will be higher than the gallon is today - for sure.  Factor in depreciated dollar and a barrel of oil may be $200 -- 100% return over a 10 years.  Why else do you think renewable energy has become a trendy topic in the last few years?
Tags:  
Categories:   Finance | World
Actions:   E-mail | del.icio.us | Permalink | Comments (3) | Comment RSSRSS comment feed

The case of C# override with the new keyword and consequence of public vs. non-public accessibility

Tuesday, 24 January 2012 20:17 by Michael Olivero

Today I came to an interesting observation of public & private accessibility with regards to using the new keyword.

The scenario was exceedingly simple, almost too trivial to even write about but warrants a mention under the subtle but interesting observation as described below.  First lets set the stage.  The following program simply adds two items to a specialized list and then iterates over them to display them.  The output is shown.

 

 

 

Now, lets assume you are asked to sort the output and are limited to only working with the specialized collection and the Node objects exclusively.  So after some deliberation of what would be the optimal route from creating a SortableList (e.g. always sorted at the cost of a delayed insert) vs sort upon delivery, you go with the later and implement iComparable on the Node and decide to override the IEnumerable on the specialized list with the new keyword as shown.

 

The interesting observation here is the breakpoint inside the enumerator never hits.  Why? This stumped me for some time and was in denial as Visual Studio wasn't reporting any errors or warnings.  The keyword new is very powerful yet dangerous as it can be considered to bypass standard OOP principles and should be used sparingly because of these subtleties.  Visual studio's lack of warnings, in this particular case, was of no help also.

 

The problem resides in the function signature not matching the signature expected by iteration -- particularly the public accessibility.  As a result, you never actually hide the underlying one as expected. This is a very important observation and is the primary cause for the breakpoint not hitting.  As a seasoned developer, I was expecting the compiler to warn on the use of new with a matching underlying function name but doesn't actually hide and replace it -- solely because of accessibility. To emphasize this further, you can rename the function anything else and and the warning will popup indicating the use of new is not required as nothing is being hidden so naturally if reverted and it doesn't warn when compiled, one can easily and wrongly assume it was hiding the underlying method assuming the existing public accessibility too.

 

Just out of curiosity of what's going on in the internals, I used reflection to inspect the methods with and without the public attribute with the following code:

MethodInfo[] enumeratorMethods = typeof(MyList).GetMethods().Where(t => t.Name == "GetEnumerator").ToArray();

foreach (MethodInfo mi in enumeratorMethods )

    Console.WriteLine(String.Format("{0} - Public: {1} - Virtual: {2}", mi.Name, mi.IsPublic, mi.IsVirtual ));

 
And interestingly enough, with the public there are two methods and without public there is only one.  In proper OOP, this would normally be impossible but yet is allowed in C# for subtle reasons.
 
 
 
In conclusion, by simply introducing public, the compiler is able to match the List<> class' implementation and effectively hide it causing the breakpoint to hit during iteration -- however we have a broken situation.  In fact, if there was any other reference to iteration throughout the program against the MyList, they would all be sorted based on numeric value which clearly could be considered a break -- especially if the MyList was sorted, say alphabetically, for some other purpose prior to iteration elsewhere.  Even a future user who decides to use the MyList API and sort locally by name for some output would stay scratching his/her brain as to why it resorts to sorting by number -- clearly not something you want to release to production.  Many seasoned developers would never write code like this for this reason and would go through pains of finding an alternative more elegant and OOP compliant solution under the constraints given.
 
Moral of the story?...Be extremely careful when using the new keyword and only when you have to.  Unlike override, where you can't change the accessibility and get nice warnings for anything violating basic OOP principals, with new you don't and could easily get in trouble -- especially down the road when further inheritance or some other matter is necessary as it will surely come back and bite you.
Categories:   Software
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Is Microsoft being biased with their spell checker?

Friday, 13 January 2012 14:45 by Michael Olivero

I was writing an email about iPads and iPhones and found it amusing Microsoft decided to exclude them from their default spell checker despite their prominence in the market place and yet decided to include some of their product names despite their lack of prominence.

Tags:  
Categories:   General | Software
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Lacie Thunderbolt Hub with eSATA

Tuesday, 10 January 2012 11:10 by Michael Olivero

Lacie, known for their popular Mac external storage devices, has announced a thunderbolt hub with eSATA ports.  In the Mac world, this is very big news because Macs, which currently do not support USB 3.0 nor eSATA, can now leverage external drives with the same speed as internally connected drives.  With USB 2.0, editing video or file transfers where unnecessarily lengthy.  With the new Lacie hub, this should hopefully bring new life to all these external devices.  The hub is expected to be available first quarter 2012.