Closed Thread Icon

Topic awaiting preservation: XMLHTTPRequest() Pages that link to <a href="http://ozoneasylum.com/backlink?for=24832" title="Pages that link to Topic awaiting preservation: XMLHTTPRequest()" rel="nofollow" >Topic awaiting preservation: XMLHTTPRequest()\

 
Author Thread
wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 01-28-2005 23:30

Well, I've been having a little look at this function in between the many things I've had over the past few days (including a Maths party(!!) believe it or not). I was just wondering, with the bitmap/gif outputting in Moz that has occurred recently, it was postulated that it might be possible to handle more complex formats. While that would be cool, I have a slightly different question

You can read in whatever with XMLHTTPRequest(), even an image. Though, similarly to my last thread, the variable gets cut off after the first 0x00. Any suggestions? I'm going to have to have more of a fiddle with this function in future, as it does look very cool

(Sorry to the many people who have probably already dissected, used, and got bored from use of this function )

Wrayal

My Website (finally! And yes, it uses frames and is evil, but, well, take a look, it's not as evil as you might think )

Iron Wallaby
Paranoid (IV) Inmate

From: USA
Insane since: May 2004

posted posted 01-29-2005 02:12

Well, while you *can* use XMLHTTPRequest() to grab anything... it's meant for XML. For example, Safari (and, I believe, Konqueror) only allow you to grab XML with it. MSIE and Firefox allow you to query anything, but suggest that you limit it to XML (AFAIK).

It could be pretty neat to query a server, then display a custom image depending on what the server replies... though it may just be easiest to have all that stuff handled server-side. :/

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
"Any sufficiently arcane magic is indistinguishable from technology." -- P. David Lebling

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 01-29-2005 16:48

I usually just urlencode my data before transmitting it via xmlhttp.
That increases transfer size quite a bit, but hey ;-). I'm not talking terabytes here.

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 01-29-2005 18:22

I'm using XMLHTTPRequest for a project at work now; to retrieve new information from a database. The way I'm doing it is having the PHP get the info, transform it into JavaScript eval code and then send that eval code to Javascript.

When I began working on it I was looking for a way to parse XML with Javascript since that would have been better, but I didn't find any standard way for JavaScript to work with XML. I found a lot of different API's that implement an XML parser for JavaScript, but all of them had some problem in at least one of the main browsers. So I stuck with sending non-XML info to javascript since that seemed to be te least problematic solution, but if it doesn't work on Safari I might have to rethink that approach as well...

Has anyone had any luck working with XML and JavaScript? If so I would love to hear how

_________________________
"There are 10 kinds of people; those who know binary, those who don't and those who start counting at zero"
- the Golden Ratio - Vim Tutorial -

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-29-2005 22:06

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 01-29-2005 22:29

INI: precisely correct . I was looking at the "advanced" uses of this. I cannot see how to overcome the 0x00 problem, but this does look interesting.
I'm just intrigued to see what ideas people had and so on. I spent so long thinlking "client side, client side", as I have only ever been able to program client side. This, however, allows some of the things I've thought of in that past....now I can't remember them Still, whatever, just a kinda interesting function!

Wrayal

