Tuesday, January 29, 2008

Helpful Acronym Explanations

SDK - Software Development Kit. Has at least a compiler to compile your code
IDE - Integrated Development Environment. Think of Visual Basic. Its a program that lets you write and run (and debug) your programs. There need to be more of these. These are the missing link.
API. Application Programming Interface. I think of this as within the code. The methods and properties that classes have to do things.

Monday, January 28, 2008

Thoughts

Usability and Speed. Things to consider

Sunday, January 27, 2008

TI Calculators

Quick thought. It would be cool to learn how to do assembly language programming on the TI Calculators because so many students have them

flash games vs. Java Games

Flash games look cooler.
Which is faster?

Learning how to make my own web server

I finally figured it out. How to turn my computer into a web server. So I could host my own pages.

I need to write a quick tutorial, but basically I had to make it on a port other that port 80.
I had to play with my linksys router (192.168.1.1) and the Qwest Actiontec modem (192.168.0.1)

I made my LAN ip 192.168.1.3
I make the linksys's router ip 192.168.0.4 (with reference to the DSL modem)
I did port forwarding on port 81 from the Modem to 192.168.0.4
I did port forwarding on port 81 from the router to 192.168.1.3
I installed POW (plain old webserver) as an extension to firefox. I ran it using port 80.
you have to test it on a computer not in your lan.
....More details to come!

Wednesday, January 23, 2008

Linksys Router

http://192.168.1.1/
amin
amin

html 5

take a look at the differences
http://www.w3.org/TR/html5-diff/

Sunday, January 20, 2008

Interplay's Atomic Bomberman

Very very cool game.

Bluetooth

I have been using my motorola w490 phone (resembles the famous razr phone) to connect to an iMac via bluetooth...all wirelessly. I have been sending picures, video, audio...all wirelessly.

Remote Desktop

One of the things I have seen done often is a "remote desktop" deal where computer connect to other computers via the internet (and an IP address) can you do that to make your computer be like a server... even if you didn't have a static ip address, you could update the address that it is for others to connect to.... hmmm....

Sockets?

Can I, over the internet, and/or by using ethernet cables directly, connect two computers to play an online game? (or so something that would need the responsiveness like an online game would)
can I do that with flash using sockets... or with java. How would I set up a server that did that?!

Saturday, January 19, 2008

mysqli

http://devzone.zend.com/node/view/id/686

php myql quick reference2

$stmt = $mysqli->prepare("SELECT id, thetime, towho, fromwho, message, style FROM chat where towho = ? order by id LIMIT " . intval($_POST[o]) . "," . $rowstoget);// . intval($rowstoget));
$stmt->bind_param('s', $to1);


$stmt->execute();

/* bind variables to prepared statement */
$stmt->bind_result($id, $thetime, $towho, $fromwho, $message, $style);


