Just a quick explanation of how an implicitly wrapped optional can be used. Logically, I would think optional variables are probably more computationally expensive than a normal variable (IMO because it is a fatter object, did not research). So, as far as it goes, it would be best to declare a normal variable in cases where it can not be… Read more →
So I encountered this problem, having to pass a large array of objects from one activity to another. That caused a android.os.TransactionTooLargeException. So we could either break the data array into chunks or redo the UI to avoid having to pass the large array through the activity. However, a short term solution would be to use a singleton with a… Read more →
Well here’s a topic that’s hotly debated in Android design. Technically, both of them could work for rapid development. However, I prefer Method B as you can modularize your singletons to support specific functions in each class definition. Best if you can work without them, but its often not the case. Method A – Extending Application Context Step 1: Create… Read more →
Running mysql commands on the shell is pretty simple. However, things can get tricky if you need to enclose variables within those aprostophes in your script. Spend some time trying to figure this out. The short sample code below shows how it can be done. Note the cats on “echo $1“. Hope this helps you as well.
mysql -u $mysql_user -p$mysql_pass -e "`echo $1`"
do_mysql "drop database $dbname; \g"
There are a couple of ways to obtain a bitmap image from a visible view object. However, its a bit more tricky to obtain the bitmap from invisible (or hidden) views. 1. Obtaining bitmaps from visible views The first approach would be to use the drawing cache of the view class (recommended). Note that while v.getDrawingCache() would provide the actual… Read more →
In C#, it is easy to confuse hiding with overriding. Both are ways to change the implementation of elements from a base class. But there are some significant differences between the two. A further confusion steps in with the term shadowing. Shadowing is a VB concept. In C#, this concept is called hiding, though there is a subtle difference between… Read more →
Here’s a pretty good tutorial on hashtable / dictionaries. Found it while studying some performance issues between the use of try/catch vs contains key for a dictionary with about 200,000 key/value associations. Read more →
Threading is fun, because with it you can do a lot more stuff at the same time. For example, keeping your UI updated while your background tasks are running. C# supports parallel execution of code through multi-threading. A thread is an independent execution path, able to run simultaneously with other threads. Here, we examine three simple C# approaches to help… Read more →