Motivation and why finishing a personal project is hard.


Often times I see people saying “I lost motivation” as the main cause to them not finishing personal projects. I’m certainly guilty of it too. But maybe to summaries such a complex problem into an easy out seems like a jet out of jail free card. Really, What is the cause of the loss of motivation?

  • Did you finish learning what you wanted?
  • Was the scope badly defined?
  • Did you really create an minimal viable product, or smaller full product?
  • Did life just get in the way

Life certainly gets in the way, It’s really hard to finish work, cook dinner, clean the house, then go do more of what you get paid to do in your free time.
But there’s a vast difference between a personal project and a work one. I think it’s something we take for granted a lot of the time. This differentiator to me is a team. A lot of developers like to think they work better alone. and maybe they do, but to me, I find we depend on the skills and expertise of others all the time.

With this, I have come to the conclusion, you really need to be the “mad hatter”. Not in the sense of having tea parties and lots of riddles.But rather in the sense of having a really broad skillset to finish a personal project. Take a moment, pause, and think what do you need to finish one?

The books that owe so much to their illustrations

Probably what jumped to your mind was something along the lines of :
Frontend developer : Make a pretty UI so people can interact with what you do.
Backend developer : Make the API / Monolith that will perform as much logic to keep the frontend dumb.

In reality though, we need a larger skillset than the above. For the frontend we need UX Designer skills For backend you need to have an architecture that you deploy to and someone to plan how that architecture is. Try think again, what are all the hats you need to wear?

The list I came up with are as follows :

  • Systems Architect : Design and Create the high level plan for components.
  • DB Admin : Manage the database, have all the schema and ERD skills.
  • DevOps / SRE: Fun of pipelines, deployments, and container orchestration
  • Backend developer: Writing the application backend logic.
  • UX designer : The ability to envision and create user friendly design.
  • Frontend developer: Converting the UX wire-frames into a usable and responsive UI.
  • QA : Catching all the issues and having the base test cases.
  • Technical Writer: Have that documentation of how the endpoints and code work so when you come back in 5 months you know what was going on.
  • Manager : Setting your own personal expectations and ensuring you actually release things.
  • Finance : Those servers aren’t free. Shop around and ensure you are keeping the costs down.
  • Marketing : Ensure you sell yourself to everyone and what you do.

    Of course, take all of the above with a bulk of salt, since each project is different. If you’re doing a RUST CLI project, well of course then you don’t need to have a UX designer and a UI Engineer.But as a rule of thumb it’s always important to evaluate what hats are important to wear.

So how to improve!

Planning :
Know the exact scope of what you’re trying to do. The very minimal amount you’d consider “OK”. Keep a clear vision of the base system architecture. Know what your willing to pay, and for how long. Have your ERD ready of the MVP.

Research:
Ensure you’re using the appropriate tools for the job, with that in mind, check if any of the tools you used before have new functionality implemented. If you’re not fully content with something before you start do some training! Youtube has a lot, another place I really like is TeamTreehouse or Linux academy / cloud guru.

Creation :
Have a Linux (ooft a silly typo I initially made) Unix mindset of write small components that do one thing well.- As soon as you can, deploy that way you can fix it early. “A stitch in time saves nine.
Don’t be a perfectionist and spend a day working on one method. You may not even use that method in the end. So best to keep the ball rolling and motivation high by avoiding perfectionism.
Remember “Rome wasn’t built in a day” is a proverb for a reason, progress takes time, be easy on yourself and set reasonable but achievable deadlines and expectations.

Conclusion

  • Commit to things that have meaning and importance, this meaning and importance allows you to finish.
  • Really plan and have everything laid out before you start.
  • Finishing in some form, is better than never finishing.

Stealth edit, feel free to connect with me on Linkedin.

How to use AWS API Gateway Lambda Proxy Integration

Since I found the AWS documentation to be a tiny bit overwhelming in terms of amounts of information, I thought I’d write a clear concise and hopefully helpful tutorial on how to get Lambda Proxy Integration working.