My Website (finally! And yes, it uses frames and is evil, but, well, take a look, it's not as evil as you might think )

Iron Wallaby
Paranoid (IV) Inmate

From: USA
Insane since: May 2004

posted posted 01-29-2005 23:01

I made a (very) bugger webcrawler once with XMLHttpRequest... I'm not even sure if it works anymore, heh, but it's here if you want it

http://www.rpi.edu/~laporj2/spider.html

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
"Any sufficiently arcane magic is indistinguishable from technology." -- P. David Lebling

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-31-2005 09:18

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 01-31-2005 15:03

Meh, I'm not the one to prove you wrong . Frankly, the whole concept of Client sided-ness annoys me. This, along with standards, conflicts and so on are the main reason I'm not looking at JS so much any more. Along with some gamecube linux dev'ing, I'm looking more at C++

Wrayal

My Website (finally! And yes, it uses frames and is evil, but, well, take a look, it's not as evil as you might think )

Iron Wallaby
Paranoid (IV) Inmate

From: USA
Insane since: May 2004

posted posted 01-31-2005 15:15

I see nothing wrong with Client-side computation mixed with Server-side data queries. Look at Gmail and Google Suggest, for example. I see the whole web moving that direction, and when it does, JS will finally have the prominent position it deserves. ;D

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
"Any sufficiently arcane magic is indistinguishable from technology." -- P. David Lebling

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-31-2005 15:41

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

TwoD
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 01-31-2005 16:33

Hmm, if the 0x00-problem is solved I could probably use the request function instead of the Java application I wrote to analyze pixeldata from JavaScript. I got to take a closer look at this some time!
(Btw Ini: I finally got it working, with the Java<->JS communication and all. I could mail it to you if you want to take a look... Thanks for all your help!)

/TwoD

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-31-2005 17:46
quote:
Java is the synthesis of what you want to achieve.



heck so is flash

But really having much of this functionality native to the browser seems like a much sexier option than relying on plug-in functionality.



.:[ Never resist a perfect moment ]:.

(Edited by bitdamaged on 01-31-2005 17:46)

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-31-2005 18:13

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-31-2005 19:11
quote:
Java is not limited to clients and applets:



Oh no doubt. However at this point I think flash is a much better system for web based GUI's particularly tied into a robust business logic tier (Say Java). I've started doing a lot of work with MVC applications (Struts Particularly) and like the idea of a Java backend tied to a Flash GUI for robust web deployable apps.

While there is something to be said for having a language that can be used soup to nuts most comapnies to seperate out their look and feel from their business logic development groups. And while Java developers are very prevalent on the server side Flash tends to be a better bet for GUI developers. I know a ton of designers who can do Flash work but very few that can actually develop a front end in Java. It's more of a Human Resources argument than an engineering one.



.:[ Never resist a perfect moment ]:.

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-31-2005 20:34

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Iron Wallaby
Paranoid (IV) Inmate

From: USA
Insane since: May 2004

posted posted 01-31-2005 21:14

InI: You do realize that coding in Java is, to me, like trudging through a tarpit.

Sure, you can do lots of cool stuff with Java, but the ugliness of the code, the difficulty of getting what you want, and the slowness of implementation is, for me, too limiting to use. ;p

On the other hand, I very much like JS, and I very much like Perl/Python. Therefore, not only can I use environments that I like and can hack out code very quickly (more than twice as fast as Java); but I can also keep a clean layer between backend and frontend, which simplifies many things greatly (though it does complicate other things necessarily).

Plus, these days, JS implementations are just as common as Java ones, run just as fast for most practical purposes (though not for 3d apps and such ;p), and are easier to write. Not only that, but it doesn't require having Java installed (since some of us forget to install Java on Linux until some coder comes along with a new Java effect that we want to see ;p).

I've commented on my dislike of Java before, and other studies have confirmed it. So, unless I have an emplyer that *really* likes Java, I'm going to avoid it like the plague and stick with easier/more fun (for me, YMMV) paradigms.

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
"Any sufficiently arcane magic is indistinguishable from technology." -- P. David Lebling

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 01-31-2005 22:22

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 01-31-2005 23:08

It's funny very rarely do you see one of these comparitive type articles not written by an evangelist of one language or the other.



.:[ Never resist a perfect moment ]:.

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-01-2005 12:45

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

TwoD
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 02-01-2005 12:54

I love using undocumented functions because you are not using the language "as it was supposed to be used". But hey, it works!

Iron Wallaby: I felt like you do just a week or two ago until I had to do something in Java. Now, I've found out how easy it really was to write a full-blown application using Java! Much thanks to Eclipse. Sure, finding the correct file to import to get a specific function takes some time. But once you've found it it'll take much less time the next time you need it. I don't think the code looks that ugly anymore since now I know which pieces of code to look at in more detail and which you can skip through fast (variable declarations etc).

/TwoD

Iron Wallaby
Paranoid (IV) Inmate

From: USA
Insane since: May 2004

posted posted 02-01-2005 14:39
quote:
TwoD said:

Iron Wallaby: I felt like you do just a week or two ago until I
had to do something in Java. Now, I've found out how easy it really was
to write a full-blown application using Java! Much thanks to Eclipse.
Sure, finding the correct file to import to get a specific function
takes some time. But once you've found it it'll take much less time the
next time you need it. I don't think the code looks that ugly anymore
since now I know which pieces of code to look at in more detail and
which you can skip through fast (variable declarations etc).



But I've used Java, and it's SO not my language. It's for the same reason I don't like C++: if I have to use OOP, I'm only going to use an system that implements OOP in a real way (take, for example, Smalltalk or Ruby: everything is an object, no exceptions, no special cases). Java is like C++, in that it feels like it's object system is "tacked on", only in Java you have to use this "tacked on"-feeling interface to do anything.

I just feel like, when I use Java, it's limiting, constricting, like wearing a suit that's a size too small. You can't move about freely, you don't have the flexibility to modify things as you desire, and it's just ugly to work in (look at the code size of programs written in Java: they're about twice as long as an equivalent program written in a scripting language -- the reason is, that even though Java is OOP, it just doesn't allow you to immediately get all the abstraction of a scripting language (though, sure, you could write an object and use that, but why reinvent the wheel?))

Okay, all my Java ranting is done. Some people like it, great. I can't stand to touch it (and it's nearly-as-evil ancestor, C++, hahah). That's that.

InI: Actually, I've seen a system built almost entirely out of Ruby (except for the kernel, which was Linux). http://www.rubyx.org/ The thing about this is that it's not "natively" Ruby, it just uses a Ruby script to do everything... but it's the closest I've seen so far. Hehe, in fact, I'd love to see a "natively" Javascript or Python operating system, since it would be really cool for toy purposes.

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C. Clarke
"Any sufficiently arcane magic is indistinguishable from technology." -- P. David Lebling

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 02-01-2005 18:31





.:[ Never resist a perfect moment ]:.

TwoD
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 02-01-2005 20:10

I can agreen that Java tends to take huge ways around simple problems, and that the downside of that is large files. And yes, the OOP "enviroment" does not feel as if it was meant to be there from the start, but I still like that it's relatively simple to learn. If a "JavaScript-rules-geek" like myself could learn it in just a few days, anyone can. But I absolutely didn't mean to glorify it in any way

/TwoD

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 02-01-2005 21:46

bitdamaged: who cares? . my topic wasn't interesting anyway, and Java vs. C++ VS.... seems to have struck a chord. I'm finding it interesting

Wrayal

My Website (finally! And yes, it uses frames and is evil, but, well, take a look, it's not as evil as you might think )

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-02-2005 05:37

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

TwoD
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 02-02-2005 12:57

I'm sorry about the vaugeness of that sentence, Ini.
I was comparing it to JavaScript and I meant problems/challenges (don't remember the exact word I'd like to use in English) like the first version of the Image Grabber I wrote.

The basics of it are simple, read an url from a text file, grab an image from the url, grab pixeldata from the image and print it back to the file.

Reading a file was as easy as using Active X with JavaScript, nothing to complain about there.
But to be sure that the image was completely loaded before trying to grab pixeldata (since grabImage returns instantly) I had to use the MediaTracker. And the MediaTracker refused to work unless I extended the Applet class. And since I extended Applet I couldn't exend another class.

And the first grabImage method I used worked great when running it as an Applet but not when running it as an application, so I had to change to Toolkit.grabImage instead. Couldn't find any documentation about why it didn't work when in an application but I assume that it had to do with the getContext (think that was its name) which is called by grabImage.

I found no good method for writing strings to a file. This was very annoying since I also write error messages in the file...

It will also take a while for me to get used to how you create objects or collections of objects in Java.
The Javascript way is straight forward and you don't have to think about things like accessing static variables or abstract classes.

Anyway, all of this confused me pretty much when first encountering it, but maybe it's just a question of experience. I bet I'll have a greater understanding of why things are as they are later on, but I still think Java isn't well suited for very simple tasks. (hmm maybe that was the word I was looking for)
Just compare the code size of <script>alert("Hello world")</script> with the same thing in Java!

Ok, that was a bad example, but I guess most are since Java and JavaScript are not really in the same league...

/TwoD

kudos
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2004

posted posted 02-02-2005 13:18

Hi
Hi TwoD. Is this what you are looking for?
http://www.geocities.com/marcoschmidt.geo/java-load-image-toolkit.html

Its been some time since it wrote java applets (it feels kind of old these days? Im I the only one that feels that way?). But it was cool in 1997->2000.
I think the discussion, if java is easier than c/c++ is sort of artificial. It is the programming task that (could be) is hard! Not how many lines you can write a "Hello World" program.
I think it basically two reasons why I use (mainly) c++ before java; c++ have more libs and (this is something that I experienced myself) c++ seems to be more cross-platform than java (I had problems with differences in JVMs).

-kudos

(Edited by kudos on 02-02-2005 13:51)

InI
Maniac (V) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-02-2005 14:10

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

kudos
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2004

posted posted 02-02-2005 15:27

Hi.
When I was saying that java was cool in 1997, i did look at it from an bedroom hacker point of view. Then java applets was a very exiting thing. You had a way to run programs (demos and small games and also an easy way to distribute (hehe..well, show of to friends
In the online-game marked, it seems (strictly my personal view) that applets are losing its game marked to technologies like flash. (And the reason is probably that the java game programmers probally are making more money on j2me applications).

But that java has matured into a serious programming language, that probably will be more widespread for "normal" application than cpp (especially for so-called consulting companies).

hehe..GPU's, yep if java applets was the thing in 1997, then GPUs are the thing in 2000.

-kudos

TwoD
Nervous Wreck (II) Inmate

From: Sweden
Insane since: Aug 2004

posted posted 02-02-2005 15:59

Kudos: I'm not actually displaying the image, all the stuff happens "in the background". All you see when running the application is a small (for now) empty window. The app reads the first row of a textfile every 5th second. If certain words appear there, it performs different things, kinda like when you type something in a command prompt.
For example, if the first row of the file is "Image" the app reads the second row too and expects it to be an image name. If the image is found, it grabs all the pixeldata from the image using pixelGrabber. The data is then compared to a set of "patterns" composed of x ,y (for position) ,red,green,blue (for color) values representing a pixel in a known image.
Each "pattern" has about 5 sets of pixel-values. One set would really be enough since it's highly unlikely that two or more images have the exact same RGB values at the same co-ordinate, but I want to be 100% sure...
When one of these patterns match the image on the URL, the app writes the name of the pattern back to the file with a preceding line: "Image Found"

The app can also update these patterns at runtime if you write "Update Patterns" followed by the sets of values in the file, this is so you can look for new types of images without having to recompile the app.

Not bad for my first encounter with Java if I may say so myself

I have a javascript which is designed to communicate with the app using the textfile. So as soon as the javascript wants info about an image it simply "posts" the URL to the image in the file and waits for a relpy. Had to do it this way since there is no direct link between your browser and a Java application. And Java Applets don't have permission to load images from anywhere.

I did this to see if I could implement a type of pattern recognition in Javascript, but I ended up doing it in Java instead which was way faster and it handles images... Still, I wanted to use JS for all the other things around the recognition process, so that's when the textfile got required...

Way off topic lol.

/TwoD

Zyler
Obsessive-Compulsive (I) Inmate

From: Your imagination
Insane since: Feb 2005

posted posted 02-02-2005 17:12

Hey Wrayal,

Although I'm not a JS programmer I had a similar problem when I was programming my own webserver, it was fine retrieving files that were plain text/ASCII but when it started messing around with binary/hex files, like images, it went all buggered.

Thanks to Wrayal's help I found it was stopping after 0x00

I managed to fix the problem by reading it Hex Character by Hex character and then sending the data. This worked but was a bit long winded, I managed to cut it down.

I'm mainly a VB programmer so I don't know whether there's a function you can use to do that in JS, but meh, just my two cents worth.

"Why fight for a piece of land? I fight only for love" - Andy Esser, 2005

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 02-02-2005 20:59

Hey Zyler, fancy seeing you here - glad you got internet back!!
Poi: you might know zyler from a couple of posts from javascript-games. Seeing as this whole thread is way off topic as it is, i have no qualms about adding in a hello .

However, zyler, if you take a look through some of the other posts, you will see unfortunately we have no knowledge of such a function. hence the method I had to implement in order to get my raytracer to output bitmaps. Oh well.

Hope you're going to participate here, everybody is welcome as long as they're a bit off their rocker

Wrayal

My Website (finally! And yes, it uses frames and is evil, but, well, take a look, it's not as evil as you might think )

Zyler
Obsessive-Compulsive (I) Inmate

From: Your imagination
Insane since: Feb 2005

posted posted 02-03-2005 15:46

Even if i'm a VB programmer?

O btw, how did JSG get banned at school _my bad_

Also, I don't have internet back, I'm using school computers. Howver, school have started being very cool, the IT tech's have set up a stand-alone computer for me to test Bluefire on a SP2 machine. I just need someone to Wine it cos Knoppix complained when I tried - yea beave I have the v3.7 of Knoppix finally a decent distro.

Me and the IT Tech's at school want to convince the powers at be to let us install Core 3 on the school comps and run a Linux server but they're not having any of it.

See ya round

"Your imagination is the limit, unless of course, you have a limited mind" - Andy Esser, 2005

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 02-03-2005 21:55

Zyler, zyler, that name rings a bell. Didn't you wrote some post on JSG about collision ?
Anyway welcome in the Asylum. Have a nice stay.
Regarding the ban of JSG at your school, a little bird told me that a certain teacher posted some messages there to tell he did not appreciate that a student spend some time on this site.

Zyler
Obsessive-Compulsive (I) Inmate

From: Your imagination
Insane since: Feb 2005

posted posted 02-07-2005 16:56

Well I believe....that a teacher saw me on JSG and moaned to the school, blah blah.

Something along those lines.

CAn't remember, it was a while ago.

But I've posted on here before, a long time ago but I think it was under a different name. I recognise you Poi, Wrayal won't stop talking about you.

"Your imagination is the limit, unless of course, you have a limited mind" - Andy Esser, 2005

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 02-07-2005 18:33

rofl - take that away now - I'd never idolise anyone
zyler: yeah, it was under zyler7952 as a quick search revealed. BTW, I saw bluefire. Looking good, though I'd imagine the source might reveal some nasties?

wrayal

My Website (finally! And yes, it uses frames and is evil, but, well, take a look, it's not as evil as you might think )

Zyler
Obsessive-Compulsive (I) Inmate

From: Your imagination
Insane since: Feb 2005

posted posted 02-08-2005 10:20

I did try emailing it to school but Mail Marshal blocked .zip's so I couldn't send it to the people I wanted. Did Luke bring it in? I asked him to.

It's kinda buggy at the moment, unless you have a relative path and it's in the Data file it won't find it. So if you link to an image at C:\images\test.jpg then it'll look in the data folder for that. It's iffy for me to try and fix. But BlueFire's not my priority at the moment, I've got a huge job for my dad, as he's planning on buying two more shops, I've gotta make a centralised Point of Sale and Billing system for him.

All possible but he's planning on having these shops within 2 months which might be pushing it slightly.

Give me a call sometime Wrayal.

"Your imagination is the limit, unless of course, you have a limited mind" - Andy Esser, 2005

« BackwardsOnwards »

Show Forum Drop Down Menu