User Tools

Site Tools


opus:fall2013:kehrlich:start

Kyle Ehrlich

Fall 2013 Opus

About Me 私について

My name is Kyle Ehrlich (pronounced Ehr-Lick). I moved up from Florida two years ago, where I grew up. I attended Corning East High for my senior year. I live in my own apartment on North Side. It is nice and spacious.

In High School I acquired a job at the Corning Inc. Decker Bldg. as a lab technician. My duties were sometimes simple, but the main reason I feel like they kept me around was because I was proficient with the computer and making programs on machine software to run tests. I was like a cheap PC&I technician (The lab computer specialists). I just left the job as of this semester, as it was growing increasingly difficult to balance school and my other duties.

I am an associate on the website Lang-8. Lang-8 is a fantastic website (free of charge) if you are trying to be proficient in your second language. It's not very good to try to learn a new language unless you have a base, though, so don't try to learn the basics from it. I have been pretty well versed in Japanese for the last few years, so people will often try to write what they want to say in Japanese, and attempt to write it in English, I will then correct their sentence. I, of course do the same thing as well often and the Japanese associates help me. It is a very difficult language to learn, very alien to European derived languages. I am learning more and more every day. I try to go through at least 100 sentences a day.

I hope to go to R.I.T., my close second choice is Portland State University, which has a foreign exchange program with 北海道大学 Hokkaidou Daigaku, a 4 year university in Hokkaidou Japan where I would study relevent material. I have not yet decided between a degree in Computer Science or Computer Engineering. Computer Engineering is a more diverse field which relates to both hardwares and softwares, whilst Computer Science is very software and theory based.

C/C++ Programming Journal

2013年8月28日

Introduction Journal

C and C++ are languages much like any other language, except used to talk to computers. If Matt Haas had his way, he would elect to count C/C++ as a foreign language.

Even though I had previous exposure with C++ in C++ for Engineers, I am going to try to start at a clean slate, especially since I know nothing of C. I believe starting with C in the course will be a good idea for me personally. I will try to take advantage of this fact, however, and claim a head start with the fact that I understand the logic behind how computers think. This is my wishful thinking at least.

I will update this Journal with more relevant things a couple times a week as we get into topics in C.

2013年9月04日

Variables and Variable Types

Variables in C are “objects” that store data. Chars are variables that store single characters of a single byte, meaning one char could not hold a 2 byte character. A string holds multiple characters, but we have not gotten to it much, yet. Ints are integer values, they can vary in length from short to double long. Pointers we haven't gotten to much, but is still worth mentioning. I learned that arrays and structures are variables that can hold multiple values. (Is variable even the right term for that?) I learned a bit about arrays before and how to use them in C++, but structures were never mentioned, and I have a good feeling we are going to be learning a lot about them soon. We learned some stuff about more \n type commands. \n, as previous learned. \o is a string terminator and is used at the end of strings always, even if not explicitly shown. \b backspaces the cursor. \l clears the screen. \f may clear the screen, or may do something entirely different. Needs to look up… \t tabs the cursor. Use
for comments, text after them will not be compiled. Using %h or another letter inside a printf will allow something to be calculated, or a function to work after the printf, and put it back inside the text. Much more useful than cout from last year. An interesting function we learned is the sizeof() function, this will return a value based on the amount of bytes in the variable.

2013年9月06日

Signed-Unsigned and Crazy Logic

A signed character is one that can be a negative value, as opposed to an unsigned that is just an integer value. One thing I want to investigate is how, interestingly enough, char types can be signed. It seemed from my previous course that a character was simply that – the character. What I think is going on is more on the bit/byte level that I don't really understand much – which leads me to the next topic. Logic gates have always been something that blows my mind away. It's how 1's and 0's turn into the complex operations that computers do. I have previously done many experiments, especially on Minecraft with them, but I still don't understand bugger all about them. This is something I want to/need to study up on. I want to maybe be able to make a logic adder by the end of the semester. Is that too ambitious? There is obvious links to course material, so it would be super helpful, surely. I had some troubles following along with the HEX math in class, that is something I should also probably look over. Is it because I haven't completed CSCS1240 yet that I don't understand it too well?

2013年9月13日

Pointers

