Oops, I did it again
A month ago, I wrote about my first contribution to an open-source, Microsoft-maintained, project, from June 2024, that got merged by November 2024. What I didn’t mention at that time was that that wasn’t my only contribution to that project. Shortly after that pull request got merged, I opened a second one. Once again, I created an issue, to report a bug, and a pull request, to solve the bug, back to back. However, this time I made them in the correct order.
The same project from the last article required me to enable ETags on the OData API that I was working on. An ETag is an HTTP header that’s used for cache-invalidation and concurrency control. It’s basically like a hash representing the state of the resource/data at said endpoint. The client may use it as a cache key and the server can use it for concurrency control when multiple requests attempt to update the resource at the same time. ETag values are based on a special field/column on the resource record that changes every time the record is updated.
Lets talk for a moment about how ETags help with concurrency control.
Read Full PostThe Painted (2024) - Movie Review
I am not a fan of cinemas. In fact, I’m quite the opposite. I particularly detest going to cinemas. I prefer watching movies in the comfort of my own home, with my own popcorn and unlimited condiments from my fridge for my hotdog. The only times I go to a cinema are when I’m forced into it.
Today was one of those occasions. While movies that I would naturally find more interesting like Mufasa, Sonic 3 and Brave New World were playing, I couldn’t buy a ticket to any of them because they belong to a class of movies that me and my sister always watch together. It’s sacred. Since she wasn’t with me today, it came down to this bunch:
Read Full PostHow to work for Microsoft without getting hired
I’ve been a fan of open-source longer than I have been an adult. The moment I first switched to Linux in 2012, I knew it would remain my daily driver until I could afford to buy a Mac. As I, both voluntarily and involuntarily, continued to ditch my usual programs in favor of free and open-source alternatives, the deeper I dove into the world of open-source and the stronger became my desire to contribute to it.
Read Full PostI made a MIPS simulator
AKA MIPS – A Java Based MIPS simulator. Browse the code on GitHub.
Long story short, my Data Structures teacher gave us this project where we hasd to use our knowledge of data structures to make something useful. She said we could do it in groups so naturally I found myself in a team of 3.
She told us about the project near the start of the semester and a week before it was due we were still trying to decide what we were gonna make. She said that we would have to present our project and pitch it and convince the audience that it’s a useful piece of shit. The problem with us was that any idea we came up with was either far too advanced and therefore not worth the time and effort or far too simple for our ego to allow us to go about presenting it as our grand project.
I thought maybe we could make like a virtual machine of the Altair or any other primitive computer and that led us to the idea of making a MIPS simulator. We opened the instruction set in a browser tab immediately and were relieved to find that it was sufficiently small and therefore we decided that this was what we wanted to do.
Within 24 hours I had written a buggy but functional parser that could read assembly files coupled with a machine object using a couple of integer arrays for simulating the RAM and registers. Downloading and running some assembly code for MIPS on my parser helped me fix some bugs and typos that had crept in.
Because the teacher had insisted that the project be a graphical program, one of our team members was tasked with creating a GUI for this and so he made a JavaFX project that ended up looking very similar to the MARS simulator for MIPS. No it wasn’t at all a coincidence because he had used MARS before.
After coupling my code with the GUI, I would say we ended up with a pretty decent program. It has a few limitations, e.g. lack of floating-point support. I learned from Steve Wozniak that it’s okay to leave that out when you’re writing your own language processor. On a serious note though, I didn’t initially plan on leaving it out but I learned after it was a bit too late that MIPS had a whole set of 64 bit registers for handling floating-points and I didn’t feel like making any changes to the otherwise working parser. Other than that, there’s no support for unsigned arithmetic. The whole program is Java based and Java doesn’t have unsigned types so neither does the simulator.
The code for the program is available on github. Feel free to check it out, give your feedback and even suggest improvements. It’s not on my teammates account because he created an pushed the code for the GUI on a separate repo and then merged the parser code directly into it.
On “Looking Backward: 2000 to 1887” by Edward Bellamy
A couple of weeks ago, I posted about “The Sleeper Awakes.” At some point in that book, Graham (the protagonist) compares his situation to that described by Bellamy; and earlier in the book, when he is sound asleep and has only been asleep for a few decades at most, we see his friends talking about the same thing. Curious as I was upon reading that name I chose to google it. (I don’t quite remember exactly what I googled but it was probably something like “Bellamy Socialist Utopia Sleeper.”) I found out that there was a book by an Edward Bellamy called “Looking Backward: 2000 to 1887” in which a man sleeps for somewhere slightly above a century and, you guessed it, wakes up in a world vastly different from the one he slept in. I downloaded that book right away and made a mental note to read it after finishing “The Sleeper Awakes.”
A few hours ago, I finished reading “Looking Backward” and I thought I might as well write about it and throw in a few words about the similarities and differences between the two books. There are SPOILERS AHEAD so proceed at your own risk.
Read Full PostEntropy of life
I know it’s kind of a weird title. I will promptly explain it. Have you ever been in one of those situations where you went ahead and did something without thinking twice only to later regret doing it and spend the next few days brooding over different ways to deal with all possible undesirable consequences of that course of action?
We often see situations like these in movies. I considered adding examples here from Harry Potter or The Flash or Infinity War but then I decided against it because I didn’t want to post any potential spoilers and because not everyone would be familiar with those scenes. Instead let me use a very general example: Something goes wrong and the protagonist(s) considers possible courses of action to take. In short, they form a plan that sounds completely nuts but they decide to do it anyway because it’s “the only way.” And all that while you’re just sitting there hoping that they’d see things your way because ot you there’s clearly another and better way but they can’t seem to think of it. Anyways, they go ahead and execute their plan only to screw up further and get themselves into a situation much worse than before and then the cycle starts again (or maybe not.)
Now that I am done typing that stupid example, I realize that it’s too general to be of any use. So let me use the example of time travel. Let’s say you have a regret. Years pass and you cannot get over it. Say you gain access to a time machine. You go back in time to fix it only to realize that you created a new world that’s equally undesirable. You try to figure out the point in time where this new world of yours went haywire and try to fix that. Again you screw shit up. Eventually you realized that you’ve messed it up to the point where it cannot be fixed. (There are actually movies about exactly this.)
Have you ever met someone and gotten to know them really well only to end up wishing you’d never met them in the first place and thinking about how your life would have been so much better if you hadn’t? Or maybe you’ve at some point said something that you immediately wanted to take back and so you keep on thinking about different ways to explain yourself should someone bring it up again and you can’t help fearing that someone would hold it against you. But anything you say to cover it up could only make matters worse.
In short, what I mean to say is that things always get worse with time. The more the time passes the greater the number of things in your life that went wrong, the more secrets you have and the more people there are that know your secrets, the greater the number of people in your life that you watch out for e.t.c. and every lame attempt to fix any of it only creates more problems. Life only gets messier and messier and there’s no way to clean up that mess.
On “The Sleeper Awakes” – H.G. Wells
I don’t exactly remember how I discovered this book. But at least a couple of months ago, I came across the name, looked up the synopsis and downloaded it with the intention of reading it on the first chance. Less than a month ago, on a particular midnight, I was unable to sleep and having little to no desire to take up something educational, I decided to go through my collection of fiction. The H.G. Wells folder caught my eye and I opened it to reveal this book along with a couple of others. Remembering suddenly what it was about, I decided to start reading it.
Fun Fact: The first chapter was called “INSOMNIA.” Also adding that although I mean to not talk in detail about any events in the book, depending on your perspective, there may or may not be spoilers ahead so proceed with caution.
Read Full PostExplaining Savitar to a noob be like
Me: Hey, Tom Felton made an appearance in the Flash.
They: Who’s that again?
Me: Malfoy.
They: What does he play?
Me: Julian Albert. A CSI working with Barry. But sometimes he gets mind-controlled and takes on the mantle of “Alchemy.”
They: Who controls him?
Me: Savitar.
They: Who’s Savitar?
Me: Barry.
They: Who’s Barry again?
Me: Flash.
They: Why does he control him?
Me: To create evil metahumans.
They: Why?
Me: Because he’s evil.
They: The Flash is evil?
Me: No. Savitar is.
They: You just said Savitar is Flash.
Me: I said he is Barry.
They: And Barry is Flash, right? So..
Me: Savitar is another Barry.
They: Like a clone?
Me: Yes, quite like a clone.
They: Where’d he come from?
Me: The future.
They: So basically, Barry turns evil in the future and goes back in time to fight himself?
Me: No. Barry clones himself in the future and that clone travels in time.
They: Why does he do that?
Me: Because he needs help.
They: With what?
Me: Fighting someone. He creates many clones of himself in the fight. They all die except for one.
They: Who was he fighting?
Me: Barry.
They: What?
Me: He was fighting Savitar.
They: No. You said he created Savitar to fight someone else.
Me: He created a clone to fight Savitar. Then after the fight, he told the clone to go to hell. The clone had no purpose or place. Just endless pain. It drove him crazy and turned him into Savitar.
They: This time travel shit is confusing.
Toggl’s “Building a Horse with Programming” comic explained
If you don’t know what this is about, you should first go and check it out.
So, C++ is, for me at least, an intolerable programming language. Everything from the code to the resultant program tends to be as ugly as it gets. More than half the time it feels like it was hacked-together to include everything. However, it has been around for a very long time and you can use it to do just about anything that you could want to do with a programming language. Only, the experience and the result may not exactly be great.
Then we have Java. The main problem with Java is that for a language that aims to be useful for all sorts of applications on all platforms, it’s missing a lot of features that are commonly used by full-stack developers. Very often, when writing programs in Java, programmers end up spending more time than they need to creating new types and methods so that they can use them in the program that they actually set out to write.
Ever since npm and nodejs gained popularity, JavaScript has become one of the world’s most widely used languages and npm is probably _the _most used package manager of them all. And the thing about Javascript programmers is that they use a lot of external libraries and packages and every once in a while, they add their own package to the global repository just to get a kick out of it. By now there are probably more packages in npm than there are libraries for any other language out there and when you are a JavaScript developer, you really have use them if you want to get any work done. The pinked “Backbone” and “Angular” are references to Backbone.js and Angular.js, two popular JS frameworks.
NoSQL refers to database systems that don’t use SQL and are non-relational. An example is MongoDB, which stores JSON objects grouped into collections. The joke is that the non-relational model doesn’t always expose enough information for you to be able to access your objects without using the abstract api.
COBOL? Well, I guess no one entirely gets it except for its creator.
Lisp has a lot of parentheses. Just google sample codes for lisp and you’d know.
C# is a fairly complete and tolerable language. The problem? Microsoft. Windows. The thing about the costume is that C# is basically Java in a costume (it closely resembles Java in terms of syntax and semantics.) The camel is basically the windows environment. Basically, it means that C# programs don’t always work as intended if not running on Windows.
Assembly doesn’t really offer a lot of language features. There’s a basic set of operations that have to be used for everything. But coding something in such a low level language means you get control over aspects that most languages abstract over. So you can make a really efficient program, hence, the thing about running.
Everyone hates PHP. They say it’s a terrible and unsafe language and has unpredictable behavior. I personally have reasons to really like PHP but I will still go ahead and tell you that most good posts on the subject target aspects of the language that really do suck so yeah some of the hate is justified.
SQL Server screwups and how to fix them.
So recently I installed Visual Studio 2017 on a laptop and I installed it with only the ASP.NET and WinForms features. I was working on a webapp and initializing the database when I realized that VS was completely unable to connect to the database. I opened the “SQL Server Object Explorer” and tried to manually connect to the MSSQLLocalDB instance and I got this error.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 – Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.) (Microsoft SQL Server)
I tried to start the service from the CMD and I kept on getting similar errors. Eventually, I concluded that the installation was corrupted and therefore tried reinstalling LocalDB. Guess what? It got me past this error but introduced me to another. It was something like this.
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘c:\Users\AnasDatabaseName-asdf5sdfasd5fs5dfs5f.mdf’.
This time, the CREATE Database command was failing because it was trying to create and MDF file in my “Users” folder. I checked the default location for the databases and it was in a sub-sub-sub-sub-folder inside AppData. A bit of Googling told me that this was actually a bug in the program itself and had been fixed in a recent update. So I just downloaded the latest Cumulative Update from the Microsoft site and it did the trick.