Labels
android
Assembly Language
bash
Beagle Bone Black
c
c++
CL1
competitive programming
compiler
computer vision
data structure
database
dsps
encryption
games
graphs
hacks
java
linux
lisp
MIL
monte carlo algo
MPAL
networking
OOMCPL
osa
perl
pl
PL -3
PL-1
PL-2
PL-4
python
qt
recursive algorithms
Scala
security
sorting
storage
terminal
ubuntu
utilities
Saturday, 28 October 2017
Intermediate Code Generation using Lex & YACC
Code
Generates Three Address, Four Address, Triple Intermediate Code.
Friday, 27 October 2017
8 Queens using BackTracking in Python using JSON file as Input
Input
The input to the program is the position of the first queen which taken from a json file.Tuesday, 24 October 2017
Monday, 23 October 2017
Parser for Sample Language
Creation of Parser for a Sample Language using Lex &Yacc.
Basic Version for Parsing simple c++ code
Basic Version for Parsing simple c++ code
Sunday, 22 October 2017
Saturday, 21 October 2017
Concurrent Quick Sort Class in OpenMP
Q: Design a class for concurrent quicksort in C++.
Decided to use OpenMp since Pthread doesn't work well with classes, not without ton's of efforts.
Decided to use OpenMp since Pthread doesn't work well with classes, not without ton's of efforts.
Friday, 20 October 2017
Recursive & Iterative Binary Search in Scala
Scala
My very first program in Scala. And I don't find Scala close to Java. I am quite used to Java and C++ and rather find the two more close as very as programming is concerned.Scala however is closer to Java since scala code is converted to Java Bytecode and the executed.
Program
I used 2 classes a Binary Search class & a Tester object
. An object is more like a singleton class according to my understanding.
The BinarySearch class has constructor which accepts a sorted array.
It has 2 functions
- A Recursive Binary Search
- An Iterative Binary Search.
Monday, 18 September 2017
Dark Conky Theme
I recently worked on a dark desktop theme for conky, the result was a super cool desktop theme. It is completely modular and consists of a number of widgets whose position can be easily configured using conky manager. I actively make additional commits to this project, add new widgets and fix any bugs that I find.
Screenshot
Saturday, 26 August 2017
Launch Applications Faster :Preload in Linux
Wanna speed up Launch time of Applications in Linux then read on.
Preload is a package that enables a service which can preload libraries required for Applications in the Ram. Obviously reading from ram is way more faster than reading from the disk. That's where your system gains up speed and can launch applications faster.
Preload is a package that enables a service which can preload libraries required for Applications in the Ram. Obviously reading from ram is way more faster than reading from the disk. That's where your system gains up speed and can launch applications faster.
Sunday, 16 July 2017
UVa 1203 - Argus C++ map and priority queue
Question
Solution to this UVa problem by using simple data structures like map and priority queue.Solution
Since priority queue stores data in descending order but we needed ascending order, we simply stored negative instead of positive. Alternatively we might have to write our own comparing function.Friday, 14 July 2017
Thursday, 13 July 2017
Competitive Programing: Vowel Substring
Q: Given a string find all the number of sub-strings which contain all the five vowels at least once.
It is solved in two ways:
It is solved in two ways:
- A slightly more complicated linear scan method
- By generating all the sub-strings and then checking whether or not it satisfies the our requirements. (brute force)
Tuesday, 11 July 2017
UVa 00637 - Booklet Printing
This problem is an adhoc problem that asks to you to design a system to print folding booklets. The problem description and test cases can be found here.
Saturday, 8 July 2017
Record internal speaker audio in Linux
Recording internal audio in Linux |
Sounds perfect, except the fact that it has been already implemented. Meanwhile, through numerous visits to stackoverflow and askUbuntu I finally discovered a cool new way to record audio.
Tuesday, 4 July 2017
Uva 278 - Chess
This problem is one of the best ad-hoc problems I have come across - simple but thought provoking. It asks you to the maximum number of rooks, queens, kings or knights you could place on n*m chess board such that no piece attack another.
Given that 4<=m,n<=10.
Given that 4<=m,n<=10.
Monday, 3 July 2017
Summing the digits of a number in C++
Q: This is a simple ad-hoc problem which asks to sum up the digits of a number repeatedly until the sum is less than 10. We are required to stop the program when input given is 0.
Saturday, 10 June 2017
Nary Search Using OpenMP
It's been quite a while since I last posted. This post shows how conduct a nary search on an array using OpenMP.
Allows to create threads in C by simple pragma directives, this is one of the easiest ways to get threading done. In case you like the way threading is done here you might want to take a look at the various directives offered by OpenMP for parallel processing.
You might have worked earlier with maybe ternary, or at least binary search. In this kind of a search we divide the sorted array into n parts at each stage and then perform the search.
OpenMP
Allows to create threads in C by simple pragma directives, this is one of the easiest ways to get threading done. In case you like the way threading is done here you might want to take a look at the various directives offered by OpenMP for parallel processing.
N-ary Search
You might have worked earlier with maybe ternary, or at least binary search. In this kind of a search we divide the sorted array into n parts at each stage and then perform the search.
Sunday, 2 April 2017
Generating Permutation in Python
This is the best way to generate permutations in python.
from itertools import permutations j="1234" for i in permutations(j): print "".join(i)
Saturday, 1 April 2017
Ditch Ubuntu Software Centre
Most noobies to Linux love Ubuntu Software. It one of the best things of Ubuntu, a preinstalled GUI package manager.
The Other thing that most guys love is the Software Updater it is extremely fast and efficient when compared to its Windows Counter Part.
The Other thing that most guys love is the Software Updater it is extremely fast and efficient when compared to its Windows Counter Part.
Experts
However experts should not be using Ubuntu Software. One of the biggest and main reason is the fact that it is buggy and it hangs even on modern hardware.
It is extremely slow compared to its terminal alternative. I have used GUI package managers on various Arch Distros, they are far more efficient then Ubuntu's Software Centre.
Secondly it has a tendency to acquire a lock and then never release. Software center was taught by canonical lock n key, however turns out it learned from its distant friend Windows lock n hang.
Usually when it decides to play this game of lock n hang. You need to use ps -aux | grep apt. To find out the process and kill it with kill -9 pid. Finally you need to ensure that the database is not corrupt by use sudo dpkg --configure -a. Failure to do so can have disastrous consequences. So why not ditch it all together ?
Usually when it decides to play this game of lock n hang. You need to use ps -aux | grep apt. To find out the process and kill it with kill -9 pid. Finally you need to ensure that the database is not corrupt by use sudo dpkg --configure -a. Failure to do so can have disastrous consequences. So why not ditch it all together ?
Thursday, 30 March 2017
A request to Stop Blocking Adds
I have lately noticed that there has been considerable loss of revenue due to UC Browsers ADD Blocking.
Being a technology blog I expect users to be tech-savy and block adds. However killing revenue for a blog barely showing three adds per page is not justified. Please switch to better browser that doesn't block adds.
UC Browser has been know to be unsecure and compromises user data. This is another reason for you to make the switch. If you still decide to use UC Browser do disable the add-blocker.
Its a race of Add-blockers and Anti-Add-Blockers. The day Add-blockers win, you will lose. No revenue to bloggers, means no more posts. No more posts and no more free knowledge.
UC Browser is no longer supported by Programing Wonders!.
Being a technology blog I expect users to be tech-savy and block adds. However killing revenue for a blog barely showing three adds per page is not justified. Please switch to better browser that doesn't block adds.
UC Browser has been know to be unsecure and compromises user data. This is another reason for you to make the switch. If you still decide to use UC Browser do disable the add-blocker.
Its a race of Add-blockers and Anti-Add-Blockers. The day Add-blockers win, you will lose. No revenue to bloggers, means no more posts. No more posts and no more free knowledge.
UC Browser is no longer supported by Programing Wonders!.
FAD-Facial Age Determinator
FAD - Facial Age Determinator is a Python based software to determine the age of people using skin texture. It determines the age group of people and classifies them into 4 groups, kids(1-10), young(10-25),adults(25-50),seniors(51+).
Applications
- Vending Machines for cigarettes and beer
- Age Appropriate Advertisements
- Targeted Advertisements on Bill Boards
- Age Restricted Entry Zones(Bars, Adult Cinema)
- As a filter in other Facial Processing Systems
- Human Robot Interactions
- Smart Car System Adaptive Behavior(Determining whether to apply brakes based on age group of pedestrian crossing.)
- Elderly Assistance Systems
- Enhanced Security for Kids Only Zones etc
Implementation Details
Sunday, 26 March 2017
The Fastest and Easiest Way to Install OpenCv for Python on Ubuntu
When I first installed OpenCV I used an article on which installed opencv from source. However this is unnecessary and time consuming.
The entire process is too complicated. You will need to use that process only if
The entire process is too complicated. You will need to use that process only if
- You are using the latest OpenCV features
- You need Python 3 bindings
Saturday, 25 March 2017
Persistance in Python
Recently I was training a dataset for Facial Age Determination. A considerable amount was spent each time I launched my script.
The Reason: It was retraining the whole dataset at each launch.
Solution : Saving the dataset into a file loading it back.
Serialization allows you to save objects to a file and reload them. I have worked with Java and Python Serialization, and with python its a piece of cake.
There are two options
I would be thus demonstration cpickle store and load through this post. The steps for pickle are the same. Just import pickle instead of cpickle and you are good to go.
The Reason: It was retraining the whole dataset at each launch.
Solution : Saving the dataset into a file loading it back.
Serialization in Python
Serialization allows you to save objects to a file and reload them. I have worked with Java and Python Serialization, and with python its a piece of cake.
There are two options
- Pickle
- CPickle
I would be thus demonstration cpickle store and load through this post. The steps for pickle are the same. Just import pickle instead of cpickle and you are good to go.
Thursday, 23 March 2017
Feret Database PreProcessing Script
I am currently working with the Feret Database on Age Determination using Frontal Facial Images using KNN and LBP in Python 3 and OpenCV.
However the Feret Database comes in a tar which when extracted contains a large number of ppm files in bz2 archives which need to be converted into jpegs before any further processing can take place.
I wrote this script in case. I am sure it will be useful to other people working with the Feret Database.
However the Feret Database comes in a tar which when extracted contains a large number of ppm files in bz2 archives which need to be converted into jpegs before any further processing can take place.
I wrote this script in case. I am sure it will be useful to other people working with the Feret Database.
Tuesday, 21 February 2017
Speed up your Make
How to speed up your make process on a multi core machine.
Whenever you are using make without arguments just a single core of your machine is used. A single process is created, which runs on one core.
No matter what kind of insanely awesome working computer you might have you are simply going to get the performance of a single core unless you create multiple process.
The make command allows you to specify the number of processes using the -j argument
The Make Process
Whenever you are using make without arguments just a single core of your machine is used. A single process is created, which runs on one core.
No matter what kind of insanely awesome working computer you might have you are simply going to get the performance of a single core unless you create multiple process.
The make command allows you to specify the number of processes using the -j argument
Tuesday, 14 February 2017
Friday, 10 February 2017
FireFox Shortcuts Essentials
While There are tons of post or cheatsheets on firefox shortcuts, this post will just cover the essentials. These are the shortcuts that you actually need to know to increase your productivity. We will explore some of the less known tools like
Note:This article has been written for linux. So if you are using windows just note that super means start button. And not all the shortcuts might be applicable to you. I would still suggest you read it since most of them would be applicable. You will definitely learn a new thing or two.
Let's get going with firstly the File Menu
- Caret Browsing
- Page Info
- Open Address Bar Link in New Tab
- Tab Navigation using KeyBoard
Note:This article has been written for linux. So if you are using windows just note that super means start button. And not all the shortcuts might be applicable to you. I would still suggest you read it since most of them would be applicable. You will definitely learn a new thing or two.
Let's get going with firstly the File Menu
File Menu
- New Window: Ctrl + N
- Private Window: Ctrl+ Shift + P
- Save a Page : Ctrl +S
- Print a Page : Ctrl + P
Most of the people should be familiar with New Tab , New Window and Printing a Page. In case, you are not, no worries, just go ahead and press the shortcut keys to get an idea. We will look a bit into the Private Window and Saving a Page.
Private Window
This opens a window similar to the New Window option but with one major difference. It doesn't remember your history. This particularly great when logging in accounts for one-time access. No browsing history , cookies and sessions are stored. Also FireFox comes with this legendary Do Not Track Me features, which means while you are using Private Browsing all tracking by websites should be rendered useless.
Note: Private Browsing does not increase security in any way. You are still vulnerable to security threats.
Save a Page
This allows you to save a page to view it offline. You can carry it on your pendrive. Whenever you want to open it just open it by double clicking it. You can use another browser to open the website. All images and css files or script files are stored in a separate folder called website_name_files. This is almost as good as making a page rip.
Thursday, 9 February 2017
Multi-Threaded Echo Server in Java
Implement a Multi-threading application for echo server using socket programming in JAVA.
Server Side
Implementation
Server Side
- Create a Server Class implementing the Runnable interface
- In the run method, create a data input and output stream with a client.
- In the main method write code to create a ServerSocket at a give port.
- Create a infinite loop, to accept server connection from clients and launch a thread.
- In the thread, when we catch an IOException we use return to quit. IOException occurs when the pipe is broken, that is, the client leaves.
- Additionally we have give id's to identify when a client joined and left.
Client Side
- Establish connection with server
- Create Input and output streams for interacting with the server
- Create a infinite loop to send messages to echo server
- Quit the loop on get quit as an input.
Monday, 6 February 2017
MultiThreaded Calculator in Lisp
Implement an calculator (64 bit Binary Multiplication) application using concurrent lisp.
Before we get to the Implementation of the Program, get your Lisp Programing Environment Setup. In case you haven't yet set it up , here's an article about the same.
We have created a text based interface for the calculator which accepts two numbers. The result of addition , subtraction , multiplication and division in calculated.
Input: Accepted in binary
Output: Displayed in binary
Functions
4 Lamda Function to compute each of the operations
btd: This function is for binary to decimal. Converts a binary to decimal
Before we get to the Implementation of the Program, get your Lisp Programing Environment Setup. In case you haven't yet set it up , here's an article about the same.
Implementation
We have created a text based interface for the calculator which accepts two numbers. The result of addition , subtraction , multiplication and division in calculated.
Input: Accepted in binary
Output: Displayed in binary
Functions
4 Lamda Function to compute each of the operations
btd: This function is for binary to decimal. Converts a binary to decimal
Code
Wednesday, 1 February 2017
Finding Java Home in Ubuntu
Often Ubuntu Users struggle with setting up of Apache Tomcat, Hadoop and other Java Technologies.
The reason being Java Home Error.
It is Either not set or incorrectly set due to mismatch in the java variant.
The easiest way to fix this is to use the update-java-alternatives command
Whenever updating apend a /jre at the end.
The reason being Java Home Error.
It is Either not set or incorrectly set due to mismatch in the java variant.
Java Variants
The java installation in Ubuntu comes in two ways- Open Jdk
- Sun/Oracle Jdk
Always use the second one if you are working with android.
The Fix
The easiest way to fix this is to use the update-java-alternatives command
sudo update-java-alternatives -l
This will give you the java home.
Use this to java home in your config File.
Whenever updating apend a /jre at the end.
Screenshot
update-java-alternatives |
Example in this case value for Java_Home will be
/usr/lib/jvm/java-8-oracle/jre
/usr/lib/jvm/java-8-oracle/jre
Thursday, 26 January 2017
PrgWonders Android App
PrgWonders proudly releases a new Android App.
Our Android App Dedicated Page:
https://prgwonders.blogspot.in/p/android-app.html
Spread the Word !
A more efficient and faster way to view our blog.
Whether you are travelling or at the examination centre.
Whether or not you have a computer to access our blog.
You can now Learn from the Experts on the Go!
- Get notified on Updates
- Data Saving Features
- Allows to Bookmark Articles
- Remember your read and unread Articles.
- Quick Links to quickly browse our Blog
- Continuously Updated
- In-app Browser for faster & efficient Browsing
- A cool Dark Theme for Nocturnals
- Switch Layouts as per Choice
- Automatic Sync
- View Saved Rss Streams Offline
- Fully Customisable Settings
Give it a try !
Links
Download at MediaFire: http://www.mediafire.com/file/oezblfb96bs335s/com_blogspot_prgwonder.apk
Our Android App Dedicated Page:
https://prgwonders.blogspot.in/p/android-app.html
Spread the Word !
Wednesday, 18 January 2017
Schedule a Shutdown in Linux
Scheduling a Shutdown in Linux, unlike Windows is a piece of cake.
The Windows Way
- Create a bat file executing run/win32/shutdown.exe.
- Schedule this using Windows Schedule Manger
Linux Way
Linux offers you tons of ways, forget at command or even cron. You can achieve this in one single command.Read-only file system Error In Pendrive
The Dreaded Issue
Often you come across errors in linux with storage devices and the one of the most common and dreaded one is the following one
Read-only file system
Here are a few google search suggestions that pop up the moment you begin typing read-only filesystem.
I have seen people using several distros constantly complaining due to this issue.
Some of the most reputed forums offer horrible fixes to this issue. The solutions offered by these forums are often over complicated.
We will look into two simple approaches to this problem.
- The Naive Method
- And Geek Method
The Geek Method is hell lot a faster and looks really cool , or rather should I say geeky.
Sunday, 15 January 2017
Adds & Changes
Adds Suck
Programing Wonders knows that adds suck. Adds are however a good way to encourage content providers to provide content. Unfortunately Programing Wonders is no different. Meanwhile we are looking at other means to monetise the blog, without affecting user experience.
Friday, 13 January 2017
Thursday, 12 January 2017
Simulation of Lift Using Led, Switches and Beagle Bone Black
Introduction
This is a simulation of working of lift using beagle bone black and python. The position of lift will be indicated using led. Switches will be used as lift buttons.
Wednesday, 11 January 2017
Accessing Python interpreter in Beagle Bone Black
- Ensure that you have properly connected the Beagle Bone Black to computer using USB cable.
- From terminal escalate your privilege level to administrator/root.Use the switch user command. Type the root password when prompted.
user@comp:~$ su
- Now to gain access to Beagle Bone Black use ssh command. The ip address is 192.168.7.2.
admin@comp:/home/user# ssh 192.168.7.2
Note:In case of any issues during while using secure shell clear the contents of known_hosts files used for ssh.
Location: /root/.ssh/
- Once you gain access to Beagle Bone Black. Fire up the python interpreter by typing in the following command
root@beaglebone:~# python
- You will get a python prompt and you are good to go.
Monday, 2 January 2017
Subscribe to:
Posts (Atom)