Physical and mental stress

I’ve been writing code for a long time.

I wasn’t a computer science student. When I was in university, I studied applied maths, because that was what I was good at and luckily, interested in as well. Then there was this side module that taught the C language. And that’s how I learnt my first proper programming language over 20 years ago.

(I self taught myself BASIC with a toy computer in my early teens, but that’s another story)

Over time, the incredible bursts and protracted periods of programming energy morphed into shorter chunks of methodical thinking and planning. Life as a teenager and young adult is also simpler than the 30’s and 40’s.

Life takes its toll. Few programmers talk about it, but there’s a mental strain, especially with you know, life happening. I’ve had my fair share of mental stress, so let me tell what worked for me.

Magnesium supplementation helped. As had this herb called ashwagandha. I also do meditation and breathing exercises when I get to do them. Continuing the food angle, I used to take weight gainer powders. I’m a skinny guy and found it hard to put on mass. Later in life, I realised I wanted to put on muscle, not just meat on my body.

So I started working out. Being the shy guy, I bought dumb bells and exercised at home. Some progress but that’s probably beginner gains.

Fast forward to now, and I’m doing mostly body weight exercises. My current regime is 100 pushups as the base. I have a very loosely defined set of workout exercises, mostly for convenience and ease. If it takes too much to set up for the exercise, I’m just not gonna do it…

I found the physical exertion to be necessary. My body needs to expend energy to be somewhat fatigued or I’ll feel cranky. This ties in to the stress release, both physical and mental.

I’ve been writing code for a long time. Which also means I’ve been living for a fair bit. If you’re a young person, by all means ride that exhilaration of energy. Just also know that it’s ok if you run out of steam and needs to recharge.

Messy and chaotic changes

So I never thought Singapore would be in lockdown mode for several months this year.

The year started well enough. I was transferred from the artificial intelligence department to the cyber security department. New technologies to learn. New people to befriend.

Then this pandemic thing happened.

Within a couple of months, the virus raged across the world. And Singapore took decisive action and locked the whole country down. Everyone was to stay home except for essential services or emergency situations.

The panic buying and queues were laughable if the situation weren’t so dire.

Professionally, I had to switch from the .NET world to the Ubuntu/Linux world. The C# and .NET libraries gave way to Python and vi (yes I do know how to exit from vi, thank goodness). Visual Studio autocompletion and SQL Server gave way to command line grep and PostGreSql/MySql.

I’d be lying if I said I was ok mentally speaking. These past few months had been psychologically and mentally taxing for everyone.

To climb out of this mental hole, I put in more effort into two specific activities: Russian language acquisition and physical fitness.

Hello comrade!

I had been learning Russian for a couple of years now. Mostly with the app Duolingo. But I discovered I wasn’t making a lot of progress. The lockdown both highlighted my inadequacy and gave me the opportunity to push myself.

So I switched over to the app Lingvist for new vocabulary and spaced repetition. I created a separate YouTube account with just Russian content. The idea is to see, hear and read as much Russian content as possible, and in as comprehensible a manner as possible (aka comprehensible input).

I made more progress in two months than in two years.

Body recomposition

I also changed my workout routine. I’ve never gone to the gym to exercise. I trained with dumbbells at home. I’ve done so since my early 20’s.

So I’ve been “training” for a long time. And I’m still not jacked! I blame myself. What the blyat have I been doing?

So I switched over to body weight exercises. And the muscle growth finally came and shattered my plateau. My biceps and triceps are more pronounced. I’m filling up my shirts with my pectorals. And my back pain is mostly gone after I focus on shoulder and lower back exercises.

New stress relievers

I used to go to the library to read. To unwind.

I used to go to the cinema to watch movies. To imagine.

Not anymore.

Now I better appreciate the times I do spend with my family and friends, ever since the lockdown eased up.

I hope you’re well wherever you are, whenever you are.

Learning Russian and Python

Russian grammar makes me want to throw my hands up in frustration and anger.

I’ve been learning Russian for over two years now.

I started by using Duolingo. I thought I was progressing quite nicely. But the gamified way of learning soon wore me down. And after a year and a half, I still could not come up with sentences of more than 5 words.

So I searched for a better way of learning. I found the apps Busuu and Lingvist to be helpful, especially Lingvist since it’s a spaced repetition app without me having to input my own words (like Anki. I’m lazy). I’ve started to actively read Russian articles (blogs or news) and watch Russian YouTube videos. And I’m using more time on the learning process, and my progress finally moved forward over the last few months.

In the midst of all that linguistic frustration, my work also involved reading and writing Python code. I had to deal with machine learning and AI and the new fangled new thing these days is Python and the powerful libraries that support it.

Let me tell you, the lack of an ending semicolon took me a while to get over.

And Python was just the tip of the iceberg. The latest technological tools and languages appear to move away from the “traditional” programming structures such as if statements and for loops. They still have them, but somehow presented in a different manner.

Python has the list comprehension thing (which looks like an SQL select statement to me). Scratch from MIT uses visual blocks to construct programming logic. And Tensorflow is … tense (tensors are hyperdimensional matrices?).

So my struggle with Russian is mostly with the 6 cases. The language makes differences for “for you” and “to you” as in <<??? ????>> and <<? ?????>>. The gender attachment to all objects didn’t help (I mean other languages such as German has it too but still).

And the newer programming languages or technologies seem to be encapsulating more and more constructs to work on a higher and more abstract level. It might even seem that programming languages are trying to approach how humans talk to each other.

And that might be the actual point. Communication.

We speak to each other and convey our ideas through natural languages. And we do the same “speaking” to computers through programming languages. The difference is that humans are more capable of picking up nuances and self-correct mistakes in communication.

Python pass by reference

Some time ago, I was given the opportunity to take a free course in Python. I was like “Sure why not? And it’s free? Woot!” (I don’t actually say “woot” but it seems like the kind of thing people say, right?)

The course is a beginner module meant for technical people (but not full-on coders). I was the only professional programmer in the class. I didn’t care, I don’t know Python. So 2 points of interest…

White space is critical

The programming languages I know consider white space as something to make the code easier to read for the human. Python elevates that to a whole new level.

I’m not even talking about the debate about whether a tab or 4 spaces is better for indentation. Python will punish you if you used 4 spaces for indentation here and then use 3 spaces for indentation there. This is especially terrible if you use an editor where a tab looks like 4 spaces so it looks like the indentation is fine but it’s not.

Parameter values are by default passed by reference

This one took a bit of getting used to. I’m used to passing values to functions and knowing that those values (or classes or structs) will never be tampered with unless I say so. For example, with the “ref” keyword in C#:

public void Foobar(ref ComplicatedClass ImComplex)
{
// ImComplex will possibly be modified
}

I’ll just slide that into my “good to know, but I’ll probably never use” list. I don’t want any weird errors slithering up because that’s hard to swallow. (I swear that’s the end of my snake jokes)

P.S. Happy Independence Day to you if you celebrate it. Coincidentally, it’s also the official day that my company closed. So Independence Day to me too.

Calming down

About 3 years ago, the stress was slowly killing me.

So back then I was working on my own business, using some of the money I earned as a software consultant, and running a company as the CEO/director. The consultancy job required me to travel an obscene distance taking an absurd amount of time to the tune of 4 to 4.5 hours every single day.

I slept an average of 4.5 hours a night. 6 if I’m lucky (such as weekends). My last thought before sleep was typically the injustice inflicted on me by my Troublesome Business Partner (TBP). My first thought upon waking up was that of TBP. My blood boiled continually throughout the day whenever the thought of TBP flits past my brain.

My health was a wreck. I could see my muscles wasted away. My breath was usually ragged and shallow. My back hurt and my shoulders ached.

