I'm no PHP expert, so forgive my ignorance.

If you test in a basic manner, rather than by using AJAX, what happens? By using your browser's inspector, you can see that doing:

$.ajax({
  url: "my_service",
  data: {f_date1: "yesterday", t_date1: "today"},
  success: function(msg) {
    console.debug("yay")
  }
});

will result in a GET request like this:

my_service?f_date1=yesterday&t_date1=today

If you paste that into a browser's URL bar (or better yet use something like HTTPie or Postman), you can make sure that you can access the query string properly. Once you know that works, and you know that jQuery's .ajax method does the same thing, you'll have a much better chance at solving your problem.

Read More

What probably happened is that your customer created an order, then while the above code was running they created another. As you're using max to work out which number to allocate and you've not yet saved the first record, both have the same id. Without knowing your transaction isolation level I can't say why your sequence looked correct.

Rule of thumb, for automatically generating numbers, use a sequence (known as auto increment in MySQL). Also, if your ids are meant to be unique, consider making that column a primary key; if not use a unique index.

Read More

It sounds like you aren't working to the strengths of the database. MySQL, unlike Oracle, PostgreSQL etc doesn't support arrays, and searching on text is unlikely to be optimal.

I don't know the context of the original query, so it's difficult to suggest a solution, but it could be something like this:

 Tags:
 - id: 1
   name: Programming
 - id: 2
   name: Databases
 - id: 3
   name: Web Development
 - id: 4
   name: Floristry
 - id: 5
   name: Kids TV

 Posts:
 - id: 1
   name: Making pages faster
   tags: [1, 2, 3]
 - id: 2
   name: CBeebies top ten
   tags: [5]

So, to find all posts about Web Development you'd look through all of the posts, filtering on the tags field for the inclusion of 5. In PostgreSQL, using the array type, we'd do something like this:

select * from posts;
┌────┬──────────────┬─────────┐
│ id │     name     │  tags   │
├────┼──────────────┼─────────┤
│  1 │ CBeebies     │ {5}     │
│  2 │ Fast Website │ {1,2,4} │
│  3 │ Programming  │ {4,6}   │
└────┴──────────────┴─────────┘
(3 rows)

Time: 0.282 ms
peter=# select * from posts where tags @> '{5}';
┌────┬──────────┬──────┐
│ id │   name   │ tags │
├────┼──────────┼──────┤
│  1 │ CBeebies │ {5}  │
└────┴──────────┴──────┘
(1 row)

That's fine, but that doesn't give you the benefits of using a relational database. What if someone deletes the Kids TV tag from the tags table? Well, our arrays (or strings full of comma separated values) will point to nothing. That's precisely what we ...

Read More

Comments
nice explanation, thanks for sharing!

Remember that UNION (and its cousins INTERSECT and EXCEPT) essentially require each of the provided queries to be run separately and the results collated. In this example (using PostgreSQL, but the same applies in MySQL), we can see exactly what's happening.

I have a small table with some users and their favourite colours:

peter=# select * from users;
┌────┬─────────┬──────────────────┐
│ id │  name   │ favourite_colour │
├────┼─────────┼──────────────────┤
│  3 │ Francis │ blue             │
│  4 │ Toby    │ blue             │
│  1 │ Joey    │ red              │
│  2 │ Dwayne  │ purple           │
└────┴─────────┴──────────────────┘
(4 rows)

Time: 0.400 ms

Now, let's say we want all users with a favourite colour of blue or red; if we use a UNION the following happens:

peter=# explain select name from users where favourite_colour = 'blue' union select name from users where favourite_colour = 'red' ;
┌───────────────────────────────────────────────────────────────────────────┐
│                                QUERY PLAN                                 │
├───────────────────────────────────────────────────────────────────────────┤
│ HashAggregate  (cost=35.33..35.39 rows=6 width=58)                        │
│   Group Key: users.name                                                   │
│   ->  Append  (cost=0.00..35.31 rows=6 width=58)                          │
│         ->  Seq Scan on users  (cost=0.00..17.62 rows=3 width=58)         │
│               Filter: ((favourite_colour)::text = 'blue'::text)           │
│         ->  Seq Scan on users users_1  (cost=0.00..17.62 rows=3 width=58) │
│               Filter: ((favourite_colour)::text = 'red'::text)            │
└───────────────────────────────────────────────────────────────────────────┘
(7 rows)

