Friday, April 5, 2024

Important vs urgent

In my workplace, we often have more work than we have personnel to handle it. As a technical nerd, I enjoy tackling technical challenges; however, to use my time efficiently, prioritizing tasks is essential. Whenever I receive a request, I assess it based on the following criteria:

  1. Is this a bug and does it have significant consequences if not addressed immediately?
  2. Is the feature well-defined? Who will be the users, and how will they use it? What value will it bring to them?
  3. Will we lose money in the short term (in less than 3 months), if we don't implement it?

If a request satisfactorily meets either criteria 1, or both criteria 2 and 3, I set aside my current tasks and begin working on it. It's important to note that priority/urgency and importance are distinct considerations. I do not simply ask if a feature is "important," as all features hold importance in at least one context.

Surprisingly, few requests meet these criteria. Those that don't are recorded in our tracking system to be revisited later.

Wednesday, February 28, 2024

How to prepare a good presentation

Most presentations are boring. If you want to make your presentation interesting (assuming you are interested in the topic yourself), do not use any text, only use images or videos. This approach demands more preparation time since you cannot rely on reading from your slides. That's precisely the point because a presentation is not an audio version of a lengthy paper, a leading cause of PowerPoint poisoning. In the limited time available, focus on engaging your audience rather than covering every detail, as striving for completeness can overwhelm your listeners. Quickly captivate their attention and encourage them to pursue more information by asking follow-up questions or exploring additional resources for which you can provide links. The goal is to spark interest, not to deliver an exhaustive lecture. Having absolutely no text in your slides is the simplest way to achieve it.

Saturday, November 4, 2023

AI: Detecting phone number and email in messages

In e-commerce applications operating on a marketplace model, a significant challenge is the exchange of phone numbers and email addresses through messages between vendors and customers. This allows them to bypass the platform, resulting in a loss of commission revenue for the site. Users may employ inventive methods to evade standard detection algorithms that rely on regular expressions, such as spelling out numbers, e.g. "fivethreetwo" instead of "532". To develop a comprehensive list of such techniques, you could prompt ChatGPT with: 'I have a webpage with a messaging feature. I want to prevent the inclusion of phone numbers and emails in messages. What are some ways users might try to circumvent my safeguards?'

This issue presents an ideal challenge for AI to address. I experimented with OpenAI's text-davinci-003 model but had little success, it failed for most of my test cases. Then I tried the gpt-4 model which was much better. I wrote the following PHP script (with help from ChatGPT4) to tackle the phone number and email detection problem in Turkish text messages. Note that to verify that an AI script works, due to the random nature of AI, you should run it a couple of times with the same input to be sure that it provides the expected output every single time. Note also that the message 'şunu dene jane at example 532 222 33', causes AI to fail 50% of the time, because AI counts number of digits as 9 but it is 8! It also sometimes detects an email and sometimes not, so there is still some prompt engineering work to do.

Thursday, April 13, 2023

Adventures with chatGPT

Recently I came across a surprising result with a short C++ code and asked GPT4 for guidance, it performed well:

Me: On visual studio 2022, when building in debug x86, why is the variable "a" printed as strange values like 4294967296 in the following c++ code: 

#include <stdio.h>
int main() {
    for (unsigned long long i = 0; i < 5; i++) {
        unsigned long long a = i;
        printf("i = %u, a = %llu\n", i, a);
    }
    getchar();
    return 0;
}

Thursday, March 23, 2023

Why are your grades important?

Below is the formula used by TÜBİTAK to rank and filter job applicants before an interview:

Let's say your Turkish university exam rank was 50000. Than you would have to have a CGPA of at least 3.2 - 10000 / 50000 = 3.0 (75%) to be even considered for an interview. Otherwise it won't matter how good an engineer you are. The lower your university entrance rank, the higher your CGPA should be. If on the other hand your rank was 500, you wouldn't need to worry about CGPA because 10000/500 = 20 which satisfies this criteria more than enough. As you can see, the exam rank has the highest effect. But that stage has long past for most of you, so concentrate on CGPA.

If for example 5 people are to be hired, usually the first 4*5 = 20 people are selected. After this initial selection, you move on to the interview and there your engineering skills are more important than your CGPA. But to get a chance to show your skills, you need good grades.

If you want to maximize the number of job interviews, stay above a CGPA of 3.0.

Wednesday, December 28, 2022

Using scanf to get user input from console

In C, you can use scanf to get character input from console. However, if you do it multiple times, you will realize that pressing enter after the first scanf affects the next scanf call. This happens when you have a space after your prompt, e.g. printf("Choice: "); char c; scanf("%c"). Either don't put a space at the end of printf or use a space in scanf like so: scanf(" %c")

Friday, September 16, 2022

When is inheritance useful?

A major disadvantage of inheritance is not being able to follow the program flow by ctrl + clicking function calls due to some functionality being implemented in ancestor classes. Therefore, I prefer composition over inheritance whenever possible. The one case where inheritance shines is reusing workflows. Let's say all your child classes have a run() method that calls f1(), f2() and f2() in order, where f1, f2, f3 functions are implemented in child classes. If we move the run() method to the ancestor class, child classes would just call that run method, saving you from duplicating the f1, f2, f3 calls in each child.