Using Sass (Scss) in Dart project

Friday, June 20, 2014

Recently I'm trying to configure Dart development environment like everyday I do with JS Grunt (or Gulp).

Dart has a default tool to get the work done -- Pub. Pub is not just for Package manager like bower. The `pub serve` and `pub build` are like `grunt serve` and `grunt build`.

In the grunt tasks you can define actual sequences of tasks. While Pub has a more conventional way to get the similar stuff done. The Pub Transformer can process some transformations in the build. Dart to JS transformation is the typical one as explained the introduction of Pub on CSS preprocessing is another typical one and I'd like to introduce the example in this post.

There are two popular CSS pre-processors -- Sass(Scss) and Less. Here I'd like to introduce Sass example.
There is already a nice Sass(Scss) transformation package and the examples at my github repo  You can try and confirm how it works.

You get the git clone, and do `pub serve` where pubspec.yaml exists. Then open http://localhost:8080 on your Dartium. The transformer runs on the startup and you can see the "Build completed successfully" message on your console.
You don't see any output CSS files in the directories, since they are included into the pub dev server, but not put in the project directories.

And don't worry, every time you save the source code, Pub watches the changes and automatically runs the transformation again.

That's it. Pretty easy.

By the way, actually I prefer to use Less for my development, not Sass. So next time I would try Less transformation.
Read more ...

Web Worker and current Dartlang

Friday, June 13, 2014
Recently I've been researching WebAudio and WebRTC getUserMedia for my personal project.
I googled, then I found the library which really fits my need. aaaa
The library uses WebWorker for audio recording and mp3 conversion to (I guess and probably true) offload the CPU intensive works. I want to write webapp in Dartlang, and it's not serious project, so I'm trying to port this JS library to Dart for my study. (Yes, you know, probably I can (should?) just use this library by dart:js.) So I have a chance to try Web Worker in Dart.
Without much thought, I tried the porting, wrote the WebWorkers in Dart, and I stumbled into that a WebWorker itself should be written in JS, not Dart.
Here is the simple sample code.
The JS version WebWorker should work normally, and Dart version raises an error (in Dartium).
I found the article mentioned about it.
What if you have a compute-intensive task to run? To keep your app responsive, you should put the task into its own isolate or worker. Isolates might run in a separate process or thread, depending on the Dart implementation. In 1.0 we don’t expect web apps to support isolates or Dart-language workers. However, you can use the dart:html Worker class to add a JavaScript worker to a Dart web app.
Please anyone tell me if I'm misunderstanding something.
Read more ...

Start diving into Google App Engine

Friday, April 25, 2014

When Google App Engine was first announced its launch, I was thrilled and sympathized with the advertised benefit so much. Focusing on application development on Google Cloud, so I didn't need to take time for the server scaling and maintenance, and didn't need to hire server engineers? Great. It's what I had wanted.

But I was silly, I had not invested even a bit part of my time to research and practice GAE, just because I felt I might as well wait until the experiences of GAE and its DataStore (BigTable) has stocked on the web blogs/forums, and I had even made excuses that Python was not so popular (!) in Japan (yes, I'm Japanese).

In the mean time I had been mostly satisfied with RubyonRails ecosystem. (Ah, I now feel I want to express my love and hate to RoR, but  this is not the right place to say it). Then I preferred Heroku, the great PaaS and it's also provides the maintenance free infrastructure. Thanks to the service I can sleep well at night.

Nevertheless, unfortunately I confess after I learned Ruby well and experienced several projects over several years, I couldn't love it because of mainly its overly flexible and casual meta programming culture. I felt it didn't meet my preference, especially after reading "Zen of Python"( I often prefer something by its philosophy and ideology. So I have gradually increased time to write code by Python instead of Ruby.

By the way I also do love Dartlang's language design. I love terse, simple and explicit design, but also have appropriate flexibility. I've been investing my time to switch my browser side development language from JavaScript to Dartlang. While I still feel I have to use JavaScript in my production with its great ecosystem like Angular, Grunt, and other abundant libraries, it's been my another great experience ongoing.

Getting back to the topic, then I watched recent Google Platform Live
( And its promotions, especially announcing Managed VM ( triggered me off seriously thinking of GAE and its Google Cloud Platform again.

So I walked through the feature list and videos, it looks GAE Python environment has greatly matured (well, I hope) and the documents seem pretty improved.

Plus, as far as I read official videos and articles and many articles on the web about DataStore, I can feel quite optimistic to handle it. While I'm still not sure how to express "Many to Many association" used in RDB (certainly needs a mental switch). So I will try to do some implementation.

You may worry about vendor lock-in? Ah, yes, I will accept the risk. I'm going to rely on Google Cloud Platform and it would be a great deal to me because I want to 100% focus on app development and service management, and don't want to spend time to worry about the server stuff like scaling, security fix, server and other infrastructure monitoring, provisioning, deployment, hiring and communicating server guys as a service grows...

Heroku is also definitely great (convenient, and expensive!) service, and AWS is the most popular choice. But currently GAE and GCP services get my interest and motivation for learning.

But it is NOT urgent priority, since I've already had the production service under development, but already built 95% for the first release. It's served on Heroku and AWS (EC2). Time span would be 6 months or 1 year, even if I decide to migrate to GAE (GCP). Even I'm not sure how to migrate data in the RDB to DataStore (BigTable) or should compromise to use Cloud SQL.

At any rate, I believe passion and craftsmanship are keys to eventually produce great products. Delegating server stuff to the reliable vender is a significant factor for a startup product in order to focus the service itself.

* It would be something like the Holy Grail eventually when Dartlang will be supported in the future.

* I want to hire passionate Dartisans (mumbling...).

Read more ...