Xcomic 0.8.0 Released

2 #

Every function working. Version 0.8.0 completes the admin control panel. This version can be seriously used to publish your comics. Changes below.

Version 0.8.0 on 11/20/04
————-
Forced add of a comics directory
Added Edit Comic
Added Edit News
Added Options
Revised Settings
Fixed Link Bugs
Modified SQL table
Other small changes and code tweaks.
Fully Usable

Project Page
Download Xcomic version 0.8.0

Xcomic 0.7.0 Demo

4 #

First off, while shadowing the install of Xomic 0.7.0 on mX labs, I noticed that the CVS did not pick up the styles directory in the admin directory and the images directory in the kubrick styles directory. Therefore, I rezipped 0.7.0 and rereleased it.

Secondly, I placed a demo of the current Xcomic script on mX labs. Unfortunately, I will not openly give out admin access since I have not throughly tested the script for security weaknesses. However, if you are interested, drop me a line (comments or email) and I can grant you access. The layout is based on the Kubrick design for Wordpress. In fact, the admin panel has almost the same layout as the Wordpress design. Their designs were great and very functional. Therefore, I just had to use them :).

Let me know what you think about the script. Give it a test run.

Xcomic 0.7.0 Released!

6 #

Excited today about my new structure idea for Xcomic, I rewrote the administration section and the base script. I dropped a few OOP designs since I realized that OOP PHP does not lend itself well to the “drop-in module” idea. Usually, a class is called by another file that constructs an object from the class. If I kept with that idea, I would have more files to complicate things, and that is not beneficial to the script’s intended design.

Version 0.7.0 is useable right out of the box. It works, but it is not totally streamlined for the end user yet. Edit comic and Edit news functions are still not ready.

Rewrote the administration scripts
Removed Comic Status
Removed News Categories
Rewrote base Xcomic scripts
Removed the use of parsed templates. Rely on xhtml and user-modifiable styles.
Added the edit user function.
Fixed bugs in news posting and comic viewing.


Project page for Xcomic
. Source code can also be downloaded.

Xcomic v0.6.5 released

5 #

Yay! I had the urge today to work on Xcomic, a web comic management script. I practically wrote the whole script in PHP OOP during the summer and left it on the backburners for a while as Tokei-Mizuro test ran the script. Looking back today, I was appalled at how ugly the script looked. Also, I thought up a new way to structure the script so that plugins and drop in code additions would be possible. Therefore, I wanted to rewrite parts of the script so that it would be useable out of the box, pleasing to the eyes, and powerful to extend functionality.

Today, I worked on the graphical side, did a lot of CSS code hacking, and totally revamped the look of Xcomic. The quick change log is:

For version 0.6.5 (11/14/04):

  • Used Wordpress skin style for admin.
  • Used Kubrick skin style for regular script.
  • Skinned install script.
  • Restyled next-previous-dropdown box navigation
  • Did a lot of CSS hacking!
  • Removed Comic status section

The project page can be found on SourceForge. Version 0.6.5 of Xcomic can be download here.

Whew! Now, back to homework!

EDIT: I should set up a demo sometime. I develop locally so I have a demo on my computer but not online ^^;. Anyway, I hope to release 1.0 soon and look for fellow PHP developers to work on the script.

Barron/Pinkmonkey Notes Extractor

0 #

So another day of reading Paradise Lost which, I admit, when read correctly is a very good work of literature. Looking into notes to supplement my reading of Paradise Lost, I found the comprehensive Barron’s Book Notes on Paradise Lost. However, as you may see on the TOC page, I would have to do a lot of clicking to read through the notes! This is unacceptable! Also, what if I wanted to place the notes on my calculator for reading? I would have to copy and paste a lot of text.

Therefore, like any good Computer Scientist, I decided to use the computer to accomplish the task of merging all of the pages into one note file. First, I used wget to quickly download all of the html pages. Whew! That’s half of the work! Now, I had to extract the text from the 90+ messy HTML files. This is where Python programming comes in :).

I wrote BarronNotesExtractor.py (3.43KB) which does the job of extracting text from the HTML pages and placing them in one nifty text file. I used a lot of pattern matching which could have probably been done much better by a Python guru (which I am not). Nevertheless, the script accomplishes its task very quickly (~3 seconds)! No more clicking links and watching ads!

Now back to work!

Xanga RSS Fixer

21 #