In C, all variables can be directly called, but they obviously have to have a place in memory. A pointer, assigned with a * and accessed with a & can be called directly from its location in memory. Malloc is a function that is used for allocating memory (hence the name – memory allocation) and is also able to return back the address of that location. Malloc and pointers can be used in powerful combinations.

Also, a neat trick is that %c(ascii number) will print out the symbol for the ascii character.

Fun With Printf

Printf has such great capabilities that even Java copied it. Printf has powerful formatting techniques. For instance, instead of just typing %d to refer to the variable after the string, you can put %8d, %-8d, which will allocate 8 spaces and the negative will left justify. If you put in 4.4d, it will allocate 4 spaces and pad them with zeros.

Also, a side-note, if you use %x instead of %d, it will show the number as a hexidecimal digit.

2013年9月20日

GD Graphics

We are doing graphics now using a library called GD. It is a very mathematical (as most things in C are) way of implementing graphics. Some important functions(not in the I/O, technical sense) that I learned are:

FILE *out; which allows the interaction of files, and in this sense specifically prepares a file to write to. FILE is from stdio.h.

arrayname[] = “characters” which creates an array that fits in the characters plus the null terminator.

gdImagePtr = new variable type from gd library. gdImageCreate = creates an img file or “resource” gdImageAllocate(resource, R, B, G) allocates a color with hex values

fopen(file, access control string) = opens a file fopen(outfile, “wb”) opens a file with writing binary access(?) a little confusing.

gdImagePngEx() = exports image as a common image file.

In order to compile images with gcc, we use the -o option which allows outfile writing, and -lgd at the end. Ex: gcc -o img img.c -lgd

Loops

For loops are numerical loops in the form: for(start; condition; step) The start allows the initialization and declares to the loop which variable will be used for cycling. The condition basically says “As long as the variable meets this condition”. The step allows the loop to increment or decrement, change the variable somehow such that it changes throughout the loops and allows it to end eventually.

2013年9月27日

Arrays And Drawing With Them

An array is a homogenous composite variable type. An array holds one type of variable, but multiple values of that variable type. This is compared to an interger which is simply a scalar variable. It has one value, one type. An interger array contains all intergers, whereas a char array contains only chars etc. This is useful in GD, as the GD library will take an array of a special type, and be able to create images based on coordinates of the array.

2013年10月04日

Functions

In C, a function is used as an organizer. Instead of re-writing or re-creating the same series of steps each time, we can create a function that performs a set of instructions. Since a function includes an input and output, and a name… We must include all those in our function. We must also define the function before the main function in the program. This is called the function protocol. This allows the program to recognize “Hey, there is a function like this, look out for it.” You then write the instructions for the function after the main, which allows you to call within the main. Since C is not necessarily a line by line script interpreter (except within blocks themselves) C is able to call the function that is outside the main.

Numbers and Characters

We discussed the differences between a variable type of character and number. The numbers 0-9's ASCII character is that number plus 48. This is a neat trick that many programmers use at a very low bit-level to manipulate numbers and characters.

Bitwise Logic

I had trouble understanding how the computer used bitwise logic before, this class really helped clear it up. Examples: & bitwise and 0111 & 1001 = 0001 Only true when both "answers" are true. | bitwise or: 0101 | 0110 = 0101 0110 =0111 Or means, if anything is true, answer is true, 1 is true, 0 is false ! or ~ bitwise not: !0000 becomes 1111 ^ bitwise xor 1110 0111 becomes 1001

2013年10月11日

Structs

In C, we discussed previously, and should be proficient with Arrays, but now we are looking at structs. A struct essentially allows a bunch of variables under one name in C. To define a struct, we use the struct identifier, “struct” followed by the name of the struct, and then inside brackets we define different variables. To then call a variable inside a structure, we use the structure name followed by a period, and then the variable inside the structure.

2013年10月18日

C++

C++ is a slightly higher level language than C. We will be looking at a system inside C++ that involves using objects and classes. A class allows the programmer to organize different types of data into different structures. Classes in C++ are just a more complicated and extended version of structures (structs) in C.

2013年10月25日

Classes

The syntax for defining a class is similar to structs for C. We use the identifier class, followed by the class name and “objects” in this case, instead of variables within brackets. C++ classes allow the use of public and private objects, which allow more organization within the classes.

UNIX/Linux Fundamentals Journal

2013年8月28日

Introduction Journal

Coming into the class I had limited knowledge of Linux/UNIX systems. I understood that they are used in a variety of devices (not that which the likes I learned today) and they are one of the most (maybe the most) operating systems used for servers. I learned from outside the class that UNIX based systems are very stable compared to Windows systems in that they can run for literally years without having to reboot. It is this reason they are popular in server systems. I believe that is reason enough to want to learn the basics of UNIX. However, a UNIX expert can do many things with respect to hardware/software configuration. Just look at how the LAIR's computers are set up, as an example. You could not ask an I.T. department to set one of those up unless they were Linux experts.

I would like to learn about other capabilities and limitations (or lack thereof) of Linux systems. I may elect to install a dual-boot or virtual machine of Linux on my laptop. This may even be extremely useful, as looking at one of the books, it has some tutorial based sections that would benefit greatly by having a Linux shell to practice on.

2013年9月04日

More Commands, Exploring "Outside"

The most exciting thing today was exploring outside our own user directory. We learned about the “world” outside our user directory. The files that compose the Linux system that the entirety of lab 46 runs on. There was also other important files not having to do directly with the operating system software of hardware. There are many scripts created by Matt himself or imported that makes the user experience better, things like the MoTD. There are also some silly games on there.

We also learned about permissions. drwxrwxrwx was the string that controls permission based on the user/group/world, with the d in front either being there or not signifying whether the file in question is a directory or not. chmod xxx is the command which will change the permissions when it is ran. Values from 0 to 7 on each x indicating permissions for each group, user/group/world.

2013年9月06日

Quotes Are Whack

In Unix kernals, different quotes mean different things. There are three different types. ("", ''), and (``). The half quotes ("") are for grouping stuff together. It allows variable expansion which I don't entirely understand, but I get the gist of through some in class examples. They are not literal quotes and you can do things inside them. Every time I think of them, it reminds me of the printf function in C. You can do some neat things inside the quotes if you use special characters, I think it is similar to this. Full quotes '' are literal quotes and do not allow for expansion. What you put inside these quotes is exactly what you get. Back quotes `` allow for command expansion. This is where I get a little confused, between this and "variable" expansion. I'll try to find a reference in one of the books, or maybe online to help explain better.

Wild Cards

These are cool. Wild Cards is everything super useful about computers that I expected. We used them as search and sort functions, but I bet they can be used in a variety of situations. They let the computer “sort meaning” saving us a lot of manual work. The symbols for Wild Cards are “*”, which translates into computer tongue as “any character and any number of characters” which basically allows us to fill a gap between words, with the option of also not including any gap at all. A “?” will translate into any single character. This is similar to the * but you can specify how many characters. [ ] brackets allow any character inside to be specified. Want a vowel in place? Use [aeiou]. [^ ] is the opposite. It means any character but what is included inside. If you want to exclude certain characters this is the tool. A neat thing about the brackets is that they allow the use of hyphens in them, i.e. [1-*]. What do these mean? ????*, ????, ?[aeiou], [^bcdfghjklmnpqrstvwxz].

2013年9月13日

VI/VIM

VI was apparently one of the first text editors. VI has a crazy amount of commands and is all available from the keyboard, so it is very quick to use and change commands/functions. VIM is the improved, modern version of it. Not much more to say than that. It can be installed on almost any OS, though. I may get it for my windows desktop when I get to use it more and are comfortable with using it. There are some entire books, like the one from the class that are dedicated to using VI better and learning all the commands.

Aliases and Scripting

Aliases seem pretty fun. In the Bash config file you can set a permanent alias, which is like a shortcut for a function. If I wanted a two letter command to do a crazy search with a ton of functions I could by setting it up. I should play with this and make some use out of it.

Scripting in bash is a very high level program language. Matt says don't try to make World of Warcraft out of it, but so far all I know from C is available on bash. There are if statements, probably loops, variables etc. The nice thing is that these scripts are directly useful to Bash.

2012年9月20日

Regular Expressions