/* fetch values */
while ($stmt->fetch()) {


$badchar = array("\\","'","\r\n","\r","\n");



$replacebadchar = array("\\\\","\\'","
","
","
");



$fromwho = str_replace($badchar,$replacebadchar,$fromwho);
$towho = str_replace($badchar,$replacebadchar,$towho);
$message = str_replace($badchar,$replacebadchar,$message);
$style = str_replace($badchar,$replacebadchar,$style);//"color: \'rgb(0,128,0)\'"; //str_replace($badchar,$replacebadchar,$style);
...

PHP mysql quick reference


$mysqli = new mysqli($host, $login, $pw, $database);
if ($result = $mysqli->query('SELECT name from employee'))
{
while( $row = $result->fetch_assoc() ){
echo "".$row['name']."
";
}
/* Destroy the result set and free the memory used for it */
$result->close();
}

/* Close the connection */
$mysqli->close();
?>

What is the difference?

between this http://livedocs.adobe.com/flex/201/langref/
and this http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/package-summary.html
?
notice that the fl stuff is missing in the first one.

Friday, January 18, 2008

Flex

helpful link

another

Jamba Juice Web Site

Some people don't like flash but this site is really cool
http://www.jambajuice.com

Comet and Sockets

I was on ajaxian.com and I thought this was interesting

Why Comet? Why not JavaScript Sockets? You know, sockets, like what “real” applications use… True bidirectional communications.

I’m using Sockets all the time for my web applications using Flash. It works great.

There are more here

Tuesday, January 15, 2008

Javascript Form















Ajax

Ajax:

XMLHTTPRequest object
Microsoft AciveX object(s)
Iframe
Script Tag
image (believe it or not)

Comet article on Opera website

http://my.opera.com/WebApplications/blog/index.dml/tag/Jetty

Flash can talk to Javascript

this topic is a lot more complicated but here is an exaple of flash talkting to javascript
the actionscript code
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.external.ExternalInterface;

public class HelloWorld extends Sprite {

public function HelloWorld() {
var display_txt:TextField = new TextField();
display_txt.text = "Hello World!";
addChild(display_txt);
var param1:uint = 3;
var param2:uint = 7;
var result:uint = ExternalInterface.call("addNumbers", param1, param2);
display_txt.text = String(result);
}
}
}


My Canvas Project

For a math class, I used canvas to make a cool little program about gates and inverters etc

Thursday, January 10, 2008

Comet with script tag

not just an iframe, not just the XMLHTTPRequest object... think of the possibilities.

PHP can make images

Here is an example of making images with php.


// create a 100*30 image
$im = imagecreate(100, 30);
$im = imagecreatefromjpeg("http://www.example.com/image.jpg"); /* Attempt to open */
// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// write the string at the top left

imagestring($im, 4, 375, 0, "Valid from: " . date("n\/j\/y") . " to " . date("n\/j\/y",mktime() + (7*60*60*24)), $textcolor);

// output the image
header("Content-type: image/jpeg");
imagejpeg($im);
?>

PHP add dates

Here is an easy way to add dates (and format dates) in php
Here is am example that shows "valid from [today] to [a week from today]"

Valid from: " . date("n\/j\/y") . " to " . date("n\/j\/y",mktime() + (7*60*60*24))

Tuesday, January 8, 2008

Comet example

http://www.zeitoun.net/index.php?2007/06/22/46-how-to-implement-comet-with-php
I like this guy's examples. Nice and simple about doing comet with php

Jetty on Mac OS

I would love to make my own server. Right now I am with two hosting companies: Bluehost and webhost4life.

I just called cox to see how much that would be. This is the number I called 1-866-456-9944.

My brother has a mac and it would be cool to set up a server on his computer.

It would be cool to use php with the built in apache server and also a Jetty server so I could make comet apps.

This might help with that
http://developer.apple.com/internet/java/enterprisejava.html

More on Comet

Comet is fascinating.
I was reading this blog entry on simonwillison.net and it helped me understand a little bit more about implementing Comet in your web apps.

http://cometd.com/

Monday, January 7, 2008

Javascript helps avoid code duplication

I love javascript because it helps against code duplication

insead of long chain if statements you can call the right function based on properties


eg
//draw the correct shape according to element type
function redraw(elem,x)
{
cir[elem.type](elem.coor.x,elem.coor.y)
//......
}
see www.thinknumber.com/dismat

Can you do that in any other language

My bug using php on a windows server

I was using webhost4life for my online chat (windows server). My scripts are written in php.
I was getting an error for it when I realized that I had extra carriage returns (enters) at the end of my php tag

eg
//code
?>





Comet

Comet is cool too.
There may be better more professional words for it. I think comet is the best one because it gives it a name and lets us know that it has to do with Ajax.

The idea behind comet is reverse Ajax. Letting the server communicate with the client.
A sort of way to look at it is in Ajax the client initiates the the communication when it wants something. In Comet, the server initiates the communication.

Ajax

Ajax is so cool.
I have liked it for a while.
I think how I got into it was when I wanted to make a web application where the user sent an email, but the page didn't have to refresh. I searched about how to do that and I discovered Ajax.

The idea is communicate with the server without having to refresh the page

Saturday, January 5, 2008

Friday, January 4, 2008

Ajax Online Chat

I am using Bluehost as my web hosting company. I am making an online chat using ajax (XMLHTTPRequest object). I ran into some trouble because I was exceeding the CPU limit. Probably because every half a second or so it checks for new messages. Right now I have many "chat" windows open to test to see if it will do it again. Hopefully not.

For the chat I am using the polling technique, which may not be the best but it works.

It would be cool to learn "Comet." Comet might be a dorky name but I think its good to have something simple to call it.

Exceeded CPU again!

Thursday, January 3, 2008

Web Design and Programming

Learning how to program and make websites is hard.
There are plenty of tutorials that really don't help.
Hopefully, if there is anything that you don't understand, please comment about it on the blog.

Flash Flex Actionscript SWF mxmlc compiler

I thought it was cool that you can compile .as files into SWF format without purchasing swf software. Thats cool!
I downloaded the Flex 2 SDK (you can download it here http://www.adobe.com/products/flex/downloads/)
I opened the readme and tried to understand it a little. Unfortunately it wasn't simple enough for me to understand, so I kind of gave up for a while.
However, using Google I found this site Beginners Guide to Getting Started with AS3 (Without Learning Flex).
Wow! that person explained it so well. He gives exapmles of .as files and how to compile them.
The simplest way that he says it is to drag your .as file over the mxmlc.exe file.
If there are errors in your actionscript code, you wont be able to see them

Quoting from his site, here is a simple example of an Actionscript file (.as)

package {
import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite {

public function HelloWorld() {
var display_txt:TextField = new TextField();
display_txt.text = "Hello World!";
addChild(display_txt);
}
}
}