Thursday, October 01, 2020

Özel ders ve okulların durumu

Tanıdığımız iki ailenin ortaokuldaki çocukları derslerde vasat durumdaydı ve aileler "bunların okuyacağı yok" düşüncesi içerisindeydi. Birkaç ay önce matematikten özel ders almaya başladılar ve o güne kadar 50 alan çocuklar kısa zamanda 90 alır hale geldiler. Matematikten yüksek not alıp sınıfın akıllılar kategorisine geçince çocuklara güven geldi, gelecek hayalleri kurmaya başladılar. Bu çocuklardan biri devlet okuluna, diğeri özel ODTÜ Koleji'ne gidiyor.

Özel ders alan çocukların biraz düzelmesini anlarım ama başarının iki katına çıkması hem devlet hem de iyi kabul edilen özel okulların öğretim açısından son derece verimsiz olduğunu gösteriyor. En önemli faydaları teneffüslerde çocukların oyun oynaması ancak pandemi nedeniyle artık o da yok. İmkanı olan ailelerin çocuklarına özel ders aldırmasında büyük yarar var. Online özel dersler gittikçe yaygınlaşıyor, ücretleri de öğretmenin eve geldiği senaryoya göre çok daha makul.

Wednesday, September 30, 2020

Tips for online monitoring of children

The Covid-19 pandemic has forced children worldwide to stay at home and take online lectures. Since children have little self discipline and lectures are usually boring compared to other things the kids could do on their computer (e.g. watching videos, playing games), parents need to monitor them.

My 8 year old uses a Windows 10 computer. He has two accounts, one for school and one for playing games. I use Microsoft Family to block games on his school account and limit his time on his gaming account. When I am at home, I use Google Hangouts for real time monitoring of his activity on his school account because he tends to slack off or watch movies. He shares his screen with me so that I can see what he is doing. Since he likes to be loud, I am usually in another room. But he is scared to be alone, so seeing me on his screen has he additional benefit of calming him down.

Monday, July 13, 2020

Üniversite tercihi: Tıp mı, bilgisayar mı?

Bu yılki üniversite sınavı (2020 YKS) geçti, Temmuz sonunda puanlar açıklanacak. Yüksek puan alacak sayısalcılar için tıp mı, mühendislik mi sorusu önemli çünkü hem lisans hem de sonrasındaki meslek hayatı ciddi ölçüde farklı.

İdeal bir kariyer ilgi alanlarının, yüksek değer problemlerin, gelecekteki seçeneklerin bolluğunun kesişimidir. Yüksek değer problemlerden kastım insanlar için acil ve önemli olan, çözülmesi için masraftan kaçınmayacakları problemlerdir. Çoğu sağlık problemi böyledir. Bu kriterlere okuma / çalışma şartlarının rahatlığını da ekleyebiliriz.
Tıbbın en büyük avantajı ortalama üstü gelire sahip iş garantisi olması. Saygınlığı yüksek, ilaç reprezantları, hemşireler ve hastalar etrafınızda pervane. İş yerinde kadın-erkek oranı dengeli, tecrüben arttıkça daha çok itibar görüyorsun. Dezavantajlara gelince; bölümü okumak zor, ezber fazla, uzmanlık istiyorsan TUS'u kazanmak zor, üniversite sınavı çabasından fazlasını gerektiriyor. Mesleğe atıldığında mecburi hizmet zorunluluğu var, iş saatleri sabit değil, nöbet var, insanla uğraşıyorsun. Yurt dışında çalışmak istersen tekrar zorlu/maliyetli meslek ve dil sınavlarına girmen gerekiyor. Kendi işini kurmak muayenehane açmaktan ibaret çünkü bunun ötesi ekipmanların pahalı olması nedeniyle ciddi parasal yatırımlar gerektiriyor. Araştırmacı olursan ortalama akademisyene göre daha iyi kazanırsın, hasta bakmak yerine araştırmaya vakit ayırabilirsin, tabi ki ancak iyi bir üniversitede kadro bulabilirsen... Velhasılı ancak tıbbı seven kişinin seçeceği bir bölüm...

