Thursday, March 19, 2015

NSClassFromString and Spaces in Product Name

If you are using NSClassFromString to get classes by "Product Name"."Class Name" in iOS, watch out for spaces in your product name. All spaces need to be converted to underscores before passing the string to NSClassFromString.

NSString *className = @"My App Name.MyClassName";
Class clazz = NSClassFromString(className);


The clazz will be nil because of the spaces in "My App Name". The className parameter should be "My_App_Name.MyClassName".

I ran into this problem using Typhoon. Typhoon is Dependency Injection framework for iOS. It has a PList integration functionality where the TyphoonAssembly is created based on the string in the PList. This started failing because I created a project with spaces in the name.

I made the small fix and sent a pull request, https://github.com/appsquickly/Typhoon/pull/328 and the Typhoon people merged the PR really fast.

Thursday, August 1, 2013

Installing Mono on Ubuntu

So I went into the process of installing Mono (from source) on Ubuntu. While the process is pretty straightforward, the problem is no single place to understand the full process. So I am listing the process here for my own sake and it will probably be out of date within 1 week of publishing this post.

Starting point is from a fresh install of Ubuntu Server. I will just list the steps first, then some explanations.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git autoconf libtool gettext pkg-config build-essential
cd ~
git clone git://github.com/mono/mono.git
cd mono
git checkout tags/mono-3.2.0
./autogen.sh --prefix=/usr/local
make get-monolite-latest
make
sudo make install
mozroots --import --ask-remove
sudo vi /etc/environments
add line "EnableNuGetPackageRestore=true"
reboot to load new environments file
modify .nuget\NuGet.targets file in your solution

If you want to host a website with Nginx and FastCGI Mono Server

sudo apt-get install nginx
cd ~
git clone git://github.com/mono/xsp.git
cd xsp
git checkout tags/3.0.11
./autogen.sh --prefix=/usr/local
make
sudo make install

Explanation:

sudo apt-get update
sudo apt-get upgrade

  • You do want all of the O/S updates, right?

sudo apt-get install git autoconf libtool gettext pkg-config build-essential

  • Install packages required to build Mono.
  • Install git to download the source from Github

cd ~
git clone git://github.com/mono/mono.git
cd mono
git checkout tags/mono-3.2.0

  • Download latest source for Mono from Github
  • Rollback source to the latest released version by git tag.

./autogen.sh --prefix=/usr/local
make get-monolite-latest

  • Initial setup to enable build
  • get-monolite-latest will download a "lite" version of the Mono C# compiler. This is required for computers without Mono already installed.

make
sudo make install

  • Build and Install

mozroots --import --ask-remove

  • To add trusted root certificates into your server. You will need to do this to be able to download packages from Nuget's website via https.

sudo vi /etc/environments
add line "EnableNuGetPackageRestore=true"
reboot to load new environments file

  • If you use NuGet Package Restore, this enable it when you build your solution. There is no Visual Studio checkbox you can click.

modify .nuget\NuGet.targets file in your solution

<SolutionDirTrimmed Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)</SolutionDirTrimmed>
<SolutionDirTrimmed Condition=" '$(OS)' == 'Windows_NT'">$(SolutionDir.Trim('\\'))</SolutionDirTrimmed>
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)"  $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir "$(SolutionDirTrimmed)" </RestoreCommand>

Wednesday, February 20, 2013

My Podcasts

Time to fire up the blog...

This post just lists up the podcasts I regularly listen to with some description. I have a long commute so I can easily catch up on podcasts. I also listen to podcasts while I exercise. I can't really listen to podcasts while I work. The podcast is either just background noise or I don't do any work. Not sure how other people catch up on podcasts while working. I am a very "single threaded" person.

Before listing up some of the podcasts, I need to mention the podcast app I use. Downcast (http://www.downcastapp.com/) is the one I use. Lots of great settings with some information iCloud synced to multiple devices. Some of my favorite things about the app are speed adjustment (I listen at 1.5x speed), pull to refresh, and background downloading per iOS rules. One thing to watch out is the episode iCloud sync. It sometimes deletes unplayed episodes because I didn't download it on another device.

Life:

No sure how to name this category. Probably could have just listed as "Not Technology".


TED Talks (http://www.ted.com/):
  • You have heard of TED right?
Wait Wait...Don't Tell Me (http://www.npr.org/programs/wait-wait-dont-tell-me/)
  • Funny NPR news game show.
Car Talk (http://www.cartalk.com/)
  • NPR show that talks about cars. Hosts are very funny.
This American Life (http://www.thisamericanlife.org/)
WNYC's Radiolab (http://www.radiolab.org/)
Rodderick on the Line (http://www.merlinmann.com/roderick/)
  • Hard to explain, but very stream of consciousness and funny. Warning, bad language, so adults only.

Tech:

  • Most of my work is in .NET.
Developing Perspective (http://developingperspective.com/)
  • Podcast on developing in iOS, but a lot of great concepts that can be used in development with other technologies.
  • I told you I work with .NET.
Herding Code (http://herdingcode.com/)
  • Let me tell you again, I work with .NET.
  • Stack Exchange people talking about their work and decisions.

Monday, March 8, 2010

Visual Studio 2010 – Testing Tools Demo with WPF

I have been “testing” the new Testing Tools for Visual Studio 2010.  This includes the new Lab Management and Test Manager.  The Lab Management piece covers the managing of Virtual Environments and Machines for testing.  The Test Manager is a GUI interface to Lab Management and a tool to manage test cases, bugs, and run tests.
In this blog entry, I want to show a demo of using the Testing Tools with a WPF application.  I will show creating a test, running the test in a virtual environment, creating a bug, fixing the bug, building and deploying to the virtual environment, and verifying the bug fix.
OK, here we go.
0. Introduction of Test Environment.
Test Environment
The screen print above is from Test Manager showing the Lab Environment.  I have created a Virtual Environment called “Xiptor Demo” and within the environment is one virtual machine, also named “Xiptor Demo”
The virtual machine (VM) is running Windows 7 with the test, lab, and build agents running.  Also, Test Manager is installed on the VM.
1. Create Test Case
image
Now, in Test Manager, I create a Test Plan and add a new Test Suite as seen in the left side of the UI.  Then, I will click on “New” to create a new test case.
image
I enter the Title and some steps to run the test case.  Then I save the test case to TFS.
2. Run Test Case from Virtual Machine
image
In Test Manager, I want to bring up the VM environment viewer to run the test case and start Test Manager.  I will select the test case and run.
image
I will start the test from the Test Runner (on left side of Environment Viewer window) and execute the test steps.  I will start the WPF application and specify the test step passed.  Then, when I click on a button, the WPF application crashes.  So, I create a screen print.  Then, I create a bug.  The Test Runner will collect all the data to include in the bug and show the New Bug Window.  After entering a title for the Bug, I will save the bug information to TFS.
3. Fix Bug in Visual Studio 2010
image
In Visual Studio 2010 using Team Explorer, I look at the bugs and find the bug just created.  Here you can the details of the bug and there are links to the screenshot, actions list, System Information, a video recording of the test session, and IntelliTrace information.
image
If you click on the IntelliTrace link, you can see the IntelliTrace information saved while running the test.  Double clicking on the Exception Data will bring me to the line of code where the exception occurred.
Now, I go ahead and fix the bug.  When I check-in the source, I associate to a work item, which is the bug created in Test Manager.
4. Queue New Build with deploy to Lab Environment
image
After making all of the changes, I queue a new Lab build.  The lab build will re-build the solution.  Then, it will deploy the new version of the application to the Virtual Machine.  Some optional items are to create a snapshot or checkpoint of the VM after deploying the build and running tests in the VM.
5. Verify Bug Fix in VM
image
I go back to the VM through Test Manager’s Environment Viewer to verify the bug fix.  This time, instead of clicking on “Run Test”, I click on “Verify Bugs”.  I select the “Resolved” bug and verify.  This will start the Test Runner and run the “linked” test case.
6. Pass Test Case and Close Bug
image
I go through the test case steps and verify the bug was fixed.  If everything was successful, I go ahead and Pass the test case and close Test Runner.  When I close Test Runner, a window pops up to close the bug.  I can enter some comments and click “Save Changes”.
Conclusion
Here are the basic steps in executing a test case, filing a bug, fixing a bug, build and deploy, and verifying bug fix.  You got to see some of the features with the new testing tools, such as IntelliTrace, Managing VM Test environments, integration to TFS and Visual Studio.  I hope this gave you a good start into understanding the new testing tools.  I will be blogging in the future more about Visual Studio 2010 Testing tools.

Wednesday, December 16, 2009

.NET for iPhone

A way to create applications for Windows Mobile is using the .NET Compact Framework.  You can use your experience with .NET applications and languages to create applications for a Windows Mobile phone.  Albeit the .NET Compact Framework has a lot of limitations compared to the full framework for Windows.  That is a long story for another day…

But what about developing applications for the iPhone?  Until recently the only way to develop iPhone applications is through the iPhone SDK (http://developer.apple.com/iphone/)  There you need to learn Xcode, which is Apple’s Development IDE.

Now, there is a product for .NET developers to create applications on the iPhone and to release them to the iPhone App Store.  Monotouch (http://monotouch.net) is an IDE to develop applications but it uses the C# syntax.

Image:Md_hw_iphone19.png

The Monotouch is only available for a Mac.  Monotouch does include interfaces to iPhone APIs, such as access to GPS, accelerometer, address book, etc.  It also uses the Cocoa Touch (Apple’s UI Framework) so you will have access to the native iPhone controls such as Pickers, Sliders, etc.

Here is a good article about using Monotouch on InfoQ (http://www.infoq.com/articles/monotouch-introduction).  Monotouch is expensive, but it is a full development environment with the language syntax C#-like.  If you are familiar with C# and want to develop iPhone applications, this is probably the fastest way to do it.  On the other hand, you can download the iPhone SDK and learn Xcode and the C syntax to create the iPhone applications.

Friday, December 11, 2009

Prism 4.0 and MEF

http://blogs.msdn.com/dphill/archive/2009/12/09/prism-and-mef.aspx

Interesting blog article talking about the future of Prism and integrating with MEF.  It also touches on points where Prism and MEF overlap.

Thursday, December 10, 2009

Happy Holidays

First post to my new blog.  Since it is the holiday season, just would like to wish everyone a Merry Christmas and have a Happy Holidays.  Be safe with your Holiday parties and if you are in Korea, don't drink too much soju.