Lessons of the Square Watermelon

This article is original from http://www.financialhack.com/lessons-of-the-square-watermelon/.

 

Japanese grocery stores had a problem. They are much smaller than their US counterparts and therefore don’t have room to waste. Watermelons, big and round, wasted a lot of space. Most people would simply tell the grocery stores that watermelons grow round and there is nothing that can be done about it. That is how I would assume the vast majority of people would respond. But some Japanese farmers took a different approach. If the supermarkets wanted a square watermelon, they asked themselves, “How can we provide one?” It wasn’t long before they invented the square watermelon.

 

 

The solution to the problem of round watermelons wasn’t nearly as difficult to solve for those who didn’t assume the problem was impossible to begin with and simply asked how it could be done. It turns out that all you need to do is place them into a square box when they are growing and the watermelon will take on the shape of the box.

This made the grocery stores happy and had the added benefit that it was much easier and cost effective to ship the watermelons. Consumers also loved them because they took less space in their refrigerators which are much smaller than those in the US meaning that the growers could charge a premium price for them.

the square watermelon

What does this have do with anything besides square watermelons? There are a few lessons that can you can take away from this story which help you in all parts of your life. Here are a few of them:

 

Don’t Assume: The major problem was that most people had always seen round watermelons so they automatically assumed that square watermelons were impossible before even thinking about the question. Things that you have been doing a certain way your entire life have taken on the aura of the round watermelon and you likely don’t even take the time to consider if there is another way to do it. Breaking yourself from assuming this way can greatly improve your overall life as you are constantly looking for new and better ways to do things. This was one of the most difficult things for me to do because most of the assumptions I make, I don’t even realize that I’m making them. They seem perfectly logical on the surface, so I have to constantly make an effort to question them.

Question habits: The best way to tackle these assumptions is to question your habits. If you can make an effort to question the way you do things on a consistent basis, you will find that you can continually improve the way that you live your life. Forming habits when they have been well thought out is usually a positive thing, but most of us have adopted our habits from various people and places without even thinking about them. I have changed a large number of habits that I have had after taking the time to question them and continue to do so. Some of them I have know idea where they came from while others I can trace to certain people or instances in my life. It’s a never ending process, but by doing this, you can consistently strive toward making all aspects of your life more enjoyable instead of defaulting to what you have now.

Be creative: When faced with a problem, be creative in looking for a solution. This often requires thinking outside the box. Most people who viewed this question likely thought they were being asked how they could genetically alter water melons to grow square which would be a much more difficult process to accomplish. By looking at the question from an alternative perspective, however, the solution was quite simple. Being creative and looking at things in different ways in all portions of your live will help you find solutions to many problems where others can’t see them. I am not a creative person, but I’ve found that the more that you look at things from different perspectives, the more creative I have become. It’s a learned art and builds upon itself.

Look for a better way: The square watermelon question was simply seeking a better and more convenient way to do something. The stores had flagged a problem they were having and asked if a solution was possible. It’s impossible to find a better way if you are never asking the question in the first place. I try to ask if there is a better way of doing the things that I do and I constantly write down the things I wish I could do (but currently can’t) since these are usually hints about steps I need to change. Get into the habit of asking yourself, “Is there a better way I could be doing this?” and you will find there often is.

Impossibilities often aren’t: If you begin with the notion that something is impossible, then it obviously will be for you. If, on the other hand, you decide to see if something is possible or not, you will find out through trial and error. Many of the lessons above are what I used to create my online income. As I’ve said many times, it’s not easy, but it’s certainly not impossible. Even for those of us that are not A-List Bloggers, creating a full time online income is quite possible as I have shown.

Take away the lessons from the square watermelons and apply them to all areas in your life (work, finances, relationships, etc) and you will find that by consistently applying them, you will constantly be improving all aspects of your life.

Posted in Misc | Tagged , | Leave a comment

Single Page Applications in ASP.NET MVC 4