Mühendislik bölümleri arasında bilgisayar mühendisliği açık ara avantajlı, çünkü iyi bilgisayarcılara talep çok, iyi olmanda kendi gayretin diğer bölümlere göre çok daha belirleyici. İnternetin ve bilgisayarının olması yeterli. Üniversite derslerinin dışında kendin de ek çaba gösterir ve sana yardımcı olacak, seni yönlendirecek insanlara ulaşabilirsen çok iyi bir bilgisayar mühendisi olabilirsin. Hem lisansta daha kolay okuyup sosyalliğe, hobilere zaman ayırabilirsin, hem de meslek hayatın rahat olur. Otomasyon çağında yaşıyoruz, crypto paradan bioinformatiğe kadar her alanda, dünyanın her yerinde çalışabilirsin, dolayısı ile ilgilerini tatmin edebilirsin. Ayrıca home office imkanları geniş, digital nomad olup dünyayı gezebilirsin. Son olarak altyapı yatırım gereksinimleri düşük olduğu için kendi işini kurup büyütmen tıbba göre çok daha kolay. Yenilik yoğun bir alan olduğundan henüz domine edilmemiş işe yarar konular bulabilirsin.

Tıbba veya başka herhangi bir alana özel ilgi duymuyorsan, öğrenmeyi seviyorsan, bilgisayar başında saatlerce oturabiliyorsan (bu oyun oynamak şeklinde de olabilir), yurt dışı vizyonun varsa bilgisayar mühendisliği en iyi seçimdir. Hele de benim gibi işini severek yapan, yardım etmeyi seven tecrübeli bir tanıdığın varsa...

Linkler:

Tuesday, July 07, 2020

Software product maturity levels

Software products have three maturity levels:
  1. Product sometimes works.
  2. Product usually works.
  3. Product always works.
Transition from lower to higher maturity levels is achieved through experienced personnelbetter development practices and tests.

Friday, July 03, 2020

Probability of at least one failure

Say you have a system with 3 components (a, b, c), each having a failure probability of 0.1. What is the probability of at least 1 component failing? The standard way is P(at least 1 fail) = 1-P(all pass) = 1-(1-p)^n, where p = 0.1, n = 3 and result being 0.271 in our case.

The longer way is to find all unique failure combinations and their probabilities and sum them up because any of those combinations will satisfy "at least one failure" criteria. Pass probability = 1-0.1 = 0.9. Since fail order is not important, we can use combinations:
  • Failure combinations: abc, a (b and c pass), b (a and c pass), c (a and b pass), ab (c pass), ac (b pass), bc (a pass)
  • Probabilities: 0.1^3, 0.1*0.9^2, 0.1*0.9^2, 0.1*0.9^2, 0.1^2*0.9, 0.1^2*0.9, 0.1^2*0.9
  • At least one failing: abc OR a OR b OR c OR ab OR ac OR bc. In probability, OR is summation, AND is multiplication.
  • Sum: 0.1^3 + 3*0.1*0.9^2 + 3*0.1^2*0.9 = 0.271
  • Check with short solution: 1-(1-p)^n = 1-(1-0.1)^3 = 0.271
We can generalize it as follows. C(n,k) means number of k combinations in a set of n elements:
  • P(At least 1 fail) = C(3,1)*p*(1-p)^2 + C(3,2)*p^2*(1-p) + C(3,3)*p^3
  • k=1..n, sum(C(n,k)*p^k*(1-p)^(n-k))
  • Binomial Theorem: k=0..n, sum(C(n,k) * x^k * y^(n-k)) = (x+y)^n
  • If we use x = p and y = 1-p, we get k=0..n, sum(C(n,k) * p^k * (1-p)^(n-k)) = (p+1-p)^n = 1. The reason that this summation is one is that it represents all possible combinations and sum of probability of all combinations (including no failure case) is 1. 
  • In our case k starts from 1, because. we don’t consider the empty set, i.e. no failure case. Probability of k=0 (no failure) case: C(n,0) * p^0 * (1-p)^(n-0) = (1-p)^n.
  • Subtract k=0 case: k=1..n, sum(C(n,k) * p^k * (1-p)^(n-k)) - (1-p)^n = 1-(1-p)^n, which is equal to the short solution at the beginning of this post.

Tuesday, June 23, 2020

Character and failure

