Re: [sqlite] Writing double into a socket file

2008-06-11 Thread Neville Franks
Hi John, Re. Javascript being slow you may be interested in EJScript which is an Embedded Javascript implementation with a Native Code Compiler. See: http://www.ejscript.org/products/ejs/doc/guide/ejs/language/overview.html and http://www.ejscript.org I have not (yet) used it so can't comment

Re: [sqlite] Writing double into a socket file

2008-06-11 Thread John Stanton
Mutliple threads in one process let me perform load balancing and share the Sqlite cache. Cache sharing can be a big win. Alex Katebi wrote: > Hi John, > > Yes the negative with the single thread is single CPU utilization. Then > again you can run 4 or more servers for a quad CPU. For

Re: [sqlite] Writing double into a socket file

2008-06-11 Thread John Stanton
We make a JSON object of the selected rows and send it to a client in one network access to minimize network traffic. Suitable for clients with Javascript. Packaging of the object can suit the client. Limits are set to avoid choking the client. Alex Katebi wrote: > Dennis, > > After your

Re: [sqlite] Writing double into a socket file

2008-06-11 Thread Alex Katebi
Hi John, Yes the negative with the single thread is single CPU utilization. Then again you can run 4 or more servers for a quad CPU. For security I could either use SSH Port Forwarding or use a MD5 implementation in my client/server code. Thanks, -Alex On Tue, Jun 10, 2008 at 11:25 PM,

Re: [sqlite] Writing double into a socket file

2008-06-11 Thread Alex Katebi
Dennis, After your explanation the prefixing doesn't look so bad. The client might do lots of queries before it exits. But I can drop that temp table when client does finalize. I have to have a state machine for clients so they don't crash the server by misusing the API anyways. Thank

Re: [sqlite] Writing double into a socket file

2008-06-11 Thread Dennis Cote
Alex Katebi wrote: > However there are two things I don't like about this method. One is that I > need to parse the prepared statments and prefix queries, and replace the > table name with the temp table name in the surrogate query. Two is that if > the client does lots of queries before

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread John Stanton
Alex, Thankyou for the comments. I use non-blocking fd's also but implement multiple threads to take advantage of multiple processor servers. Since threads carry quite a bit of baggage your single thread approach would probably be superior on a single processor machine. It has been

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
John, My server uses epoll( ) and runs non-blocking in a single thread. I did some google and found out that people who need a very fast server that is highly scalable are using this model. non-blocking seems to be more complicated at first glance but it actually makes the server design much

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread John Stanton
We use an application server I wrote which handles HTTP, serves file and has embedded Sqlite for the RPCs. The RPC can deliver its result either in XML for widely distributed applications or as JSON if it is responding to a WWW browser in AJAX mode. We keep a local library of SQL RPCs so that

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
Dennis, My servers main connection itself is in :memory:, but your suggestion will still work. However there are two things I don't like about this method. One is that I need to parse the prepared statments and prefix queries, and replace the table name with the temp table name in the

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread John Elrick
Alex Katebi wrote: > Yes I need to do it as 8 byte buffer. Convert the endianess to the network > then back to host for 8 byte integer. > I think XML is great for command validation and CLI auto typing, help etc. > Besides parsing issue, XML can not handle binary data directly. > As John

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Hakki Dogusan
Hi, Alex Katebi wrote: > I am trying to implement remote procedure calls (RPC) for SQLite API to be > used in my application. > In particular sqlite3_column_double( ) returns a floating point double. > How can I write this double value into a TCP socket? > I have tried writing 8 bytes as integer

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread John Stanton
Alex, the whole point of using XML is to avoid using binary data in an RPC situation and to tag the data and thus make extensions less traumatic. The radix change overhead is insignificant compared to the network cost and the bonus is complete freedom from endian dilemmas. The biggest

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
D. Hipp, I have since identified and fixed my problem, thanks to our user group! A lot of the networking gear like IP routers use big-endian machines since this is the format used by the network protocol control messages. PowerPC is an example. Thanks, -Alex On Mon, Jun 9, 2008 at

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
Arjen, Thanks! On Tue, Jun 10, 2008 at 1:39 PM, Arjen Markus <[EMAIL PROTECTED]> wrote: > > I am going to guess yes. > > > > On Mon, Jun 9, 2008 at 9:58 PM, Russell Leighton > > <[EMAIL PROTECTED]> > > wrote: > > > > >> > >> Aren' t there aligment and endian issues as well as potential floating

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
Yes I need to do it as 8 byte buffer. Convert the endianess to the network then back to host for 8 byte integer. I think XML is great for command validation and CLI auto typing, help etc. Besides parsing issue, XML can not handle binary data directly. On Tue, Jun 10, 2008 at 12:31 PM, John

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Arjen Markus
> I am going to guess yes. > > On Mon, Jun 9, 2008 at 9:58 PM, Russell Leighton > <[EMAIL PROTECTED]> > wrote: > >> >> Aren' t there aligment and endian issues as well as potential floating >> point representations between platforms? >> As most computers nowadays use the IEEE standard to

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
I am going to guess yes. On Mon, Jun 9, 2008 at 9:58 PM, Russell Leighton <[EMAIL PROTECTED]> wrote: > > On Jun 9, 2008, at 8:52 PM, Igor Tandetnik wrote: > > > "Alex Katebi" <[EMAIL PROTECTED]> > > wrote in message > > news:[EMAIL PROTECTED]<[EMAIL PROTECTED]> > >> I am trying to implement

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Peter A. Friend
Alex Katebi wrote: > Peter, >I am using my own implementation. I found RPC and others too complicated > to use and it did not give me enough control on the transport layer. I need > my socket to be non-blocking and I am using epoll( ) which is very > efficient. > XDR is a separate

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
Igor, You are right. The answer is to use 8 byte buffer and don't forget to account for the endianess. I had a bug in my code. On Mon, Jun 9, 2008 at 8:52 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > "Alex Katebi" <[EMAIL PROTECTED]> > wrote in message > news:[EMAIL PROTECTED]<[EMAIL

