Sunday, January 5, 2014

Turning to VB .NET

I might have a new job pretty soon! Finally, I will be saved from the world of retail!

The new job is a VB .NET developer position and as you might know already, I write most of my software in C#, Java, or C++. But I'm definitely not new to the VB world.

But I did need a refresher, so I decided to write a couple of applications today. The main one I developed is a system monitor. It's pretty standard. There's a thread running in the background that calls a thread-safe subroutine which updates the list of running processes. I used a SortedDictionary to sort the processes by PID, and the list is checkable, so you can check multiple processes and kill them with the "Kill" button. I also give the option to open the directory of the selected (not checked) process in explorer. But I'm not sure about how to select the file when explorer is opened at that location. On the left-hand side of the form is a list of changes occurring in the file system. Using FileSystemWatcher, I can see changes occurring all throughout the file system, and save the results to a log file. The log file begins with the current date and time, machine name, and current user name, followed by the list of changes found and the list of running processes at the time. And finally, in the menu, you can go to Tools>Run and choose one of the menu items (Command Prompt, Task Manager, Registry Editor, Notepad).

I already knew VB, but writing in it again felt amazing. Like the feeling you get when writing Python after you haven't used it in awhile, without wishing that all languages were like it (nerd humor that probably only I will understand). Anyway. Check out my source code, it's well documented in case you don't know VB. I also use a little Boolean trick (line 136) which I've used in C-style languages forever. It works in VB as well and you might find it useful if you don't use it already.

Here is a screenshot!


VB isn't so bad. The source code is at my github.

Tuesday, November 26, 2013

JediChat update

I got the server GUI working right (for the most part). I'm going to post an image of my progress (yes there is one error in the chat dialog, BUT AT LEAST IT WORKS).

So here is an image!