Step 1:

These are the prerequisites. You need to have an API Gateway with a resource and a method (in this tutorial it’s a get method because GET cant have  bodies while sending information).  You will also need a Lambda function ( or at least know how to make the above).

Navigate to your API, from here go to the method on the resource. In this case it’s a GET method on the “createqueue” resources as seen in the left hand side. We want to click on “Method Execution” which will bring us to the screen in the screenshot.

We need to make sure that Lambda Proxy integration is enabled. We also want to make sure that our Integration type is Lambda functions as that’s what we will be using.

This is the first critical step!

Step1

 

 

Step 2:

We will want to navigate to the lambda function associated with this resources now. First of all it’s best to set up the test that we will use to verify it works. The screenshot below shows JSON that gets passed to the Lambda function.  The “queryStringParameters” is used to denote what we expect to find passed to us in the URL along with a value. In this case it’s a “queueName” and a sample name for a queue.

Step2

Step 3 is somewhat more challenging!

Every lambda function always has an event, and context. The event contains the payload of information. The context has meta information describing the event.

With that short definition out of the way. We access the information in the event passed via query string parameters by going event[‘queryStringParameters’][‘Item’] . This is the second critical step.

However we still have some work left to do in the lambda function. The API Gateway expects us to return certain information.

It wants to know the statusCode (was it successful ? or did something bad happen in the lambda). What the body is that we are returning, in my use case I am returning a queueName that gets generated by SQS. It also wants to know about the headers, some are optional but you do need the content type one.

Formatting the data in a way the API Gateway understands the response is the last critical step!

Step3

 

 

Now we can navigate back to the API Gateway and test our changes.

In the picture below you see that we are now passing in the newly made query parameter along with a value. On the right hand side we see the response body of the queue we created!

Step4

I greyed out the logs and response headers as they’re excessive information that aren’t all that important to understanding the basics.

step5

TLDR:

Enable Lambda Proxy Integration

Access input data like  : event[‘queryStringParameters’][‘Item’]

Return JSON object to API Gateway with the needed information.

 

Google Algorithms Workshop

To start the day at google, we all enter the reception and gather our name tags, chat a little bit with one another about the weather and journey in, then maybe 30 young adults including myself were escorted into a rather colourful room full of seats and desk along with dual projectors so everyone could see what was going on. Shortly afterwards they (googlers I’m going to use “they” for anonymity) addressed us on problem solving.  Something a lot of people take for granted.

The steps for problem solving when it comes to algorithms that they suggested when you’re in an interview situation, in no order are:

1) Clarifying the problem cases, any ambiguity can be a dire hindrance. They encouraged us to always dig into the edge cases, ask for clarity.

2) Situational questioning: Don’t take anything for granted, in this given situation could any of the following be an issue such as time, memory, scale, performance.

As an example ask if the data set size is not defined already ask, as an example ask if it’s 5 or 5000 as that makes a great difference to how you approach the problem.
To me this seems like incredible advice, people are often too keen to rush into it and just write code without thinking. It’s always important to remember that when you’re dealing with people you’re understand will always be somewhat different than theirs. This asking for clarity is showcasing some fundamental soft skills.

3)When it’s an algorithm ask which is more important time complexity or space complexity. Chances are that when you’re working in most environments time is more important, but if there’s a doubt ask.

4) What data structures could be of use? At what does each one do incredibly well? Such as hashmaps could be of use when it comes to de-duplication. Also remember the trade-offs (if any) that could be involved.

14037618_1128529930538215_464010325_o
With all that in mind they gave us a (banned) sample question. Paraphrasing this and shortening greatly but it was along the lines of “Write an algorithm to count the amount of events that happen each sec, min ,hour when a certain event happens”.
The key thing to note here, is that we are working by each clock second, and that we are working with huge data sets up to thousands of items.
If you want take 4 minutes to think of a solution before reading on, this was the time given (including any other thoughts that may be important).

One approach would be to use a linked list along with timestamps, however this is generally only better for smaller data sets.
Another one would be to use a circular buffer array, however, there are problems with this, in the end of the hour you will need to clear the last second preparing it for the next second. You also need to consider if the functions don’t get called then you need to clear inputs that may mess with the test cases.

After all this we did a few other algorithms questions. Which helped me realize that there’s a plethora of real world applications for simple algorithms to help simplify seemingly complex tasks. Afterwards we took a few breaks, it was during one of these breaks that I gained a lot of insight as to the selection process. I asked them “When you’re looking at a student would you rather a plethora of languages or expertise in one?” they confidently responded to me that it’d be best to be honest, honest with yourself and everyone else, never over exaggerate your technical abilities. But an expertise in one language could never be a bad thing, as long as you know the fundamental principles of OOP and can apply them it should be fine. At the same time they did state having experience in many languages can be beneficial in any scenario.
The other question I remember posing is “When you look at a student, which do you find more interesting grades, or outside of college work” of course the answer to this question is subjective so it’d differ from one to another. With that in mind they stated grades are a good indicator as to the talent of someone, but passion for what you do by participating in code jams along with things outside of the course such as internships are equally as valuable as you will gain skills you can never attain by studying.

Following this we went back to the room we were previously in to discuss the technical interview at Google and the process one goes through when dealing with a company of this scale.
In the technical interview, the google format would be:

  1. A short introduction and settling down for about 5 minutes or so.
  2. A technical assessment of 35 minutes that may include a warm up question. They won’t have logic puzzles.
  3. Close along with a question.

The tips that they suggested were:
When given a question they stated that it can be a good idea to ask for an example set of data if it is appropriate and ask for clarification if needs be.

They also stressed how important it is to talk as you go along, highlight your logic in what you’re doing. Do what you do with conviction and justify it out loud as you go along. There’s no point in simply writing perfect code as that doesn’t give them insight as to how you solved it. Have a bit of back and forth with your interviewer as otherwise it’d be awkward standing there for over 10 minutes in silent in an interview. If you’re working off any assumptions, say so clearly as you go along. It will help with the back and forth between you and the interviewer. Go for simple, refine it and create the optimal code from there.

Google are also looking at can an interviewee make use of any tips given to them. Can they improve upon feedback given to them to make a better solution that is more efficient, they will always throw more complexity at you. They are testing to see where your personal limit is. As always it’s a good idea for multiple test cases and create more efficient code as you go along.

When writing code by hand, they noted that syntax isn’t the be all and end all, but you should know the ins and outs of whatever language you’re coding in. Avoid pseudocode as little as possible and it might not be a great idea to change your preferred language last minute as a question may be harder in one language than another *looks at C*.

As “Advanced” tips, they suggested to use linux to dive deep into internal networks. Python and GO can be super handy to code on whiteboards, while languages like Java and C can be incredibly long in contrast.

Layman’s guide to PC parts.

I decided to write this as I know a lot of people find computers hard. Even more don’t have an iota of what goes on inside the case, or sometimes incorrectly referred to as the “hard disk”. I must note that to do this simply sacrificing clarity is done at some points.

Case: This is where everything goes into. There are different types of cases which I won’t go into extreme detail but it would be safe to go by understanding that ATX (Advanced Technology eXtended) however there are other types like MINI ATX. This refers to what type of motherboard fits in the case itself. Fans are important, they deal with the air flow. If it’s too warm the computer will falter, if it’s too dusty it will also cause other problems as the parts can’t get enough air to keep cool. I’d suggest having at least 2. I’d also suggest having filters of sorts to keep dust out. To clean it you can used compressed air.

Motherboard(Mobo): This is what everything plugs onto/into. It’s important to note that if you’re going to build a gaming rig and you want to overclock(OC) you need to have a motherboard that supports this. Your motherboard also needs to be compatible with your CPU. Motherboards generally accept certain CPU socket types, such as LGA 1150 which is used for Intel CPUs while AMD would have G34 socket type.

