Friday, June 9, 2023

Is Blogging No Longer a Thing?

As I embark on my new journey to learn the Rust programming language, I find myself pondering—where have all the blogs gone? In search of practical guidance, I sift through numerous search engine results, only to be met with the official documentation or obscure Stack Overflow questions. The nostalgia of vibrant personal blog posts and the valuable insights that accompanied them seems to have faded away. This situation raises the question: is blogging no longer a thing?


As people drift toward video platforms like YouTube and TikTok, certain intriguing changes take root. Not only do they replace the traditional text-based content delivery, but these platforms also diminish the sharing of personal experiences, discovery narratives, and the enlightening lessons that once made blog posts relatable.


Of course, official documentation remains relevant and invaluable for learning new technologies. However, there's something unique about the style and personal touch of a blog post that resonates with readers and fosters a sense of connection. Bloggers often share their experiences, complete with pitfalls and successes in a way that's relatable and enriching.


Despite the rise in video content creation, I believe there's still a place for text-based content, especially when it comes to learning. Just as I am attempting to master Rust, others too embark on their quests for knowledge. And as helpful as documentation and Stack Overflow questions may be, the personal touch provided by bloggers offers an added depth of understanding and a different perspective.


Having not written a blog post myself in years, I can't help but feel guilty for not contributing to the wealth of written knowledge online. But perhaps it's time for a change—a return to the authenticity and value of crafting thoughtful blog posts. Instead of lamenting the decline of blogging, why not revitalize this expression of creativity?


The digital landscape evolves continuously, and yet, there remains a place in our hearts and minds for good old-fashioned text. Engaging blogs breathe life into learning experiences, fostering more profound connections representative of the collective human experience. So, let us not see the decline of blogging as an irreversible loss, but rather seize this as an opportunity to recharge our pens and reinvent the wonder that is blogging. And as for me, maybe it's time I start the change I yearn to see.

Saturday, March 7, 2020

First godot game published

I haven't published anything in google play for a very long time. I'm very happy to finally introduce my latest project to the public. It is a casual game called..... Add Block. Yeah.. The best original game name award coming right up. But seriously, try it out. Find in at the play store here.

I love playing casual games on my phone. It's great to pass the time. But it doesn't really do anything for your skills. Or at least not anything for real life important skills (yes, I don't consider being able to identify the consecutive shapes or color as really important). So I decided to create one.

So in this game, you practice your math skills. Find the adjacent blocks that add up to the total you need. So it's math, math is important right? Right?....

The levels are unlimited, the idea is that you keep on playing until you can't anymore. You'll die if you finally can't get the number of wins required to pass the level in time. You only have 100 seconds to finish each level.

This is the initial release. The game mechanics work, and the high score board works. But apart from that, it's quite plain. If the game really does pick up steam, I might add in additional features like bonus blocks, unique level layout or things like that. Maybe even a universal high score board so you can compare with your friends, but for now that's it.

I created this game using the great open source game engine godot. It's a great open source project. I've never dabbled too seriously with unity but godot feels like the open source version of unity. It's quite easy to get into. And the performance seems to be good enough for casual games. I'm not a digital artist by any stretch of the imagination, but I think if you've got talent, you could probably create really good beautiful games with it. And one of the main point for me when comparing godot with unity is that godot runs in linux. So yeah, I developed the whole thing on my manjaro linux laptop, no need to switch over to windows at all. Awesome...

For the music, I got them from bensound. And for the sounds, I got them from zapsplat. Both awesome sites with great quality music and sound which are royalty free.

So do test it out, and give feedback if you like it or you've got some suggestions for it. Thank you.

Wednesday, January 1, 2020

New day, new year, new me...

Welcome to the future...

At least that's what we've been told since I was just a small boy. I remember at school we were given assignments to write about what we think Malaysia would be like in the year 2020 because back then we had a "Vision". We'd write things like flying cars (eh.. we're working on that now... no wonder...), robots, computers and things like that... And so here we are.. in the future.. watch out for that flying skateboarder...

But in a very real sense, we are way more advanced than 20 years before. I remember in school, me and my friend would wait till everyone is asleep before we'd play warcraft together because we'd have to connect using modems and in the daytime someone always pick up the phone. And also I think the charges were cheaper at night. I remember having 4 megabytes of RAM was a huge deal. And downloading mp3 took days. I remember riding the bus to KL and the only way to cool down was to sit beside the open window. I remember sitting awkwardly together with friends or family because we haven't got anything to say but don't have any smartphone to whip out and ignore them. I remember we'd always have the same prime minister.. oh wait.. we still do.. never mind.

