Working on new things

It’s been nearly a month since there’s any new content posted and I feel obligated to provide an update of sort.

I have recently got myself into a new habit of waking up at 5.15am in the morning to go for a 30 minutes run around my neighbourhood. It has been going on for the past three weeks now and there are multiple reasons. One, I promised myself that I need to be healthy and reduce my stress level. And since I do enjoy running, it’s the best kind of exercise for me. Second, my working hours, especially that of the evening, is unpredictable given my recent change to a new project. And usually by then, I will be too exhausted to exercise. So, a morning run is the best.

I have also signed up for a short Udemy course on Creative Writing and is currently undergoing the lessons.

Next, I also decided to do commercial writing. And no, no money involved just yet. What I meant is that I write for companies, using my technical skills and experience. It’s also a good place for me to start if I need to do writing as a career.

Finally, I’m still working on my novel; still trying to work out the kinks of the first chapter. And I’ll be honest. I’m having a writers block of sort because I recently find myself not feeling passionate about this particular storyline set in the Intertwined Fate universe. Initially I started the project because I felt like I need to do a slightly bigger fiction project before I go to the next level. I’ve tried writing space opera a few years ago and my skills then didn’t allow me to do a good job. That’s why I would be stupid for me to attempt it again.

The sci-fi LGBT-themed short story I wrote previously for the Intertwined Fate universe was a good starting point. You can read the first chapter here. That story was small enough and manageable for me. Furthermore, I felt the passion for it and enjoyed writing it. Now, it’s just really hard for me to find that passion back.

Image Downsizer

Let’s say you have images that you wish to load into your application. However, instead of having the user downscale or downsize those images first, your application could do it for them.

Below is a piece of code I wrote in C# that will do just that by brute forcing. Admittedly, it’s not the best solution. An AI probably could do it better but in many cases, the following works pretty well.

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;

namespace ImageTuner
    class Program
        static void Main(string[] args)
            string originalImageFile = "<image image file&gt;.jpg";
            string scaledImageFile = "<downsized image file&gt;.jpg";
            bool imageMatchCriterion = false;
            bool imageStillTooBig = false;

            float resolutionScaleFactor = 0.95f;
            long jpegQualityLevel = 100L;

            using (var originalImage = new Bitmap(originalImageFile))
                while (!imageMatchCriterion)
                    Console.WriteLine("Image doesn't match size criterion. Resizing.");
                    int scaledHeight = (int)(originalImage.Height * resolutionScaleFactor);
                    int scaledWidth = (int)(originalImage.Width * resolutionScaleFactor);

                    using (var toCompress = new Bitmap(originalImage, new Size(height: scaledHeight, width: scaledWidth)))
                        var jpgEncoder = GetEncoder(ImageFormat.Jpeg);
                        var myEncoder = Encoder.Quality;
                        var myEncoderParameters = new EncoderParameters(1);

                        var myEncoderParameter = new EncoderParameter(myEncoder, jpegQualityLevel);
                        myEncoderParameters.Param[0] = myEncoderParameter;

                        using (var tempStream = new MemoryStream())
                            //Save the image byte to memory first.
                            toCompress.Save(tempStream, jpgEncoder, myEncoderParameters);
                            byte[] imageSize = tempStream.ToArray();
                            //Check the image size in memory. If it's too big, continue to loop.
                            if (imageSize.Length <= 512000)
                                imageMatchCriterion = true;
                                using (var saveStream = new FileStream(scaledImageFile, FileMode.Create))
                                    toCompress.Save(saveStream, jpgEncoder, myEncoderParameters);
                                if (resolutionScaleFactor &gt; 0.60f)
                                    //Reduce the resolution of the image by 10 percent each time.
                                    resolutionScaleFactor -= 0.10f;
                                    //When the resolution scaling already reach 60%, time to look at reducing the quality level by 5 each time.
                                    if (jpegQualityLevel &gt; 50)
                                        jpegQualityLevel -= 5L;
                                        //Cannot drop the image quality below 50 percent. Once that happen, the image is almost unusable.
                                        imageStillTooBig = true;
            if (imageStillTooBig)
                Console.WriteLine("Image resizing failed.");
                Console.WriteLine("Image resizing completed.");


        private static ImageCodecInfo GetEncoder(ImageFormat format)
            ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
            foreach (ImageCodecInfo codec in codecs)
                if (codec.FormatID == format.Guid)
                    return codec;
            return null;