Time: 3.868 ms

As you can see, the query plan involves

  • two sequental scans (Seq Scan) that each perform a Filter,
  • an Append operation which is actually performing the UNION,
  • plus Group Key and HashAggregate steps, from which the resulting recordset can be ...

Read More

Re:

[QUOTE=Jx_Man;584701]i already installed ruby and in ruby directory contain fxri and Scite.
well, i m do small ex in fxri...
what is Scite for? what different about fxri and Scite? why i can't compile code in Scite?
i find compile in tools of Scite but it was disable.
example i write code in Scite :
[code=ruby]5.times { print "Odelay!" }[/code]
when i tried to compiled i can't do this perform. there are compile, Build,Go etc in tools option that i cannot perform to click, it was disable. i m confused.
But this code running great in fxri. so why i can't do compiled in Scite?
please help

Thank you.[/QUOTE]

Did your source file definitely have a .rb extension? Did anything at all appear in the output window?

Read More

Comments
Thank You For Directing friend :)

[QUOTE=dodol;397955]How to fastening inserting data on mysql???
I have 5000 record in excels. And I want to insert all record to mysql.. and it take time abaout 6 six minutes.. How to fastening become under 20 second to insert all 5000 records??

Peace

DODOl[/QUOTE]

Also you may want to temporarily stop using indexes on the tables in question

Read More

Comments
good suggestion

I didn't see this thread sooner and it may now be too late, but 1 database is the way to go; easier to manage, easier to optimise, easier to backup, faster, requires less disk space.. 1 database is better in every way.

Don't be worried about the number of rows in a database; they are designed to cope with large volumes of data.

Read More

Comments
good

[QUOTE=iamthwee;352204]Ok I'm getting there.

I have managed to get my printer to work, and I have got g++ and gcc working! Yay.

Before I try and get my graphics card working,how do I burn cds?:'(

Thanx[/QUOTE]

As jbennet says nautilus is fine for burning files. For burning ISOs and other stuff:

[code]sudo apt-get install gnomebaker[/code]

You should already have Serpentine installed (for burning audio cds)

If gnomebaker doesn't float your boat you may wanna try K3B (Its KDE so apt will have to install quite a few other libraries on your machine to use it, but its a bit fancier than gnomebaker).

If you're on Feisty and have an nVidia or ATi card there's a utility to install the restricted drivers automagically. If you're on something older than Feisty I'd recommend you upgrade/reinstall - its worth it!

Read More

Comments
Thanx(thwee)

[QUOTE=EnderX;250308]I'm currently trying to create a program in delphi to call up a webpage; the page is written in php and records some data about its contents for record-keeping in my system. I'd like to be able to write the program so that when it opens it does the following:

  1. Opens the webpage. I can do this, I found the code to open an application via ShellApi some time ago and it works just as well for a web url as for a file path.

  2. Closes the webpage. I only really need to run the page once to do the job, and if the program can close the page afterwards it should. Again, I found some code on how to do this, so that's not really a problem, although I may need to build in a delay; as currently written, it doesn't like to close the page. This isn't critical though, it's merely my own personal aesthetics.

  3. Closes the program itself. I know you can close a program with a single form (all this one has) by using the form.close procedure, except that this doesn't work when the statement is included in the form.formcreate procedure, and that's where I'm hoping to call it from.

Is it even possible to code my program so it fits this set of instructions, or should I start looking for a workaround?

Thanks in advance,
-EnderX[/QUOTE]

[code]
application.terminate;
[/code]

Read More

Comments
Quick response, accurate information. Quite nice.

[QUOTE=msvinaykumar]Hi,
How to convert excel to html in shell prompt
Is there any unix command to do this ? so that I can use that in excel
Vinay[/QUOTE]

install gnumeric

then use ssconvert

should be something along the lines of:

ssconvert -I Gnumeric_Excel:excel -T Gnumeric_html:html40 file.xls
file.html

Read More

Comments
excellent, i hadn't heard of this before