Posts

C Pointer Program to get the last name from a full name

Image
C Language Flag / Logo Another C programming here, this article will simply explain how to do char array operation in C language to get the last word from a whole sentence, or in this case we just rename our function to be more specific to get a person last name from its full name. This is a very simple C function to get a user last name from a user full name. This function will do some pointer operation, so if you are trying to learn about pointer in C, this may help you little bit on understanding about a pointer in C: char * get_last_name(char * full_name) { char *last_name = full_name; int last_space=0; for(int i=0; i 0) last_space+=1; last_name += last_space; return last_name; } This function will loop through all the characters bit by bit and will try to find any spaces located on that character. If a space is found, then store the last space pointer location and return that pointer as its function return. - We define our function called get_last_name to ...

Recursive Function In C : Fibonacci, Factorial and Power of Numbers

Image
C Language Flag / Logo These are some example programs in the C language using recursive function to calculate Fibonacci, Factorial and Power of numbers. You can use a loop, but for a purpose of giving you an example on how to use recursive so we are going to use recursive instead. Fibonacci This is to calculate the sum of fibonacci numbers that are less than the specified number user input. int fibonacci(int number) { if(number == 0){ return 0; } else if(number == 1) { return 1; } else { return (fibonacci(number - 1) + fibonacci(number - 2)); } } - Our function accept integer, then we compare them using if statement - If the parameter number equal to 0, then the return of function is 0 - Also If the parameter number equal to 1, then the return of function is 1 - But if the number is not 1 or 0, this function will call itself with a new parameter for the first call is the parameter -1 and the second parameter -2, then add both results. - This ...

Everthing on the clouds soon - Google Drive, Onedrive and Windows File Explorer

Image
File Explorer, Google Drive, One Drive As a forever Windows user, I have been using File explorer since the very first time I knew about this OS. It is the default program for browsing files on our computer, so we were familiarised with its feature, and that it’s very convenient to use, work smoothly, and make it very efficient for our daily use. Windows file explorer is a very simple program basically just showing a bunch of files, with its properties like file name, size, file format, date created, date updated, type of the files and many more handy features. Just like most file explorers in any operating system. File explorer actually has many more functionalities behind it, but for me i have never used most of them because file explorer is file explorer, it is just for working with files. Some features in file explorer  for example i have never used is the search box that is on the right top of the windows. I have almost never used it for example because it’s not always showing...

3 Easy Tips To Keep Your Blog Up To Date, Even Though You Are Very Busy

Image
Photo by Jan Baborák on Unsplash After a few years stick with the blog you have, you have been promised to create a daily content to your blog so your blog won’t sink from the internet, but it doesn’t happen, your blog lacks contents. And then its visitors start to decline. But don’t worry, you're not alone in this case, it not just happened to you, it probably happened to the majority of bloggers. Yes the only thing to keep your blog growing or at least stay and not losing any visitors is just to maintain your blog up to date by giving your time to write and publish at least one single post everyday. But then life turns out to be very complex and messy, it rarely, or worst it never goes according to our plans, it's just the way life is, full of surprise and chaos. Our life requires us to take care of other things in our life other than just writing some article for your blog, that’s why your blog is sinking from the internet search. If you need some motivation on how to keep y...

How To Create An HTML Input Date & Time In React

Image
html datetime in react The thing about HTML 5 is that it does have some features that work from different browsers and the other doesn't, the obvious element that is really useful is the HTML input type datetime-local. It works perfectly on Chrome, but unfortunately doesn’t work on Firefox and Safari, if this happened only on an internet explorer or something older, i wouldn’t bother, but Firefox or safari is a major browser with a huge amount of users, so it is something that we need to support in other for our app to be function. So here’s what I came up with using a combination of HTML type date and html type time to create a single react component as a replacement of datetime-local. Here's the full example code on Code Sandbox so you can play with: FULL CODES & DEMO . The idea is just to create a combination of input date and input type which is supported by All major browsers, so there’s nothing fancy here. There’s already a react-datetime library but it doesn’t wo...

How to Create Javascript Countdown App

Image
Countdown Timer If you need to create a countdown app in Javascript, this is the solution I am going to reveal. It's very easy to do anything in Javascript, especially because of the abundance of libraries out there. You don’t have to experience the pain process developing stuff from scratch. It’s generally not easy to make a countdown app because the nature of our calendar system which is very mess up and not well structured, so sometimes 1 year is 12 months, or  365 days sometimes less, sometimes more, and then a month can have between 28-31 days, a day is 24 hour, 1 hour is not 1/10 minutes but  it’s 1/60 and so on. Real mess, so very difficult to crush those numbers because it’s nothing like base 10 which is the number we are familiar with. Luckily in Javascript there’s tons of libraries to deal with Calendar or Date stuff, there’s one that stands out is MomentJS. So here’s a Javascript code on how you create a countdown app using javascript, in this example we are gonna d...

How To Disable And Re Enable Hyper V On Windows

Image
VMWare Logo If you use an older version of virtualization machine like VM ware or virtual box you might at some point face this problem “VMware Workstation and Device/Credential Guard are not compatible”, this is a message telling you that there’s a conflict from your newest installed program with VMWare. For example i tried to install Docker (a containerization program), afterward my VMWare stopped working. There’s conflict between VMWare and Docker, Docker can only be run when Hyper-V is activated but VMWare doesn’t work if Hyper-V is activated.  The solution for this type of conflict is actually very simple, disable Hyper-V when you want to run VMWare and then enable Hyper-V when you want to run Docker that needs Hyper-V activated. How to disable Hyper-V 1. Open control panel 2. Programs 3. Turns windows feature on/off 4. Uncheck all feature under Hyper-V 5. OK Disable Device/Credential Guard It probably is not enough to make your VMWare work by disabling Hyper-V. You need one e...

How to Protect Your Windows PC with Cloud Backup Service?

Image
Nowadays, more and more computer users are aware of the importance of computer backup. Because once the data is lost, it may cause serious consequences to users, especially for enterprises and special institutions. However, data on your computer is always facing the risk of losing due to system crash, hardware failure, human errors and so on. Is it necessary to cloud backup Windows PC? Since backing up your data on the computer is necessary, what is the best backup solution for computer data? In the past, users thought external storage devices like external hard drives, flash hard drives, USB drives, etc. are safer than local hard drives and preferred backing computer data to these external storage devices.  But recently, people have realized that the external hard drives are not safe either because they also may be damaged or lost. Therefore, users want a safer backup solution to protect their computer data. According to the 3-2-1 backup strategy, to prevent your data from losing ...

How To Build a Simple OS Using Windows WSL-Debian

Image
How to build simple os from Windows This is just a repost from Osdev wiki here https://wiki.osdev.org/Bare_Bones . It’s very thorough and easy to follow step by step guide developing a simple OS. I don’t have the skill of explaining that well, so if you want to know in-depth, read the original post. I will only provide a method that is working for me, a summary and the code that is working on my Windows 10. Actually it’s not Windows, it’s Linux inside Windows, it’s 100% Linux, not cygwin or mingw. It tastes like 100% Linux. Now, here's a step by step to develop an OS on Windows. 1. Have a Linux on your Windows First thing to do, you are gonna need Windows subsystem for linux (WSL), because the main Windows OS usually doesn’t have very many tools for this kernel development purpose, it’s easier to do in Linux. In case you don’t know what WSL is, you can read my previous article ( Windows terminal WSL ). I use Debian (but Ubuntu or any Linux that has an apt package manager will be ...

This Is A MySQL Tutorial For Real Beginners

Image
MySql for Beginners MySQL is one of the most popular and widely used in the world, so if you are planning to be a programmer, especially web-based programming, skill in MySQL is one of the required skills you must acquire.  If you just started learning programming, here’s some really step by step to work with MySQL. 1. Start by installing MySQL I am a big windows fan, so installing mysql on windows is just like you are installing any other software, download the installer and start configuring your MySQL root password. Just set your mysql password 1234, it’s easier to remember because you are gonna use this password a lot, don’t worry it’s okay for our local computer. To install MySQL, you can download the installer here https://www.mysql.com/downloads/ , follow the installation step. 2. Make MySQL available on terminal You must be able to use MySQL on the terminal, on windows, open environment variable and add mysql.exe to your system path, mysql binary by default is at C:\Pr...

To learn or to suffer - Programmer’s rambles

Image
Chart up green arrow, sales growth I am trying to write anything from vim starting from now, this is actually the first article that i wrote for this blog without using any advanced word processor. I just open terminal, type in vim command and start to create a new file and write this article content. This may not be very interesting for anyone, but for me it's quite compelling. I really like pushing myself to almost the limit of my capability. VIm is not something extraordinary, probably the majority of programmers even already have  experiences with vim for years. So nothing special. So little bit about myself, I have been working as a programmer for quite a few years, not that long but i feel like i have been doing programming intensely so it feels like very long for me. I feel that I have enough experience to write any code without any help from IDE, or even from the internet.  Of course i am not gonna be that extreme, there's a principle  in software engineering that...

How To Install Vim Plugin On Vim For Windows

Image
Vim nerdtree on Windows 10 As a beginner vim user, even just installing a plugin is already something that confusing, i don’t know why the first time i try to install vim plugin just doesn’t work, even though i believe i have followed the instruction correctly.  So if you are someone like me, struggling to install vim plugin, you can follow this step by step guide. Actually it’s very simple, but because vim users mostly are linux users, it kind of difficult to find a reference of Vim for Windows. Now to install a plugin, let’s start by opening our windows command prompt or there is a new cool windows terminal (if you don’t know about windows terminal, this is a really cool terminal, you can read in my previous article here ). Move to HOME /vimfiles/pack/vendor/start directory using cd command. If the path doesn’t exist, you can manually create it. Note that the HOME is your home directory, on windows, Home directory usually something like C:/Users/your_username . Now clone the sou...

The Ultimate Terminal For Windows, Couples Things To Begin With

Image
Watching star wars from windows terminal Today i just discovered a very cool terminal for Windows OS, it was developed by Microsoft itself, so it’s not gonna be disappointing, and probably a long term project. This very cool and modern terminal, the best terminal console I've ever seen. If you don’t know about this project, Windows terminal is Microsoft project, a better version of terminal that runs on Windows. Here’s the Official website of the terminal ( https://aka.ms/terminal ) from Microsoft. You can look for much detailed information, and how to install it. What to do the with the terminal The first thing i would do is to make the Windows terminal launch in fullscreen mode (maximize mode), which you probably already know, even this simple thing is not possible to do in classic cmd or even powershell. To make windows terminal launch maximize,just put "launchMode": "maximized" , into your settings.json . If you don't know where settings.json is, open W...

Should I need To Learn How To Write Code On VIM Or IDE

Image
Vim text editor logo This document is written in Vim, a terminal based text editing program, there's not a lot of fancy things to do with Vim. It can not be used for doing any complex editing, but it's still working so it's actually not that bad for writing, because it’s very fast, and i love working on a terminal a lot. When I am writing code on Vim, you need to memorize your codes because there’s no code autocompletion like if you are using an IDE. But that’s actually a good practise on writing codes, because you can write code much faster if you remember all of the language's syntaxes. I still kind of switch between IDE and VIM, because sometimes the clients or project managers at the company that I work for need a quick fix, so I only use vim for doing personal projects in my spare time. If you are a beginner, an IDE can really help you write better codes quickly, and also it will guide you with lots of code recommendations. But for me I have been using IDE for quit...

Not That Very Important Tips About Blogging For Beginner

Image
Graphic Designer - Photo by XPS on Unsplash The Internet is very huge, and has been growing so fast from just private military projects to something that not only we can just enjoy using it, but the internet also provides some people a way to make revenue. From small scale to big tech companies like in FAANG (Facebook, Amazon, Apple, Netflix and Google). 1. Don't expect too much at first To some individual lone wolfer like us trying to make a dime from the internet, it’s sometimes not only so hard, but almost seems impossible. But today we have video streaming like Youtube, you literally only need to upload videos to youtube, probably a little bit skill in video editing, maintain the video quality and chances are you are gonna make some online income if you are very persistent. Blogging on the other hand seems so simple but as nowadays the internet is already full with millions of websites, the chances of getting success on blogging are probably a bit smaller. But here’s just very...

Drawing Border / Polygon on Map Using React Leaflet