Re: [sqlite] Writing double into a socket file

2008-06-10 Thread Alex Katebi
Peter, I am using my own implementation. I found RPC and others too complicated to use and it did not give me enough control on the transport layer. I need my socket to be non-blocking and I am using epoll( ) which is very efficient. Thanks! -Alex On Mon, Jun 9, 2008 at 10:53 PM, Peter A.

Re: [sqlite] Writing double into a socket file

2008-06-09 Thread Peter A. Friend
Alex Katebi wrote: > I am trying to implement remote procedure calls (RPC) for SQLite API to be > used in my application. > In particular sqlite3_column_double( ) returns a floating point double. > How can I write this double value into a TCP socket? > I have tried writing 8 bytes as integer

Re: [sqlite] Writing double into a socket file

2008-06-09 Thread D. Richard Hipp
On Jun 9, 2008, at 9:58 PM, Russell Leighton wrote: > > On Jun 9, 2008, at 8:52 PM, Igor Tandetnik wrote: > >> "Alex Katebi" <[EMAIL PROTECTED]> >> wrote in message >> news:[EMAIL PROTECTED] >>> I am trying to implement remote procedure calls (RPC) for SQLite API >>> to be used in my

Re: [sqlite] Writing double into a socket file

2008-06-09 Thread Teg
Hello Alex, How about a text representation? CSV over the network using the HTTP protocol or something like that. C Monday, June 9, 2008, 8:40:39 PM, you wrote: AK> I am trying to implement remote procedure calls (RPC) for SQLite API to be AK> used in my application. AK> In particular

Re: [sqlite] Writing double into a socket file

2008-06-09 Thread Russell Leighton
On Jun 9, 2008, at 8:52 PM, Igor Tandetnik wrote: > "Alex Katebi" <[EMAIL PROTECTED]> > wrote in message > news:[EMAIL PROTECTED] >> I am trying to implement remote procedure calls (RPC) for SQLite API >> to be used in my application. >> In particular sqlite3_column_double( ) returns a floating

Re: [sqlite] Writing double into a socket file

2008-06-09 Thread Igor Tandetnik
"Alex Katebi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am trying to implement remote procedure calls (RPC) for SQLite API > to be used in my application. > In particular sqlite3_column_double( ) returns a floating point > double. How can I write this double value into a TCP

[sqlite] Writing double into a socket file

2008-06-09 Thread Alex Katebi
I am trying to implement remote procedure calls (RPC) for SQLite API to be used in my application. In particular sqlite3_column_double( ) returns a floating point double. How can I write this double value into a TCP socket? I have tried writing 8 bytes as integer values but the received valued at