So it's 2020. We made it. We are here now... So what are we going to make of it?

Well, I've learned some powerful and painful lessons in the year 2019. I hope to be able to continue learning from it and improve myself with regards to my health and finances. To contribute more to my family, community and the world. To be a better person in each and every way and it begins today...

Wednesday, December 11, 2019

The audiobooks I've been listening to

Last week I've written about my personal updates and I mentioned that nowadays I'm listening to audiobooks while I'm commuting to and from work. I'd like so share about some of my experience listening to the audiobooks and some titles I've personally enjoyed a lot. I use audible to listen to audiobooks. Listening to audiobooks is of course very different than actually reading a book. The main difference being that you can't read at your own pace, it would be at the pace of the narrator. And your enjoyment of the content is also very much dependent on the narrator almost as much as on the author. A great book can become quite boring if the narrator just keep on droning flatly through. And a boring book can be become great when the narrator can read it so enthusiastically that it become infectious. So in some ways, buying an audiobook is a bit more riskier than buying a book. Another difference is that with books, you can very easily skim through again to find something as a reference. To read a particularly interesting passage again. Or to rehash something you feel worth remembering. No such luck with audiobooks. Until they've got really good searchable captions, you're pretty much stuck with just jumping around on the audio timeline to try to find what you're looking for. So that makes audiobooks much less suitable as a reference point. But like I mentioned last week, it's great to hear the idea at least even though you might have to hear it a couple of times to get the maximum benefit out of it. So because of that, there has been audiobooks that I like so much, I wish to buy their physical book just to reference it once in a while.

So the first audiobook I'd like to mention is, Can't Hurt Me: Master Your Mind and Defy the Odds, written by David Goggins, narrated by David Goggins and Adam Skolnick. This was my first audiobook. I was quite at a loss of what to purchase first because I didn't know what to expect. This was on the list of best sellers, so I though I'd give it a try. And I absolutely loved it. It was mostly narrated by Adam Skolnick, but between the chapters there would be something like a podcast where Adam and David talked about what have just been read and David would give the content more context. It was great, and the reading and conversation was full of enthusiasm. It's the first time I've heard of Ultraman races. I've heard of the Ironman races before, but the ultra races is even more crazier. I can't even begin to fathom the kind of mental perseverance it requires to run for days and days without any rest or sleep. And I sometimes wonder whether there has been any muslim participants and how would they stop to pray on the days of the races. Anyhow, Can't Hurt Me is almost like a biography book. It follows the life of David Goggins from an abused child, to distinguished Navy seal officer, to Ultraman runner. He shares his life story and the techniques he used to master his mind and defy the odds.

I've listened to some great lectures, namely from the audiobook "Great Mythologies of the World" and "Your Best Brain: The Science of Brain Improvement". The Great Myth book is the longest audiobook I've listened to, clocking in at over 31 hours. But it was quite fun. I've enjoyed listening to how different cultures around the world tried to make sense of the world and the stories they came up with in that process. It was so long, that there was a few narrators in the audiobook, and this was my first experience with a pretty bad narrator. He fumbled over words, his reading was quite flat and matter of fact, so that part of the audiobook I didn't enjoy very much. But the rest of it was great. And I liked the Best Brain audiobook. I've learned a lot about how our brain works, or at least our current understanding of how it works, and have gained a better appreciation of what a great gift it is to be human and able to do what we do.

Now there are audiobooks that are just audiobooks production, which is to say, they don't actually come from a real physical book you can buy at a book store. These audiobooks was written specifically to be recorded as an audiobook only and sometimes has things which only an audiobook could have, like music for example, deeply woven into the story. The titles I've listened to which I highly recommend are "Foreverywhere", "The Mystwick School of Musicraft" and "Treasure Island: An Audible Original Drama". "Foreverywhere" is a story of how a lonely unicorn formed a rock band and the challenges they had to face to become a success. "The Mystwick School of Musicraft" is almost like Harry Potter where the main protagonist went to a special school to learn how to do magic. But in this world, magic is done using music. And it is not some sort of secret wizard society where the muggles has no idea about magic, but everyone knows about music and their magic and even fought world wars using music magic. It was quite funny and the music was lovely. "Treasure Island" is an audio drama, with many voice actors and actress playing out the parts of the characters. It was great and suspenseful. The voice acting was really good and really brought the whole story to life.

