#include
#include
int iterator_1 = 0; //iterator for the cieling & floor
int iterator_2 = 0; //iterator for the walls
void plusminus() //Create the dashed floor and cieling
{
printf("+----+----+----+----+----+----+----+----+\n");
}
void blankbar() //Create the lined box's walls
{
printf("| | | | | | | | |\n");
}
int main(int argc, char** argv)
{
while(iterator_1 < 8) // Run it 8 times, only doing top to bottom
{
plusminus(); //Call plusminus to create the first cieling
++iterator_1;
while (iterator_2 < 3) //create the walls
{
blankbar();
++iterator_2;
}
iterator_2 = 0;
}
plusminus(); //creating the last floor
return 0;
}
Tuesday, August 3, 2010
8x8 grid quare in C
Thursday, May 20, 2010
Installing japanese Input
This is me installing Japanese input support on ubuntu 9.04. The steps are pretty much the same for 10.04 and it seems to work for net-books as well.
Video is probably easier to follow if you pop it out, like it's hot; http://www.youtube.com/watch?v=BAA52SGzhL4
There is no sound because I always sound like a huge nerd over microphone
Friday, January 22, 2010
List apps. using an internet connection
Show apps that use internet connection at the moment
typing in lsof without any arguments is a terrible mess, however using some of the arguments in the link makes some pretty output
Go ahead and look at the manuals for lsof, ss, and netstat, then close them....They're all really long....Reading is for chumps.
System details:
Ubuntu 9.10
aggitan@Moneque:~$ uname -a
Linux Moneque 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 16:20:31 UTC 2009 i686 GNU/Linux
lsof -P -i -n | cut -f 1 -d " "| uniq | tail -n +2
aggitan@Moneque:~$ lsof -P -i -n | cut -f 1 -d " "| uniq | tail -n +2
software-
pidgin
skype
evolution
firefox
skype
ss -p | cut -f2 -sd\"
aggitan@Moneque:~$ ss -p | cut -f2 -sd\"
firefox
software-center
skype
evolution-data-
pidgin
firefox
pidgin
pidgin
pidgin
skype
pidgin
ss -p | cat
aggitan@Moneque:~$ ss -p | cat
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 192.168.1.2:58623 74.125.127.191:www users:(("firefox",5652,59))
CLOSE-WAIT 1 0 192.168.1.2:49530 91.189.89.31:www users:(("software-center",3165,42))
ESTAB 0 0 192.168.1.2:37498 97.74.195.163:23314 users:(("skype",5993,28))
ESTAB 0 0 192.168.1.2:38578 74.125.19.104:https users:(("evolution-data-",3522,23))
ESTAB 0 0 192.168.1.2:52701 64.12.104.29:aol users:(("pidgin",3220,7))
ESTAB 0 0 192.168.1.2:58629 74.125.127.191:www users:(("firefox",5652,66))
ESTAB 0 0 192.168.1.2:50324 64.4.34.34:msnp users:(("pidgin",3220,24))
ESTAB 0 0 192.168.1.2:41756 64.12.200.200:aol users:(("pidgin",3220,26))
ESTAB 0 0 192.168.1.2:46001 205.188.248.153:aol users:(("pidgin",3220,27))
LAST-ACK 0 1 192.168.1.2:50468 64.211.162.170:www
ESTAB 0 0 192.168.1.2:56745 97.102.113.65:39196 users:(("skype",3275,25))
ESTAB 0 0 192.168.1.2:48318 68.180.217.22:mmcc users:(("pidgin",3220,22))
ESTAB 0 0 192.168.1.2:45615 208.82.32.2:https
ss -p | grep STA
aggitan@Moneque:~$ ss -p | grep STA
ESTAB 0 0 192.168.1.2:58623 74.125.127.191:www users:(("firefox",5652,59))
ESTAB 0 0 192.168.1.2:37498 97.74.195.163:23314 users:(("skype",5993,28))
ESTAB 0 0 192.168.1.2:38578 74.125.19.104:https users:(("evolution-data-",3522,23))
ESTAB 0 0 192.168.1.2:52701 64.12.104.29:aol users:(("pidgin",3220,7))
ESTAB 0 0 192.168.1.2:58629 74.125.127.191:www users:(("firefox",5652,66))
ESTAB 0 0 192.168.1.2:50324 64.4.34.34:msnp users:(("pidgin",3220,24))
ESTAB 0 0 192.168.1.2:41756 64.12.200.200:aol users:(("pidgin",3220,26))
ESTAB 0 0 192.168.1.2:46001 205.188.248.153:aol users:(("pidgin",3220,27))
ESTAB 0 0 192.168.1.2:56745 97.102.113.65:39196 users:(("skype",3275,25))
ESTAB 0 0 192.168.1.2:48318 68.180.217.22:mmcc users:(("pidgin",3220,22))
ESTAB 0 0 192.168.1.2:45615 208.82.32.2:https
ss -p | cut -f2 -sd\"
aggitan@Moneque:~$ ss -p | cut -f2 -sd\"
firefox
software-center
skype
evolution-data-
pidgin
firefox
pidgin
pidgin
pidgin
skype
pidgin
ss -p | grep STA | cut -f2 -d\"
aggitan@Moneque:~$ ss -p | grep STA | cut -f2 -d\"
evolution-data-
firefox
skype
pidgin
firefox
pidgin
pidgin
pidgin
skype
pidgin
ESTAB 0 0 192.168.1.2:45615 208.82.32.2:https
netstat -lantp | grep -i stab | awk -F/ '{print $2}' | sort | uniq
aggitan@Moneque:~$ netstat -lantp | grep -i stab | awk -F/ '{print $2}' | sort | uniq
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
evolution-data
firefox
pidgin
skype
lsof -nPi | cut -f1 -d" " | sort -u
aggitan@Moneque:~$ lsof -nPi | cut -f1 -d" " | sort -u
COMMAND
evolution
firefox
pidgin
skype
software-
lsof -P -i -n
aggitan@Moneque:~$ lsof -P -i -n
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
software- 3165 aggitan 42u IPv4 17054 0t0 TCP 192.168.1.2:49530->91.189.89.31:80 (CLOSE_WAIT)
pidgin 3220 aggitan 7u IPv4 15717 0t0 TCP 192.168.1.2:52701->64.12.104.29:5190 (ESTABLISHED)
....
pidgin 3220 aggitan 27u IPv4 16065 0t0 TCP 192.168.1.2:46001->205.188.248.153:5190 (ESTABLISHED)
pidgin 3220 aggitan 28u IPv4 68682 0t0 TCP 192.168.1.2:33893->64.12.30.44:5190 (ESTABLISHED)
skype 3275 aggitan 21u IPv4 15556 0t0 UDP 127.0.0.1:54110
skype 3275 aggitan 22u IPv4 17137 0t0 TCP *:38228 (LISTEN)
skype 3275 aggitan 23u IPv4 17138 0t0 UDP *:38228
skype 3275 aggitan 25u IPv4 18201 0t0 TCP 192.168.1.2:56745->97.102.113.65:39196 (ESTABLISHED)
evolution 3522 aggitan 23u IPv4 84194 0t0 TCP 192.168.1.2:47782->74.125.19.104:443 (ESTABLISHED)
firefox 5652 aggitan 22u IPv4 83368 0t0 TCP 192.168.1.2:42311->74.125.127.97:443 (ESTABLISHED)
firefox 5652 aggitan 42u IPv4 83382 0t0 TCP 192.168.1.2:50066->74.125.127.132:443 (ESTABLISHED)
....
firefox 5652 aggitan 86u IPv4 85007 0t0 TCP 192.168.1.2:42467->74.125.127.133:80 (ESTABLISHED)
skype 5993 aggitan 21u IPv4 57559 0t0 UDP 127.0.0.1:49063
skype 5993 aggitan 22u IPv4 57648 0t0 TCP *:1219 (LISTEN)
skype 5993 aggitan 23u IPv4 57649 0t0 UDP *:1219
skype 5993 aggitan 28u IPv4 58655 0t0 TCP 192.168.1.2:37498->97.74.195.163:23314 (ESTABLISHED)
(11:52:02 AM) internet: netstat is good for that
(11:53:24 AM) aggitan: It's ugly.
(11:53:59 AM) aggitan: unless you grep it
(12:02:35 PM) aggitan: netstat | grep tcp
netstat | grep tcp
aggitan@Moneque:~$ netstat | grep tcp
tcp 0 0 Moneque.local:58623 pz-in-f191.1e100.ne:www ESTABLISHED
tcp 1 0 Moneque.local:49530 barbadine.canonical:www CLOSE_WAIT
tcp 0 0 Moneque.local:37498 ip-97-74-195-163.:23314 ESTABLISHED
tcp 0 0 Moneque.local:52701 bos-m085b-sdr2.blue:aol ESTABLISHED
tcp 0 0 Moneque.local:37518 nuq04s01-in-f104.:https ESTABLISHED
tcp 0 0 Moneque.local:50324 bay12-ts5.bay12.ho:msnp ESTABLISHED
tcp 0 0 Moneque.local:41756 buddychat-m01b.blue:aol ESTABLISHED
tcp 0 0 Moneque.local:46001 oam-d10b.blue.aol.c:aol ESTABLISHED
tcp 0 0 Moneque.local:56745 65.113.102.97.cfl:39196 ESTABLISHED
tcp 0 0 Moneque.local:48318 cs117.msg.sp1.yaho:mmcc ESTABLISHED
tcp 0 0 Moneque.local:45615 208.82.32.2:https ESTABLISHED
Thursday, January 21, 2010
Thursday, November 12, 2009
What type of ram do I have?
System details:
Ubuntu 9.04
uname -a: Linux Moneque 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux
Solution:
use lshw
tl;dr....sudo lshw
*nix Systems come with a bunch of ls things; lshw, lsusb, and lspci are a few that I know of. lshw will list everything your computer recognizes as part of it, though I donno if that's printers and the such as well. lsusb Will list the details of your usb bus bits. lspci Will list your pci devices, video cards and sound rcards, this includes pci-e.
to use lshw you can fire up a terminal and type
lshw
That will, at least on my system, probably cry about wanting to be super user.....
aggitan@Moneque:~$ lshw
WARNING: you should run this program as super-user.
moneque
description: Computer
width: 32 bits
*-core
description: Motherboard
physical id: 0
The information this displays is good enough for somethings, like if you want to know a bit about your processor and so on. However some details, like the memory type will be omitted.
To fix this we run it with sudo....
sudo lshw
and that should give us more details.....
aggitan@Moneque:~$ sudo lshw
moneque
description: Desktop Computer
product: System Product Name
vendor: System manufacturer
version: System Version
serial: System Serial Number
width: 32 bits
capabilities: smbios-2.3 dmi-2.3 smp-1.4 smp
configuration: boot=normal chassis=desktop cpus=2 uuid=A0E172FB-7331-DC11-8A81-001E8C259ED7
*-core
description: Motherboard
product: M2R32-MVP
vendor: ASUSTeK Computer INC.
physical id: 0
Now, depending on your system you may get more information that can be displayed on your screen at any one time so you'll need/want to pipe the output to a file.
sudo lshw >> somefile
If the file doesn't exist it will be created and written to.
So as far as the memory problem goes we want the segment that starts with
*-memory, it will tell us: where the modules are, how big they are, and what type they are.
*-memory
description: System Memory
physical id: 45
slot: System board or motherboard
size: 2GiB
*-bank:0
description: DIMM DDR2 Synchronous 800 MHz (1.2 ns)
product: PartNum0
vendor: Manufacturer0
physical id: 0
serial: SerNum0
slot: DIMM0
size: 1GiB
width: 64 bits
clock: 800MHz (1.2ns)
*-bank:1
description: DIMM DDR2 [empty]
product: PartNum1
vendor: Manufacturer1
physical id: 1
serial: SerNum1
slot: DIMM1
*-bank:2
description: DIMM DDR2 Synchronous 800 MHz (1.2 ns)
product: PartNum2
vendor: Manufacturer2
physical id: 2
serial: SerNum2
slot: DIMM2
size: 1GiB
width: 64 bits
clock: 800MHz (1.2ns)
*-bank:3
description: DIMM DDR2 [empty]
product: PartNum3
vendor: Manufacturer3
physical id: 3
serial: SerNum3
slot: DIMM3
The important parts here are the descriptions, it looks like my system is rocking DDR2 and the modules I have are running at 800MHz. So I would want to look at getting more DDR2 RAM that operates at 800MHz
Saturday, October 17, 2009
Huge Log Files
-- The VM has limited space
-- You're getting a filesystem full error message
-- A log file has gotten ridiculously large (1.5GB in my case)
Details:
-- FreeBSD system 6.2-STABLE
Oct 9 06:00:00 system kernel: pid 13311 (dd), uid 2 inumber 47118 on /var: filesystem full
%df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 496M 64M 392M 14% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad0s1e 496M 26K 456M 0% /tmp
/dev/ad0s1f 9.7G 2.2G 6.7G 25% /usr
/dev/ad0s1d 1.9G 1.8G -2.8M 100% /var
%ls -alh
total 1720980
drwxr-xr-x 3 root wheel 1.5K Oct 9 03:01 .
drwxr-xr-x 24 root wheel 512B Oct 8 16:50 ..
....
-rw-r--r-- 1 root wheel 1.4G Oct 9 07:02 httpd-access.log
-rw-r--r-- 1 root wheel 247M Oct 8 22:53 httpd-error.log
Solutions:
-- Backup, remove, and recreate the files
-- Backup and use the built in tool: truncate
-- Delete everything.
Let's do it:
the filesystem full error message will tell you which filesystem is full, to view details about your other filesystems use the df command
%df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 496M 64M 392M 14% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad0s1e 496M 26K 456M 0% /tmp
/dev/ad0s1f 9.7G 2.2G 6.7G 25% /usr
/dev/ad0s1d 1.9G 1.8G -2.8M 100% /var
Looks like our /var directory is full. There are few things, that I know of, that would grow and cause this directory to fill; the log files.
use the cd command to cd to the directory the logs are located at
%cd /var/log/
use the list command with the proper flags to view files and their human-readable sizes
%ls -alh
total 1720980
drwxr-xr-x 3 root wheel 1.5K Oct 9 03:01 .
drwxr-xr-x 24 root wheel 512B Oct 8 16:50 ..
....
-rw-r--r-- 1 root wheel 1.4G Oct 9 07:02 httpd-access.log
-rw-r--r-- 1 root wheel 247M Oct 8 22:53 httpd-error.log
Looks like we have some pretty large files there, the G means gigabytes and the M means megabytes. While it is generally believed that bigger is better this is a bit much.
We can either delete these two files and recreate them or shave off some of the extra fluff.
Take a quick look at the manual page for truncate. Then put on your robe and wizard's hat. Once you're set You can speak the magic words:
truncate -c -s -900m httpd-access.log
And this should chop your file down a fair bit. You can keep using this command and modify the number until you get the file down to what you feel is a reasonable size.
%ls -alh
total 1720980
drwxr-xr-x 3 root wheel 1.5K Oct 11 00:00 .
drwxr-xr-x 24 root wheel 512B Oct 10 18:14 ..
....
-rw-r--r-- 1 root wheel 7.5M Oct 11 00:25 httpd-access.log
-rw-r--r-- 1 root wheel 7.3M Oct 11 00:17 httpd-error.log
All that's left now is to take off the robe and wizard's hat....and put it all away...
Sunday, September 6, 2009
Project Outline: N.O.’ing
I want to make a conjugation practice program thing for Japanese. Japanese programming is pretty systemic so it should lend its self to being programmed by me fairly easily. I’m naming it “Not only ‘ing” and abreviating it as: N.O.’ing
This is a fancy name because there is more to conjugation than just attacking “ing” to a verb and N.O.’ing can be read as Knowing...Shouldn’t have to explain this.
So here is the outline:
Project Name:
Knowing~
N.O.’ing
Not Only ‘ing
Project Type:
Educational
Project Details:
Description: A platform for going over various types of Japanese Conjugation rules
Web based application PHP/*SQL application
Focused on mobile usage: UMPC, Mobile Phones(?), PSP, and the Nintendo DS
ultra lite
*nix desktop application
Web based tracking?
Project Work Flow:
Figure out table:
How many tables will I need?
How to link tables to store info related to another.
General DB table design.
Create a modular, extensible database(table?) to hold verbs with their:
Conjugation rules
Japanese line type/name
Grammatical Categorization
Miscellaneous Details
Conjugation Formulas
Room to add more (stuff)
How to avoid the orz
Figure out script to table design
MySQL+PHP or PostGres + PHP or....?
Figure out front end to back-end script
CSS, HTML and JavaScript
How much JavaScript is too much JavaScript?
Theming
PSP theme
How can this be made quick and easy, to use, as a web app. for the PSP?
PSP does not have touch screen
PSP has a large screen
DS theme
DS has two screens
Very few browsers for the original DS
F.O.S.S. Browser for the DS ain’t the best.
DS has one touch screen
UMPC
Generally like a desktop theme?
UMPC may have touch screen
UMPC may not have touch screen
UMPC may be windows based
UMPC may have a proprietary OS
Drop UMPC support?
Web Based Tracking?
Is it within my range?
Can/Will I get help
How to do web based tracking?
Login + password
syncing user progress from multiple devices
User metrics
User updates
orz
orz
orz
Development Blog

