EF Code-First first look

Modifying a project built using EF Code First, and so far I like what I see. The whole POCO concept seems to work well, especially for a smaller simpler project. I learned a lot about it from this link: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx

I also like how you can eaisly define test data to use in place of the database, so that during testing and debugging you don’t have to mess around with a “real” database- you can launch from the same start data every time, or create custom test cases etc.

Phalanger PHP Compiler – new version released

I’ve been watching this project for years, and just noticed a new major release was made last month. Phalanger is a Php to .Net (CLR) conversion framework. Effectively lets you run PHP apps as .Net, inside the CLR, on an IIS server. As it matures, this should be a great option for running php code on microsoft servers, as well as a good method to assist in porting php apps over to a “real” .net language.

see http://phalanger.codeplex.com/

 

Groupon Clone

Doing some research into ways to get a “daily deals” website online, much like the famous groupon.com site. There are quite a few out there now, and a number of options if you want to create your own. It seems the lifecycle is still early enough that many providers are charging $1k+ for a reasonable usability, but often limited to a single instance etc.

Looking into open source options, I’ve only so far found a chinese one called “open groupon” (I’m sure the name will need to be changed ;). Testing it out now, and looks ok but a little rough in some areas. It’ll be interesting to see what comes out next around this type of app, I’m sure the OS community is hammering away at this and there will be 20 different clones out by year’s end.

Add any good options you’ve found in the comments below, I’d like any feedback I can on this.

DDOS at Codero

I’ve been hosting with Codero for a while now, and had great service. Until this morning, when a DDoS attack effectively blocked one of their data centers from the rest of the world. So, all my projects on my primary server with them were offline for… about 6 hours or so.

Last year a DDOS at my registrar, which I use for DNS, blocked access to all my sites as well.

Time to start looking into redundency options. Fun.

Installshield sucks. Thanks Microsoft.

Adding an installation project to my solution in vs2010, i notice an “installshield le” option for installation projects. ok, whats this? I do some research and apparently microsoft is abandoning their own installation projects, and will be moving everyone to use this “light edition” of installshield in the future.

I’ve used installshield in the past. Surely it’s not as bad as it used to be.

I add the new installshield le project, and am instructed I need to download it. this requires registration with “flexera”, who apparently now owns installshield, or whatever. create an account, give all my personal info. get a registration key in the mail. download installer and run it.

now, go back to visual studio, try to add the installer project again. Please enter serial number first problem – error, cant authorize. what? go through registration process again and try with new key. finally works.

now i finally have an install project in my solution. go through the setup steps using the weird navigation system (yes, it’s weird).

ok, we’re ready! build. what? errors?

get some kind of crazy “cant set codepage for lcid 1033”, as well as some other nonsense. click the error message, and am take to the “flexera” site, which lists a bunch of matches on this error message. no real solutions found, the matches listed date back to 2009 and 2007, so definitely not something new. I still haven’t resolved this, but do not look forward to dealing with it.

So, not much has changed. Same old cryptic BS dealing with installshield, and apparently microsoft has given up trying to provide something better. So this is what you get with a mult-thousand dollar license of visual studio 2010. Thanks Microsoft! for the opportunity to remember something i hate worse than crystal report.

How does ChatRoulette work – the RTMFP protocol

Disclaimer – I’ve never used chatlroulette and have no intention of starting. But I was curious about the technology under it. Has Flash finally enabled some way of direct peer-to-peer streaming of data? And it appears that this is the case.

The RTMFP protocol is a version of Adobe’s earlier streaming protocol called RTMP. RTMFP uses UDP datagrams, which are not guaranteed to be delivered, as TCP ones are. But this is fine for live streaming apps, since data from a second ago is already outdated.. so why bother trying to guaratee delivery and all that overhead.

But the real magic with using udp is – firewall transparency. Since firewalls usually allow most outbound traffic through without much harassment (at least for home users), inbound is another story. NAT enabled routers are not even able to allow inbound connections without some finagling, since it has no idea which local machine to send the connection request to.