I've listened to "The Qur'an: A New Translation by M.A.S. Abdel Haleem". I've had the book for quite a long time and read it through a couple of times already. Easily one of the best Qur'an translation for me because it uses modern terms and language, and also formatted to be more like a book with paragraphs rather than line by line translation only. But listening to the audiobook, made me realize how dense the Qur'an is. Lessons and teaching is quite short and compact. So if you haven't been paying too much attention, like you do when you're walking while listening to an audiobook, you might miss the content of one or two sentences and basically you've lost that point already. The Qur'an will move on teaching other things. It doesn't have a lot of the usual intro phase, then the bulk of the lesson phase, and the closing/conclusion phase of each lesson. It is one lesson after another in short intervals. It was quite a hard listening for me at first. Then I've learned to relax and just take in as much as I can without stressing out about getting everything. Then it was fine. So I intend to listen to it regularly at least every few audiobooks. I've listened to it twice already now.

I've also listened to "The Subtle Art of Not Giving a F*ck: A Counter intuitive Approach to Living a Good Life" by Mark Manson, "Loserthink: How Untrained Brains Are Ruining America" by Scott Adams, "12 Rules for Life: An Antidote to Chaos" by Jordan B. Peterson. These are some of the books that I mentioned I'd love to buy the actual physical book so that I can refer back to them once in a while. I like the ideas shared in the books. I don't agree with all of them, of course, but there are some ideas which I though would be useful for me to try to implement in my life. And I would like to able to share those ideas with other people by sharing the book with them. I think quite a lot of good can be had there.

Well, those are some of my thoughts and experience with audiobooks. This piece has got quite a bit longer than I was planning so I'd stop here. But if you are trying out audiobooks, give them a try. I'm sure you'll enjoy them all. Till next time, wassalam.

Wednesday, December 4, 2019

Personal Update

I haven't written a lot lately. It's mostly because I haven't got a lot to say that was important enough for me to spend time and write it out. I think that's probably a mistake. I should probably write more just to practice writing and to be more articulate. So I'm trying out a new schedule where I try to write something out at least once a week. I'm going to think of something to write every week and use the whole week to write bits and pieces of it until I can get round to putting it all together to be published on Wednesday. And since this is the first time I'm doing this and I haven't prepared anything for this week, I figure I'll just try something easy like sharing my own personal updates this year.

So it's almost the end of 2019. It has been quite a roller coaster ride for me. Just last year, the Pakatan Harapan formed a new government after the 14th General Election in 2018. Ever since then, well.. life has been pretty much the same. The best thing so far that has come out of the election results is finally all the big investigations into major corruption cases is finally getting trialed in court and we can see how bad the rot was. But apart from that, life goes on. Politicians are still being politicians. And Malaysians are still being Malaysians. And there hasn't been much difference for me, apart from My100.

Late last year my department was moved from the great Menara Bumiputra Commerce in front of Sogo to Menara CIMB at KL Sentral. In the beginning I wasn't very happy with that. There's a lot of things I miss about the office space at MBC, but the thing I'd say I miss the most is the food and the shops. Food was very close to the office at MBC, very close and very cheap. You just have to walk out across the road and you already have so many choices of things to eat and drink. Sure there was a lot of moments of no one knows where we should eat, resulting in almost 15 minutes of friendly arguing about "you choose lah","how about this one","I don't want to eat there","so where do you want to eat?","I don't know, you choose lah". But worse come to worse we can just eat across the street. And you can choose to have a 15 minute "teh tarik" session just before you head on home. Here at Menara CIMB, that 15 minutes is the walking time to and from the closest place to minum, so you can imagine lah the friction of choosing to have a break first before going home. Better to just head on home, minum dekat rumah. And the shops. With Sogo being right in front of the office at MBC, it's absolutely no problem to just quickly run over and buy some groceries to bring home, or pop over to the pharmacy for some medicine or vitamins. No such thing at Menara CIMB. And for Friday prayers, at MBC it was just a short walk to the Dang Wangi police station, barely 5 minutes walk. Here at Menara CIMB, we usually go to the surau at Menara Bank Rakyat, which was almost a 20 minutes power walk. It's no unusual to reach there panting and sweating especially on a hot day. But as the way things usually goes, you get used to it. So it's not so bad now, and maybe somehow a bit better? Let me explain.

This year, just like so many years before, I'm trying to slim down and live healthier. And just like all the years before this, many times I started something, a diet or an exercise, then stopped. But this year I started something which I hope to be able to continue for a long time to come. This June I started taking the LRT and MRT to the office. So I would ride my motorcycle to the Sg Besi LRT, take the LRT until Plaza Rakyat, then walk to the Merdeka MRT station and take the MRT to Muzium Negara. And that come out right beside my office. It takes around an hour to commute this way, with around 15 to 20 minutes of that walking, so I'm finally getting in some regular physical exercise. And because I'm taking the LRT and MRT almost everyday, that's why I feel so grateful for the My100 scheme. I just top up the Touch & Go on my IC and we're good to go for the whole month. And in fact, even at lunch time I can take the MRT and LRT anywhere to eat and not have to think about having to pay for the fares. Great. It's still a lot of walking though, but since walking is now my preferred form of physical exercise, I don't mind it that much. And not only that, now I look forward for Friday prayers to solat at Menara Bank Rakyat. That itself could easily clock in 2000 to 3000 extra step counts for the day. And since all the cheap eateries is quite far, like I mentioned before, there's a whole lot less "teh tarik" session and that is surely a good thing for a guy who's trying to slim down a little. So all in all I'd say I'm kinda grateful that we were moved to Menara CIMB, KL Sentral.

Another thing I started when I started walking was that I listened to audiobooks. When I planned on walking like this in the morning, I knew I had to find someway to distract my mind from feeling the physical exertion it had to endure, so one way to do it is to distract it with audiobooks. I must confess, I haven't been able to read proper books for long periods of time for quite a while now. I get so tired and sleepy so easily, it's a pain to endure while trying to finish unexciting parts of books. But with audiobooks, I just have to listen while I'm riding the LRT/MRT and walking from station to station. The walking itself is quite safe from any traffic or dogs or whatever so it doesn't matter that my ears and frankly my mind, not being 100% focused on where I'm going. And I love that an actual book is being read to me rather than just some unfiltered ramblings of a conversation like radio or podcast. A book is an idea already filtered, sorted and crystallized so that it makes sense and bring real value. And when I hear a real good audiobook, it makes me want to buy the real physical book so that I can randomly look up things and refer to it once in a while. And the great thing about books, whether physical or audio, is that it gives you so much ideas and knowledge. I've learned so many things on my commute that I look forward to it everyday now. Whenever I'm listening to a particularly interesting or funny book, I even cheat sometimes and listen to it even when I'm not commuting. Maybe one day I might even write blog post based on a book which I've listened to. Maybe.. one day..

Anyhow, that's what I wanted to share for now. I hope I'll be able to write more consistently every week and keep on getting better at it. I'll try to publish new content every Wednesday. Till next time, wassalam.

Wednesday, October 16, 2019

Rendering template from string using thymeleaf in spring

Finally solved a very big problem for me... How do I render a page in spring framework that uses the thymeleaf templating engine? The string most probably will come from the database. After long hours of searching and trying, I've got it.

First I've got a clue from this particular stackoverflow question. But following an example from there got me an error about class not found for ognl.PropertyAccessor. That solution was found here.

So here's how I finally done it...

First thing is to create a service where that service can be used wherever you need it in your spring app.


@Service
public class PortalService {
    
   private TemplateEngine templateEngine;

   private final static String TEMPLATE_LOCAL = "US";

   private TemplateEngine getTemplateEngine(){
        if(null == templateEngine){
               templateEngine = new TemplateEngine();
               StringTemplateResolver templateResolver = new StringTemplateResolver();
               templateResolver.setTemplateMode(TemplateMode.HTML);
               templateEngine.setTemplateResolver(templateResolver);
        }
        return templateEngine;
   }

   public String getTemplateFromMap(String htmlContent, Map dynamicAttributesMap){
        templateEngine = getTemplateEngine();
        String template = null;
        final Context ctx = new Context(new Locale(TEMPLATE_LOCAL));
        if(!CollectionUtils.isEmpty(dynamicAttributesMap)){
              dynamicAttributesMap.forEach((k,v)->ctx.setVariable(k,v));
        }
        if(null != templateEngine){
              template = templateEngine.process(htmlContent,ctx);
        }
        return template;
    }
}
So to use it somewhere in your contoller, do something like this:
Map context2 = new HashMap();
context2.put("object", object);
service.getTemplateFromMap(datafromdb, context2);

Wednesday, August 21, 2019

Learning kotlin interactively

Stumbled on this nice online learning site for kotlin, the Kotlin Koans.
Haven't gone through the whole thing yet, but will soon.

Is Blogging No Longer a Thing?

As I embark on my new journey to learn the Rust programming language, I find myself pondering—where have all the blogs gone? In search of pr...