Writing longhand with pen and paper

How many of you write your content using pen and paper before actually getting it onto other platforms for publishing?

If you do write using pen and paper, it’s great and would love to hear your thoughts about it.

For most of us, we’d probably write on computers. I write predominantly on computers too. It’s just a much more powerful tool, more convenient, and probably could write much faster.

However, due to the nature of my work, technology burnout is inevitable. For several days during this week, I couldn’t bring myself to use a computer or even my phone to write anything. Yet, there’s a book that need writing.

This was how the decision to reintroduce pen and paper into my writing life came about. I got a lecture pad and a black ballpoint pen. Then I got down to writing.

The experience was definitely painful at first because it’s been a while since I wrote longhand using pen and paper. After finding my handwriting in a total mess and my hand aching badly, I decided to use the pen correctly and even went to google for the right way to hold the pen or pencil for that matter. Then it was time to put it into practice.

I would say there were definitely some good and bad that came out of this process.

For me, it has been therapeutic. The chance to get away from technology is just great for my mental health.

Further more, I could focus better on my writing because there’s no internet involved. No Netflix. No music. No internet browser. If you put your technological devices out of reach, you have no choice but focus on the act of writing and the story you want to tell.

The second advantage come in the form of deliberate writing. Because writing on paper meant it’s nearly impossible to change what you wrote. Unless you want to leave behind lines after lines of strikethroughs or whiteouts, every word you want to put down on paper have to be the right word. This slows down your writing and forces you to think. This has the added advantage of allowing you to identify if there’s loopholes or problems with your content. This is especially helpful for me as a pantser because I won’t run astray with my writing and create plot holes.

The third advantage was that it’s just more natural. You can do whatever you want. Scribble along the margin of the page. Skip lines. Doodle. The freedom meant you could explore your ideas and thoughts in a more natural and faster way rather than having to conform to what the computer and software forces you to do.

The fourth advantage is the permanence of the content. Unless your notebook or lecture pad end up getting soak, caught fire or the pieces of paper blown away by the wind, you can always trust that your content won’t go away. That’s unlike when you are using a computer to write. Machine can fail. Storage devices, including cloud storage, can fail or corrupt your data.

But not everything is all so shiny and great.

The biggest disadvantage with using pen and paper is the speed of writing. Your arms and hands don’t move as fast when you have to draw out the arches and lines associated with latin characters whereas with a computer, a key press means a letter. Because of that, I find it much harder to get into the flow.

The second disadvantage is you can’t edit the content like you could on the computer. Every word that you write on paper is permanently set in stone, so to speak. If you want to change something, you have to strike out what you wrote or use whiteouts. And if you are like me who makes quite a lot of mistakes when writing, you will find that your paper may end up becoming a complete mess and hard to comprehend.

As for portability, it doesn’t concern me. I always bring a backpack when I go to work and I could just shove the lecture pad in it. And when it comes to publishing, well, since I’m writing a novel, it would be much later in the writing process that I have to type them all out. With that, I’d probably do my editing concurrently. So I get to kill two birds with one stone.

Now, I won’t say every writer should write longhand using pen and paper. For most people, it would be very tedious and tiring. So if you prefer to write using your computer, then by all means do that. At the end of the day, the most important thing is getting your content out for your audience to consume and encourage them to come back for more. But if you find that your computer is getting in the way of you doing your work, then maybe it’s time to go old-school.

Dealing with burnout

I don’t want to treat this blog as my personal diary. I needed it to be the place where readers will only find useful and good content.

But I feel compelled to share with the world my current situation.

Two weeks ago, I worked a 60 hour-week instead of the usual 44 hour and I went four days surviving only on 6 hours of sleep total, relying on caffeine so that I could code and fix bugs.

And last week, it was a 50 hour-week and I didn’t pay off my sleep debt.