NOTE: As of October 26th, Xanga has finally corrected their RSS feeds! Therefore, those of you who were using this script will now receive XML errors since it no longer works for Xanga’s new RSS. There is no practical use for this script anymore. To access Xanga RSS feeds use this format:
http://www.xanga.com/rss.aspx?user=INSERTUSERNAMEHERE
and send this url to your favorite RSS feed reader. Thanks for using Xanga RSS Fixer!

Being immensely annoyed at Xanga’s inability to create valid RSS feeds, I happened upon Josh Staiger’s Perl solution to fixing the Xanga RSS Feed. However, I could not run his perl script on this server (perhaps for missing modules or security reasons). Therefore, I decided to port it over to PHP and host the script on this site.

If you want to grab valid RSS feeds for your RSS reader, you can filter Xanga feeds through the PHP script here. Or you can craft the url yourself like this:
http://www.mikexstudios.com/labs/XangaRssFixer.php?user=InsertUsernameHere

Otherwise, you can download the source code, make modifications, or perhaps run the script on your own server. Please note that there is no practical uses for this script anymore since Xanga returns almost valid RSS feeds now.

On a sidenote: Xanga is really a horrible blogging service. I don’t see why people wouldn’t use LiveJournal or Blogger!

You can stlil raed seabrmlcd wdors…kindof

6 #

Most of you have heard of this effect from an email that went around beginning with: Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy…. If you didn’t, go read it now!

So being bored one day (even though I still had piles of homework to get done), I decided to write a python program to scramble my own words and sentences! Grab the file here: WordRearranger.py. I’ll post what I have right now (to fill up some space. Otherwise, this post doesn’t seem all that important!):

"""
Word Rearranger by Michael Huynh

Rearranges the letters inside words for the idea that wrods can siltl
be rbedalae if the fonrt and lsat lteters are kpet cnotsnat.

Version 1 (09/28/04)
Version 2 (09/29/04) - Fixed bug when punctuation counted as part of a word.
  For instance: [However,] would be arranged with the H and the , in fixed
  positions rather than the H, r, and , in fixed positions. Added a recursive
  solution. Thanks to Penguin for pointing out this bug!

Future considerations: Want to modify this program? How about adding a
degree of obfuscation to the program? This value can be adjusted to change
the *extent* to which letters can be moved around. For instance, the word:
[composition] can be extremely jumbled like: [cotiioosmpn], or it can be
mildly jumbled like: [copmsotioin]. This would be an interesting study to
determine the degree of word jumbling that can occur but still retain elements
of recognition.
"""

import random
import re, string

"--------------------------------------"
"Definitions: "

#Function to rearrange letters in a word
def shuffleWord(inWord):

    #Filter for 1, 2, or 3 characters
    if (len(inWord)<4):
        return inWord

    charList = list(inWord)

    #place list into new sequence
    firstChar = charList[0:1]
    lastChar = charList[len(charList)-1:]
    midCharList = charList[1:len(charList)-1]

    #-----------------------------
    #If first and last characters aren't letters or numbers, then
    #scramble where the letters start
    if(re.match('W', lastChar[0])): #If the last character is not a word
        #send first+mid Chars into this function again for processing
        firstAndMiddleChars = midCharList
        firstAndMiddleChars.insert(0, firstChar[0])
        return (shuffleWord(firstAndMiddleChars)+lastChar[0]) # + means concat
    if(re.match('W', firstChar[0])):
        midAndLastChars = midCharList
        midCharList.append(lastChar[0])
        return (firstChar[0]+shuffleWord(midAndLastChars))
    #-----------------------------

    random.shuffle(midCharList) #randomizes the middle characters
    #print firstChar, midCharList, lastChar

    #join together in one list
    wholeShuffledWord = midCharList
    wholeShuffledWord.insert(0, firstChar[0])
    wholeShuffledWord.append(lastChar[0])
    #print wholeShuffledWord

    #convert list into string and return
    shuffledWord = ''.join(wholeShuffledWord)
    #print shuffledWord
    return shuffledWord

"--------------------------------------"
"Main program: "

"!!!! For reading from a file !!!!"
"""
# Open a file, read the text
inputFileHandler = open('sometext.txt', 'r')

#Read into string
inputFile = inputFileHandler.read()
"""
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

"!!!! For manual input !!!!!"
inputFile = "Python is an easy to learn, powerful programming language. It has
efficient high-level data ,structures and a simple but effective approach to
object-oriented programming. Python's elegant syntax and dynamic typing,
together with its interpreted nature, make it an ideal language for scripting
and rapid application development in many areas on most platforms."
"!!!!!!!!!!!!!!!!!!!!!!!!!!!"

#Split string into and word list
listWords = inputFile.split()