You can judge the character of people or establishments by looking at how they handle failure. Do they look for someone to blame or do they analyze the steps leading to failure and try to implement a system that has a good chance of preventing such mishaps in the future? That system should NOT become a huge bureaucracy, it should be invisible and make work life more pleasant than before by reducing ambiguity related stress.

Saturday, June 13, 2020

JavaScript blessings and curses

Can you spot the difference between the following two JavaScript lines:

ctx.fillstyle = "green";
ctx.fillStyle = "green";

The first line does not give you an error even tough ctx does not have a fillstyle field (note the small "s"), it just adds another field to ctx! Being not strongly typed is the blessing and curse of JS (more a curse when the code gets larger). When you use the first line you will get a black circle because black is the default color.


Tuesday, May 05, 2020

Online English

My wife is taking one-on-one English lessons online with Lingoda. Before Lingoda we tried Preply, but left it because the first teacher disappeared before the first lesson, the seond teacher first postponed, then cancelled the lesson without explanation. With Lingoda, my wife has taken 11 lessons up to now and we did not have such problems. I think the reason Lingoda is more reliable is that its focus is on curriculum rather than a particular tutor. And of course, it being a German company helps too(!) You choose a topic and lecture time, Lingoda assigns a teacher.

Lingoda has supplementary materials for each lesson for you to prepare in advance. After the lesson, the teacher writes a short summary about what you did well and where you can improve. Other teachers can see these summaries and have an idea about what you need. You also get a quiz.

My wife studies grammar on her own, watches movies with English subtitles to see her gaps in English and uses Lingoda to fill them. The teachers accomodate the lessons according to her needs. She also uses Duolingo.

Lingoda is active in the YouTube language community. The first time I heard about them was through Deutsch mit Marja. We highly recommend Lingoda.

Music: Vivaldi's Four Seasons: Summer - Epic Trailer Version

Monday, April 27, 2020

JavaScript: Adding to arrays with "..."

In JavaScript, push method is used to add to an array. Let's say you have an existing array called out  = [{e1: 5}, {e2:10}] and want to add its elements to an array called arr. Results differ for arr.push(out) and arr.push(...out). When you use ellipsis (...), each element of out array will be added as a separate element to arr and arr.length will increase by 2 after push. Without ..., out will be added as a single element to arr, and arr.length will increase by 1 after push operation. Below is an example script:


Tuesday, April 14, 2020

Technical Team Leader

A software technical team leader's main responsibility is to make the team better, because that will result in highest efficiency due to each member becoming a better version of themselves. Examples of duties of a techlead:
  • Review/refactor design and documentation that the team produces. See Scrum sprints.
  • Review code, optimize/refactor for comprehensibility, speed, memory and safety. This will keep you up to date with the code.
    • Evaluate and select code analysis tools.
    • Evaluate tutorials and point team members to them.
    • Use stack instead of heap.
    • Solve difficult technical challenges that are beyond the capabilities of a team member.
  • Assist in solving difficult problems. Since you have been continuously reviewing design and code, you won't need extra acclimation time.
  • Review issue definitions and refactor for comprehensibility.
  • Review commits to repository (commits should be multiple times a day, not once a week)
  • Write simulators/emulators for external hardware and software components
  • Write initial versions of build scripts. Scripts will be maintained by juniors.
  • Write initial versions of setup scripts that makes setting a development environment as simple as a single mouse click.  Scripts will be maintained by juniors.
  • Find ways to decrease build times, create tutorials.
    • Disable antivirus
    • Use Linux instead of Windows.
    • Precompiled headers
  • Optimize IDE settings, create tutorials.
    • Shortcuts
    • Folder view
    • Output directory = bin
Notice that the list does not contain product work because fulfilling the above would take a lot of time. Product development consists mostly of repetitive/boring work that a junior can handle with guidance of a senior. By freeing the techlead from those chores and making him a team mentor and solver of only hard problems, you improve productivity of everyone.

Thursday, April 02, 2020

Writing my first C program in Linux

Recently I wrote my first C program in Ubuntu Linux for which I had a deadline. I was already familiar with C/C++ on Windows. It was quite a learning experience. My method was as follows:
  1. Search the internet for projects matching the problem definition. Result: There weren't any.
  2. Search examples/tutorials for terms in the problem definition like fork, poll.
  3. Write small demos. Modify and combine examples to solve the original problem. Result: Faced many difficulties during adaptation.
  4. Dive deeper and understand the details of concepts/terms that I am not well versed in, like pipes.
  5. Apply that deeper knowledge.
  6. Increase depth until the problem is solved in its entirety.
As you can see, I did not start by reading a lengthy Linux C fundamentals book. I focused on the problem at hand, tried shortcuts first and only spent more time on problematic points. I felt a lot of frustration while trying to hack my way out but I was determined enough to overcome constant failures. If you are working under time pressure, this is the fastest method of getting things done.

Notes:
  • To display processes starting with "node": ps -ef|grep node
  • To run as a background process, add & to the end.
  • Windows Subsystem for Linux, using Ubuntu with VS Code, tasks.json to build file (ctrl + shift+b)
  • pipes, socketpair, filedescriptor, dup2. 
  • Redirecting stdin
  • fork - exec
  • poll
  • Converting a string to a vector of strings, with space as delimiter
  • Difficulty of using strings. Writing and reading structures is much easier, to read a string after a write, you need to send EOF with close(fd), but then you have the problem of opening the filedescriptor again.
  • gcc, makefile, tar
  • Difficult to find bug in C: for (int i = 0; len; i++). Note that i< is missing.
  • When you print elements of a union structure, you will only get the last set element right.

Wednesday, March 25, 2020

Remote work challenges

The global coronavirus pandemic has forced many institutions to think seriously about remote work. The first idea that comes to mind is make people work on laptops. If the work place had to use a local network isolated from the internet due to security concerns, the following challenges have to be faced:
  • A lot of laptops have to be reconfigured by the IT department so that they cannot be connected to the internet. Software needed for daily work have to be installed. That's a lot, depending on the number of laptops and the number of software to be installed on each laptop.
  • Many software products needed for development rely on local license servers. How are you going to make them work on laptops that are neither connected to your LAN nor the internet? You may have to obtain standalone licenses (extra cost) and install them on each laptop. In my case, I need licenses for two different products. May be existing license servers can be made to work on a virtual machine on the laptop.
  • Complex projects require multiple people to work on the same software components. How will you prevent merge conflicts when the oubreak has calmed down and everybody wants to push their work to the local repository?
  • Embedded software projects require multiple people and hardware working together. You might take your hardware home but you won't be able to get your colleagues and their hardware/software due to social isolation requirements to prevent the virus spread.
  • If you have kids at home, how will you prevent them from constantly interrupting you? By having a schedule and clear visual indicators that you are working (like a sign on the door).
If your software/hardware were highly modular, if you had abstractions/simulators, you could take only the parts that are suitable to work at home. But true modularity is almost never the case. In my opinion, during the remote period it is not realistic to expect work to be done as usual. The main areas to focus are:
  • Limited development with only your hardware and software (if standalone licenses can be purchased).
  • Improving documentation of existing software/design. Documenting the system will show you clearly where the design is too complex and needs improvement.
  • Self education. Example subjects for me: Blockchain, real time operating systems, embedded software development.
  • Daily physical exercise.

Thursday, March 19, 2020

Getting rid of background noise in an image

I have an image whose background I want to get rid of and only leave text. I open it in paint.nethttps://www.getpaint.net/and select Adjustments - Brightness/Contrast:

I increase contrast until the background disappears:

Tuesday, March 17, 2020

The inefficiency of university entrance exams

For the last few days, I have been watching how top students in Turkey were preparing for the university entrance exam. What struck me the most was the extraordinary amount of effort they put into it (2 years ~3000 hours of concentrated work) and how little of that effort is transferrable to real life. The most important skill gained is how to hack the test. I am not against hard work, I am against this horrible waste of energy...

Last autumn I started to teach kids robotics and have been thinking intensively about what an ideal/useful education should be like. My main criteria is exposing students to practical knowledge. It might not be applicable immediately but they should be able to see its merit clearly. This would solve the motivation problem due to lack of context. The challenge is to keep them interested while improving at a steady pace.

I hope I can imbue my students and my son with such useful knowledge that they won't need to suffer through years of mostly useless torture and bypass the university route altogether. How nice would it be if they could become productive members of society by the time they start high school, which was the norm not so long ago.

Applied Mathematics

Recently I helped my cousin with her integral questions. They were about areas between curves. This made me think if there were any applications of this that I personally know of and came to the conclusion that I don't know any. I decided to make a list of mathematical subjects that I apply in my work so that I can motivate students who are exposed to them for the first time:
  1. Trigonometry (sine, cosine)
  2. Quadratic equations
  3. Vectors in 3D, derivative of vectors in rotating reference frames
  4. Linear algebra. Cross product, dot product. Matrix multiplication: Used in rotating objects in 3D
  5. Basic integral
  6. Basic derivative
  7. Differential equations (2nd order ODE)
  8. Taylor Series (for linearization and as a starting point of numerical integration)
  9. Interpolation
  10. Gaussian distribution. Regression. Bayes' Theorem. Markov Chain. Kalman Filter
  11. Fourier Transform

Friday, February 28, 2020

Letters to a novice programmer

Dear novice, for you to change the way you develop software, you have to go through the following phases:
  1. A lot of work you thought would take 1 day ends up taking 1 month because most of the code you reuse is leaky, which causes unforeseen extra work.
  2. You get annoyed that your plans and deadlines are actually worthless with this type of low quality code base. You get so irritated that you want to do something about it.
  3. You start to make a list about possible refactorings that would increase the robustness of existing code. You add items to this list whenever you see something fishy in code, but you can't act on it right away because you almost certainly have  some crisis that needs fixing immedately.
  4. Whenever there is a break from firefighting mode, you go back to your list and start working on the most important items.
  5. You realize that most of your refactorings will have unforeseen side effects and that you have to revert them. You give up refactoring at this point and go back to firefighting. 
  6. After wasting 10 years, you realize that you have to refactor on the off chance of improving quality to the point where you can reuse code in peace. And you are enlightened (!)
A novice programmer was once assigned to code a simple financial package. The novice worked furiously for many days, but when his Master reviewed his program, he discovered it contained a screen editor, a set of generalized graphics routines, and an artificial intelligence interface, but not the slightest hint of anything financial. When the Master asked about this, the novice became indignant. "Don't be so impatient," he said, "I'll put in the financial stuff eventually."
Notice that I have not mentioned any software development standards or processes. Their time comes after you have matured through these phases. The most important one is phase 2, i.e. to be annoyed of wasting time by not being able to trust existing code, ending with rewrites whenever you "reuse" code.

Music: Kraftwerk - Das Model

Wednesday, January 22, 2020

Çocuğum mutlu olsun yeter

Bir tanıdığım televizyondaki eğitim programında şöyle bir diyaloğa şahit olmuş:
Veli: Çocuğuma matematikten özel ders aldırıyorum, ancak matematiği sevmediği için zorlanıyor, ne yapmalıyım?
Uzman: Çocuğunuz hangi konularla ilgileniyor?
Veli: Tarihi seviyor.
Uzman: Çocuğa tarihten özel ders aldırın, böylece vasat bir matematikçi olacağına üst düzey bir tarihçi olma şansını yakalar.
Bu diyalogda sorunlu bulduğum nokta tamamen çocuğun neyi sevdiğine odaklanılması. Çocuk matematiğe ilgi duymayabilir, ancak matematik önemli ve çocuğa "bunu zorlukların üstesinden gelme becerini geliştirmek olarak gör, bu beceri her alanda önemli" denilebilir. İlgi duyduğu alanlarda zaten çocuğun çok az desteğe ihtiyacı oluyor, örneğin internette nereye bakması gerektiğini göstermek yetiyor, gerisini kendi getiriyor zaten.

Çocukların ilgileri sık sık değişiyor; bir gün zoolog olası geliyor, bir gün piyanist, bir gün astronot. İlgilendikleri alanlarda çaba gösterdikçe desteklenmeliler. Örneğin piyanoya ilgi duydu diye hemen piyano alınmaz, çocuk aylarca kendi isteğiyle kursa gittikten sonra hala istiyorsa alınır. Evler atıl durumdaki piyanolarla dolu!

