473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Possibly strange question regarding VB.NET and CGI

Nak
Hi there,

Im currently developing a web site using PHP. Unfortunately due to
limitations with my web server I am having to use XML as a method of data
persitance, this doesn't really bother me as I prefer XML anyway. I'm not
using ASP.NET for design reasons at the moment.

At the moment I am fighting a design battle in relation to file writing
and various locking methods which all appear to be very unreliable. That's
why I am looking into CGI. Now apparently any application can use CGI as
long as it implements a specific interface (though what this is I haven't
quite worked out yet). So I'm just wondering if it is at all possible to
use VB.NET with CGI?

Writing some code to perform XML work with VB.NET will be a piece of
cake obviously and probably the main reason why I should be using ASP.NET
anyway, but for now I am looking into alternatives. Has anyone known this
to be done? I've seen examples of it one in legacy VB via stdio stream
handling, so it must be possible with VB.NET right?

Anyway, any thoughts on this would be greatly appreciated. Thanks loads
in advance!

Nick.
Nov 21 '05 #1
7 1775
On 2004-12-18, Nak <a@a.com> wrote:
Hi there,

Im currently developing a web site using PHP. Unfortunately due to
limitations with my web server I am having to use XML as a method of data
persitance, this doesn't really bother me as I prefer XML anyway. I'm not
using ASP.NET for design reasons at the moment.

At the moment I am fighting a design battle in relation to file writing
and various locking methods which all appear to be very unreliable. That's
why I am looking into CGI. Now apparently any application can use CGI as
long as it implements a specific interface (though what this is I haven't
quite worked out yet). So I'm just wondering if it is at all possible to
use VB.NET with CGI?

Writing some code to perform XML work with VB.NET will be a piece of
cake obviously and probably the main reason why I should be using ASP.NET
anyway, but for now I am looking into alternatives. Has anyone known this
to be done? I've seen examples of it one in legacy VB via stdio stream
handling, so it must be possible with VB.NET right?

Anyway, any thoughts on this would be greatly appreciated. Thanks loads
in advance!

Nick.


Yes it's possible. Basically, you would just create your CGI
application as a Console app. I won't go into the details of CGI here -
but essentially, all a language has to be able to do is read environment
variables and handle stdin and stdout. So, your good here :) The place
where you may have difficulty (at least I did when I played with this
year or so ago) is getting the permissions right so that your
application will run.

--
Tom Shelton [MVP]
Nov 21 '05 #2
Nick,

When you have this Javascript you are in my opinion be halfway.
The XML file I use is a true XML dataset

\\\
var fotosXML = new ActiveXObject("Msxml2.DOMDocument");
xmlinlopen(fotosXML, 'fotos');
function xmlinlopen(object, bestand){
object.async = false;
object.resolveExternals = false;
object.load(bestand + ".xml");
xmlinlopena(object);}
//in my opinion should this beneath be there accoording the documentation,
however
//I think that it does nothing (this is not a copied script by the way but
own made)
function xmlinlopena(object) {
if (object.readyState < 3 ) window.setTimeout('xmlinlopena(object)',100);}
///

Than when you have to use it, you can look at MSDN for "selectNodes"

The rest of the code I have made is so generic that it is senseless to show
to you.
"inlopen" is something as "load" and bestand is "file", I did not change it
to prevent typing errors.

I hope this helps?

Cor

"Nak" <a@a.com>

Im currently developing a web site using PHP. Unfortunately due to
limitations with my web server I am having to use XML as a method of data
persitance, this doesn't really bother me as I prefer XML anyway. I'm not
using ASP.NET for design reasons at the moment.

At the moment I am fighting a design battle in relation to file writing
and various locking methods which all appear to be very unreliable.
That's why I am looking into CGI. Now apparently any application can use
CGI as long as it implements a specific interface (though what this is I
haven't quite worked out yet). So I'm just wondering if it is at all
possible to use VB.NET with CGI?

Writing some code to perform XML work with VB.NET will be a piece of
cake obviously and probably the main reason why I should be using ASP.NET
anyway, but for now I am looking into alternatives. Has anyone known this
to be done? I've seen examples of it one in legacy VB via stdio stream
handling, so it must be possible with VB.NET right?

Anyway, any thoughts on this would be greatly appreciated. Thanks
loads in advance!

Nick.

Nov 21 '05 #3
Nak
Hi Cor,
When you have this Javascript you are in my opinion be halfway.
The XML file I use is a true XML dataset


Aaah, I think I may have not explained my problem properly. Handling
XML in PHP is very simple, I like it, much less code than most languages to
be honest with you, I even have XPath navigation.

My problem is 2 clients accessing the PHP script at the same time, this
could cause grief with file access causing a violation or only 1 change to
be made. I'm using XML for my hit and download counters.

That's why I would like to make a VB.NET CGI app that can run
asynchronously and que up write requests. I'm hoping this can be achieved
although I may need to use C.

Thanks for the JAVA code though, I'll keep a snipette of that, quite
handy.

Nick.
Nov 21 '05 #4
Nak
Hi Tom,
Yes it's possible. Basically, you would just create your CGI
application as a Console app. I won't go into the details of CGI here -
but essentially, all a language has to be able to do is read environment
variables and handle stdin and stdout. So, your good here :) The place
where you may have difficulty (at least I did when I played with this
year or so ago) is getting the permissions right so that your
application will run.


