Archive

Author Archive

Algorithm: Graphic Sort

August 8th, 2010

Graphic Sort

Graphic Sort

Today, I created different kinds of sorting.

  1. Bubble sort
  2. Selection sort
  3. Insertion sort
  4. Quick sort

Yet, my Quick sort does not work properly… And I have 6 more sorting method to go… :(

Download: Graphic Sorting (18) (demo executable file)

Download Source Code: Sooooooon… :P

Thanks to: http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html

Camilo III Info.Tech, Software Development, dev-C++

VLSM Table

July 31st, 2010
Comments Off

Variable Length Subnet Mask Table

Prefix Add-on Octet Hosts Subnet
/30 +4 4th byte 2 255.255.255.252
/29 +8 4th byte 6 255.255.255.248
/28 +16 4th byte 14 255.255.255.240
/27 +32 4th byte 30 255.255.255.224
/26 +64 4th byte 62 255.255.255.192
/25 +128 4th byte 126 255.255.255.128
/24 +1 3rd byte 254 255.255.255.0
/23 +2 3rd byte 510 255.255.254.0
/22 +4 3rd byte 1022 255.255.252.0
/21 +8 3rd byte 2046 255.255.248.0
/20 +16 3rd byte 4094 255.255.240.0
/19 +32 3rd byte 8190 255.255.224.0
/18 +64 3rd byte 16382 255.255.192.0
/17 +128 3rd byte 32766 255.255.128.0
/16 +1 2nd byte 65534 255.255.0.0

Download PDF file: Variable Length Subnet Mask Table (36)

Camilo III Administration, Cisco: Network Administration, Info.Tech

dev-C++ : Bubble Sort with Graphic Plotting

July 24th, 2010
Comments Off

I’m having difficulties in creating good programming algorithm with C++. I find its very difficult. Somehow, I would like to share my accomplishment in creating this program, Bubble Sort with Graphic Plotting. But first, what is bubble sort?

Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements “bubble” to the top of the list. Because it only uses comparisons to operate on elements, it is a comparison sort.

Below is the demo, source codes and libraries needed…

If you have better algorithm solutions, if you don’t mind, can you email it to me… Like to see how others solve the problem.

Camilo III Info.Tech, Software Development, dev-C++

IPTABLES – Logging and dropping traffic in a single rule

July 15th, 2010

Many people who are familiar with IPCHAINS (the predecessor to IPTABLES) are familiar with the ability to simply tack on a ‘-l’ to also log rules which match that rule. In IPTABLES this is not done the same way and no such option exists.

To accomplish the same task in IPTABLES you could simply put a identical rule with a LOG action before every drop rule, but that will fill your script with copies of the same rule and force updates in multiple locations. This is therefore not an ideal solution.

The cleanest method of accomplishing this is to create a new chain which does both the LOG and DROP for you. The following IPTABLES rules will create a LOGDROP chain.

# Create the LOGDROP chain
 iptables -N LOGDROP > /dev/null 2> /dev/null
 iptables -F LOGDROP
 iptables -A LOGDROP -j LOG --log-prefix "LOGDROP "
 iptables -A LOGDROP -j DROP

The first rule in this set creates the new chain. The output is sent to /dev/null because if you attempt to run this twice on the same system, you will get an error saying the chain already exists. It’s up to you if you want to see that message or not.

The second rule flushes the contents of the chain, again, so that if you run it twice on the same system you don’t have duplicate rules in the chain.

The third rule LOGS the traffic with the added “LOGDROP” prefix and the fourth rule DROPs the traffic

What this now means is that you can easily log and drop traffic or even log and accept traffic (with minor modifications to the above), by creating a rule such as this:

# Log and drop all connections to the HTTP port
 iptables -A INPUT -p tcp --dport 80 -j LOGDROP

As you can see, you now simply use the LOGDROP target in order to log and drop any traffic you want. You must ensure that you define the LOGDROP target BEFORE you attempt to use it in a rule.

If anyone has any comments or corrections for this, please let me know using the comment system below.

Article From: http://www.techbytes.ca/techbyte136.html

Camilo III Info.Tech, Operating Systems

AB-220KC POS Printer Driver

July 6th, 2010
Comments Off

I’m having problem looking for this POS printer driver… its nowhere to be found in the internet… finally, you can download it here in my blog site…


Product Details:

Type Dot-matrix
Style Black And White
Use receipt
Interface Type IEEE1284, RS232, USB
Max Paper Size 76MM
Black Print Speed 4.6LPS
Brand Name ZONERICH
Model Number AB-220KC
Place of Origin Guangdong, China (Mainland)
URL http://www.zonerich.com/english/ab-220k-c.htm


 
Download Driver: AB-220KC POS Printer (mini dot matrix) (2)

 

Camilo III Personal

Generating SSL certificates using OpenSSL

May 10th, 2010
Comments Off

Based on Centos Wiki on HowTo SSL – http://wiki.centos.org/HowTos/Https

I simplified the procedure to create a bash script. Here’s the code;

#!/bin/bash
umask 077

echo ""
if [ $# -eq 0 ] ; then
 echo $"Usage: `basename $0` <DOMAIN_NAME> [...]"
 echo ""
 exit 0
fi

for target in $@ ; do

 keyFile=${target}.key
 crtFile=${target}.crt
 csrFile=${target}.csr

 echo $keyFile
 echo $crtFile
 echo $csrFile

 # Generate private key
 openssl genrsa -out $keyFile 1024 

 # Generate CSR
 openssl req -new -key $keyFile -out $csrFile

 echo ""
 echo "Please enter the number of days which SSL Certificate will be valid:"
 read DAYS
 echo ""

 # Generate Self Signed Key
 openssl x509 -req -days $DAYS -in $csrFile -signkey $keyFile -out $crtFile
done

Or download the script below…

Download: gencert (9) bash script

How to add gencert command to your system:

  1. Download the gencert bash script
  2. Extract the file
  3. chmod u+x gencert
  4. then copy the gencert file to /bin/
  5. Wallaah! You’re done!

Camilo III Administration, Info.Tech, Operating Systems

CEntOS: Securing FTP (vsftpd) and SSH

May 8th, 2010

SECURING FTP

Use chroot_local_user=YES then the vsftpd.chroot_list becomes a list of users to NOT chroot. So… you said chroot ALL users but ftpuser.

Notice the commented out lines.
In /etc/vsftpd/vsftpd.conf:
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

edited /etc/vsftpd.chroot_list:
add users only that DO NOT NOT NOT NOT get chrooted.

use /sbin/nologin
edited /etc/passwd entry for ftpuser:
ftpuser:X:#:#:FTP User Account:/home/ftpuser/./:/sbin/nologin

————

chroot_local_user=YES
chroot_list_enable=YES
means that by default ALL users get chrooted except users in the file

chroot_local_user=NO
chroot_list_enable=YES
means that by default ONLY users in the file get chrooted.

See the difference?

Article by: JordanH

SECURING SSH

Edit /etc/ssh/sshd_config and at the bottom of the file, add these lines…

# Allowed users to login SSH
#AllowUsers root user002

# Disallow users in logging in at SSH
#DenyUsers user001

Camilo III Administration, Info.Tech, Operating Systems , , ,

Prototype POS System – Transparent GUI

April 23rd, 2010
Comments Off

POS System – Transparent GUI

My article is about a prototype POS system for grocery stores or 24 hours mini marts using Transparency graphical user interface.

Transparency in MS Visual C# works similar to chroma keys in Adobe After Effects or Premiere. All you have to do is set a color key to make it transparent.

  1. As you create a form as Form1, go to Form1 properties and set TransparencyKey to Black.
  2. Then set your Backcolor of your form to Black.
  3. In Photoshop or any image editing tools, create an GUI or layout design then save as PNG format.
  4. In Form1 properties, set BackgroundImage and select the PNG image you created from Photoshop or other image editing tools.
  5. Set also the FormBorderStyle to None and Opacity to 95%.
  6. Then run your project. You’ll see the transparency works well. :)

See my sample source code.

Prototype POS System - Transparent GUI (17)

 

 

 

Camilo III Info.Tech, Software Development, Visual C#

Bayan ko walang pag-asa…

April 21st, 2010
Comments Off

Yesterday, I watch TV and shocked about the decision of the Judge (DOJ) that they release Ampatuan who brutally killed 57 people. Does the word “Justice” really work in our country? Well I guess this country is not an ideal one.

I am tired of the political issues in this country. The word CORRUPT is all over the country. There’s no such news that no corrupted city. Such president, GMA, cover everything up. She’s smart, yet too obvious. So far so good, she made the freedom fighters sent to prison.

In addition, such scheduled brown-outs. They say there’s no water because El Niño. Do you really think its El Niño? If there’s water, how can the water district supply water to us? As I remember, my last El Niño experience, even water supplies are scheduled for no water supply.

Straight to the point, scheduled brown-outs are for messing the incoming 2010 election since we are using electronic voting system. And messing our electric bill so that the politicians behind the power supplies need money from the people. Such sudden increase of electric bill price is an obvious move.

Well, there’s nothing I can do about this country. This is how they make the Philippines go round. All I need is pray for my migration somewhere else and finally rest in peace.

One thing, here at my birth city, its starting to create a bad crowd. You know what I mean… :)