I have two clients and one server. And a launcher in the upper left-hand corner (but you can't see it). The default port is 31337, but you can change that. Just click the "start listening" button and the server will wait to accept new client connections.

See the error? [NEW_USER] is one of the software-level protocol broadcast messages I spoke about in the previous post. It's broken here, but the error gives an opportunity to explain what it does. For now, I only have [NEW_USER] and [USER_LEFT] (tells clients to update online user lists), but I'd like to work in some others in the near future. When the client reads the special broadcast messages, it doesn't treat them like regular messages, it tells the client to do something. It reminds me of my scripting language, and how it works. Very similar. Very awesome. I really like where this is going.

ANYWAY. I've got /connect user@server:port and /disconnect working and I have a lot of other cool slash commands like /nick and /who, but I also have a new command in mind: /new user, which will open a privatized chat tab!

OKAY. Well. I'm off to bed. It's 4:00 AM here in OKC. 1337dr34mz c0d3junk33z

Friday, November 22, 2013

JediChat

In Advanced Java, we have to get a development team together, talk about a final project, and then work on it.

The professor told us to get to know the others in the class so that we'd know who to add to our teams, but the task was due by the following week. I actually have some pretty decent social skills thanks to my year of retail experience (and being a decent salesman), but I still didn't have enough time to meet every single person in the class. I decided to add the guys who sat closest to me. The majority of that class has dropped anyway. I'm glad we stuck around.

ANYWAY. "Jedi?"

A long time ago (2007), I was concurrently enrolled through my high school at a local voc-tech (MNTC), and I took my very first programming class at this school. The language was Java, and when time came to assemble a team, I did, and I named my team the "Java Jedis." We were all Java Jedis.

Now that I have provided a historical explanation as to where the "Java Jedi" idea originated, you can extrapolate what I decided to call my most recent team. And the project I decided we should write is "JediChat", IRC-like chat software written in Java for and by Java Jedis.

My team (Amar Molinas and Andrew Jackson) and I developed it together, but I did have to use Google to remember how to sockify everything. Worked on a software-level protocol for sending the messages, and made a pretty GUI with Netbeans. Yes, I use Netbeans; not Eclipse and Windowbuilder. I'm a huge proponent of Netbeans (it's what I've been using for six years).

Here is a screenshot of a console based server (for debugging) and the graphical JediClient sending messages to it.


It needs some work; not going to lie. See that empty box on the right-hand side of the frame? That's a user list. Notice the tabbed pane? The main tab is the JedIRC (clever, I know) view, which allows a normal broadcast chat for all users to communicate simultaneously. Privatized messaging is on its way. The JediServer GUI is pretty basic, with just "kick" and "start listening" buttons, and a list of users, and I'm thinking maybe the console-based server is the better option (I'll include both) in the tarball.

P.S. I've been sick for the past week, but I'm still being productive.

And if you are a Java Jedi as well, may the source be with you.

Wednesday, October 2, 2013

WebParse: A Simple HTML Parsing Library for C#

So last night, when the government had officially shutdown, I posted at Facebook that I was writing an HTML parsing class library in C#. I just now finished it.

Here is a screenshot of it in action.



You can download it at Github.

P.S. If you follow me, I'll follow back. :]

Sunday, September 29, 2013

USL Update

I made a mistake in my last release. I broke the sysExec function, but it's fixed now.

I have been working on a startup with a friend of mine which I won't make public anytime soon, but that and school plus work is keeping me pretty busy these days. I'm still looking for a programming job. Even if it's something like $30,000 annual salary. Anything beats my current hourly pay.

Anyway. Here is a code sample demonstrating some USL code manipulation.



So what's going on in this code? We've defined a method called "ls" that lists either the directories or files within the current working directory. This is done by storing the procedure in a variable called @code. If the parameter passed is a string containing the letter "d", a for-loop which generates a temporary list of directories in a specific directory (found at @path) will be written to the @code variable. You can guess what happens if the letter "f" was passed instead. But something really cool happens in the else-block. Since an invalid parameter value was found, we set @code to the commentation symbol #. After the endif, the rest of the code is appended. If an invalid parameter was passed, the code executed is just a comment. It may be a bit quirky of me to be excited about the discovery of cool tricks in my own language, but I'm just a quirky dude like that.

Follow me on Github!

Monday, August 26, 2013

Back to School!

I'm back, and I'll probably be posting here more often. I'm going to ask my professor if I can post my solutions here or commit them to github and link them here. I got a new job. I'm working as an EasyTech Associate at my local Staples. I don't get to touch computers, but I do help the techs when they ask for help. It appears I'm the only person there who is comfortable in a command-line environment. My job is to sell protection plans. I don't make commission either, we just have to sell plans to make our store look good (and earn the corporation some extra moolah). I feel ridiculously underpaid and I'm not given enough hours. But this blog isn't dedicated to complaining about retail jobs. This blog is about code.

So I'm back in school. I'm really close to graduating, I have two more semesters and I'll be able to get my Associate's in Computer Science. I'm not really sure if I'm taking the right degree, because I checked the "Computer Programming" degree and it says the highest math course required is College Algebra. I'm in Trigonometry and I took Pre-Calc/Analytic Geometry last semester. Who knows...

Anyway! So I get to Advanced Java, and the classroom is full of seemingly competent programmers. My professor is a nuclear physicist by trade, and the overall experience is something I'm not used to. But I really like it a lot. The first assignment was to code recursive and loop-based methods for generating Fibonacci numbers and calculating factorials. Right off the bat, I'm supposed to know about asymptotic algorithm analysis, and how to draw recursion trees. I've never had to draw a recursion tree, nor do I know what one is. I am currently collecting data in hopes of extrapolating the largest value of fib(n) calculable in 1 hour, 1 day, 1 month, and 1 year. I am currently still in the 1 hour zone. But I'm getting there. The recursive fib(n) seems to be in the order of n^2 aka O(n^2), but I'm really not sure what he means by "spatial and temporal performance." I googled these terms and could not find anything relevant. I also checked the books index and couldn't find anything. So I'm hoping he will clarify tomorrow. And I'm hoping I'm not the only person who has absolutely no idea what he's talking about.

Anyway! Here's a screenshot of my progress.

In the first window, I use my scripting language to compile and run the java program. The second window is the source. The third window is the USL interactive shell. I could easily use Python instead, but I really have grown attached to this language, and so I use it everyday as a general scripting language.

Anyway! The same professor also teaches my C++ class. And I seriously enjoy that class. I'm going to ask if I can post my source code here. I wrote a really awesome algorithm for converting Roman numerals to decimals and I'm very happy with it.

Follow me on Github!

Wednesday, April 17, 2013

PageCrawler

So a couple of days ago I was browsing a forum and found a board with tons of links to computer science related eBooks. I found one link to a book called Security Engineering by Ross Anderson, and the webpage contained links to all of the chapters, each in a separate PDF file. I figured downloading each PDF by hand would be far too time consuming for anyone, so I developed a solution to this problem.



PageCrawler lets me download all of them at once. It reads a webpage, parses the HTML in order to find hyperlinks (specifically for hypertext references) and compiles a list of each based on the file types I'm looking for. Click "Save" and select the directory to save to. Voila!

I'm working on the "Extensions" button when I find some time between school, work, and homework. The "Extensions" button will parse the page and list all of the found file extensions in the "File Extensions" text box.

A friend of mine put forth a suggestion to grab files from a range of web pages, and so I'll implement that as well (in time).

I'll post to SourceForge this weekend!