Image
Drawing Border / Polygon on Map Using React Leaflet So i have actually known leaflet for quite a while, but in the past i used to implement it using vanilla JS, now i almost do any front end stuff using React, so i need to learn how to use leaflet in React. As you may already know, leaflet is kind of really complex and has lots of APIs, so it must be quite difficult to port leaflet to React. Lucky for us, the React community is growing so fast, i believe any top open source Javascript project has already been ported to React, maybe porting to React from vanilla is not something that difficult so people can do it pretty easily, but I don't know, i have never done that. I use this react-leaflet library, basically just a leaflet ported to React, so it is much more manageable. Here’s how you can draw a border or polygon on Map using React leaflet. 1. Install leaflet and react-leaflet to your project yarn add leaflet react-leaflet 2. Your map would be something like this import ...

Step by Step How To Use cURL Library Using C From VS Code Windows

Image
When we want to develop a pure C program, not C++, and we need to transfer and download files over the internet via http or any other internet protocol. I am not expert in this but it is probably platform specific, meaning different OS have different API. so without a library, it’s gonna be so much painful to just implement Http GET or POST. In C there’s been a solid Http file transfer library as you may already know is a library called cURL. So we can use cURL to do file transfer. Here’s a step by step how to use cURL in C and an example code doing HTTP GET, to download Google webpage and store it in our current project directory. 1. Firstable, if you don’t have a VCPKG package manager, you need to follow instructions to install VCPKG here . If you already have VCPKG, skip to step 3. 2. In that article I also cover how to start a CMake project in VS code. 3. Because we are going to write our code in C, you might rename main.cpp to main.c, and change inside CMakeLists.txt lin...

Get Oldest Version Of Open Source Project From Github

Image
To become very expert on software development, one of the things that usually i did is by looking and learning from someone else's code. Lucky open source world is kind of out of control, there’s literally millions of open source projects out there, whether it’s popular and continued or it’s just kind of one commit sort of thing. Github is the home of open source projects, you can search any open source software or platform there, for very big scale like Linux operating system, Apache web server, Google chrome V8 engine and many other big projects that you can find. The problem is that projects are sometimes already growing too big and difficult to follow because they are already very complex, because updates over the years. We are very lucky that there’s Git version control, we Got, you can keep track of the old codes of those projects. For example you can still see Linux version 2.6.x released back in c2005 here https://github.com/torvalds/linux/releases?after=v2.6.12-rc5 . May...

How To Use Package Manager In C++ Windows

Image
C++ logo frow Wikipedia The thing I like about coding in C and C++ is the low level stuff, and the simplicity. But this simplicity is also one of the things that makes C doesn’t seem to fit for rapid development applications. Although sure it depends on how experienced the programmer is, for someone who has been doing C/C++ for a while, it’s not gonna be much of a problem.  But for beginner C and C++ like me, coming from higher level programming languages and tools, even small things like how to use a library for example the library that we are gonna use is cURL, are already big steps that it is already hard to handle quickly. If you are someone like me, a C/C++ beginner and want to use this very useful Curl library, on Windows, here’s how you can use Curl or any other library.  In Linux based OS maybe it could be much more straightforward, because cURL is usually already included. Now we can easily  use any libraries, thanks to VCPKG: a C++ package manager for Windows, a...

How To Create C/C++ Code In Visual Studio Code

Image
 I like Visual studio code, it’s cross-platformed, and very fast IDE(or for some people they just call it a text editor). But this text editor is very smart and supports many features, well actually you can just create your own extensions if you think that your programming language or tool is not available in the extension market. In this tutorial I am using Windows, to develop C/C++ code, firstable you need to already have C/C++ build tools, which you can install through Visual studio installer. But if you prefer using MinGW or Cygwin, it’s up to you, but i am not familiar with that. 1. Assuming you don’t have C++ build tools on your windows machine, then first you need to Download Build Tools for Visual Studio 2019 here: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019 2. Open Visual studio installer 2019, select Desktop development with C++, and install them. 3. All those above steps are just one time process, you're not gonna repeat that each tim...

Popular posts from this blog

How to Install Microsoft Office on Your PC: A Step-by-Step Guide

Coding On Your Android Phone Using Termux

How To Create Spring Boot Project Using Netbeans