Jarred Capellman Putting 1s and 0s to work since 1995

31Jan/120

WCF + SSL + Visual Studio 2010 = Not Working?

Posted by Jarred Capellman

Came across an interesting problem yesterday in which I was previously using HTTP for my WCF Mobile Service and a potential client wanted it encrypted. Rather than write a custom encryption, I simply applied a SSL certificate to the IIS application and created a HTTPS binding in IIS.

Afterwards I knew I had to update my Endpoint and Behavior to use HTTPS and allow Meta-Data temporarily so Visual Studio could update my Service Reference. This is where everything went down hill. The Service Configuration file in my WP7 application got wiped and the actual Reference.cs was virtually empty.

After trial and error for several hours I ended doing the following:

  1. Added a new WCF Reference using a brand new name
  2. Saved the Project/Solution
  3. Exited Visual Studio 2010
  4. Removed the new Reference
  5. Added the original WCF Reference using the original name

After all that it worked, so hopefully that saves some one hours of headache.

31Jan/120

Error 1 “aapt.exe” exited with code 1

Posted by Jarred Capellman

Chances are you'll get this error after adding images from either another project, an artist etc.

I got it with an image that had a "-" in it. Ensure your drawable assets are 0-9, a-z or _.

28Jan/120

Cloud Based Web Rendering?

Posted by Jarred Capellman

Last night when working on my Silicon Graphics Origin 300 and suffering with an old version Mozilla circa 2005 as seen below:

Mozilla 1.7.12 on IRIX

I started wondering, these machines can function as a Web Server, MySQL server, firewall etc especially my Quad R14k Origin 300, yet web browsing is seriously lacking on them. Firefox 2 is available over at nekoware, but that is painfully slow. Granted I don't use my Origin for web browsing, but when I was using a R12k 400mhz Octane as my primary machine a few years ago as I am sure others around the world are doing it was painful. This problem I don't think is solely for those on EOL'd Silicon Graphics machines, but any older piece of hardware that does everything but web browsing decently. Thinking back to the Amazon Silk platform, using less powerful hardware, but a brilliant software platform, Amazon is able to deliver more with less.

The problem arises for the rest of the market because of the diversity of the PC/Workstation market. The way I see it you've got 2 approaches to a "universal" cloud web renderer. You could either:

  1. Write a custom lightweight browser tied to an external WCF/Soap Web Service
  2. Write a packet filter inspector for each platform to intercept requests and return them from a WCF/Soap service either through Firefox Extensions or a lower level implementation, almost like a mini-proxy

Plan A has major problems because you've got various incarnations of Linux, IRIX, Solaris, VMS, Windows etc, all with various levels of Java and .NET/Mono support (if any), so a Java or .NET/Mono implementation is probably not the right choice. Thus you're left trying to make a portable C/C++ application. To cut down on work, I'd probably use a platform independent library like Gsoap to handle the web service calls. But either way the amount of work would be considerable.

Plan B, I've never done anything like before, but I would imagine would be a lot less work than Plan A.

I spent 2 hours this morning playing around with a WCF service and a WPF application doing kind of like Plan A.

jcW3CLOUD in action

But instead of writing my own browser, I simply used the WebBrowser control, which is just Internet Explorer.

The Web Service itself is simply:

public JCW3CLOUDPage renderPage(string URL) {
     using (WebClient wc = new WebClient()) {
          JCW3CLOUDPage page = new JCW3CLOUDPage();

          if (!URL.StartsWith("http://")) {
               URL = "http://" + URL;
          }

          page.HTML = wc.DownloadString(URL);

          return page;
      }
}

It simply makes a web request based on the URL from the client, converts the HTML page to a String object and I pass it into a JCW3CLOUDPage object (which would also contain images, although I did not implement image support).

Client side (ignoring the WPF UI code):

private JCW3CLOUDReference.JCW3CLOUDClient _client = new JCW3CLOUDReference.JCW3CLOUDClient();

var page = _client.renderPage(url);

int request = getUniqueID();

StreamWriter sw = new StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory + request + ".html");
sw.Write(page.HTML);
sw.Close();

wbMain.Navigate(System.AppDomain.CurrentDomain.BaseDirectory + request + ".html");

It simply makes the WCF request based on the property and then returns the HTML and writes it to a temporary HTML file for the WebBrowser control to read from. Nothing special, you'd probably want to add handling for specific pages, images and caching, but this was far more than I wanted to play with. Hopefully it'll help someone get started on something cool. It does not handle requests from with the WebBrowser control, so you would need to override that as well. Otherwise only the initial request would be returned from the "Cloud", but subsequent requests would be made normally.

This project would be way too much for myself to handle, but it did bring up some interesting thoughts:

  1. Handling Cloud based rendering, would keeping images/css/etc stored locally and doing modified date checks on every request be faster than simply pulling down each request fully?
  2. Would the extra costs incurred to the 3G/4G providers make it worthwhile?
  3. Would zipping content and unzipping them outway the processing time on both ends (especially if there was very limited space on the client)
  4. Is there really a need/want for such a product? Who would fund such a project, would it be open source?
27Jan/120

Rack’d up (well nearly)…

Posted by Jarred Capellman

Spent a few hours last night getting all of my rack equipment in, well nearly all. I'll be getting a rackmount shelf from Amazon tonight so I can mount my ClearOS 2U AMD machine. It's definitely a much better to have it all nicely packed away rather than sprawling over my office like so:

Original "Stack" in my office

Original "Stack" in my office from the side

Into this:

Nearly all "stacked" in the Rack

Tagged as: , , No Comments
25Jan/120

Rack at last

Posted by Jarred Capellman

After about 9 years of waiting I finally have a rack. Not sure about the model, but it's an IBM 36U made in 2002. I was able to get it ridiculously cheap thankfully, now I've just got to get some rails for it. Luckily though I had some extra MDF boards from my bookshelf to prop my Sun Blade 100 and Dell 15" LCD.

IBM 36U Rack closed

IBM 36U Rack open

With any luck I can get some cheap rails.

23Jan/120

Can do with Telerik’s Kendo

Posted by Jarred Capellman

After playing around with Google Charts and doing some extensive C#/SQL integration with it for a dashboard last summer, I figured I'd give Telerik's Kendo a shot. If you're not familiar with Telerik, they produce very useful controls for WinForm, WPF, WP7 and ASP.NET controls (in addition to many others). If you do .NET programming, their product will save you time and money guaranteed. That being said, I started work on the first module for jcDAL last night and wanted to add some cool bar graphs to the web interface for the analyzer. About 15 minutes of reading through one of their examples I had data coming over a WCF service into the Kendo API to display this:

jcDBAnalyzer Screengrab showcasing Kendo

So far so good, I'll report back with any issues, but so far I am very pleased. A lot of the headaches I had with Google Charts I haven't had yet (+1 for Telerik).

18Jan/120

AMP + C# = what I wanted to see for years

Posted by Jarred Capellman

I was reading about AMP the other night, basically a light weight C++ wrapper that is used to offload tasks to your GPU. I was going to brush off my C++ skills tonight, but luckily I don't have to after reading this article. WinRT makes using C++ libraries a breeze, finally you don't have to use p/invoke. I'll definitely be playing around with this as soon as my Visual Studio 11 installation issues get resolved.

A word to the wise, if you're installing Windows 8, install it with the Developer Tools. I made the mistake of installing the non-developer tools Windows 8 Developer Preview, which doesn't install the necessary SDK for C++ compiling. If you're only doing C#, I had no trouble programming/compiling WPF and WCF apps.

15Jan/120

jcBENCH Android Port Released

Posted by Jarred Capellman

After some additional work getting used to the XAML-ish layout I'm done with the initial jcBENCH Android port. You can download it from here. You will need Android 2.2 or higher for it to run.

jcBENCH Android

I've only tested this on a Dual 1.2ghz HTC Vivid. However, the results were interesting. Comparing single-threaded and multi-threaded operations was curious. Running it in multi-threaded mode was actually 3 times slower. I'm not sure if the way the Task Parallel Library was implemented on Monodroid was done poorly or if there is a bug in the detection for how many cores/cpus there are inside the Mono implementation or not, but something isn't right. Single threaded versus my HTC Titan 1.5ghz SnapDragon it lost out by ~23%. Which makes sense, 300mhz difference or 20% comparing single cores to each other.

All that being said I'm content with jcBENCH for the moment until I hear feedback or come up with more features to add.

15Jan/120

apk on IIS

Posted by Jarred Capellman

Those that have seen an IIS 404 error on a file that is known to exist will know right off the bat, a lack of mime type.

A quick trip to Google found it, but for posterity's sake:

application/vnd.android.package-archive

Tagged as: , , No Comments
14Jan/120

IronPython + PLINQ?

Posted by Jarred Capellman

Spent the afternoon reading IronPython documentation and finally got a chance to play with it a bit. I have to hand it to Microsoft for making it extremely easy:

var ipy = Python.CreateRuntime();
dynamic pyTest = ipy.UseFile("test.py");

Only 2 lines of code to have access to a python script. For me this opens new doors for scripting operations I still typically write in PHP because of the simplicity of opening notepad and pushing it out to an IIS server running PHP. Now I can write a few line C# app with an interface to run whichever script I wish to run.

Being curious about performance, I ported jcBENCH to use IronPython. To put it simply, the math operations pale in comparison to native C# math operations. The actual overhead in creating the Python Interpreter was negligible if anyone was curious even on an AMD C-50 (Dual 1ghz) Netbook with a OCZ Vertex 2 SSD.

Porting it did bring an interesting idea, this could work for a workflow process. The ability to process multiple workflows utilizing PLINQ, but with the flexibility to adjust the logic in script and not in the C# code.