UDP doesnt have all the extra error checking headers etc, so it’s pretty trivial to trick it into “faking” a connection across firewalls, but having computers at both ends of the connection intiate a connection about the same time. A third-party middle server is normally used to coordinate the setup and timing of the attempt to connect in this manner. The router will see outbound packets to an ip and port, and then see packets coming back from that same ip and port… and will assume they are responses to the request, thus forwarding them on to the internal computer. This can be done from both ends at the same time, thus both ends can be behind firewalls etc. You’ll definitely get a few bad packets bouncing off the firewall until both ends get their business straigntened out, but after this everything will usually just work.

TCP, on the other hand, has headers which keep track of a bunch of things, like sequence etc., so when these headers are not correct the router will discard them as being bad.

I did some research some years ago to see if it would be possible to do this same trick of “faking” a connection (called “connection splicing”) with TCP as well. The only way it *might* be possible is to have the third party server doing some illegal packet manipulation to fool the firewalls. I never decided if was truly impossible or not, but at minimum it would be tricky. I did manage to find one other discussion about this, appears to still be around: http://www.advogato.org/article/217.html

Back on topic – the reason I dug back into this today was I was curious if Silverlight has any provisions for supporting something like the RTMFP protocol, and thus allow direct p2p connections. From what I can tell, it does not currently support anything like this.

Update- apparently chatroulette went offline recently and displayed the message “chatroulette rtmp connection failed”, so there was a spike in search traffic to this page for that phrase. Short answer: yes, this means chatroulette is offline, just wait for it to come back!

Async javascript loading for reduced page load time

Many of my websites have the standard addins for integrating with the rest of the world- the addthis.com gadget, the facebook like button, etc. A number of them also use google maps. Each of these includes a javascript file from a remote source, which normally will slow down the load time of your pages. Google fixed their analytics scripts some time back to allow loading them asynchronously, so the page is not paused while waiting for it to load. Strangely, a lot of scripts don’t yet support this, and I’m seeing in google webmaster tools that the calculated load time of my pages has suffered as a result. What should be a tiny page that loads in literally milliseconds, is now a 3 to 5 second loading affair.

After some research, it looks like this is not a simple task to undertake. There are a number of ways to load a script async, but each has a set of drawbacks. This seems to be a great overview of the various methods currently avaialble: http://friendlybit.com/js/lazy-loading-asyncronous-javascript/ . I’ve seen that html5 also includes direct support for allowsing async loading of scripts, so maybe eventually this will no longer be a problem, but for now it’s a pretty big headache.

As time permits (or, when I get the chance to delegate it), I’m planning to try the solution listed on that linked page and see if addthis, facebook, google maps, perhaps even adsense, and even a wufoo form can perhaps be loaded in this async manner. I’ll report the progress here.

Orchard multitenancy configuration

Am now successfully running multiple sites on a single instance of Orchard (this one). Can’t really divulge what they are, but I will comment on the configuration- when making a new tenant, make sure you have no spaced in the name. It doesn’t fail immediately, but does a few steps later. The solution requires – 1. shut down the orchard website instance 2. open the tenants subfolder in the app_data and find the offending folder with spaces in the name, and delete it. 3. restart the website.

Note that even if you abandon an existing “spaces in name” corrupted attempt, it will still blow up every time you try to create a new one until this is resolved. And, if you don’t shut down the site first, it will keep recreating this messed up folder. fun times.  

torsion bar valve springs

When I’m running, I get lots of weird ideas. Today, I thought, why not use torsion bars for valve springs in engines, instead of the usual coil spring? Benefits should include- less moving mass, adjustable pre-load, and… well that’s all.

So, this falls into the “new-old” ideas category – apparently was done as far back as the 50’s- even this clunker had them – http://en.wikipedia.org/wiki/Panhard_Dyna_Z

And some F1 cars and bikes have used them with good effect. So, good new-old idea 😉

If you can read this…

Site is moved over to new server, and running on orchard 1.0 now.

Porting was a bit painful – i used the orchard blogml module to export posts from the old server, and then import to this new one. Worked great, except that tags were mangled up. After tinkering a bit, i just dozed through and fixed the tags on all the posts. Fortunately not that many to fix.

So now to see what all orchard 1.0 can do.