Whew! God help me go through that surrounds me… Please help me migrate away from this country.

I believe, this country would be next to Haiti neither of these countries; Afghanistan, Angola, Bangladesh, Benin, Bhutan, Burkina Faso, Burundi, Cambodia, Cape Verde, Central African Republic, Chad, Comoros, Democratic Republic of Congo, Djibouti, Equatorial Guinea, Eritrea, Ethiopia, Gambia, Guinea, Guinea-Bissau, Haiti, Kiribati, Laos, Lesotho, Liberia, Madagascar, Malawi, Maldives, Mali, Mauritania, Mozambique, Myanmar, Nepal, Niger, Rwanda, Samoa, São Tomé and Príncipe, Senegal, Sierra Leone, Solomon Islands, Somalia, Sudan, East Timor, Togo, Tuvalu, Uganda, Tanzania, Vanuatu, Yemen, Zambia…

Camilo III Madness, Personal , ,

Conspiracy Theory: Earthquake, Tidal Waves and other Natural Disaster

March 3rd, 2010
Comments Off

Do you really think Earthquake, Tidal Waves and other Natural Disaster are really natural event? Like Haite Earthquake, Phuket Thailand Tsunami and Chile Earthquake…

For my analysis, these are man made events. It’s a test causing Earthquake, Tidal Waves and other Natural Disaster. This is another mass destruction weapon of U.S. Government. It might be the HARP project nor other Top Secret project.

Yet, I don’t know how to prove it cause I’m just a low life human being… :P

Camilo III Madness, Personal