PSU(Power Supply Unit): This is what keeps the machine going, without a PSU it won’t turn on. Depending on what you want your machine for you’d be looking for at least a 550watt PSU. Over time this may change and more or less power may be needed depending on what type of PC you are building. I’d highly suggest looking into tier lists. Avoid the Corsair CS brand, they’re prone to breaking and lots of people have problems with them. This is due to bad capacitors but that may have changed since I last checked. It’s also important to note the quality of the PSU, most “ok” ones you find will be bronze. The best of the best are Gold rated for their efficiency. It’s also possible to buy a 1000w Gold PSU or something to that extent, but it can be a waste of money as your system may not draw that much power ever.

CPU: The brains of the computer, speed of the CPU is measured in (GHZ), L2/L3 cache, and amount of cores determine how good it is. Per core performance is important though if you were wanting to game as most games simply don’t utilize every core (Like that image of people digging the hole and 1 guy is doing it). Most people that want to game go for an i5 of some sort such as the 4690k. However in an example if someone wanted to do streaming they often go for an i7. It’s important to note that there’s a CRUNCH sound when it fits into the motherboard(With some CPUs), this doesn’t mean it’s broken simply the pins (the bottom of the CPU) fitting in. It’s also super important to always hold the CPU by its sides and NEVER touch the bottom of it.

RAM(Random Access Memory): It’s measured in GB in today’s age. Most people who build their own rig would have about 8+GB. However, if you have a 32bit Operating system you will limit yourself and never use more than 4(I know it’s not 4 exactly but it’s easier for the sake of example). The most common type of RAM is DDR3. However, DDR4 ram is coming more and more into the scene. DDR4 is commonly found with LGA1151 socket types.  Demanding programs generally eat up a lot of this such as photoshop.

GPU(Graphics Card): This handles calculations of things displayed (like video games). It’s possible to have multiple GPU’s and “crossfire” them together to make them act in harmony (That said there are multiple conditions for this to work). With video games people would generally have a R9 380(or higher!) from AMD or a GTX 970 from NVidia. The higher monitor resolution you run at the better GPU you want to have. Running 2K/4K is often too demanding on mid tier GPU’s. Most have displayport and HDMI connections. If possible you’d want to use the displayport.

Monitor: The things you want to look here for most is the refresh rate and resolution. The refresh rate is the rate at which things are displayed. If the refresh rate is at 60, the monitor will not be able to display things at higher frames. The resolution you’d want would be at least 1920×1080. Following this you would generally want a good response time in a monitor.  The higher the response time the worse it is for you.

 HDD/SSD(Hard Disk/Solid state Drive): They are where you store your files. The faster the Revolutions per minute the better. The higher storage(Generally TB) the better. It’s also important NOT to defrag an SSD if you do decide to get one.

 

So tell me what you think! If I got something wrong or you just want to say that you read this piece I’d love to hear it 🙂

 

Xbox 360 controller combinations with LWJGL in Java.

 

I suppose instead of starting a new blog I may as well reboot this old blog.
In this section of the blog I’d like to talk about a solution I developed to finding combinations of buttons pressed on a controller. It may not be perfect, like everything I am sure it has flaws. In my controller assignment I was concerned with ABXY on the Xbox 360 controller. Having no background in programming with controllers this was something new I never came across before, how to tell a combination of button presses. So if A followed soon by A is double jump how’d I note that down?

I suppose it’s important to note, the original idea of having button combinations as part of my assignment was suggested to me by Joost, a lead developer of a game called “Awesomenauts” and who’s part of Ronimo and indie games company.

I started off thinking the possible ways to do it, one thing that kept on coming to mind was the Fibonacci sequence(0..1..1..2..3..5..8..etc). But why?Well the logic I had was if I assigned a number, let’s say 1 to A, then if A was pressed twice I knew the combination number would be 2. This was similar to the Fibonacci in that regard. But then we can face a problem. For this idea to work I needed to make it so no 2 combinations could create the same sum. Here’s where we begin to face a problem. As an example, if we assigned 0 to A, 2 to B, and 1 to X. Then the combination of AB is the same as XX.