#Scramble word
for eachWord in listWords:
    #Split word by characters
    print shuffleWord(eachWord), #comma supresses newline

""" Sample output:
Photyn is an esay to learn, puoerfwl pnmigrramog luganage. It has eiefifnct
hilgheve-l data ,sctuuetrrs and a spmile but efeivftce apoprcah to
ooerjtenb-eitcd pmoaingrrmg. Ph'tyons elgnaet synatx and damniyc tnyipg,
ttehoger wtih its ietnretrped nraute, make it an iaedl lggnuaae for sncirtpig
and riapd appioitclan dvlepnmeeot in many areas on msot plmtorafs.
"""

My conclusions about this letter scrambling idea were very similar to the ones I found on a Cambridge University’s site explaining why this works. I also found a paper that related somewhat to this idea: Reading quickly in the periphery — the roles of lettersand sentences.

Now back to work for me!

Science Club Proposal

19 #

This is a stub until I can get my [CENSORED] off of this seat and write more :):

Read the latest Upper Darby High School Science Club Proposal Here (Version 1.2)

Older Version 1 Proposal

(Written in LaTeX and generated with pdflatex, you might see very pixelated fonts while viewing the pdf. I apologize for now and I will post another version later.)

Case Closed: Google challenge

6 #

It’s a bit late, but I solved it nevertheless. Just last week, I was catching up on my RSS feeds after being away for so long and found that google had a challenge issued on July 12th. Supposedly, this challenge was a publicity stunt and a method to recruit the best minds in the computing field. The challenge was a cross between mathematics and computer science, and I decided to give it a try. After all, the challenge seemed fun and interesting—keeping my brain thinking.

The first clue was straightforward: “{first 10 digit prime found in consecutive digits of e }.com�
Google Billboard: {first 10 digit prime found in consecutive digits of e}.com

WARNING!!! CHALLENGE SPOILERS BELOW. IF YOU WANT A CHALLENGE BY SOLVING IT YOURSELF, DO NOT READ ON!!!

To solve this, I knew that I would have to take every 10 digit blocks of e, Euler’s constant, and test them for primality. When I find the first block of 10 digits that are prime, I would craft those numbers into a url (add the .com) and that should take me somewhere.

My first problem was finding enough digits of e. In day-to-day programming, built in constants to programming languages do not have the precision to handle or calculate e to many digits. For instance, in Java, calling Math.E results in only 15 or so decimal places, hardly enough to solve this challenge.

On the other hand, during my brief dip into the Maple math software at CMU, I learned a method to calculate e to any precision with the expression:
evalf(exp(1), [insert number of decimal places here]);
So initially, I was planning to write a program in Maple to solve the problem. However, programming in Maple was less than satisfactory. The language didn’t strike my fancy. Not wanting to work against something, I turned to alternative solutions.

I decided to try my hand at Python. Much hyped these days and used by many big names, Python has a good reputation of being easy to write and very powerful. Even Eric S. Raymond himself converted! Hm, that must be something.

After downloading Python, I looked for a way of generating the digits of e. I found the promising gmpy library, but no matter how much I searched, gmpy just didn’t seem to have a way of generating e. It could generate Pi easily however: gmpy.pi([number of decimal places here]). You’d think they would have: gmpy.e() or gmpy.exp(), but no, they don’t.

So hours of grueling work ensued until I finally found a library called real for python (I’m hosting it on this site because of its hard to find nature). Although outdated and very slow, real did what I wanted with an intuitive command: real.e([number of digits]). From here, I wrote two Python programs: PrimeCheck and Google01. PrimeCheck was an exercise for me in getting up to speed with Python. I could have used a pre-existing prime check library if I wanted to. Google01 was my attempt at solving the first google challenge:

# Solve google challenge 01
# Find first 10 digit prime from the digits of e

import real
from PrimeCheck import isPrime

digits = 1000
e = real.e(digits) #compute e to n digits
strDigitsOfE = str(e)[2:-3] #Omit first 2 "2." and last 3 "+-2"

#Take every 10 digits and check for prime
for startDigitPlace in range(digits-10): #can't select 10 digits from n-9th place
    #select blocks of every 10 digits and check for prime
    if isPrime(int(strDigitsOfE[startDigitPlace:startDigitPlace+10])):
        print strDigitsOfE[startDigitPlace:startDigitPlace+10]," | Position: ",startDigitPlace

Only 17 lines of code that did the trick:

7427466391 | Position: 98
7413596629 | Position: 122
6059563073 | Position: 148
...
...
4563549061 | Position: 920
0510115747 | Position: 947