Sometimes just standing still and doing nothing was the best thing I could do for myself. Because moving or even the thought of moving was too mentally painful.

I was continually worried about money. My company wasn’t making profits and I had to make payroll using my own personal money (because my business partners seemed to think it was unheard of for them to continue investing their money and time beyond the initial company setup).

The wakeup call

So one night I was walking home after work. It was near midnight when I alighted the train. The night was cool and I wanted to save money by not taking the bus.

I was enjoying the slight breeze and the solitude of the quiet night when I felt something. More precisely it was what I didn’t feel.

Because for a few moments I felt the absence of my heart beating.

I stood shivering on the walk path beside the road. Tears welled up. I was just so tired. I took long deep breaths as I watched the occasional car pass by. Then I continued my journey home.

You might think I imagined that. I thought so too. Until my heart “gave out” on a couple of occasions after the initial one. It was then that I finally came to terms that I had to do something drastic to turn my life around.

Because whatever I was doing was clearly not working.

The frantic search for relaxation

Prior to my heart incident, I was already trying my darndest to relax. I’m not stupid you know. So I followed the typical advice.

Such as long walks, preferably in nature. I took long walks in the nearby park. But the presence of humans agitated me more than the relaxation benefits. Yes people stress me out, like way more than was normal.

I wasn’t unfriendly nor anti-social. But after dealing with TBP, I became much more cynical and distrustful of people.

I did deep breathing, forcing my breaths into long drawn out streams of air flow. It sort of helped. But I was so wired up that the moment I stopped consciously breathing, my breathing adjusted to simulate a chihuahua panting. It was like two giant hands squeezing my chest and back together, holding with enough space that I could just barely breathe.

I also tried visualisation and meditation. Years ago I would have found it easy to maintain a light meditative state. That stressed out Vincent? Oh he was bombarded with a constant flow of anger, sadness, money worries, future worries, frustration, moments of small joy. I had a nervous tick in my left eyelid.

“What about pets?” Have I mention my cat died? A small part of me died too. I’ll leave it there…

“Well what about exercise?” I also did that. The thing was, you need to be able to recover from that exercise to reap the benefits. I was so stressed out that some pushups or jumping jacks took me days, maybe even a couple of weeks for me to recover. I was so worn out.

“Uh massage?” I couldn’t afford it.

“Talk to friends?” They’re not the business kind of people. And even if it’s just to talk it out, they’re guys. It’s not a manly thing to talk about such woes. So I just hang out with my friends but I kept my troubles to myself.

I was at my wit’s end. But what I’ve told you were what I actively did for relaxing. Mentally with meditation. Physically with exercise. Emotionally and socially with friends.

Those helped, but not significantly enough to turn things around for me. I needed something more drastic. Something that is done to me. Something that is passive for me once I start the initial process.

Next time I’ll tell you about my research into health and fitness and the ridiculous amount of health supplements I tried.

Food Rolodex

I should have listened to my gut and my brain. On hindsight there were so many obvious signs that it’s a bad idea and a bad business relationship. But my heart wanted to really make it work.

My heart can go take a bench break.

So back in October 2013, my soon-to-be Troublesome Business Partner (TBP) convinced me and the soon-to-be Amiable Business Partner (ABP) of forming a company. The business: to have an app where people can browse food items of an eatery place, be it a cafe or restaurant or anything in between.

My instincts and gut feeling told me that was a bad idea. My brain figured out that there’s no real business. The app users must be able to use the service for free. For that kind of service, fremium would drive people away unless there’s something compelling. During the late quarter of 2013, there were already food related services (FoodPanda was one of them I think. We’ll get to that in a future post). That idea alone was not enough of a business model.

Social media was so rampant that just being able to browse food items of an eatery place was laughably ignorable.

