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

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.

Microsoft Courier - The tablet Microsoft shut down

Tuesday, 29 November 2011 20:02 by Michael Olivero

Recent rumors has it Microsoft was working on two tablets simultaneously, one inspired with a "think different" approach lead by J Allard and another as an evolution of Windows lead by Steven Sinofsky.  In short, Balmer had a tough decision and resorted to Bill for helping him making the best decision.  Bill, having the natural affinity to Windows, killed the think different version because it was not designed with Windows in mind didn't integrate with Office at it's core.  This is the first time I see the promotional video of the think different version -- Microsoft Courier; not too shabby.

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