[This is from InfoQ - http://www.infoq.com/news/2012/02/SPA]

The ASP.NET MVC 4 beta includes an experimental project for developing “single page applications”. Known as ASP.NET SPA, this project type is based on a stack of open source libraries and the MVVM pattern made popular by WPF and Silverlight.

Browser-Side

At the bottom of the browser-side stack is the well-known jQuery library along with the Unobtrusive Ajax, jQuery UI, and jQuery Validation plugins.

Next in the stack is Upshot. It supposedly is a data access and caching library that builds on jQuery and Knockout. In the sample code, a knockout compatible view-model is automatically generated. Inside it are Upshot-based functions for handling communication with the service layer. It also includes code for driving the UI. (Like in XAML technologies, it appears that a SPA view-model can quickly become a dumping ground for all manner of code.)

MVVM style data binding is done using the Knockout framework. Like XAML based technologies, Knockout offers declarative data binding. Likewise, it works best when the data and view models are based on observables, which expose property change events. However you don’t have to explicitly raise the event, even for computed properties. Rather than setting a DataContext property on a control you call ko.applyBindings. This doesn’t prevent you from having child controls with a different data context, they simply need to use a “with” or “foreach” binding. The “with” binding is like binding a control’s DataContext to a property on the view model, while the latter effectively creates a items control.

At the top of the stack nav.js, a new library from Microsoft.

Server-Side

Server-side, the application frame is represented by a normal MVC page. The various views within the application are represented server-side by partial pages. In the sample, Knockout’s data binding is used to dynamically show and hide them.

Most of the server-side data access is handled by the abstract class DataController. This is a subclass of the ASP.NET Web API’s ApiController that offers basic methods for submitting a ChangeSetEntry from the client to the server. Developers who prefer using stored procedures or third-party ORMs can inherit from this directly; those leaning towards Entity Framework can use DbDataController. Visual Studio’s scaffolding support can automatically generate the latter with basic CRUD operations exposed.

Posted in .NET, Web Development | Tagged , , | Leave a comment

Letter from Scott Hanselman

It’s an interesting time to be a web developer. HTML5, CSS3, and JavaScript, and the excitement around them, are moving the web forward faster than ever. As the web evolves, the folks at the web team here at Microsoft are evolving with it. The next version of Visual Studio will include lots of new features for web developers. The HTML, CSS, and JavaScript editors have all been gone over with a fine-toothed comb with a clear focus on your everyday workflow. Little things like IntelliSense for CSS vendor-specific prefixes, a hex-code aware color picker, and snippets that expand into the features you use every day all work together with the promise to smooth your way.
ASP.NET Web Forms offer the comfortable control-based model with server-side events, ASP.NET MVC gives you an environment that promotes unit testing and separation of concerns, and ASP.NET web pages combine all the power of the lightweight and expressive Razor syntax with the convenience of inline scripting. ASP.NET itself is at the core; it’s the system that makes ASP.NET Web Forms, ASP.NET MVC and ASP.NET web pages possible. Each can create modern and powerful HTML5 sites and each use all the power of today’s modern JavaScript frameworks like jQuery, Knockout, Backbone, and much more. New frameworks like SignalR build directly on top of ASP.NET and make possible scalable real-time applications with cutting edge tech like Web Sockets.
Don’t think of ASP.NET as an island. It’s a citizen of the larger community. More and more of ASP.NET is open source, and we push hard every day to stay open and be open. We want to make ASP.NET more pluggable, more open, more fun. We’ve got big things planned – some that will surprise you. I hope you’ll join the conversation and the community.
Read about the next version of ASP.NET at http://asp.net/vnext.

 

———————————————————————————————————————–

Bruce’s Notes: The official news & updates are always exciting people working with Microsoft’s products. I’m currently working with asp.net MVC3. That’s good but not perfect. I really hope Microsoft can make it better and better.

Posted in .NET, Web Development | Tagged , , , | Leave a comment

“Unable to load DLL” problem with SQL Server CE

 

I got an error when using SQL Server Compact 3.5 (SqlCe) with asp.net MVC3 web application.

The error is like: “Unable to load DLL ‘sqlcese35.dll’: The specified module could not be found. (Exception from HRESULT: …

 

When looking this issue, I found that SQL CE is not installed in GAC so the reference is added from its installation folder. e.g. C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Private. And the file name is “System.Data.SqlServerCe.dll".

 

This assembly requires several native DLLs to work. They are (possibly):

 

sqlcea35.dll

sqlcecompact35.dll

sqlceer35en.dll

sqlceme35.dll

sqlceoledb35.dll

sqlceqp35.dll

sqlcese35.dll

 

I’m not sure which of these are really needed. To avoid further problems, I copied all of them into my project’s “bin” folder. bingo, now it works!

 

This problem brings an additional deployment step for my web application. I know “xcopy” is easy to deal with. But in the future I would like to take a look for other alternatives against SQL Server CE, e.g. sqlite. Although I’m not sure if it’s a one-file solution.

Posted in .NET, Web Development | Tagged , , | Leave a comment

web前段优化的伎俩

Convert CSS images to data URIs automatically with CSSEmbed

data-uri-results

I wanted to play around with Nicholas Zakas’ new tool for automatically converting CSS background images to data URIs so I tested it out with the CSS on this site.  CSSEmbed accepts a CSS file and outputs a copy with all image references replaced with base 64-encoded data URIs.  (If you’re unfamiliar with the concept of data URIs, read this post by Zakas.)

As you can see, the file size of your stylesheet increases significantly as the stylesheet takes on the image data.  But once you add compression you end up with roughly the same total load size.

In this example the total amount of data remained the same but the number of HTTP requests was reduced from 14 to 1.  Yikes!

There are still a few things with the concept that need to be sorted out – namely, the best way to handle IE 6&7, both of which do not support data URIs.  I’m planning to experiment with a few of the possible options later this week.  If you’re curious about the idea, I recommend trying out CSSEmbed with some of your own CSS.  It’s easy to use and kinda fun.  It feels a bit like the future.

 

转自http://www.ravelrumba.com/blog/convert-css-images-to-data-uris-automatically-with-cssembed/

Posted in Web Development | Tagged , | Leave a comment