Profit would have to come from the eateries themselves, cafes and restaurants and whatnot paying us money to list their business in our app. Or from advertisements and sponsors. As a newcomer in the arena, I did not see how we could compete since we had no competitive advantage.

But ABP agreed to TBP’s idea, and I was blinded by the fact that I found people willing to do business together with me.

Lesson: Do not let your heart run your business decisions. Your heart can take a bench break.

Despite what my gut instincts and brain were telling me, I chose to try to make it work. My two business partners (we formed a company soon after), TBP and ABP have… shall we say qualifications that added some letters before and after their names. Who was I to judge?

I confirmed with TBP if TBP had any further ideas, such as monetisation or marketing the app or getting initial customers or … anything at all. TBP had no further ideas beyond the original idea.

My gut shot that red flag to my brain so quickly I nearly choked but my heart brushed it aside just as quickly. (I was really lonesome for like-minded people)

Alright, I’m going to try to describe the app as best as I can and you can judge it on its own merit. I named it FoodSkim. My two business partners were next to worthless when it came to naming, and I had to do something (I was the CEO after all).

So you would go to your favourite cafe Mooncoin, fire up the FoodSkim app, select Mooncoin as the eatery, select your favourite beverage CinnaSoyLattecino Triple Shot with the signature Coin Cake, and then send it off as an order.

FoodSkim would send your order to Mooncoin’s corresponding FoodSkim server on Mooncoin’s computer for processing (probably in the kitchen or something). Mooncoin would still need you to pay at their cashier counter, but you know, that’s just a minor inconvenience compared to Oh Em Gee you can rate the food item and share your opinions on the food/eatery on your favourite social media sites!

It must have been a superbly brilliant idea because I couldn’t get TBP and ABP to see the practicality of convincing businesses to do business with us based on that.

How were we to convince them of setting up our FoodSkim server program on their computer? Do they even have a computer? “If they don’t, we provide them with a (cheap) computer.” I’m flabbergasted.

How were we to interface with their Point-Of-Sales (POS) system? Can we interface with their POS? Should we interface at all? Would they allow us to interface? How difficult would it be to interface? (Because no interface means the customer, that’s you, would still have to go queue up and pay at the cashier, which defeats the purpose of choosing food items at your leisure)

TBP also suggested we allow FoodSkim users to preorder food before they’re at the eatery.

How could the eatery trust that the customer would show up, because they have to prepare the food (no payment yet, remember)?

“Oh we put GPS location lock on the customer and the eatery location.”

That meant we had to enter the eatery GPS location into our database. What if they move (they’d have to inform us, and why would they think it’s important to inform us?)? Data maintenance would be a problem.

Despite me bringing up those questions of practicality, I was brushed aside. Ok, how about the initial set of businesses? Neither TBP nor ABP did anything to get eateries to list their businesses with us.

I actually went out to a few eateries to talk with the owners. I asked them if they’d be interested to be listed. I gave them my name card. No one contacted me. I wasn’t surprised, but I did the leg work. I tried to make it work and give it my best effort just in case it did.

Finally, I couldn’t take it anymore. It was almost two years after the company was formed. TBP was nowhere to be seen nor heard from. TBP just disappeared without telling me. ABP told me that both of them were still in contact, and ABP told me TBP was afraid of me.

Really? I wonder why.

Coward.

I wound up development on FoodSkim. At that point, I was forking out my own money to keep the company and the FoodSkim project going. TBP and ABP didn’t offer any money at all to help.

I could no longer tell myself my company and FoodSkim were going to work.

I told ABP of my decision and ABP was ok with closing the company. Then I went through a long process of terminating the funding agreement with the venture capitalist organisation. Even the liaison from the venture capitalist organisation disappeared and didn’t help me or give me advice.

The termination took a few months to finally get settled. Then I went through the long process of closing my company.