And the kicker was, the company doesn’t give time-off to us for burning our weekends and nights just because they deemed our jobs to be “professional” and doesn’t care how we deliver the results.

I was thinking maybe I should throw in some more physical activities to help contribute to my energy levels and reduce my stress levels. It helped a little.

Then my boss told me I have to quickly take over the product development because the main developer for it was leaving by the end of the month while my current project has multiple deliverables also by the end of the month.

So I suspect this coming week will be another 60 hour-week, possibly even 70 hour-week, depending on how things turn out. I also have a medical appointment for some conditions that I’m suffering from and needed some relief.

With all that, I thought I could write my novel during whatever free time I have. I’m pushing hard to write my novel because I intend to get it out before my next birthday in a few months time. The novel will be at least 70,000 words long, meaning I need to be churning out 23,000 words each month.

And for the month of June, I only managed 10,000 words instead of 23,000 with the month coming to an end. Most of the time, I had to deal with wasted hours of staring at the blank canvas, not sure what to write. Words don’t come out. Even if they did, they felt forced. They lack life.

In addition to that, I have had literal nightmares for several days, continue to suffer from insufficient sleep due to anxiety. The hatred for my day job continues to grow. Even my attempts to see it “working in service of my writing” didn’t do me much good. Mind you, I am already at this stage where I am no longer interested in building software. I really just want to do something else for a living and is just forcing myself to go to work so that I can pay off my credit card debt, my bills and generally live a decent life in this expensive country.

Right now, I’m frustrated and disillusioned. My gastric issue and body pain came back, requiring me to survive on antacid, painkillers and muscle relaxant. And as a writer, I don’t even have the time to read so that I can be inspired and learn new stuff…

I just don’t know how long I can keep this up.

Your passion is not as clear cut

In non-asian context, there’s always this talk of finding your own passion. When you find it, you will never work a single day of your life.

And in asian context, chances are, your parents, relatives or friends will just say, “Find a job that give you stability, high pay and prestige. Fuck your passion.”

What if you are asian and received western education?

It turns out, in both asian and non-asian societies, parents behave mostly the same, which lead to their kids doing stuff they don’t like. And Gary Vaynerchuk does a better job of explaining it in this video.

So… what is passion?

Now, for me, I was lucky. My parents didn’t expect me to be anything. They just want me to have a better life than them and be happy. Then the day came when I was inspired to be a game programmer when I was about fifteen years old. With that inspiration, I pushed myself to do my best for my studies and make my way to a polytechnic where I get myself exposed to the world of information technology. Then I graduated with a final year specialisation in game development.

But I didn’t go that route because I found that the game industry in Singapore wasn’t as established as it is today and the reality of video game industry meant I didn’t want to risk burning out on the very medium I rely on for relaxation.

So I went with general software development. Before I know it, five years passed. Now I realised I couldn’t be bother with the latest technology. I no longer want to spend time learning about messaging queues like Kafka, latest trends in microservices, what’s new with Spring Framework, etc. And when I watched Apple’s WWDC 2019, as much as I’m happy with the state of Augmented Reality and what Apple is doing to help developers on that front, I find myself having zero desire to do it.

I would say these five years of work in the real world exposed quite a lot of things for me. It made me think about what I truly enjoy.

I like science.

I like technology.

I love reading fiction.

I love writing, science fiction in particular. It was all to express myself.

I love building structures and routines for myself.

I love playing video games.

And now my question becomes: what can I do for a living that allow me to apply some, if not all of the above, so that work doesn’t feel like work? As of right now, even I accepted the counteroffer from my company and continued to work there, I know my heart and mind is now all on crafting my next science fiction novel, which is moving along nicely at eight thousand words.

For those who are still attempting to find your passion, please don’t rush. I know you must feel like you are running out of time. But really, if you are in your twenties, you got the time on your side. If you are inspired to do something, go do it as much as practicality allows. That way you have the chance to decide if that’s something you want to do for a considerable amount of time. Otherwise, you will never know. By the time you hit your thirties, you’d probably identify things that you know you can do without feeling like shit.

I’m glad that I got the chance to identify all the things I enjoy after attempting to do something that I thought I might enjoy. I will probably need a career coach to advice on where to go next.