Sık sık duyduğum bir cümle "çocuğum mutlu olsun yeter", sanki mutlu olmak çok kolay bir şeymiş gibi... Mutlu olmanın en garantili yolu başkalarının işine yaramaya odaklanmaktır. İşe yaramak için seçtiğin konuda uzman olmalısın, uzmanlık da 10 bin saat (5-10 yıl) tecrübeyle edinilir. Sevdiğin bir alanda dahi çalışırken zamanının çoğu zorlukları aşmakla, işin sıkıcı kısımlarının üstesinden gelmekle geçer. Zorlukları aşabilmek için antrenmanlı olman gerekir. Sadece sevdiğin şeyleri yapmaya alışmışsan sıkıcı/zor noktalarda büyük olasılıkla vazgeçersin.

İşe yararlığın yanında gelire dönüşme olasılığı da çok önemli. Para her sorunu çözmez ama parayla ilgili sorunları çözer(!) Tipik mesleklere bir bakalım:

Eğitim = Öğretmenlik
Sağlık = Doktorluk
Üretim = Mühendislik
Eğlence = Müzisyenlik

En yararlı meslek öğretmenlik ancak ne yazık ki eğitimin çok karmaşık bir alan olmasından dolayı çoğu veli kendi çocuğuna en uygun eğitimin nasıl olması gerektiğinden bihaber ama bildiğini sanıyor. Neyin doğru, neyin yanlış olduğu ayırt edilemiyor, eğitim sistemi içinden çıkılmaz bir hale geliyor, bu da iyi öğretmenin motivasyonunu çok düşürüyor. İnsanlık aydınlanma çağına ulaşana kadar öğretmenlik bence hobi olarak yapılmalı, profesyonel halinde sizi hayal kırıklıkları, ağır çalışma koşulları ve düşük gelir bekliyor. Ben ekmeğimi yazılım mühendisliğinden kazanıyorum, öğretmenliği de hafta sonları gönüllü olarak çocuklara robotik ve kodlama anlatarak yapıyorum.

Doktorluk ve mühendislik yarar-gelir dengesinin iyi olduğu meslekler, uluslararası geçerlilikleri var.

Eğlence alanı da insanların hayatına renk ve anlam katması açısından çok yararlı. Ancak piyasada az sayıda insana yer olduğundan birkaç sanatçı gelirin çoğuna sahip oluyor, geri kalanlar fakirlik sınırında yaşıyor.

Özetlersek, çocuklara en başta kazandırmamız gereken beceri zorlukların üstesinden gelmektir (persistence). İkinci olarak yararlı olmaya odaklanmalarına yardımcı olmalıyız. Çabayla destekledikleri bariz bir yetenekleri yoksa mümkünse doktor veya mühendis olsunlar (hangisini daha çok seviyor ya da hangisi daha az eziyetli geliyorsa). Bu meslekler dışında tutkuları varsa onu da hobi olarak yapsınlar. Ayrıca her meslek yeterince tecrübe kazanıldığında danışmanlığa, organizasyon ve şirket kurmaya, nihayetinde pasif gelire açık, ömrünüzü hep aynı şeyi yaparak geçireceksiniz diye bir kural yok.

Müzik: Survivor - Eye Of The Tiger

Thursday, January 09, 2020

Effect of good software design on maintenance and innovation

If the design of a complex software project is poor, a lot of effort has to be spent to maintain the system. If design is good, more time will be freed up for innovation instead of wasting time to keep the product barely working.

Music: The Stable Song - Gregory Alan Isakov (Peanut Butter Falcon soundtrack)

Wednesday, January 01, 2020

Future of car maintenance

Cars are equipped with more and more sensors which are connected to the cloud. For example, you might get a call from your car company when your airbags are activated and they'll ask you if you need help.

As instrumentation increases, it becomes possible to identify root causes of car malfunctions by correlating failures to sensor data. This is exactly what AI (neural networks) is good at. The car cloud knows the history of each specific car and can notify the user of probable failures before they happen. As data increases, so does the reliability of predictions. This is a form of predictive maintenance.

Ideally, high resolution data and machine learning could lead to servicing cars only when risks of failure pass a threshold, reducing unnecessary part changes and making periodic service visits a thing of the past.

Another interesting use case: Advanced Automatic Collision Notification