Saturday, October 17, 2020
Thursday, October 15, 2020
As the title clearly says, creating bootable USB in the Ubuntu system is a bit challenging as compared to the Windows system. Windows system provided their own tool and we can seamlessly create a bootable thumb drive. After the less availability of CD ROMs, it is very important to know how to create bootable USB disks.
Yes, I also tried to use some of the tools I was familiar with, such as UnetBootIn, copying with dd tool, etc, but unfortunately, I was unsuccessful. It creates a bootable USB, but the problem, the installation of windows crashes, with some file related error.
Because I did not have any windows system in my machines, and I have to install windows in my newly bought notebook, I have to create anyhow a bootable Windows 10 installer using my Linux machine. I carried out some research on this, got a working tool to create a bootable Windows installer on USB.
1) Installation of WOEUSB command
What I did is, I have first of all run a couple of Linux commands to add the repository, then install the tool.
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt udpate
sudo apt intall woeusb
Now installation completes.
2) Get USB Info
We have to find out the usb device id (for example: /dev/sdb or /dev/sdc). Using one of the following commands, we can find out that information:
sudo fdisk -l
3) Unmount the USB Disk
This is important, we have to unmount the USB before carrying out the problem. There is a simple command to carry out this task:
sudo umount /dev/sdb1
3) Create the installer
The final step is to run a command to create the actual installer.
sudo woeusb --target-filesystem NTFS --device Win10_2004_English_x64.iso /dev/sdb
Here, Win10_2004_English_x64.iso is the iso file downloaded from the Microsoft site. Which can be freely downloaded.
/dev/sdb is the path of the USB disk.
It can take up to 5-6 minutes depending upon how fast your system is.
After the process finishes, we are ready to use it as a windows 10 installer.
Friday, April 10, 2020
1) Create a Java application
2) Bundling into an executable Jar file
3) Running a Jar file
I take a problem scenario to explain the above steps and how they are carried out.
We want to have a java application, which should have addition, subtraction, multiplication and division functionalities, that we can call those functionalities providing the command line parameters. For example
add 2 4 4 (result=2+4+4)
subtract 54 12 (result=54+12)
multiply 12 54 55 (result=12*54*55)
divide 34 17 (result=34/17)
So, let's start:
1) Create a Java application
I am creating a Java application with Gradle as a build tool because it is easy to use. I am creating 4 classes with the main method which is responsible for corresponding operation and parameters. One option could be to create a single method and get an operation as a parameter, which makes it really complex to handle parameters. If we create a main method for each operation, it makes our tasks of handling parameters easy.
So, I begin with creating four java classes with main method, which manipulates the arguments to get the corresponding result. Because the example task is very simple, our actual task could be way bigger with many dependent libraries. So, we define a bunch of libraries in "build.gradle" file and we create a "fatJar" with all dependencies included in the jar file. An alternative will be we copy dependent libraries in the classpath.
I begin with the fatJar method, which create a jar file with all dependent libraries automatically from gradle. For this, we have to write a method to create fatJar. Have a look at the sample build.gradle file.
The method jar create the jar file without dependencies. But the fatJar create a jar file with all dependencies, and we can use out of the box.
So, after definition of Gradle build information.
Now, we create class files with specific operation in main methods. The class files look something like this:
The application structure looks like this:
So far, we have created a java application with the required operations.
2) Bundling into an executable Jar file
Bundling into an executable Jar file is quite easy because we have already written a method in build.gradle file above. So, we just call
gradle clean && gradle fatJar
The created Jar file will be in folder build/libs as shown above(Operations.jar)
Note: If we simply run "gradle build", then it will create a thin jar file(i.e. without dependencies)
3) Running a Jar file
The Last Step is to execute the Jar file Operations.jar. The bundled jar file includes all the classes, and we can run all operations providing corresponding arguments.
java -cp Operations.jar com.kpaudel.operations.Add 12 34.33 45.3
I hope you have enjoyed this recipe. Thanks for reading :)
Tuesday, December 31, 2019
1) GIT = Thorough Learning
- Created git repository server
- Learned git client commands
- Learned more in professional work in the new company
- Learned some groovy language concepts
Positive: familiar with the server with nodejs
4) NoSQL(MongoDB) (partly from professional project)
Positive: Familiar with MongoDB
Negative: Could not manage time to learn ReactJS
Positive: Learning with ongoing professional work.
7) RestAPI (Server & Client) (from the professional project)
Neutral: Learned something but not advanced.
8) WebSocket Server & Client (Spring & NodeJS) (from professional project)
Neutral: Not so positive progress.
9) Python(with Tensorflow)
Positive: Learned virtual environment, Tkinter GUI tool, deployment with docker.
10) Hobby Projects in Arduino & Raspberry PI: Implement the above technologies in these projects
Neutral: Learned something but not enough.
Positive: Implemented Jenkins to automate the build and deploy process. (partly from professional work)
12)Spring Boot: (from the professional project)
Positive: Learned spring boot concepts from professional work.
Wednesday, October 30, 2019
This article does not go into detail. This will just give you the idea on how we can program LED strips and you can program the lights according to your need.
Let's begin, we need the following items before we begin the programming.
2) Power Source (10 V)
4) LED Strip
We connect the power source to one end of the led strip. Normally positive wire of strip is red, and negative is white. The white is grounded with the ground of strip. Strip has also cables to be connected to the Arduino. The red and white are 5v and GND respectively. GND should be connected to the negative of the power supply. Note that the green color cable is used for the color signal which we normally connect to PIN 7 of Arduino.
Now we come to our actual task: programming. Before we start we have to install the needed libraries.
We need Adafruit_Neopixel and optional Tinkerkit libraries. Adafruit library is used to actual programming while Tinkerkit libraries make it easy to read sensor values because we are using sensor to control the led lights.
Here the PIN is the output PIN of Arduino, and a number of pixels(NUMPIXELS) mean the number LEDs in the LED.
We further define the required variables as follows:
After this, we initialize everything in the setup block.
Now the interesting part is to actually define animation which runs continuously in a loop.
Arduino to define cool animations in your own way.
Just try yourself :)
Monday, April 22, 2019
The first step will be the installation of Arduino from here:
You, normally select the latest version for download, not nightly build versions.
I downloaded 1.8.9 version.
Extract the downloaded compressed file into /opt/arduino (for example). Just run the install.sh file inside the extracted Arduino folder.
2) Settings for Visual Studio Code
After installation is complete, we have to carry out some settings in visual studio code. First, install the Arduino extension and after installation is complete, restart IDE. Then we create a workspace folder.
Now, we open the arduino folder from VSCode IDE. Now, using
C: Arduino:Select Serial Port
The final step is to define the build folder in arduino.json created in the root directory.
This is, I guess, automatically created. But to be safe, add this line.
3) Create a Program
The most interesting part is here.
Create a new program example.ino with the following contents
Then we first verify the correctness of the program. And then upload the program.
Verification: CTRL+SHIFT+P => Arduino:Verify (Shortcut: CTRL+ALT+R)
Upload: CTRL+SHIFT+P => Arduino:Upload (Shortcut: CTRL+ALT+U)
While uploading I faced the following problem
I did not know how secure is this, but I made the terminal readable and writable for all. And restarted IDE, then it worked! I ran the following command from the terminal.
sudo chmod a+rw /dev/ttyACM0
Now, we can use the power of visual studio code to develop Arduino programs.
Note: Because we can not place multiple files and run. To achieve this we create a folder structuer inside src folder of root. For example: