Hi,
This is my array
Array
(
[0] => Array
(
[sample_id] => 3
[time] => 2010-05-30 21:11:47
)
[1] => Array
(
[sample_id] => 2
[time] => 2010-05-30 21:11:47
)
[2] => Array
(
[sample_id] => 1
[time] => 2010-05-30 21:11:47
)
)
And I want to get all the sample_ids in one array. can someone please help ?
Can this be done without for loops (because arrays are very large).
I have different php output in jQuery-based tabs. This output is formed from database and it consists of several <div>'s. Every time I click any tab it sends AJAX request to the php script which performs "SELECT" request and gives result back as response to AJAX request from the tab.
$(document).ready(function() {
$('ul.tabs li').css('cursor', 'pointer');
$('ul.tabs.tabs1 li').click(function(){
var thisClass = this.className.slice(0,2);
$('div.t1').hide();
$('div.t2').hide();
$('div.t3').hide();
$('div.t4').hide();
$('div.' + thisClass).show('fast');
$('ul.tabs.tabs1 li').removeClass('tab-current');
$(this).addClass('tab-current');
var data = thisClass;
$.ajax({
type:"GET",
url:"handler.php?name="+data,
data:data,
success:function(html) {
$('div.' + thisClass).html(html);
}
});
return false;
});
});
//Server-side PHP script:
<?php
$name = $_GET[name];
switch ($name) {
case "t1":
query_and_output_1();
case "t2":
query_and_output_2();
// etc...
}
?>
The problem is that the first tab contains output that must be in second and third ones as well, the second also contains the third tab output.
Sorry for such a rubbishy question, I used to work with server side and unfortunately I'm not familiar with DOM and jQuery yet.
Thanks.
I'm an experienced programmer, but relatively new to SQL. We're using Oracle 10 and 11. I have a system in place using SQL that combines actual rows with virtual rows (e.g. "SELECT 1 from DUAL") doing unions and intersects as needed, which all seems to work.
My problem is that I need to combine this system which is expecting rows of data, with new data that will have the data in (let's say for simplification) comma delimited strings.
So I think what I need is a way to convert a string like: "5,6,7,8" into 4 rows with one column each, with "5" in the first row, "6" in the second, etc. In other languages, I'd do a "Split" with comma as the delimiter. Of course, the data won't always have 4 entries.
There's a second question, but I'll ask it separately. But I suspect it will simplify things, if possible, if the solution to the above could be used as a table in another SQL statement (i.e., to work with my existing system). Thanks for any help.
I have a directory /tmp/dir with two types of file names
/tmp/dir/abc-something-server.log
/tmp/dir/xyz-something-server.log
..
..
and
/tmp/dir/something-client.log
I need append a few lines (these lines are constant) to files end with "client.log"
line 1
line 2
line 3
line 4
append these four lines to files end with "client.log"
and For files end with "server.log"
I needed to append after a keyword say "After-this".
"server.log " file has multiple entries of "After-this" I need to find the first entry of "After-this" and append above said four lines keep the remaining file as it is.
Any help will be great appreciated :) Thanks in advance.
I have just recently started running Linux on my PC and I am trying to start learning OpenGL. I am using the latest version of Eclipse CDT as my IDE, and my system is Ubuntu 10.10, 64 bit version.
The problem I am having is that whenever I try to run a build from within the IDE I get the error message "Launch Failed. Binary Not Found."
Ive done a lot of looking around on the internet but I still cant solve the problem. I know for a fact that the binary is built, it can be run from a terminal window. According to posts I have seen the problem is that Eclipse tries to run a 32 bit binary, but GCC 4.4.5 defaults to 64 bit binaries on a 64 bit system.
Ive seen a lot of information about using the -m32 flag in makefiles, but then I still get the following output in Eclipse:
make all
g++ -o HelloWorld2 main.o
/usr/bin/ld: i386 architecture of input file `main.o' is incompatible with i386:x86-64 output
/usr/bin/ld: final link failed: Invalid operation
collect2: ld returned 1 exit status
make: *** [HelloWorld2] Error 1
What I would like to know is how to either get Eclipse to launch the 64 bit binaries, or have Eclipse correctly compile 32 bit binaries.
Hi,
Through the housekeeping stuff my android application has to do is to read and write some files and sometimes to delete others and create new ones. The files in cause have all "sdcard/" as root. Is it safe if I perform all this task using Java style functions ?
To me it is very handy to do it this way but I've read that not always the java functions can be applied when it comes to files in Android.
We have an XBAP application that fails when opened in Internet Explorer 8 64 bit. We only get a pretty generic error which makes it hard to determine where the error is coming from.
I'm trying to find a way to debug the application with IE 8 64 bit, but I haven't figured out how to do this. I can't set the 64 bit version as the standard browser and overwriting the browser path in the browsers.xml for Visual Studio doesn't work as well. It just gets overwritten as soon as I hit F5 to debug to point to the 32 bit IE.
I have figured out how to start the application from Debug with the 64 bit browser by changing the Debug options from "Start browser with URL" to "Start external program" and setting the command line arguments to point to the bin folder.
Unfortunately then the XBAP is looking for its config.deploy file which doesn't seem to be generated during regular debug. This doesn't happen when using "Start browser with URL" and the application doesn't seem to care for this file then.
Does anybody know why there's a difference between "Start browser with URL" and "Start external program" in the Debug options which might cause this difference in behavior when Debug is started?
Also, does anybody know how to successfully debug an XBAP with a 64-bit browser?
Hi
I have a list of dates for an event in the following format
13/04/2010 10:30:00
13/04/2010 13:30:00
14/04/2010 10:30:00
14/04/2010 13:30:00
15/04/2010 10:30:00
15/04/2010 13:30:00
16/04/2010 10:30:00
17/04/2010 11:00:00
17/04/2010 13:30:00
17/04/2010 15:30:00
How can i have the list be output, so that the date is only displayed once followed by the times for that date, so the above list would look like something like this:
13/04/2010
10:30:00
13:30:00
14/04/2010
10:30:00
13:30:00
15/04/2010
10:30:00
13:30:00
16/04/2010
10:30:00
17/04/2010
11:00:00
13:30:00
15:30:00
Hi all,
Am I better to move a node I sent down form the server or to insert it?
I'm using jQuery (1.4) but would like to know for both jQuery and JS in general. In this case the node is small with only one child. But what if it were a large list?
Hi,
I'm a beginner in java. I want the logic of the small program.
I have two arrays
array = {a1,a2,a3,a4,a5,,,,,,,,,an}
and
array2 = {b1,b2,b3,b4,,,,,,,,,,,bn}
I want string as:
a1b1,a2a3b2b3,a4a5a6b4b5b6,..........an
Please tell me what will be the logic.
When I search on the Internet about JQuery and I got the jquery cheat sheet. At there, I am very confused about how to use the following under which condition. Pls help me.
[attribute|=val]
[attribute*=val]
[attribute~=val]
[attribute$=val]
[attribute=val]
[attribute!=val]
[attribute^=val]
[attribute]
[attribute1=val1] [attribute2=val2]
What are the functions of these special character *, ~, $, !, ^? Thanks very much.
Has anyone an idea, how I can make TValue using a reference to the original data? In my serialization project, I use (as suggested in XML-Serialization) a generic serializer which stores TValues in an internal tree-structure (similar to the MemberMap in the example).
This member-tree should also be used to create a dynamic setup form and manipulate the data.
My idea was to define a property for the Data:
TDataModel <T> = class
{...}
private
FData : TValue;
function GetData : T;
procedure SetData (Value : T);
public
property Data : T read GetData write SetData;
end;
The implementation of the GetData, SetData Methods:
procedure TDataModel <T>.SetData (Value : T);
begin
FData := TValue.From <T> (Value);
end;
procedure TDataModel <T>.GetData : T;
begin
Result := FData.AsType <T>;
end;
Unfortunately, the TValue.From method always makes a copy of the original data. So whenever the application makes changes to the data, the DataModel is not updated and vice versa if I change my DataModel in a dynamic form, the original data is not affected.
Sure I could always use the Data property before and after changing anything, but as I use lot of Rtti inside my DataModel, I do not realy want to do this anytime.
Perhaps someone has a better suggestion?
Hi,
I need to generate a cryptographically secure 64-bit unsigned random integer in Javascript. The first problem is that Javascript only allows 64-bit signed integers, so 9223372036854775808 is the biggest supported integer without going into floating point use I think? To fix this I can use a big number library, no problem.
My Method:
var randNum = SHA256( randBigInt(128, 0) ) % 2^64;
Where SHA256() is a secure hash function and randBigInt() is defined below as a non-crypto PRNG, im giving it a 128bit seed so brute force shouldn't be a problem.
randBigInt(n,s) //return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
Is this a secure method to generate a cryptographically secure 64-bit random int? And importantly does taking the 2^64 mod guarantee 100% I have a 64-bit number?
An abstract example, say this number is prime (it isn't i know), I will use it in the Galois Field [2^p], where p must be 64bits so that every possible 1-63bit number is a field element. In this query, my random int must be larger than any 63-bit number. And Im not sure im correct in taking the 2^64 mod of a 256bit hash output.
Thanks (hope that makes sense)
Hey guys,
I have been working on this code but I can't find out what is wrong.
This program does compile and run but it ends up having a fatal error.
I have a file called myFile.txt, with the following content :
James------ 07.50 Anthony--- 17.00
And here is the code :
int main()
{
int n =2, valueTest=0,count=0;
FILE* file = NULL;
float temp= 00.00f, average= 00.00f, flTen = 10.00f;
float *totalNote = (float*)malloc(n*sizeof(float));
int position = 0;
char selectionNote[5+1], nameBuffer[10+1], noteBuffer[5+1];
file = fopen("c:\\myFile.txt","r");
fseek(file,10,SEEK_SET);
while(valueTest<2)
{
fscanf(file,"%5s",&selectionNote);
temp = atof(selectionNote);
totalNote[position]= temp;
position++;
valeurTest++;
}
for(int counter=0;counter<2;counter++)
{
average += totalNote[counter];
}
printf("The total is : %f \n",average);
rewind(file);
printf("here is the one with less than 10.00 :\n");
while(count<2)
{
fscanf(file,"%10s",&nameBuffer);
fseek(file,10,SEEK_SET);
fscanf(file,"%5s",¬eBuffer);
temp = atof(noteBuffer);
if(temp<flTen)
{
printf("%s who has %f\n",nameBuffer,temp);
}
fseek(file,1,SEEK_SET);
count++;
}
fclose(file);
}
I am pretty new to c and find it more difficult than c# or java. And I woud like to get some suggestions to help me to get better. I think this code could be simplier. Do you think the same ?
Hi,
I have myself a handle to a bitmap, in C++, on Windows:
HBITMAP hBitmap;
On this image I want to do some Image Recognition, pattern analysis, that sort of thing. In my studies at University, I have done this in Matlab, it is quite easy to get at the individual pixels based on their position, but I have no idea how to do this in C++ under Windows - I haven't really been able to understand what I have read so far. I have seen some references to a nice looking Bitmap class that lets you setPixel() and getPixel() and that sort of thing, but I think this is with .net .
How should I go about turning my HBITMAP into something I can play with easily? I need to be able to get at the RGBA information. Are there libraries that allow me to work with the data without having to learn about DCs and BitBlt and that sort of thing?
I've searched through related questions but can't find what I need.
I have a richtextbox control. I need to trigger an event when the vertical scrollbar reaches a certain position (say 90% down to the bottom). I've been playing around with the events for the rich textbox but have yet to find anything.
Any help would be greatly appreciated.
For a project, I have to convert a binary string into (an array of) bytes and write it out to a file in binary.
Say that I have a sentence converted into a code string using a huffman encoding. For example, if the sentence was: "hello" h = 00 e = 01, l = 10, o = 11
Then the string representation would be 0001101011.
How would I convert that into a byte? <-- If that question doesn't make sense it's because I know little about bits/byte bitwise shifting and all that has to do with manipulating 1's and 0's.
I'm new to SQL and the time functions are different than mySQL so I'm having a terrible time finding a good site reference with USEFUL timestamp queries.
I'm not able to locate the correct way of doing this query in SQL:
Id Timestamp
-----------------------------------
1145744 2012-10-10 18:15:11.500
1145743 2012-10-10 18:15:11.313
1145742 2012-10-10 18:15:11.313
1145741 2012-10-10 18:15:11.253
1145740 2012-10-10 18:15:11.190
1145739 2012-10-10 18:15:11.190
1145738 2012-10-10 18:15:11.127
1145737 2012-10-10 18:15:11.067
1145736 2012-10-10 18:15:11.063
1145735 2012-10-10 18:15:10.940
1145734 2012-10-10 18:15:10.817
SELECT * from table WHERE Timestamp ... RANGE
I need the range of 2 timestamps so I can select rows by the following parameters:
second range
minute range
hour range
day range
week range
month range
year range
Is there one function to put in 2 timestamps and get the range? or is this a mix of functions I need?
Any good site references would be greatly appriceated. MSDN site isn't helping me isolate the proper way of doing this. I've been searching for about an hour trying to get the last day from 1:30PM to 1:30PM today.
I am trying upload images and than create an thumbnail of it and than store both in S3. After the file has been uploaded i am first uploading it to S3 and than trying to create thumbnail but it doesn't work as than PIL is not able to recognise the image. And secondly if I create the thumbnail first than while uploading original image I get EOF.
I think Django allows just once for the uploaded files to be used only once....Please kindly tell me a way to do so....Thanks in advance
I need to port this following from Oracle syntax to Postgresql. Both FLO_END_DT and FLO_START_DATE are of type DATE in Oracle, and TIMESTAMP WITHOUT TIME ZONE in Postgresql:
SELECT
TRUNC( TO_CHAR(ROUND(( FL.FLO_END_DT- FL.FLO_START_DT)* 24), '9999D99'),2)
FROM
FLOWS FL
I am not familiar enough with Oracle to know what it is trying to accomplish.
Any ideas?
I was recently faced with the problem of calculating the number of days from two dates in Java (without using joda, I'm afraid). Searching on the 'net shows most answers to this question say to get the milliseconds of the two days and convert that to days, which I found appalling. However, a scant few show a different approach: use a temporary variable to count how many times it takes adding 1 day to the first date to get to the second. This leaves the conversions to the code that does it best: the library.
Why do so many people advocate the first?
In another project, I had previously encountered numerous subtle date calculation problems involving time-zones, daylight-saving and once even leap years using seconds to do date comparisions and calculations. All these went away when all the comparison and calculation code was rewitten to use the language libraries. (This was in PHP, though, where the libraries are structured quite differently to Java.) So I'm understandably reluctant to use this "common wisdom" in the world of Java about comparing dates.
I have a table that looks like this:
ID / Description / textValue / dateValue / timeValue / Type
1 / FRRSD / NULL / 2010-04-16 00:00:00.000 / NULL / classdates
Now I've got a LINQ command to pull only the rows where the type is classdates from this table:
Dim dbGetRegisterDates As New dcConfigDataContext
Dim getDates = (From p In dbGetRegisterDates.webConfigOptions _
Where p.Type = "classdates" _
Select p)
I now want to display the data in five different labels like so:
lblClass1.Text = "Your class is from " & getDates.Description("FRRSD").dateValue & "to " & getDates.Description("FRRCD").dateValue
Basically, I want to pull a row based on the description column value and then return the datevalue column value from that same row.
Hello everyone,
Im trying to use the DOM in PHP to do a pretty specific job and Ive got no luck so far, the objective is to take a string of HTML from a Wordpress blog post (from the DB, this is a wordpress plugin). And then out of that HTML replace <div id="do_not_edit">old content</div>" with <div id="do_not_edit">new content</div>" in its place. Saving anything above and below that div in its structure.
Then save the HTML back into the DB, should be simple really, I have read that a regex wouldnt be the right way to go here so Ive turned to the DOM instead.
The problem is I just cant get it to work, cant extract the div or anything.
Help me!!
UPDATE
The HTML coming out of the wordpress table looks like:
Congratulations on finding us here on the world wide web, we are on a mission to create a website that will show off your culinary skills better than any other website does.
<div id="do_not_edit">blah blah</div>
We want this website to be fun and easy to use, we strive for simple elegance and incredible functionality.We aim to provide a 'complete package'. By this we want to create a website where people can meet, share ideas and help each other out.
After several different (incorrect) workings all Ive got below is:
$content = ($wpdb->get_var( "SELECT `post_content` FROM $wpdb->posts WHERE ID = {$article[post_id]}" ));
$doc = new DOMDocument();
$doc->validateOnParse = true;
$doc->loadHTMLFile($content);
$element = $doc->getElementById('do_not_edit');
echo $element;