Aah, thats good to know, although the last bit worries me. My website
is hosted by a 3rd party so I doubt I can get them to apply permissions like
that, although I *might* be wrong. Thanks for the input at least I have a
solid yes/no answer now :-) Cheers.

Nick.
Nov 21 '05 #5
Nak
Hi,

Just incase anyone else wants to use VB.NET to create a CGI binary
executable, you can use the following PHP class to run it,

<?php

class application
{
var $filename;

function application($ifilename)
{
$this->filename = "<replace this for your CGI bin path>" . $ifilename;
}

function execute($iarguments)
{
$cmd = $this->filename;
$outputfile = tempnam("<replace this for your temp path>", 'appout');
$cmdline = "cmd /C " . $cmd . " " . $iarguments . " > " . $outputfile;
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmdline, 0, true);
readfile($outputfile);
unlink($outputfile);
}

}

?>

Then to call it,

<?php

// Include the PHP script with the application class in here
$app = new application("helloworld.exe");
$app->execute("<put any arguments in here>");

?>

VB.NET doesn't seem that bad for CGI applications either, especially
with the benefit of the .NET Frameworks XML functions you can create far
more powerful objects than you could in PHP. Anyway, I hope this helps
someone else because it took me fekking ages working this out!

Nick.
Nov 21 '05 #6
Nick

I cannot use it at the moment, however you never know tomorrow

Did I ever told you that my VBNet snippet directory has the name Nak.
However this one I leave in this newsgroup, I can find it probably in Google
using Nak and PHP.

:-)

Thanks,

Cor

"Nak" <a@a.com>

Just incase anyone else wants to use VB.NET to create a CGI binary
executable, you can use the following PHP class to run it,

<?php

class application
{
var $filename;

function application($ifilename)
{
$this->filename = "<replace this for your CGI bin path>" . $ifilename;
}

function execute($iarguments)
{
$cmd = $this->filename;
$outputfile = tempnam("<replace this for your temp path>", 'appout');
$cmdline = "cmd /C " . $cmd . " " . $iarguments . " > " . $outputfile;
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmdline, 0, true);
readfile($outputfile);
unlink($outputfile);
}

}

?>

Then to call it,

<?php

// Include the PHP script with the application class in here
$app = new application("helloworld.exe");
$app->execute("<put any arguments in here>");

?>

VB.NET doesn't seem that bad for CGI applications either, especially
with the benefit of the .NET Frameworks XML functions you can create far
more powerful objects than you could in PHP. Anyway, I hope this helps
someone else because it took me fekking ages working this out!

Nick.

Nov 21 '05 #7
Nak
Hi Cor,
I cannot use it at the moment, however you never know tomorrow
LOL, I hate web development, hence my attempt to use VB.NET as much as
possible.
Did I ever told you that my VBNet snippet directory has the name Nak.
However this one I leave in this newsgroup, I can find it probably in
Google using Nak and PHP.


Haha, yeah, not much call for this kind of thing, but it took me so long
to work out that I had to share it. I'll have a web site set up soon
hopefully with loads of other crap code snipettes ;-)

Nick.
Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
3
by: Sebastian C. | last post by:
Hello everybody Since I upgraded my Office XP Professional to SP3 I got strange behaviour. Pieces of code which works for 3 years now are suddenly stop to work properly. I have Office XP...
6
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
4
by: Gav | last post by:
Hi all, I'm having this strange problem where, in a web app, I have 2 different links to a different form. One is just a straight forward link the other is a bit more complicated because it gets...
1
by: | last post by:
Hello Guys, I have a strange question regarding session. When I refresh a page, would the session objects be retained or discarded? What about the values in the hidden fields and text boxes...
5
by: soeren | last post by:
Hello, two days ago I stumbled across a very strange problem that came up when we were printing tiny double numbers as strings and trying to read them on another place. This is part of an object...
49
by: iesvs | last post by:
I got a double ** (double **coef). And gcc accept the syntax coef, it works. I don't understand why. For me coef is not correct because it's a double ** and not type. If someone could explain me...
1
by: Victor | last post by:
Hi guys, I have a very strange problem with scriptmanager here. I want to load a js (which is embed in the project) but everytime i try to load that, it gives me error like Specified argument was...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.