11Jan/120

Other jcBENCH news and jcDAL

Posted by Jarred Capellman

After some more thought about jcBENCH and what its real purpose was I am going to drop the Solaris and IRIX ports. Solaris has a Mono port, but I only have Sun Blade 100 which has a single cpu. Not expecting a ton of performance from that. IRIX on the other hand, I have a Quad R14k 500 Origin 300, but no port of Mono exists. So I could port it to Java, but then you really couldn't compare benchmarks between the Mono/.NET versions. I am about 50% done with the Android port and am just waiting for the OpenSuse 12.1 compatible MonoDevelop release so I can get started on the Linux Port.

After those 2 ports are completed I am thinking of starting something entirely new that I have been thinking about the last couple years. Those that deal with a SQL database and write a data layer for his or her .NET project, know the shortcomings or doing either:

  1. Using an ADO.NET Entity Model, adding your Tables, Views and Stored Procedures and then use that as is or extend it with some business logic
  2. Use an all custom data layer using the base DataTable, DataRows etc, wrap your objects with partial classes and create a "factory"

Both approaches have their pros and cons, the first takes a lot of less time, but you also have a lot less control and could be costly with all of the overhead. Both however will eventually fall apart down the road. The reason, they were built for one audience and one production server or servers. How many times have you gone to your IT Manager and asked for a new Database server because it was quicker then really go back to the architecture of your data layer. As time goes on, this could happen over and over again. I have personally witnessed such an event. A system was designed and built for around 50 internal users, on a single cpu web server and a dual Xeon database server. Over 5 years later, the code has remained the same yet it's been moved to 6 different servers with ever increasing speed.

Times have changed and will continue to change, workloads vary from day to day, servers are swapped in and out, so my solution, an adaptive, dynamic data layer. One that profiles itself and uses that data to analyze the server to use either single threaded LINQ queries or PLINQ queries if the added overhead of using PLINQ would out way the time it would take only using one cpu. In addition using Microsoft's AppFabric to cache the commonly used intensive queries that maybe only get run once an hour and the data doesn't change for 24. This doesn't come without a price of course, having only architected this model in my head, I can't say for certain how much overhead the profiling will be. Over the next couple months, I'll be developing this so stay tuned. jcBENCH as you might have guessed was kind of a early test scenario of testing various platforms and how they handled multi-threaded tasks of varying intensity.

11Jan/120

jcBENCH WP7 Release

Posted by Jarred Capellman

After a few days wait, I've ported jcBENCH to Windows Phone 7 (aka WP7 or Windows Phone). I've only tested it on an HTC Titan thus far, but all of the WP7 devices released thus far are all about the same specs wise. Virtually all of them have a 1.4ghz or 1.5ghz SnapDragon CPU, 512mb of RAM and all support 480x800. I wish the Titan would have had one of the Dual Core Qualcomm CPUs, maybe in the Titan III :)

jcBENCH WP7 Screenshot

All you'll need to run it is a developer unlocked phone and then deploy the XAP file as you would normally.

8Jan/120

jcBENCH 0.1.63.0 Released

Posted by Jarred Capellman

With this new release I've fixed a bunch of things in Web Service and the main library that powers all of the clients. In addition I'm tracking a bit more information like the platform and benchmark version (thinking more down the road when specific versions are going to change in the logic in the actual algorithm).

Also this release marks the first release of the GUI Mac OS X 10.6 (and later) client.

jcBENCH on Mac OS X

You'll need GTK 2.12 or newer and Mono 2.10.8 or newer to run it. Being my first Mac OS X application ever outside of iOS development, I can without a doubt say I cannot stand development on anything Apple. KVC has got to be the most bloated way of doing things I have ever seen. I am so glad I do not have to do native Mac OS X applications for a living. That being said though, I think it turned out pretty well in matching the WPF version.

8Jan/120

Mono + WCF Service (added as a 2.0 service) + Entity Model Object = Fail

Posted by Jarred Capellman

Found a bug in either mono or WCF, not sure which one. But if you go to add a Web Reference in Mono Develop (2.8.5) and have an Entity Model Object as a parameter for an object some of the properties will be null. Debugging had me scratching my head as the object was populated prior to sending to the WCF Service. I hadn't tried it as a Native WCF Service in Mono Develop because I've had prior problems with that route.

The solution I came up with was create a serializable object in your WCF Service that wraps the object like so:


[Serializable]
public class BenchResult {
public string CPUName;
....
}

Then in your application your reference will contain (in my case a BenchResult object) the object you defined and upon populating and passing it to your WCF Service all of the data will be populated. Nearly 2 hours gone down the drain on that issue, hopefully it helps someone else.

7Jan/120

New version of jcBENCH tonight

Posted by Jarred Capellman

New version of jcBENCH will be coming out tonight, in the mean time I have taken down the web service so you won't be able to submit results. More details to follow...