Regular expressions are the next thing that blows my mind. They are, in a broad sense, similar to wild cards. Regular expressions allow searching based on very specific specifications. Here are the basic expressions:

. match any single symbol * 0 or more of the previous \< match start of word \> match end of word

$ match end of line [ ] match one of enclosed [^ ] do not match any of enclosed ( ) grouping

Grep is the tool used to understand regular expressions. Grep means “globally search of regular expressions” Some examples:

grep '….' will not search for only 4, will search via substring for 4 or more

grep '^….$' will only search for 4 chars

6 or more that must end in e: '…..e$' or '^…..e*'

'^s.*m.*e$' searches for words that start with s, have an m in the middle, end in e.

* 0 or more of the previous will cancel out the last characters, for instance [aeiouy][aeiouy]* will only give one vowel, tricky. It means “one vowel or more, but only vowels

Also supports ranges, i.e. [0-9] [a-z][A-Z] i.e. match an email address pattern '[.0-9a-z][a-z0-9.]*@[a-z0-9][a-z0-9].[a-z0-9A-Z]$'

extended regular expressions: egrep is used for extended regular expressions All words ending in ing or ed grep '^.*(ing|ed)$'

2013年9月27日

For Loops

For loops aren't a foreign concept to me. I have used them in Obj. Oriented Problem Solving and C/C++ programming. In Unix, we use double parenthesis 1) as a pocket for arithmetic, so in for loops, we are assuming the same and we use a pocket of arithmetic for that. Example: Ex script: #!/bin/bash # for2) do echo “$i” done Will display numbers 0-9

2013年10月04日

Arrays in Bash

Similar to C, bash allows the use of arrays. The example we used was “battleexp”, so, to make an array that holds an unlimited(?) amount of the same variable, you would use battleexp[n] for any number.

While Loops

In bash scripting, we can use while loops for an “unlimited” amount of loops, that is, until a certain condition is met (or isn't met.) The syntax is while [ “$variable” “condition” “variable/number etc.” ] ;do … done.

File Function

In unix, there is a function that looks at the internals of the files and tells you what kind of file it appears to be, regardless of what it is named. This is useful if files extensions have been mislabeled, or likely more commonly, not included at all.

Cat, Head, Tail

The functions cat, head, and tail allows bash to find certain parts of strings within a file. Cat usually spits out what is in the file, head n you display the first n lines, whilst tail n displays the last n lines from the end.

Messaging

write username will allow you to enter a string and have it display on username's terminal. talk username opens something like a “chat session” with somebody.

Aliases

As discussed in class, an alias is like a name that can mimic functions and options on bash. For instance, you can make an alias that makes ls always use ls -a to display all. The syntax is: alias “AliasName”=function -options –other options

2013年10月11日

html

html (Hyper text markup language) is the language that web pages use. It is a formatting language that allows us to put words in varieties of formats. Some common formatting tools: Note, that to end a html format block, the same <format> is entered at the end with a slash infront of it </format> <html> identifies where to begin using html. <title> allows a change on the title bar of the browser <body> where you should put the bulk of text <strong> bolds text <center> centers text <em> emphasizes text <p> begins a new paragraph <br /> forces a break in the line <hr /> makes a horizontal bar <ul> <ol> <li> are lists

2013年10月18日

Devices in Linuix

It was mentioned before that in Linux everything is a file. As such, in order to interact with hardware, Linux sends and receives data from device files. These files can be found in the /dev directory. With these files, data can be sent and received to ports to interact with the hardware and “software” devices.

2013年10月25日

Multi-tasking in Linux

Linux is a multi tasking operating system, in fact, multiple users can be running multiple tasks simultaneously on the same system. We are able to view and edit/kill all of our running processes, as well as send processes to running in the background. To view our running processes, type ps. This screen shows each process, how long it has been running, how much memory and CPU power it uses, as well as a unique ID for each process. kill (PID)) allows us to kill a process, but in order to kill it, we must give the kill command a signal of what kind of level we should to end the process, these can be found by typing kill -l, which gives a list of the different signals to use. This is a basic look, but we can also run jobs in the background vs. foreground.

2)
i=0; i<10; i++
opus/fall2013/kehrlich/start.txt · Last modified: 2014/01/19 02:56 by 127.0.0.1