Worst weather

It’s middle of April and we get massive snow, sleet, freezing rain. WTF?

Advertisements

doge haircut

My doge got a haircut! she lost so much of her hair! all her ear hair was plucked out too. Groomer was fantastic and I will ask for her again! She was pretty insistent on using conditioner though but I didn’t see the need.

Using React-Bootstrap frontend with Webpack and REST backend (django)

I’ve been toying with React in frontend web-dev as a hobby. It’s a very good abstraction in terms of controlling client-side state and doing a dependency based re-rendering. I’ve started a simple Todo application with a friend doing a backend and it is going pretty well so far. One mistake I made was trying to use latest stable React and Bootstrap 4 beta from CDNs. This was flying too close to the Sun and when trying to do anything dynamic (anything that requires bootstrap.js and therefore modifying DOM by anything other than React), it failed. The failure was Modal. While there exists a workaround, it’s for sure not a clean abstraction that a purist in me would like.

So I attempted to look at alternatives and I recalled using React-Bootstrap from the github project. Basically, it’s bootstrap components that are re-implemented using React framework. Unfortunately, it’s still in development towards 1.0.0 release and is based on stable Bootstrap v3. So I did what is most rational. I made an attempt to change to using React-Bootstrap components instead of using pure React and Bootstrap CSS. The Re-architecting surprisingly went well without much headache because most that I had to do was just replace the JSX components. Of course the CSS made the sites look difference and that was expected.

Initially, I created a project that was a generic copy of the React’s create-react-app, but using externalized npm components. I used the webpack it used to compile and emit the bundle.js file. I basically leveraged that to emit bundle.js from the bag of js files, and used that bundle.js file in the static folder under django root directory. It is definitely not a standalone webpack framework to compile just what I need since it was meant to be a standalone React, Express server, but for my purposes it did its job (there is a bug where webpack –watch fail with ENOENT but that’s just an annoyance). Someday I’ll create just a webpack project that makes the bundle.js file that I need to supply for frontend.

I switched from using CDN to using actual components in my js files. The pros and cons for this is pretty common sense so I won’t describe them here. The end result is that everything works as expected using React-Bootstrap components. It worked pretty much too well to my surprise (after some weird ES2015 things not working like Object Destructuring) and that bodes a good news to develop further without much headache down the road. Looking to make the best todo app!

Blog

I got a ChromeBook the other day. I want to be able to dev using Browser based IDE that supports windows tiling and collaborative editing. I think it may be doable using Chrome App…