No data received error in Chrome In Ruby application - mysql

I am new in Ruby. I am using Sinatra as framework. I am working on a project that involves a few mysql queries taking reasonable amount of time. Actually there is a front end where user can input the parameters and press view button in response to which the query fires and at the completion of them view is populated.
But the problem is that due to reasonable amount of time taken by the query it is showing "no data received" in chrome though the query is executing in the backend. I don't know how to fix that, I have tried many ways to optimise the query but actually the data is much so I don't think any further optimisation possible. Thanks in advance.

Related

NodeJS Emit when a row is added to database table

I am quite new to NodeJS but I've written a few apps (like a chat, real time page updater etc) And I've used mysql to read from my database and emit() information to my webpage, but how can I have nodeJS watch a database table and emit() whenever a row is added?
I have no idea where to start and google didn't produce much results. However there must be an include I can require() that will watch the database in someway.
The answer really isn't a nodejs question, but a mysql question. If mysql itself can tell you ( via an event or log ) that a row was added, nodejs could read and consume that data. Unfortunately, that doesn't seem to be possible, based on this answer. The answer suggests that the only thing you can do with mysql is to poll for new rows.
IF you're in control of inserting the data rows from nodejs itself, there shouldn't be any problem emitting those events after you get the confirmation it wrote, but I do not have enough information on your project to know what constraints you have.
UPDATE: Nice little npm package https://www.npmjs.com/package/live-sql seems to solve your problem I hope

Joomla SQL Query Debug Method

I'm planning to debug Joomla site by entering each query and it's query execution time to a database table. I have more than 10 models which have different queries. I'm pretty sure that all the queries go through a single place/class before executing but I have no idea where/what the place/class is.
My issue is, Is there a central place I can edit to log the database query and the execution time of a SQL query? I mean like edit a core file just to log every SQL query & it's execution time.
How can I get it done?
Have you considered using Joomla's built-in System Debug?
Rather than trying to do this programmatically with brute force, it seems it would be far easier and less intrusive to use a proper SQL benchmarking tool such as MySQL Benchmark Suite Another possible non-brute-force option might be Toad World
If you wanted to stay away from third-party tools, a slow query log might be the place to start.
If you really want to do it via joomla (hack):
Goto joomla's database driver, for 3.3 that is: libraries/joomla/database/driver.php
Remove the setDebug function (in case some component set it to 0)
At start of file change $debug = false; into $this->debug = true;
Now, every query gets logged together with profile information.

Couchbase clarification

I am running into a problem using couchbase, but it may be because I don't quite understand how couchbase works. I have created a simple console .NET app to do some simple stores and gets on data. The problem I am having is when I close the app, then restart it and try to get data I previously stored, it will not retrieve any data. But, if I store and then get before closing the app, it returns data. Can anyone offer me clarification? Thanks!
Found my problem... I was not disposing of the client properly. I had the client as a member of another class, which is what I had in my using statement, so I guess that does not properly dispose.

Blackberry WebWorks HTML5 Database Issues

I've been having lots of problems getting my application to work using an sqlite database. Everything works just fine in ripple (I presume this is because it's just using chrome's sqlite implementation). However, once I run my app on a simulator (Curve 9300, OS 6) the problems begin. I've gotten to where the app can run, create a database, and insert rows, so I know that my actual queries are fine.
My application has a javascript file that has wrappers for working with the database. This javascript file is sourced in both the listener, and the page that is the core of the application. The problem is as follows:
Install the application. The listener starts running.
Send a text message from one simulator to another. The message is saved successfully (I can verify this because my banner indicator count increases, and the number is based of off a query)
Continue sending texts, and the banner indicator will increase.
Open the application, and read all of the messages. At this point, the javascript file is loaded twice, so I have two db objects pointing to the same database.
Close the application (listener is still running)
The next text message received causes a Runtime Exception, with no further details provided.
I looked at the stack trace, and it just says that the exception took place in the callback of the sms listener. This is obvious, as that's where the queries happen. Does anyone have any idea why opening a second connection to the db causes the exception? As far I understand, the db is only locked during a transaction. There are definitely no transactions running, other than the one trying to insert the new row. Although I'm new to javascript, I'm quite sure that no variables are being shared as the javascript file is loaded in two different pages. Any ideas would be greatly appreciated.
Well, I couldn't find a solution. I don't think the blackberry sqlite implementation can handle two concurrent connections. Instead, my listener now saves incoming data to a file. The file is read in when the main application opens, and all necessary data is saved to the db then. Afterwards, the file is deleted and the application performs queries without problem. I hope this helps anyone dealing with a similar issue.

Allow from a webpage and get immediate response

I am new in J2EE. Can anyone tell me:
What is one way to allow from a web page to start a long running server process but get an immediate response back?
Why are HTML checkboxes sometimes problematic for managing true/false values via form submissions?
Thanks in advance
1) It's called comet. This takes considerable resources because of the number of connections the server must keep open. This also sticks users to one server.
2) Programmer error.