Posted by Sam on Apr 21, 2008 at 12:00 AM UTC - 6 hrs
I've been working on a couple of .NET projects lately. Maybe you could tell from a couple of my whinings (I won't call them rants), but I'm not entirely sure of what I'm doing yet.
I'm finding that I'm working against the platform. .NET and I are butting heads, and although I'm getting work done, I can't imagine it is really as hard or time-consuming as my initial experience has been.
Some of this is due to the extra ceremony .NET adds as a tax on you and your development time. Most of it's due to my ignorance. I've been honest about that: my ignorance of the overall strategies and thought-processes present in .NET takes full credit for most of my pain.
I've known for a while that I need to read something to "get in the know," and I've been putting it off until I had time. Thanks to a conversation with another developer (who shall remain nameless, unless he tells me he wants credit) this morning, I've decided now is the time.
I'm looking for books that give a strategic overview of .NET. I'm looking for ASP.NET and Windows programming (Windows Forms) to start with. I'd also like to see some strategy guides for Active Directory and Sharepoint. Seeing as I'm sore from fighting so much, a guide for pain-free coding in .NET might also be in order. (I'm going to buy that book since I know the author is a good one.)
I can easily do a search on Amazon for .NET books. O'Reilly has a ton of them. But I don't know what's good or bad or how to tell the difference. Further, except for one person (who shall also remain nameless) I sent an email to this morning, I don't know who to ask.
Well, that's not entirely true. I know there's a crowd of good developers with diverse experiences reading this weblog. So I'm asking you:
What is TFM on .NET? Any suggestions welcome. Short reviews of why it's a good book (or article online) get bonus points.
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Posted by Sam on Mar 24, 2011 at 10:36 AM UTC - 6 hrs
Motivation
I recently decided to cut the cord on cable and downloaded PlayOn to do the job of serving video content from the internet to my Xbox 360 and Wii, so I could watch it on my TV. Naturally, this led me to figure out how it worked, and how I could play around with it.
One thing I immediately wanted to do was improve the organization functionality. I thought I'd start with a plugin that simply takes the media server's location of video output and provides it as input back to the same server, but in a different organization scheme. Unfortunately, that didn't work as PlayOn didn't know what to do with its own URIs as input for a VideoResource in the Lua plugin API.
I didn't want to get into the scraping, transcoding, and serving of files from the internet -- that's already done well and I didn't want to spend all that time creating a media server of my own. But I did want to see better fastforward and rewind capability. To solve that, I thought I'd create a DVR for PlayOn (or TVersity, or any other media server really) and knock out both the organization features I wanted, along with the seek functionality.
Launching a business
This will be my first attempt at launching a money-making venture online (aside from programming for other people's money-making ventures). I don't expect this will turn into a full-time job, nor do I expect I'll make retirement money off of it, but I think it can make a decent return that won't require a ton of ongoing work on my part, and it might make a fun experiment.
More...
Just as well, I thought it could make for some interesting blogging for me, and reading for you. Here's how I plan to begin:
I'm starting with a simple landing page that asks for your email address, telling potential customers we'll let them know when it's ready. Cost: $22.00 or so for the .net and .com domains. Email list is free to start out at MailChimp, and I'll only need to pay them if I generate more than 500 signups and want to email those folks (which of course, I will).
The reason behind the landing page and email list is to gauge interest before I start. Right now I've only tested the technological feasibility of my idea by trying out all the moving parts needed to make it work. It's not all in one code base (some of it isn't even code), and there's no UI to speak of.
If there's a decent amount of interest, then I'll put it all together with an easy to use interface, and I'll probably devote more time to it in the short run. If it looks like me and my tech savvy friends will be the only users, I'll probably still release it, but you might configure it with text files instead of WinForms until I get sick of doing that and build the UI for it later down the line. I'm pretty sure that would be a free version. =)
So by going the landing page + email list route, I only invest a little time and money up front, until I can see what the demand will be like. I seem to remember hearing that dropbox started similarly, and I'm sure I must have heard this tactic mentioned a hundred times on Mixergy, where Andrew Warner interviews entrepreneurs about how they've been successful (and sometimes not-so).
On to pricing: I'm thinking of initially starting it out at a one-time fee of $35 (US), but that may change. More than likely, I'll test different pricing schemes and see what works well. I've got $105 of credit in Google Adwords, and I thought I might use that to do some A/B testing on the signup page. Half of the users would see Test which A might mention the one-time $35 price point, while the other half see Test B, which may be $5 per month. Hopefully, this would inform us as to which one results in more signups to the email list.
However, I decided not to do that at this point. It's just more up front work that has to be put into the idea. Instead, I'll probably wait to see if anyone signs up for the list, then do something similar to test which pricing options are better than others (using the email list instead of the website).
As I mentioned above, the DVR is not ready for public consumption yet, but you can sign up for the email list on MediaServerX if you want to be notified when it's ready.
If this little business experiment generates any action on my part aside from "well that flopped, I give up," I'll keep you updated here on the blog.
Deciding on technology
At first I thought I might like to really dig deep and write something from scratch, so the world was open for me to be cross platform and there were flowers in the fields with unicorns and rainbows.
However, after taking a look at the UPnP spec documents, I realized I didn't really care about that rainbow and what I really wanted was to just write some code.
So I moved on, thinking I'd use Developer Tools for UpNP Technologies to generate the beginnings of a control point. After messing around with it for a little while and reading that Casey Chesnut " would probably try to use the MS stack next time," I decided to go with the UPnP Control Point API that's been included on Windows since Millenium Edition was all the flop.
It seemed like the lowest barrier to entry, which is something I haven't heard in a while about programming and Microsoft.
Code
First I created a solution in Visual Studio and included a reference for the UPnP 1.0 Type Library (Control Point). It can be found by right-clicking on References, then clicking on Add Reference. It's under the COM tab.
To start out doing anything, you can find a UPnP device using the UPnPDeviceFinder class. The code below will find all devices listed as MediaServer:1 (there are also :2 and :3, but I have yet to look into the differences between them).
UPnPDeviceFinder deviceFinder = new UPnPDeviceFinder();
UPnPDevices mediaServerDevices = deviceFinder.FindByType("urn:schemas-upnp-org:device:MediaServer:1", 0);
foreach (UPnPDevice mediaServerDevice in mediaServerDevices)
{
// do something with the UPnPDevice
}
The basic object model consists of a Device Finder (seen above) which can get you a collection of individual devices. Individual devices have a collection of services. A service is what you need to communicate with to control and get information from the device. ( Here is a diagram).
In our case, we want to get the MediaServer's ContentDirectory service to give us a list of ContentDirectories and their children.
UPnPService cdService = mediaServerDevice.Services["urn:upnp-org:serviceId:ContentDirectory"];
Now that you have the content directrory service, you can invoke actions on it. For example, to see what it contains you can use the browse service:
string browseFlag = "BrowseDirectChildren"; // BrowseDirectChildren or BrowseMetadata as allowed values
string filter = "";
int startingIndex = 0;
int requestedCount = 1000;
string sortCriteria = "";
object[] inArgs = new object[6];
inArgs[0] = objectID; // use 0 for root
inArgs[1] = browseFlag;
inArgs[2] = filter;
inArgs[3] = startingIndex;
inArgs[4] = requestedCount;
inArgs[5] = sortCriteria;
object outArgs = new object[4];
cdService.InvokeAction("Browse", inArgs, ref outArgs);
object[] resultobj = (object[])outArgs;
string result;
int numberReturned;
int totalMatches;
int updateID;
result = (string) resultobj[0];
numberReturned = (int)(UInt32) resultobj[1];
totalMatches = (int)(UInt32) resultobj[2];
updateID = (int)(UInt32) resultobj[3];
This where it really starts to get wieldy. I find it a complete PITA to be sending and receiving basic object s and casting them back and forth to their desired types. The result string ensures more fun searching through XML to get what you want. It's nothing we want to be doing throughout our source code, because it's a ton of noise to sort through.
Side note: Setting the objectID to 0 will get you the root element. After that, the results report back their IDs so you can use what it returns. That took me forever to find out, so hopefully it will save you some time.
Obviously, this sort of hassle calls for some abstraction, so I began writing a wrapper library. So far it works through everything I've shown above, and includes a sample project showing how to use it.
Source code: upnplib-mediaserver-wrapper
It's a Visual Studio 2008 solution with 2 projects: the upnplib-mediaserver-wrapper is the library, and example-upnp-mediaserver-browser is an example of how to use the library. You'll need to set that one up as your startup project for it to run. I'd have guessed it would be in the .sln file but it's not, and I don't want to include my user-specific settings in the source control.
Let me know if you're interested in seeing it become more complete.
If you're a fan of PlayOn or TVersity and want a DVR service, click the preceding link to sign up and be notified when it's ready.
As always, I'd love to hear your thoughts or questions on the subject.
Last modified on Mar 24, 2011 at 10:38 AM UTC - 6 hrs
Posted by Sam on Mar 03, 2009 at 12:00 AM UTC - 6 hrs
A while ago, I was working with a problem in C# where where our code would get deadlocked, and since someone must die or several must starve, I thought it
would be nice to just toss a "try again if deadlocked"
statement into the exception handler. I muttered this thought on twitter to
see if there was any language with such a try-catch-try-again-if construct.
More...
A couple of my tweeps responded with what we we're used to using: loops.
Another two mentioned redo in Ruby.
redo is certainly a cool construct (and underused), but it doesn't do what I want
it to:
begin
raise from_the_dead
rescue
redo
end
Ruby responds, "tryredo.rb:35: unexpected redo." As you might know, you need to use a loop:
class Zombie
def initialize
@starving = true
@last_feeding = DateTime.new
end
def eat(bodypart)
@starving = (DateTime.now - @last_feeding) * 10_000_000 > 3
starving_enough_to_reconsider = @starving && rand > 0.5
unless starving_enough_to_reconsider || bodypart == "braaaiiinzzz"
raise "Zombies don't like #{bodypart}"
end
puts "Mmmmm... #{bodypart}"
@starving = false
@last_feeding = DateTime.now
end
end
zombie = Zombie.new
["feet", "stomach", "intestines", "braaaiiinzzz"].each do |bodypart|
begin
zombie.eat bodypart
sleep 1
rescue
puts $!
redo
end
end
So I'll ask to this larger audience:
Suppose I have a zombie who only really likes eating braaaiiinzzz. Most of the time, he gets exactly
what he wants. But every so often, we try to feed him some other body part. Now, if he's really hungry, he
eats it. We might only have fingers available at the time, so I want
to try to feed him fingers again until brains are available or until he's hungry enough to eat the fingers.
I know that conceptually this is just a loop even if we don't explicitly code it. But does your language have a
try again ? What do you think the merits or demerits of such an approach would be? Is it just a harmful
goto ?
My zombie is hungry and waiting. Rather impatiently I might add.
Posted by Sam on Jan 16, 2008 at 07:04 AM UTC - 6 hrs
Something's been bugging me lately about ASP.NET: I can't seem to remember to type runat="server" every time I write a line of code to display a server control.
For normal HTML elements, I understand the necessity of using the attribute when you want that element to be tied to the server.
But I can't seem to figure out any other way to run a control that's been prefixed with the namespace asp .
So why does ASP.NET require such a silly, useless bit of text for everything it does?
I can think of three reasons:
More...
- Initially, Microsoft envisioned the controls running in several places: perhaps the browser, a printer, or a zoo. But three and a half major versions in, we're still required to pass the same attribute with the same value for every control. Couldn't they drop the requirement and make it a default if they decided to add more valid values?
- They wanted a constant reminder to novices that this code was running on the server. This way, people wouldn't ask why changes weren't occurring on the browser before posting forms to the server.
-
They wanted to remain consistent in having to tell the computer everything at least twice, à la
Object obj = new Object(); . However, in this case, it seems more like Object obj = new Object(type="Object"); . I'm not sure why that is.
Can you think of any other possible reasons? Please enlighten me, so I can forgive and forget this minor annoyance.
Last modified on Jan 16, 2008 at 07:06 AM UTC - 6 hrs
Posted by Sam on Jan 07, 2008 at 06:42 AM UTC - 6 hrs
A note to myself (a .NET neophyte) and others who may not know how ASP.NET works:
I was writing a user control (we'll call it ContentBoxVariation ) in ASP.NET which composes another ( ContentBox ). Both have a public property Title , with getters and setters.
You might call ContentBoxVariation in an .aspx page like this:
More...
<aNamespace:ContentBoxVariation" ID="ContentBoxVariation1" Title="Welcome to Sam's" runat="server"/>
Then ContentBoxVariation includes ContentBox like this:
<aNamespace:ContentBox ID="ContentBox1" Title="<%=Title%>" runat="server"/>
You might think that the ContentBoxVariation would pass it's Title to the ContentBox , and that the result would be "Welcome to Sam's."
Unfortunately, it does pass it's title, but the title hasn't been changed from its default of "" at the time it happens. As far as I can tell, the instantiation happens in this order:
- Instantiate
ContentBoxVariation
- Instantiate the composed
ContentBox
- Set
ContentBox 's Title to the variation's title, which is currently "". Even if setting it to a different variable, it seems to stay blank as if that variable doesn't exist, even though it does and no error occurs.
- Set the variation's title.
The order makes sense if you are looking at it like that, but being in templates and looking at it from that point of view, it is surprising.
The solution is to explicitly set the title for ContentBox in code, like this:
<%
ContentBox1.Title = this.Title;
%>
Hopefully that saves someone some time.
Last modified on Jan 07, 2008 at 06:43 AM UTC - 6 hrs
Posted by Sam on Nov 22, 2007 at 12:04 PM UTC - 6 hrs
Since the gift buying season is officially upon us, I thought I'd pitch in to the rampant consumerism and list some of the toys I've had a chance to play with this year that would mean fun and learning for the programmer in your life. Plus, the thought of it sounded fun.
Here they are, in no particular order other than the one in which I thought of them this morning:
More...
- JetBrains' IntelliJ IDEA: An awesome IDE for Java. So great, I don't mind spending the $249 (US) and using it over the free Eclipse. The Ruby plugin is not too shabby either, the license for your copy is good for your OSX and Windows installations, and you can try it free for 30 days. Martin Fowler thinks IntelliJ changed the IDE landscape. If you work in .NET, they also have ReSharper, which I plan to purchase very soon. Now if only we could get a ColdFusion plugin for IntelliJ, I'd love it even more.
- Programming Ruby, Second Edition: What many in the Ruby community consider to be Ruby's Bible. You can lower the barrier of entry for your favorite programmer to using Ruby, certainly one of the funner languages a lot of people are loving to program in lately. Sometimes, I sit and think about things to program just so I can do it in Ruby.
If they've already got that, I always like books as gifts. Some of my
favorites from this year have been: Code Complete 2, Agile Software Development: Principles, Patterns, and Practices which has a great section on object oriented design principles, and of course,
My Job Went to India.
I have a slew of books I've yet to read this year that I got from last Christmas (and birthday), so I'll have to
list those next year.
-
Xbox 360 and a subscription to
XNA Creator's Club (through Xbox Live Marketplace - $99 anually) so they can deploy their games to their new Xbox. This is without a
doubt the thing I'd want most, since I got into this whole programming thing because I was interested
in making games. You can point them to the
getting started page, and they could
make games for the PC for free, using XNA (they'll need that page to get started anyway, even if you
get them the 360 and Creator's Club membership to deploy to the Xbox).
-
MacBook Pro and pay for the extra pixels. I love mine - so much so,
that I intend to marry it. (Ok, not that much, but I have
been enjoying it.)
The extra pixels make the screen almost as wide as two, and if you can get them an extra monitor I'd do
that too. I've moved over to using this as my sole computer for development, and don't bother with
the desktops at work or home anymore, except on rare occasions. You can run Windows on it, and the
virtual machines are getting really good so that you ought not have to even reboot to use either
operating system.
Even if you don't want to get them the MacBook, a second or third monitor should be met with enthusiasm.
-
A Vacation: Programmers are notoriously working long hours
and suffering burnout, so we often need to take a little break from the computer screen. I like
SkyAuction because all the vacations are package deals, there's often a good variety to choose from (many
different countries), most of the time you can find a very good price, and usually the dates are flexible
within a certain time frame, so you don't have to commit right away to a certain date.
Happy Thanksgiving to those celebrating it, and thanks to all you who read and comment and set me straight when I'm wrong - not just here but in the community at large. I do appreciate it.
Do you have any ideas you'd like to share (or ones you'd like to strike from this list)?
Last modified on Nov 22, 2007 at 12:04 PM UTC - 6 hrs
Posted by Sam on Nov 19, 2007 at 04:09 PM UTC - 6 hrs
String fullName = new StringBuilder().Append(firstName + " " + middleName + " " + lastName).ToString();
Posted by Sam on Oct 31, 2007 at 04:26 PM UTC - 6 hrs
When looping over collections, you might find yourself needing elements that match only a certain
parameter, rather than all of the elements in the collection. How often do you see something like this?
foreach(x in a)
if(x < 10)
doSomething;
Of course, it can get worse, turning
into arrow code.
More...
What we really need here is a way to filter the collection while looping over it. Move that extra
complexity and indentation out of our code, and have the collection handle it.
In Ruby we have each
as a way to loop over collections. In C# we have foreach , Java's got
for(ElemType elem : theCollection) , and Coldfusion has <cfloop collection="#theCollection#">
and the equivalent over arrays. But wouldn't it be nice to have an each_where(condition) { block; } or
foreach(ElemType elem in Collection.where(condition)) ?
I thought for sure someone would have implemented it in Ruby, so I was surprised at first to see this in my
search results:
However, after a little thought, I realized it's not all that surprising: it is already incredibily easy to filter
a collection in Ruby using the select method.
But what about the other languages? I must confess - I didn't think long and hard about it for Java or C#.
We could implement our own collections such that they have a where method that returns the subset we are
looking for, but to be truly useful we'd need the languages' collections to implement where
as well.
Of these four languages, ColdFusion provides both the need and opportunity, so I gave it a shot.
First, I set up a collection we can use to exercise the code:
<cfset beer = arrayNew(1 )>
<cfset beer[1] = structNew()>
<cfset beer[1].name = "Guiness" >
<cfset beer[1].flavor = "full" >
<cfset beer[2] = structNew()>
<cfset beer[2].name = "Bud Light" >
<cfset beer[2].flavor = "water" >
<cfset beer[3] = structNew()>
<cfset beer[3].name = "Bass" >
<cfset beer[3].flavor = "medium" >
<cfset beer[4] = structNew()>
<cfset beer[4].name = "Newcastle" >
<cfset beer[4].flavor = "full" >
<cfset beer[5] = structNew()>
<cfset beer[5].name = "Natural Light" >
<cfset beer[5].flavor = "water" >
<cfset beer[6] = structNew()>
<cfset beer[6].name = "Boddington's" >
<cfset beer[6].flavor = "medium" >
Then, I exercised it:
<cfset daytypes = ["hot" , "cold" , "mild" ]>
<cfset daytype = daytypes[randrange(1 ,3 )]>
<cfif daytype is "hot" >
<cfset weWantFlavor = "water" >
<cfelseif daytype is "cold" >
<cfset weWantFlavor = "full" >
<cfelse>
<cfset weWantFlavor = "medium" >
</cfif>
<cfoutput>
Flavor we want: #weWantFlavor#<br/> <br/>
Beers with that flavor: <br/>
<cf_loop collection="#beer#" item="aBeer" where="flavor=#weWantFlavor#" >
#aBeer.name#<br/>
</cf_loop>
</cfoutput>
Obviously, that breaks because don't have a cf_loop tag. So, let's create one:
<!--- loop.cfm --->
<cfparam name="attributes.collection" >
<cfparam name="attributes.where" default = "" >
<cfparam name="attributes.item" >
<cfif thistag.ExecutionMode is "start" >
<cfparam name="isDone" default="false" >
<cfparam name="index" default="1" >
<cffunction name="_getNextMatch" >
<cfargument name="arr" >
<cfloop from="#index#" to="#arrayLen(arr)#" index="i" >
<cfset keyValue = attributes.where.split("=" )>
<cfset index=i>
<cfif arr[i][keyValue[1]] is keyValue[2]>
<cfreturn arr[i]>
</cfif>
</cfloop>
<cfset index = arrayLen(arr) + 1>
<cfexit method="exittag" >
</cffunction>
<cfset "caller.#attributes.item#" = _getNextMatch(attributes.collection,index)>
</cfif>
<cfif thistag.ExecutionMode is "end" >
<cfset index=index+1>
<cfset "caller.#attributes.item#" = _getNextMatch(attributes.collection,index)>
<cfif index gt arrayLen(attributes.collection)>
<cfset isDone=true>
</cfif>
<cfif not isDone>
<cfexit method="loop" >
<cfelse>
<cfexit method="exittag" >
</cfif>
</cfif>
It works fine for me, but you might want to implement it differently. The particular area of improvement I
see right away would be to utilize the item name in the where attribute. That way,
you can use this on simple arrays and not just assume arrays of structs.
Thoughts anybody?
Last modified on Oct 31, 2007 at 04:29 PM UTC - 6 hrs
Posted by Sam on Oct 26, 2007 at 08:53 AM UTC - 6 hrs
I just wanted to highlight a couple of interesting ideas I saw on InfoQ this morning:
- Somewhat-open classes in Java: I hadn't known about JavaRebel until now, but it looks interesting. It sounds as if you can do open-class type things, but they don't seem to market it on that aspect - instead, they focus on the time it saves you by not having to "redeploy or restart."
-
That sounds quite a lot like another language where you're working in the abstract syntax tree itself. So I found it good timing that InfoQ also mentioned several implementations-in-the-works of Lisp on the .NET platform. Hey Grant, why don't you join one of those teams?
Do I have any votes for polyglot programming?
Posted by Sam on Oct 16, 2007 at 09:11 AM UTC - 6 hrs
Like many of you,
I got into programming because I wanted
to make games as a kid.
It was around the time games started looking better and being more complicated than
Wolfenstein 3-D that
I started thinking I'd never be able to make a game. Sure, I could do Tetris or
Minesweeper, but how in the world could I ever match the game play and graphics of a
Quake or Diablo.
Let's not even get started with
Halo 3 and Call of Duty.
More...
It seems you need an army of programmers to make even a decent game now.
But then people started releasing game-development frameworks that could help you get past the
technical hurdles. However, by the time I thought about something like that
(or had the capacity to think it) I had almost
long forgotten about my dream to make games.
And even if you're using a framework, what do you do about the monetary hurdles?
A computer to program on is one thing,
but where would you find the cash for a good 3D modeling studio? What if you wanted to
deploy to a console? That license is in the tens of thousands of dollars (or so I've heard).
But as some of you have known for a while, and I only found out as recently as August, Microsoft
is helping to solve those problems. They've released the XNA framework, which lets you deploy to
XBOX 360 or PC ( Developer Center,
Creators Club, XNA Team Blog).
I'm only three weeks in and I've got quite a decent start for a game. It's
cartoon-like, so it doesn't require the type of art you'd find in Gears of War
(though I could still use the help of a 3d modeler
if you're offering). It works mostly how I want it to, and I need
only a few tweeks. Most importantly, I've got a nice framework written
that allows me to add levels and new game objects with relative ease (not WYSIWYG just yet, but that
might happen at some point in the distant future).
So that only leaves the soundtrack.
Unless you don't plan to distribute your game, licensing songs may still be an prohibitive issue
(barring that you're good at making your own on the computer,
and have a good sound-editor to do it). For that, I'm trying to get the band back together over the winter
to record an impromptu soundtrack. Getting back in the studio with those guys
would be reward enough, but I'll have a game to go with it. Thanks XNA!
As always, thoughts are appreciated. I'd especially
like to hear from you if you know or are a member of
any community where free(ish) 3D models and textures are available.
Last modified on Oct 16, 2007 at 09:12 AM UTC - 6 hrs
Posted by Sam on Oct 10, 2007 at 03:39 PM UTC - 6 hrs
Here's a WTF I ran into the other day (partially pseudocode):
XmlDataDocument goto = new XmlDataDocument();
goto.Load(".\\locations.xml");
XmlNode gotoThisUrl;
if(referer == "http://www.someplace.com/directory1")
{
gotoThisURL = goto.SelectSingleNode("gotoOnDirectory1");
}
else if (referer == "http://www.someplaceelse.com/directory2")
{
gotoThisURL = goto.SelectSingleNode("gotoOnDirectory2");
}
Response.Redirect(gotoThisURL.InnerText.Trim(), true);
It was actually a bit more complex than that (probably 3x as many lines), but with the same purpose. There were literally two places from which to choose to direct the request. And no, the application wouldn't take incredibly long to compile. I felt like it was quite a bit of overkill.
Last modified on Oct 10, 2007 at 03:49 PM UTC - 6 hrs
Posted by Sam on Sep 25, 2007 at 06:39 AM UTC - 6 hrs
The last bit of advice from Chad Fowler's 52 ways to save your job was to be a generalist, so this week's version is the obvious opposite: to be a specialist.
The intersection point between the two seemingly disparate pieces of advice is that you shouldn't use your lack of experience in multiple technologies to call yourself a specialist in another. Just because you
develop in Java to the exclusion of .NET (or anything else) doesn't make you a Java specialist. To call yourself that,
you need to be "the authority" on all things Java.
More...
Chad mentions a measure he used to assess a job candidate's depth of knowledge in Java: a question of how to make the JVM crash.
I'm definitely lacking in this regard. I've got a pretty good handle on Java, Ruby, and ColdFusion. I've done a small amount of work in .NET and have been adding to that recently. I can certainly write a program that will crash - but can I write one to crash the virtual
machine (or CLR)?
I can relunctantly write small programs in C/C++, but I'm unlikely to have the patience to trace through a large program for fun. I might even still be able to figure out some assembly language if you gave me enough time. Certainly in these lower level items it's not hard to find a way to crash. It's
probably harder to avoid it, in fact.
In ColdFusion, I've crashed the CF Server by simply writing recursive templates (those that cfinclude themselves). (However, I don't know if that still works.) In Java and .NET, I wouldn't know where to start. What about crashing a browser with JavaScript?
So Chad mentions that you should know the internals of JVM and CLR. I should know how JavaScript works in the browser and not just how to getElementById() . With that in mind, these things are going on the to-learn list - the goal being to find a way to crash each of them.
Ideas?
Last modified on Sep 25, 2007 at 06:41 AM UTC - 6 hrs
Posted by Sam on Jun 11, 2007 at 08:38 AM UTC - 6 hrs
For the dynamic language weenies (or otakus!), we have John Lam's Getting Started with the DLR: ToyScript. John is the driving force behind IronRuby, and the post provides a link to download ToyScript, "a quick starter kit for folks interested in building languages on top of the DLR."
Also we've got Visual Studio Shell, which InfoQ reckons will compete with Eclipse. Will be kind of cool to see what pops up on that front.
News courtesy of InfoQ: ( ToyScript/DLR and VS Shell)
Posted by Sam on Jun 11, 2007 at 07:50 AM UTC - 6 hrs
Don't forget to (learn how to) unit test it using XMLUnit.
Posted by Sam on Jun 11, 2007 at 07:36 AM UTC - 6 hrs
I take my second weekend in a row (mostly) off of a computer, and look at all the cool things happening!
Adobe releases AIR (previously known as Apollo) and Flex 3 public beta, both products have been on my list of things to do for quite some time, still with no action taken.
Ruby ( MRI) released bug fixes in version 1.8.6.
JRuby officially went 1.0 (though it has yet to be posted to the website as I write this). And Ruby.NET released version 0.8 (IronRuby uses its scanner and parser, according to the article -- and this happened a couple of days before the weekend).
More...
For web developers, InfoQ let us know about Browser Shots, which is a service that will test your web sites in tons of different browsers and present screen shots to you. It lets you choose whether to enable Flash, Javascript, or certain media players, and allows you to set the color depth and screen resolution. It's quite slow at the moment (set it and come back in four hours or so), but it shows us what can be possible! ( Screenshots of codeodor.com, as they are coming in more will pop up)
Also, InfoQ completed its first official year. It was "pre-released" (I forget the exact term they used) I think in May 2006, but it went officially live a year ago Friday. Congrats to Floyd Marinescu and the entire InfoQrue! (And they have a lot of relevant news (to me) I'll be posting links to today)
Last modified on Jun 11, 2007 at 08:29 AM UTC - 6 hrs
Posted by Sam on May 29, 2007 at 07:14 AM UTC - 6 hrs
Often when we make a change to some code, if it is not properly designed, the result is that cascading changes need to be done throughout the application because bugs will ripple through the system. That's one of the ideas behind why we want to have low coupling between classes. We also have unit testing to combat the effects of this, but let's just suppose we haven't written any, and haven't used JUnit Factory to create regression tests.
Given that there is a lot of code out there that isn't quite perfect, wouldn't it be nice to have a tool that could analyze changes and where they would affect other code? I can imagine how such a tool might work, but I haven't heard of one before now (that I recall, anyway).
So the point of it all: I heard something about BMC and IBM teaming up on such a tool (my understanding is that BMC started it, and IBM later joined the project). I'm assuming it'd be in Java, but does anyone have information on this? Can anyone confirm or deny the story I heard?
Last modified on May 29, 2007 at 07:15 AM UTC - 6 hrs
Posted by Sam on May 20, 2007 at 08:04 AM UTC - 6 hrs
What if we had functions compile(String sourceCode) and runCompiled(BinaryData compiledCode) ? What could you do with it? Could it act as a closure, and bring really dynamic coding to traditionally static languages, perhaps allowing dynamically named variables and functions to languages without them (and much more!)? Could we store our code in a database and mix and match chunks, building programs based on a SQL query?
What do you think? Useful or useless?
Posted by Sam on May 19, 2007 at 01:25 PM UTC - 6 hrs
Peter Bell's presentation on LightWire
generated some comments I found very interesting and thought provoking.
(Perhaps Peter is not simply into application generation, but comment generation as well.)
The one I find most interesting is brought up by several people whose opinions I value -
Joe Rinehart, Sean Corfield,
Jared Rypka-Hauer, and others during and after the presentation.
That is: what is the distinction between code and data, and specifically, is XML code or data
(assuming there is a difference)?
More...
The first item where I see a distinction that needs to be made is on, "what do we mean when we are talking about
XML?" I see two types - XML the paradigm where you use tags to describe data, and the XML you write - as in,
the concrete tags you put into a file (like, "see that XML?"). We're talking about XML you've written, not
the abstract notion of XML.
The second idea: what is code? What is data? Sean Corfield offers what I would consider to be a concice,
and mostly correct definition: "Code executes, non-code (data) does not execute." To make it correct (rather
than partially so), he adds that (especially in Lisp) code can be data, but data is not code. You see this
code-as-data any time you are using closures or passing code around as data. But taking it a bit further -
your source code is always just data to be passed to a compiler or interpreter, which figures out what the
code means, and does what it has been told to do.
So is XML code? Certainly we see it can be: ColdFusion, MXML, and others are languages where your
source code is written (largely) in XML. But what about the broader issue of having a programmatic
configuration file versus a "data-only" config file?
Is the data in the config file executable? It depends on the purpose behind the data. In the case of data
like
<person>
<name>
Bill
</name>
<height>
4'2"
</height>
</person>
I think (assuming there is nothing strange going on) that it is clearly data. Without knowing anything about the
back end, it seems like we're just creating a data structure. But In the case of
DI (and many others uses for config files),
I see it as giving a command to the DI framework to configure a new bean. In essence, as Peter notes,
we've just substituted one concrete syntax for another.
In the case of XML, we're writing (or using)
a parser to send data to an intepreter we've written that figures out what "real" commands to run based on
what the programmer wrote in the configuration file. We've just created a higher level language than we had before
- it is doing the same thing any other non-machine code language does (and you might even argue
about the machine code comment). In the configuration case,
often it is a DSL (in the DI case specifically, used to describe which objects depend on which other
objects and load them for us).
While we don't often have control structures, there is nothing stopping us from implementing them,
and as Peter also notes, just because a language is not
Turing complete), doesn't mean it is not
a programming language. In the end, I see it as code.
Both approaches are known to have their benefits and drawbacks, and choosing one over the other is largely a matter
of personal taste, size and scope of problem, and problem/solution domain. For me, in the worlds of
JIT compiling and interpreted langages, the programmatic way
of doing things tends to win out - especially with large configurations because I prefer to have
the power of control structures to help me do my job (without having to implement them myself).
On the other hand, going the hard-coded XML route is especially popular in the compiled world, if not
for any other reason than you can change configurations without recompiling your application.
I don't make a distinction between the two on terms of XML is data, while programming (or using an in-language DSL)
in your general-purpose language is code. To me, they are both code, and if either is done incorrectly it will
blow-up your program.
Finally, I'm not sure what value we gain from seeing that code is data (and in many cases config data is code),
other than perhaps a new way of looking at problems which might lead us to find better solutions.
But that isn't provided by the distinction itself, just the fact that we saw it.
Comments, thoughts, questions, and requests for clarifications are welcome and appreciated.
Posted by Sam on May 07, 2007 at 09:53 AM UTC - 6 hrs
A couple of days ago, InfoQ reported on Jasper, an ORM for .NET (available here).
One of the things I never liked about .NET (or VC++ before that) were the reams of code it would generate. Of course, that's better than just hand coding everything, but it was a hassle to keep up with. It contributed to this vicious cycle where I never knew how anything worked, had horrible God-Classes, and had access to the code it generated which meant that sometimes I needed to know how some of it worked, but never took the time to learn (which may have taught me how it worked if I had used it correctly!). Of course, I was young, conceited, and generally "unconsciously incompetent" about programming back then (has anything changed? =) ). In any case, they are starting to implement the idea of synthesis, and it shows why run-time generation (what I keep calling synthesis) really trumps generating code in files.
It doesn't yet work in C#, but I would expect as they keep adding dynamic features to the platform, it eventually will.
|
Me
|