The position part isn’t really necessary, but I added it in there to see if there were any patterns (hey, you never know!). The code executed quickly, and I had my answer.

Excited, I entered in the url: http://7427466391.com. The site featured a regular white page with another problem centered on the page. I felt like the Batman going after the Riddler!:

Congratulations. You’ve made it to level 2. Go to www.Linux.org and enter Bobsyouruncle as the login and the answer to this equation as the password.

f(1)= 7182818284
f(2)= 8182845904
f(3)= 8747135266
f(4)= 7427466391
f(5)= __________

Hidden inside the source code of the page was an interesting “no help here” comment. But anyway, this second part was a lot harder than the first part. Again, the question seemed straightforward. To me, it said: “Here are a few inputs and outputs of a function. Figure out f(5) or else we’ll post your biggest secret on our main page!” Okay, okay, maybe not the last part, but I had to find f(5).

Normally, when encountering a problem like this, one might try to reverse engineer the function based on its inputs and outputs. This was what I tried at first, using excel and maple to calculate best fit lines, but I did not have any success. The points plotted on a graph did resemble the top of a bell curve however. This threw me off track as I tried to best fit a gaussian plot to the points! Bad idea!

So exhausted from my failed attempts. I sought some hints using google’s own search engine. I stumbled on another page with full write ups, but since I wanted to solve this myself, I only read a small portion of the page for my hint: “all of the outputs of f() are digits of e”. Why, of course! How could I have not seen that! In my haste, I didn’t realize that the url I found was part of the outputs to f(). I made a mental note to be more careful in the future.

But then, what’s the correlation from input to output? What’s the pattern here? I tried finding the position where each output began in the digits of e and tried to discern a pattern there, but with no success. Finally, on a whim, I decided to add up the digits in each output: 49. Bingo. That’s it. So simple, yet so elusive.

From here, all the coding required was slight modifications of Google01. Essentially, I needed a function that summed the digits in a number, and instead of checking for prime, I check to see if the sum of the digits of 10-block numbers of e equaled 49. Google02 is as follows:

# Solve google challenge 02
# Sum of ten digit blocks from e that equal 49

import real

def sumOfDigits(inNumber):
    #convert to string
    strNum = str(inNumber)

    sum = 0 #sum of all digits

    for digit in strNum[:]:
        sum = sum + int(digit)

    return sum

digits = 1000
e = real.e(digits) #compute e to n digits
strDigitsOfE = str(e)[2:-3] #Omit first 2 "2." and last 3 "+-2"

#Take every 10 digits and check for sum of 49
for startDigitPlace in range(digits-10): #can't select 10 digits from n-9th place
    #select blocks of every 10 digits and check for sum of 49
    if (sumOfDigits(int(strDigitsOfE[startDigitPlace:startDigitPlace+10]))==49):
        print strDigitsOfE[startDigitPlace:startDigitPlace+10]," | Position: ",startDigitPlace

Around 31 lines this time. Not too bad. The output:


7182818284 | Position: 0
8182845904 | Position: 4
8747135266 | Position: 22
7427466391 | Position: 98
5966290435 | Position: 126
2952605956 | Position: 144
...
...
5209618369 | Position: 880
6965521267 | Position: 974

The first four outputs corresponded with the givens in part 2. Now, I had f(5) which equals 5966290435. Coolness. A quick trip to Linux.org entering in the login information dropped me at the end of the Google challenge–a recruiting page. Darn. I wanted to do more!

And thus, my google journey end. I hope you tried the challenge.

Tags:

Distributed Stream Information Propagation for End System Multicast

0 #

This was the research paper Andrew McGuier and I completed at Carnegie Mellon University as part of the Pennsylvania Governor’s School for the Sciences. This project was conducted under Dr. Jibin Zhan and the ESM research group. In addition to the research paper, a presentation was given at the end of the 5-week program at the PGSS Symposium.

Abstract:

Whereas traditional broadcasting solutions suffer from the high costs of high-end centralized servers and high bandwidth dedicated internet connections, new broadcasting solutions utilizes multicasting technology for more efficient data routing and load distribution. End System Multicast (ESM) is an implementation of the multicast specifications on the end system level and provides a cost-effective method of high quality real-time internet broadcasting with the network load distributed among peers participating on the system. The proposed extension to the ESM system, eXsm, provides a decentralized method of locating broadcast stream information and also includes the use of XML to encapsulate stream information. eXsm is demonstrated by a client written in the Java programming language utilizing the decentralized Gnutella network. In addition, client design decisions and challenges will be discussed.