From here my approach was that whatever number I assigned to each button needed to be sum of previous combinations added together + 1.(..1..3..5..9..18..36). The only reason that this would work is a single button press doesn’t count as a combination. You may get 9 + 9 which gives 18, but whatever button has the value of 18 wont count as a combination until the value of another button is added to it. I cross referenced this against (https://en.wikipedia.org/wiki/List_of_OEIS_sequences) The only similar sequence you could get would be “Jacobsthal number”.

At this point I also noticed, AB and BA would result in the same value. This was problematic and I still have figured an approach to deal with this problem truth be told. I suppose Booleans could be used for it. But truth be told for this assignment I decided to sweep this problem under the rug.

The code snippet (in Java) I used for calculating what number it would be is here.

if(buttoncounter==0)
{
buttime1=System.currentTimeMillis();
buttonvalues.add(number);
}
if(buttoncounter==1)
{
buttime2=System.currentTimeMillis();
buttonvalues.add(number);
timebetween=buttime2-buttime1;
if(timebetween < buttonms)
{
buttonadder();
buttoncounter=-1;
timebetween=buttonms*2;
buttonvalues.clear()

}
else
{
buttonvalues.clear();
buttoncounter=-1;
timebetween=buttonms*2;
buttime1=buttime2=buttonms*20;
}
buttonvalues.clear();
}
}

So, at this point I leave you a question. How’d you go about this? What do you think of my method?All constructive criticism is appreciated.

Progamming Language selection.

Programming languages “Project Suitability” is the main topic of this post. This is more so an opinion post in contrast to other posts that I make.  So, what I mean by this is how good of a “fit” a language can be for an assignment or project.

Comfort with syntax.
Even though this may not seem like a huge factor, I think this is one thing that a lot of people do subconsciously. As humans we’re bound to go to what we know before we go to the unknown, with that in mind I think it’s fair to assume that this is a big factor in the language selection. If someone codes in JAVA for years on end chances are they know the syntax and errors like the back of their hands.  They’d be able to catch and error quicker and there’d be much less hair pulling.
As a bit of anecdotal evidence, I recently started to use Python, but the fact that it is so simplified and streamlined caught me off guard. No semicolons, loops are different, declaring and using variables differently were things that I simply wasn’t used to.  Although, I feel as if it’d be harder to go from Python to something like C because of that.

Libraries.
Before I write a line of code, I always look at the libraries I need, skim reading the docs of each compare them to see their benefits. If one language overs me better libraries for the task then chances are I am going to pick that language for that reason. There’s no reason why I’d take the extra hassle of using a worse library and toiling away with it when another language offers a better version. An example I encountered was the difference between libraries for games in C# vs Java, it’s unreal.

Suitability for the project.
By this I mean, can I accomplish something easier with one language over another. Why write 150 lines of code when you can write 30? In my opinion simplicity in larger programs is key. There’s no point having excess complex code. An example for this that comes to mind is a minor thing I was working on, writing a reddit bot. It’s far easier to do this in Python than it is to do it in Java.

Control.
What level of control do I want? Do I want to be using pointers, dynamic memory allocation and memory allocation in C or do I want to let Javas JVM deal with that kind of thing.  This is only an example of control but I think it gets the point across rather well. Lately I feel as if a lot of programming languages are moving to the point where it does a lot of things we take for granted for us.  I can only wonder what it will be like in 40 years.

All of the above contribute to how I decided what language I am going to use when I make a project. I’d like to believe that for each programmer they have different weightings on how important they are.

New blog.

This is a new blog,

Mainly so I can discuss ideas I have, thoughts related to projects I found interesting and stuff along the lines of that.

Mainly I intend to discuss things I found hard while working on projects or stuff that intrigued me.