During that entire period of time, I kept telling myself that, in five or ten years time, Future Vincent would look back on the memory of this period and laugh. Because Present Vincent was in a lot of emotional pain and stress. Without any self-motivation and self-talk, Present Vincent would have had a nervous breakdown.

I still look at that period of time as a learning experience. I still feel bittersweet when I think of the times when I did payroll. The sense of responsibility of taking care of the company bank account. Swallowing my pride when talking to potential customers. Putting up a face of calm when presenting to the VC.

I’m also more cynical of people now, and hopefully a better judge of character.

I paid a hefty price for that experience, in terms of money, of sweat and tears, of lost opportunities, of loss of time.

It took me 3 years to recover to the point where I’m able to talk to you about it. I hope you learnt something from my experience, and that you have a better time than me.

Closing my company was painful

I never thought closing my company would be such a relief.

Three years ago, about this time of the year, I was preparing the final documents for the very last Annual General Meeting for my company. I was doing so as both the (sole) company director and the CEO. Before that, I had already sent the accountant all the payment receipts, invoices, the company cheque book and other finance related documents for review and to generate the financial statements (to be presented to the stakeholders during the AGM).

The only agenda of the AGM was to accept or reject the closing of the company.

On the fateful day of the AGM, I waited in the appointed room for the other two stakeholders. They were business partners only in name, but legally speaking they were considered stockholders.

There was one particular business partner that I hoped fervently did not appear for the AGM.

When the other business partner arrived, I breathed a small sigh of relief. I needed *this* business partner to appear and that the other business partner to *not* appear.

If at this point you’re thinking that I’m doing some sort of subterfuge, you’re right. I hated to have to do it, but it was necessary because that other business partner had been giving me trouble to no end.

Legally speaking, I needed a majority from the stockholders to approve of the closing of the company before I can proceed to close it. You’d think I have the majority of the stocks but you’d be wrong. I was fairly sure I could convince the amiable business partner to agree, since we’ve already decided beforehand that it was best for the both of us and for the company.

I told my secretary the amiable business partner had arrived. That business partner, my secretary and I waited in the room. 15 minutes passed the appointed time. Half an hour passed the appointed time. I called for the AGM to proceed without all the stockholders present.

I presented to the amiable business partner the financial statements of the company. The partner reviewed the documents, and asked me and my secretary questions, including why the other business partner wasn’t present.

I’m not going to tell you how I managed to get the other business partner to not appear. It’s still painful (even after 3 years) and I hope I never have to do something like that ever again. Well maybe in a future post, I’ll talk about it…

In any case, the amiable business partner agreed to the closing of the company. I closed off the AGM and thanked the business partner for coming. I discussed with my secretary the final document preparation of the closing of the company. Then I left the office.

I don’t remember what I did after that, but I *do* remember the immense weight that was lifted off my shoulders. I might have stood still and shivered. I might have cried a little.

Because it was the first time in a long time that I felt… free.

Don’t get me wrong, I don’t regret running the company. I had to work with the venture capitalist organisation that funded the company project. I had to make payroll (it was sobering to see how much money was draining from the company bank account every month). I learnt to do company taxes and all sorts of company admin work (that only I as the CEO/director could do).

I was also doing consultancy work and running my own private business at the same time. Because I didn’t get paid anything for being the CEO nor being the company director. I was doing the equivalent of three jobs. I had trouble sleeping. I had to sometimes consciously remind myself to breathe because my breaths were so shallow. And my blood boiled every time I thought of that troublesome business partner.

It was not a good way to live.

Next time, I’ll tell you of the heart attack I almost got when the bank closed the company bank account with a final figure that did not tally with that from my accountant.

How to fix Open XML SDK created spreadsheet for iOS devices

Note that this is only for Open XML SDK 2.0. I haven’t tested for SDK 2.5 (or later, but there’s no “later” version at the point of this writing).

The fix

You have to manipulate the [Content_Types].xml file. This XML file is zipped together in the spreadsheet file, and is at the root of the file. If you don’t know what I’m talking about, you’re probably reading the wrong article.

Unfortunately, this can’t be done within Open XML SDK. As I understand it, the SDK runs internally on System.IO.Packaging namespace objects.

Now a package is a zip file with structure. But a zip file is not necessarily a package. (go maths logic!) See Microsoft reference (bottom of page).

As I understand it, you can’t manipulate a package’s [Content_Types].xml with any of the methods or classes from the System.IO.Packaging namespace. This XML file is supposed to be tamper-proof.

So if you can’t change it with the Packaging stuff, then you’ll have to manipulate it as a pure zip file. And as at .NET Framework 3.5 (because I’m using Open XML SDK 2.0 as reference), there’s no in-built zipping mechanism for the kind of zipping algorithm you need (the Gzip and Deflate isn’t exactly the tool).

This means you need an outside zip library. I leave it to you to find your favourite library. Assuming you found one, here’s why you need to change the [Content_Types].xml file.

The one generated by Excel looks something like this:

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels"/>
<Default ContentType="application/xml" Extension="xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" PartName="/xl/workbook.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.theme+xml" PartName="/xl/theme/theme.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" PartName="/xl/sharedStrings.xml"/>
<Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml"/>
</Types>

The one generated by Open XML SDK 2.0 looks something like:

<?xml version="1.0" encoding="UTF-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" Extension="xml"/>
<Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.theme+xml" PartName="/xl/theme/theme.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" PartName="/xl/sharedStrings.xml"/>
<Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml"/>
</Types>

Spot the difference time!

The workbook part is missing. Specifically, look for the XML tag with the ContentType attribute equal to “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml”

Open XML SDK, for whatever reason, doesn’t explicitly set the PartName=”/xl/workbook.xml” part. This is why iOS devices can’t see the spreadsheet file.

I don’t know whether the fix will work on Android devices or Windows phones. But a developer emailed me that iOS 6.0 devices seem to still be able to read the spreadsheet files by Open XML SDK, but iOS 7.0 just gives up.

Microsoft, please, you created the Open XML specs. Other companies are following the specs and the one useful tool you made to help generate Open XML documents fail to follow the specs.

How to found a company

Just do it.

But jokes aside, the bigger question is not how. It’s why.

[Disclaimer: any information you read here pertains to Singapore laws and regulations. Your country’s laws and regulations might differ.]

I have people emailing me “Wow Vincent, you’re running your own business! That’s totally awesome. I wish I could do something like you did.”

Or “I don’t really have a product to sell.”

Or “I have this small thing that I’m working on, but it’s too early to tell.”

Or “I have a family to take care of.”

Or “I’m scared.”

All perfectly valid reasons. And at some point in time, all of them were applicable to me. And I’m still working for myself now.

Now for the big news. I founded a company! Yay! (ok I co-founded a company, but the circumstantial details are more complex than I’d like it to be. I might talk about it in an email. Sign up on the right side bar [or wherever it might be in case the position is changed]).

So about the how thing. It’s not hard. It’s just frustratingly tedious. Mostly because I don’t know what forms to fill in, in what sequence, and “Is there anything else I need to do because I don’t wanna get sued and go to jail!”.

Also, because I’ve never done it before. Most people will feel scared if they’re doing something they’ve never done before. So they find it frustrating and tedious and moan and groan and go drink a bottle of whiskey and go to bed.

You go to ACRA, come up with a company name, decide on the shares allocated to each share holder (probably decide beforehand and not on the spot), put in share holder details, company official member details, pay ACRA for the registration and you’re done!

There’s also quite a bit of legalese and fine print. Since I don’t want to get sued and go to jail, I read them. You might want to go on the wild side and just skip them. To each his own.

So it’s not so much the how. Find a strong enough reason for why, and you’ll just do it.

By the way, I founded a company! The company name is One North Soft. I have a secret project in the works. Tell you more in future.