Skip to content

A Simple Random String Generator Implemented in Python

The general idea of this program is that given a grammar, construct any random string that follows the grammar rules. It is guaranteed that all the strings produced will be valid.

For the grammar, all the non-terminals are positioned on the left side while the equivalent values are positioned on the right side.

This is the grammar provided to us by our professor. This is a grammar for a simple calculator. The assumption here is that the grammar is Context Free and that the string has a finite length. Read more…

String Rewriting Parser Implemented in Python

The program assumes that you will be providing Context-Free Grammar, otherwise it will not work properly. The idea of the program is to break a sentence down to its atomic elements. It follows the concept of String Rewriting System.

Given a sentence: abbabab

and grammar rules:

  1. ab -> S
  2. aS -> S
  3. Sb -> S
  4. SS -> S

The program determines whether the sentence can be parsed or not. It can be parsed if the sentence follows the grammar rules. Read more…

Simple Finite State Parser Implemented in Python

This is a Simple Finite State Parser that checks whether is an English sentence is syntactically correct or not based on the grammar provided by my teacher.

The following is the Finite State Diagram of the grammar:

The program reads from a file a dictionary of valid words which also contains the type of the word. See sample below: Read more…

Windows 8.1 Managing Network Profiles

Open the Registry Editor (regedit via Run command) and go to this directory:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles

Each network location is represented by a folder entry under this directory.

If you want to set up again the network locations when the network adapter connects to the network, delete all the subfolders of Profiles folder.

If you want to rename the network location, click on the right subfolder and edit the key named ProfileName and input the name you desire for the network location.

Script File to Backup SimStudent Logs

My group and I are performing an experiment in one of our subjects. We are using the SimStudent program which is locally installed in approximately 80 machines. We needed a way to copy all the logs of all the program instances and store them in a network storage.

This is the script I made. This will only work in Windows.

@echo off

REM	Written by: Yancy Vance M. Paredes, March 18, 2014

REM 	Go to the directory where the log folder is located
cd simstudent\SimStAlgebraV8

REM 	Prompt the user to enter the correct student number
SET /p STUDENT_ID="Enter student ID (ex: 02 [with leading zero]): "

REM	Prompt the user to enter the session number
SET /p SESSION_ID="Session No. (1, 2 or 3): "

REM	Prepare the target path based on the user's input

REM	Make sure to update this one to point to the UITO network storage

REM	Copy the file to the network storage, prompt for overwriting
REM	and copy everything inside the log folder to the new directory
xcopy log "%TARGET_PATH%" /s /-y

The assumption here is that the script is located just outside the SimStudent directory.

Enable Developer Option on Samsung Android 4.3

After I upgraded to Jellybean 4.3, the Developer Option became missing. According to forums, to be able to bring it back, follow the steps:

Go to Settings > More > About DeviceĀ 

Scroll down and click the Build Number item 7 times.


Afterwards, go back to More menu and you should see the Developer Option. Read more…

How to Calibrate Samsung Devices’ Magnetic Sensor

If your Samsung device comes with a magnetic sensor, you can calibrate it.

The first thing that you have to do is go to the Diagnostic Menu by issuing the code *#0*# . Afterwards, go to Sensor. You will know if the magnetic sensor is calibrated or not. See the picture below.

2014-02-11 23.11.56

The value should be 3 and not 1. By the way, this screenshot was taken from my Note 10.1. To calibrate it, just shake your device until it becomes 3. Just wait for a few minutes before the value changes. See the picture below. Read more…

Setting GRUB’s Default Operating System

If you are using GRUB as your boot loader and you want to change the default operating system that is highlighted in the list, just follow these simple steps:

You should do this on your Linux machine. My current setup: dual boot of Windows 8.1 and Ubuntu 13.10.

Open the terminal and issue the following command:

sudo nano /etc/default/grub

Look for the variable GRUB_DEFAULT. Set the value to any integer value. It works similarly with the index of an array in C or Java.

2014-02-16 22.42.50

In the list above, you can set the value from 0 to 3, inclusive.

After changing the file, save it and issue the following to update the GRUB:

sudo update-grub

Finally, restart your system to see if it works.

Fixing Missing Dropbox Indicator on Ubuntu 13.10

If you try installing Dropbox on Ubuntu 13.10, you will notice that the Indicator is missing. According to forums, it has something to do with the Dropbox application since Unity 3 does not recognize it properly.

To fix it, just install the following package:

sudo apt-get install libappindicator1

Afterwards, log out then log in so that the changes will take effect.


How to Change Path to Home Directory of Users on Ubuntu

If you want to modify the path to the home directory of a user, issue the following command in the terminal:

sudo usermod -d /new/home/path -m username

This will work if the user you want to modify is not logged in.

%d bloggers like this: