Apart from linq, this extension saves me more time than any other syntactic sugar.
public static class Extension { public static bool Like(this string str, string str1) { if (String.IsNullOrEmpty(str) || String.IsNullOrEmpty(str1 )) return (String.IsNullOrEmpty(str) && String.IsNullOrEmpty(str1)); else return str.Equals(str1, StringComparison.InvariantCultureIgnoreCase); } }
Usage is simple.
instead of having to write:
if (str.Equals(str1, StringComparison.InvariantCultureIgnoreCase))
you can write
if (str.like(str1))
And not have to worry about null exceptions.
Enjoy!
When you experiment with materials, even just play with them, their properties expand your outlet for creative expression. This doesn’t happen when you simply watch them on TV, you need to really use them to learn their characteristics, how they bend, stretch, stick, reflect, and sound. Such is the case with cardboard, spray adhesive, tinfoil and tape. I’ve used these ingredients to build several DIY ringlights and Tent Soft boxes.
So here is new twist, a light mod that sprays light out like a star against a wall. The basic construction is a strip of card with slits in it wrapped in a ‘U’ shape surrounding a toilet roll coated in foil with a flash mount made of popsicle sticks. The band-aid wrapper is the result of using my finger to guide the leatherman saw blade (not all experiments are a success).
A good test of a web framework is to see how it handles select boxes. It requires managing the list, the selected item across several states, be easily styled, be easily ajax-ed, and connect to a data store.
I like using Enums for static data, but they are a bit limited without a description value, you end up with select options labeled “ItemName ” instead of ”Human Friendly Item Name”.
Binding an enum to a dropdown is well documented. Adding descriptions to enums is also well documented. Here is a way to have enums with descriptions into a dropdown.
Your Enum
The Razor
This function will turn your enum into an IEnumerable<SelectListItem>
Of course shortly after finishing this I found a great post on StackOverflow about making html helpers which results in an even prettier finish in razor, but requires a few extra helpers.
Ever used the definition list tag? Me neither, yet it’s fully supported in all the browsers.
turns into this:
From w3schools: “ The <dl> tag defines a definition list. The <dl> tag is used in conjunction with <dt> (defines the item in the list) and <dd> (describes the item in the list).”
Well now i’ve used it.
CORS was really part of the inspiration for ServerCyde. AJAX is cool, it lets you make the web more responsive, but it only connects to the site that you built. If you wanted to consume the services of a third party then you would have to proxy it over your server or compromise on the functionality that you can offer. As more and more digital services get turned into API services (life graphs, url minification, image manipulation, data storage…) browsers will evolve to allow greater interconnectedness without sacrificing security. Right now each browsing is either trying their own implementation out (is it netscape vs IE all over again) or at some stage op implementing CORS standards, or web sockets. In the mean time I wanted a solution that worked now and supported all of the HTTP verbs so I had to implement one myself.
What it came down to was simple enough. Hidden iFrames and window.href polling. You see, when you open a site in an iframe the parent can only read the URL if the domains match. So what i did was have my server redirect back to your domain with a token in the URL that you could use to make a plain JSONP request for the data. This model, works in every browser, lets you POST with cookies, and even allows a connection to stay open for a COMET implementation.
You can check it out in action here: http://servercyde.com/Developers/
Get the code from GitHub here: https://github.com/easymovet/ServerCyde/wiki
And see a presentation of it’s implementation, that I delivered to JavascriptMN at Refactr in November.
Do you think that you could tell the difference in the work of a mechanic using a thumb adjustable wrnch vs. one using a voice activated wrench? Better yet, could you tell if a painting was done with a horse hair bush or a cow hair brush? The same is true for photography. I’ve seen creative genius take better photos with an iPhone than I’ll probably ever get with my percision engineered German glass wielding 21megapixel beast of a camera. Why? Not because I’m not a creative genius (Ii’m not) and not because I don’t go to pretty places (I do). I don’t get as great an image because most of the time i’m a pervert, that is to say, I spend more time fantasizing about the technical aspects of the equipment than actually using it. It’s a bad habit, I know, and I’m working on it. It’s not entirely my fault, I’m just a victim of marketing that has taught me to obsess about my tools so that I buy better ones.
So now that you know that I know that equipment doesn’t translate into the quality of a product (I’ve built better websites using my phone than my friend could build on his MBPro). We can indulge in the relative (and insanely marginal) differences between camera companies. Actually I’ve changed my mind, this post has made me realize that if I really want to break the habit and start taking better pictures then I have to stop being a perv. The end. Go take some pictures with whatever camera you have. Go paint even if all you have is a wall and some crayons (unless you are my kids, then do not color the wall please.) Go write a book, you don’t need a better typewriter, you don’t need a sharper pencil, you need to write. Now.
Quick reviews on some lenses i have played with lately:
Nikon 70-200mm f/2.8G ED-IF AF-S VR Zoom Nikkor Lens for Nikon Digital SLR Cameras
Bought: $1300
Sold: $1670
Usage:
This lens is a head turner, it’s also built to last. Rubber bumper on the front, metal latch for the hood, tripod mount has 2 holes, either for better balance with different weight bodies or use of tubes or simply when one wears out. Focus is perfect, not as fast as Canon but deadly accurate.
Image Quality
I’ve noticed a trend with the newer lenses, I think a side effect of asynchronous lenses, the transition from sharp to bokeh is unnatural looking. This lens doesn’t have that. IQ is as good as it gets, really.
GassApp: Tracks your fuel consumption and expense on a monthly basis derived from info at each fill up at the pumps.While the Samsung Vibrant that my wife has is technically superior to my Nexus One, it’s not a better phone.
It has become clear to me now that the dichotomy of computing devices (eg: apple vs. PC) is a relic of geeks like me being resistant to change, a case of the early adopters failure to adopt. There was a certain pride in being the only one who knew how to reinstall windows for my Mom and find all of the drivers for her pervasive yet poorly supported peripherals, why would i want to let that joy in labor be lost?
I’ve seen the light, it’s crafted from a single billet of aluminum and bears a glowing symbol of wholesomeness and the future. It doesn’t allow multitasking, it can’t get viruses* and it is really well marketed. I’d like to apologize to folks who may have been deterred by my counsel to cling to open platforms with less DRM and a larger choice of third party software. So from now on:
I will be using a Mac.