PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
11,387,088
07/08/2012 22:02:57
1,445,314
06/08/2012 19:41:53
105
0
G++ cant compile code with boost for x32
I have a problem, i writed a code using boost (locks.hpp). My server is x64 Ubuntu. When i compile this code with -m64 all ok. But when i trying to compile for -m32, error: g++ -fPIC -m32 -shared -Wl,-soname,test.so -ldl -o test.so test.cpp -lboost_thread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libboost_thread.so when searching for -lboost_thread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libboost_thread.a when searching for -lboost_thread /usr/bin/ld: skipping incompatible //usr/lib/libboost_thread.so when searching for -lboost_thread /usr/bin/ld: skipping incompatible //usr/lib/libboost_thread.a when searching for -lboost_thread /usr/bin/ld: cannot find -lboost_thread collect2: ld returned 1 exit status What i'm doing wrong? Thanks!
c++
boost
g++
null
null
null
open
G++ cant compile code with boost for x32 === I have a problem, i writed a code using boost (locks.hpp). My server is x64 Ubuntu. When i compile this code with -m64 all ok. But when i trying to compile for -m32, error: g++ -fPIC -m32 -shared -Wl,-soname,test.so -ldl -o test.so test.cpp -lboost_thread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libboost_thread.so when searching for -lboost_thread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libboost_thread.a when searching for -lboost_thread /usr/bin/ld: skipping incompatible //usr/lib/libboost_thread.so when searching for -lboost_thread /usr/bin/ld: skipping incompatible //usr/lib/libboost_thread.a when searching for -lboost_thread /usr/bin/ld: cannot find -lboost_thread collect2: ld returned 1 exit status What i'm doing wrong? Thanks!
0
11,387,092
07/08/2012 22:03:42
1,252,854
03/06/2012 17:30:39
16
0
Filter the display of table cells with jquery
I have a table structure like the one below and I would like to use JQuery to filter the display of the table cells when I click on a link. For example, if I had a link that looked like this `<a href="#" title="cat">show cats</a>` I would like to hide all the table cells besides those that contained the word "cat" in them. I am thinking that I could use a combination of "attr", "contains" and "hide/show", so I can grab the title attribute of the link I am clicking on and then match it up with the text in the table cell and finally show/hide the cells I want, but theory and implementation are 2 different things, and I am not even sure if this would work or how to put it all together so I thought I would ask the experts here for some advise. <table> <tr> <td>cat</td> <td>cat</td> </tr> <tr> <td>dog</td> <td>dog</td> </tr> <tr> <td>horse</td> <td>horse</td> </tr> </table>
jquery
filter
table-cell
null
null
null
open
Filter the display of table cells with jquery === I have a table structure like the one below and I would like to use JQuery to filter the display of the table cells when I click on a link. For example, if I had a link that looked like this `<a href="#" title="cat">show cats</a>` I would like to hide all the table cells besides those that contained the word "cat" in them. I am thinking that I could use a combination of "attr", "contains" and "hide/show", so I can grab the title attribute of the link I am clicking on and then match it up with the text in the table cell and finally show/hide the cells I want, but theory and implementation are 2 different things, and I am not even sure if this would work or how to put it all together so I thought I would ask the experts here for some advise. <table> <tr> <td>cat</td> <td>cat</td> </tr> <tr> <td>dog</td> <td>dog</td> </tr> <tr> <td>horse</td> <td>horse</td> </tr> </table>
0
11,387,098
07/08/2012 22:04:08
1,098,178
12/14/2011 15:54:29
13
0
MySQL PHP CSV File Export
First of, apologies for some of the code below. I am new to PHP and learning and I know the code I have written is neither the most elegant or most efficient. I am attempting to create a function which generates a CSV type file for use in excel by exporting data from a table in MySQL. So far I have got everything working except that I would like to substitute one of the variables in my table from 'Client ID' (a number) to 'Company Name' (a text value) so it makes the final exported file easier to read. My code thus far is like this (again apologies!), //Connect with db global $smarty; $tpl_vars = $smarty->get_template_vars(); global $gCms; $db = &$gCms->GetDb(); //Check config settings $config = $tpl_vars['invoice_export_columns']; $headers = str_replace('"','\'',$config); $rows = str_replace('"','',$config); $start = $tpl_vars['from']; $start = date("'Y-m-d'", $start); $end = $tpl_vars['to']; $end = date("'Y-m-d'", $end); //Get client name $modops = cmsms()->GetModuleOperations(); $joms = $modops->get_module_instance('JoMS'); $client = $tpl_vars['clientrp']; $query = 'SELECT * FROM '.cms_db_prefix() .'module_joms_clients WHERE company_name = ?'; $row = $db->GetRow($query, array($client)); $client = $row['client_id']; $clientid = "'$client'"; //Check available statuses if (isset($tpl_vars['csvdraft'])) { $draft = '\'14\''; } else { $draft = '\'0\''; } if (isset($tpl_vars['csvsent'])) { $sent = '\'15\''; } else { $sent = '\'0\''; } if (isset($tpl_vars['csvpaid'])) { $paid = '\'25\''; } else { $paid = '\'0\''; } //Connect with invoices $db = cmsms()->GetDb(); $table = 'cms_module_joms_invoice_headers'; $file = 'export'; //Create headers $result = mysql_query("SHOW COLUMNS FROM ".$table." WHERE Field IN ($headers);"); $i = 0; if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $csv_output .= $row['Field'].", "; $i++; } } $csv_output .= "\n"; //Create body if ( $clientid == "''" ) { $values = mysql_query("SELECT $rows FROM ".$table." WHERE invoicedate >= $start AND invoicedate <= $end AND (status_id = $draft OR status_id = $sent OR status_id = $paid) "); } else { $values = mysql_query("SELECT $rows FROM ".$table." WHERE invoicedate >= $start AND invoicedate <= $end AND (status_id = $draft OR status_id = $sent OR status_id = $paid) AND client_id = $clientid "); } while ($rowr = mysql_fetch_row($values)) { for ($j=0;$j<$i;$j++) { $csv_output .= $rowr[$j].", "; } $csv_output .= "\n"; } //Write file $myFile = "uploads/csv/invoice.csv"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $csv_output); fclose($fh); Their is a column in the table called client_id and this is currently being outputted in the csv body as a 2 digit numerical value. I would like to substitute this for the actual name. Earlier in the code I have managed to do the same thing in reverse (under //Get client name) but I don't know how to do this the other way round whilst generating the $csv_output at the same time. The $csv_output looks something like this, invoicenumber client_id invoicedate status_id taxrate amountnett 100 2 2012-06-14 00:00:00 15 19.6 50 103 3 2012-06-16 00:00:00 15 20 23.5 104 2 2012-06-27 00:00:00 15 20 50 What I want to do is substitute the values from the column client_id with the values from the column company_name in the 'module_joms_clients' table. I appreciate this is a tricky question to answer but I thought I would see if anyone could help at all. Many thanks
php
mysql
query
csv
null
null
open
MySQL PHP CSV File Export === First of, apologies for some of the code below. I am new to PHP and learning and I know the code I have written is neither the most elegant or most efficient. I am attempting to create a function which generates a CSV type file for use in excel by exporting data from a table in MySQL. So far I have got everything working except that I would like to substitute one of the variables in my table from 'Client ID' (a number) to 'Company Name' (a text value) so it makes the final exported file easier to read. My code thus far is like this (again apologies!), //Connect with db global $smarty; $tpl_vars = $smarty->get_template_vars(); global $gCms; $db = &$gCms->GetDb(); //Check config settings $config = $tpl_vars['invoice_export_columns']; $headers = str_replace('"','\'',$config); $rows = str_replace('"','',$config); $start = $tpl_vars['from']; $start = date("'Y-m-d'", $start); $end = $tpl_vars['to']; $end = date("'Y-m-d'", $end); //Get client name $modops = cmsms()->GetModuleOperations(); $joms = $modops->get_module_instance('JoMS'); $client = $tpl_vars['clientrp']; $query = 'SELECT * FROM '.cms_db_prefix() .'module_joms_clients WHERE company_name = ?'; $row = $db->GetRow($query, array($client)); $client = $row['client_id']; $clientid = "'$client'"; //Check available statuses if (isset($tpl_vars['csvdraft'])) { $draft = '\'14\''; } else { $draft = '\'0\''; } if (isset($tpl_vars['csvsent'])) { $sent = '\'15\''; } else { $sent = '\'0\''; } if (isset($tpl_vars['csvpaid'])) { $paid = '\'25\''; } else { $paid = '\'0\''; } //Connect with invoices $db = cmsms()->GetDb(); $table = 'cms_module_joms_invoice_headers'; $file = 'export'; //Create headers $result = mysql_query("SHOW COLUMNS FROM ".$table." WHERE Field IN ($headers);"); $i = 0; if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $csv_output .= $row['Field'].", "; $i++; } } $csv_output .= "\n"; //Create body if ( $clientid == "''" ) { $values = mysql_query("SELECT $rows FROM ".$table." WHERE invoicedate >= $start AND invoicedate <= $end AND (status_id = $draft OR status_id = $sent OR status_id = $paid) "); } else { $values = mysql_query("SELECT $rows FROM ".$table." WHERE invoicedate >= $start AND invoicedate <= $end AND (status_id = $draft OR status_id = $sent OR status_id = $paid) AND client_id = $clientid "); } while ($rowr = mysql_fetch_row($values)) { for ($j=0;$j<$i;$j++) { $csv_output .= $rowr[$j].", "; } $csv_output .= "\n"; } //Write file $myFile = "uploads/csv/invoice.csv"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $csv_output); fclose($fh); Their is a column in the table called client_id and this is currently being outputted in the csv body as a 2 digit numerical value. I would like to substitute this for the actual name. Earlier in the code I have managed to do the same thing in reverse (under //Get client name) but I don't know how to do this the other way round whilst generating the $csv_output at the same time. The $csv_output looks something like this, invoicenumber client_id invoicedate status_id taxrate amountnett 100 2 2012-06-14 00:00:00 15 19.6 50 103 3 2012-06-16 00:00:00 15 20 23.5 104 2 2012-06-27 00:00:00 15 20 50 What I want to do is substitute the values from the column client_id with the values from the column company_name in the 'module_joms_clients' table. I appreciate this is a tricky question to answer but I thought I would see if anyone could help at all. Many thanks
0
11,430,219
07/11/2012 10:04:58
1,353,666
04/24/2012 12:25:59
3
0
Compression when using the Channel API in Google App Engine
In [this FAQ question][1] it says that compression is used automatically when the browser supports it and that I don't need to modify my application in any way. My question is, **does that apply to Channel API messages too?** I have an application that needs to send relatively large JSON (text) data through a persistent connection and I'm hoping I can get things through faster if they are compressed. If not, I can think of a workaround to have the server send just a ping through the channel when a big load comes through and have the browser then make a GET request to fetch it (and that would "automatically" compress it), but that would add the latency of another request. [1]: https://developers.google.com/appengine/kb/general#compression
google-app-engine
compression
http-compression
channel-api
null
null
open
Compression when using the Channel API in Google App Engine === In [this FAQ question][1] it says that compression is used automatically when the browser supports it and that I don't need to modify my application in any way. My question is, **does that apply to Channel API messages too?** I have an application that needs to send relatively large JSON (text) data through a persistent connection and I'm hoping I can get things through faster if they are compressed. If not, I can think of a workaround to have the server send just a ping through the channel when a big load comes through and have the browser then make a GET request to fetch it (and that would "automatically" compress it), but that would add the latency of another request. [1]: https://developers.google.com/appengine/kb/general#compression
0
11,430,220
07/11/2012 10:05:12
464,531
10/02/2010 10:32:43
80
4
AVAssetSessionExport - cancelExport block the whole UI
I am using AVFoundation framework to export videos from highest quality to medium. When I am trying to cancel the current export session the whole app get blocked (UI, ...), cancelExport method has never finished (I have added NSLog after call and it is never printed on the console). "cancelExport" is executing on the main thread, when I am trying execute "cancelExport" in separete thread with dispatch_async..., I am getting BAD_ACCESS error (some release issues I suppose). - (void)exportVideoFromUrl:(NSURL*)originalVideoUrl { NSDate *date = [NSDate date]; NSLog(@"start time %f", [[NSDate date] timeIntervalSince1970]); if (!isExporting) { isExporting = YES; processingVideoUrl = originalVideoUrl; AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:originalVideoUrl options:nil]; exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetMediumQuality]; NSURL *fileUrl = [Util generateFileURLWithPrefix:@"video" extension:@"mp4"]; [exportSession setOutputURL:fileUrl]; exportSession.outputFileType = AVFileTypeQuickTimeMovie; [exportSession exportAsynchronouslyWithCompletionHandler:^(void) { isExporting = NO; switch (exportSession.status) { case AVAssetExportSessionStatusCompleted: dispatch_sync(dispatch_get_main_queue(), ^{ NSLog(@"export completed"); processingVideoUrl = nil; [[NSNotificationCenter defaultCenter] postNotificationName:kVideoFinishExporting object:fileUrl]; NSLog(@"seconds export %f", [[NSDate date] timeIntervalSince1970] - [date timeIntervalSince1970]); [self performSelector:@selector(processNextScheduledVideo) withObject:nil afterDelay:2.0]; }); break; case AVAssetExportSessionStatusFailed: case AVAssetExportSessionStatusCancelled: dispatch_sync(dispatch_get_main_queue(), ^{ NSLog(@"export failed or cancelled"); }); break; } }]; }else { NSLog(@"wait for exporting added to queue"); [videosProcessingQueue addObject:originalVideoUrl]; } } **- (void)cancelVideoExportingWithUrl:(NSURL*)originalVideoUrl** { if (processingVideoUrl && [processingVideoUrl isEqual:originalVideoUrl] && exportSession.status == AVAssetExportSessionStatusExporting) { [exportSession cancelExport]; }else { [videosProcessingQueue removeObject:originalVideoUrl]; } } Thanks in advance for any assitence.
objective-c
xcode
avfoundation
null
null
null
open
AVAssetSessionExport - cancelExport block the whole UI === I am using AVFoundation framework to export videos from highest quality to medium. When I am trying to cancel the current export session the whole app get blocked (UI, ...), cancelExport method has never finished (I have added NSLog after call and it is never printed on the console). "cancelExport" is executing on the main thread, when I am trying execute "cancelExport" in separete thread with dispatch_async..., I am getting BAD_ACCESS error (some release issues I suppose). - (void)exportVideoFromUrl:(NSURL*)originalVideoUrl { NSDate *date = [NSDate date]; NSLog(@"start time %f", [[NSDate date] timeIntervalSince1970]); if (!isExporting) { isExporting = YES; processingVideoUrl = originalVideoUrl; AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:originalVideoUrl options:nil]; exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetMediumQuality]; NSURL *fileUrl = [Util generateFileURLWithPrefix:@"video" extension:@"mp4"]; [exportSession setOutputURL:fileUrl]; exportSession.outputFileType = AVFileTypeQuickTimeMovie; [exportSession exportAsynchronouslyWithCompletionHandler:^(void) { isExporting = NO; switch (exportSession.status) { case AVAssetExportSessionStatusCompleted: dispatch_sync(dispatch_get_main_queue(), ^{ NSLog(@"export completed"); processingVideoUrl = nil; [[NSNotificationCenter defaultCenter] postNotificationName:kVideoFinishExporting object:fileUrl]; NSLog(@"seconds export %f", [[NSDate date] timeIntervalSince1970] - [date timeIntervalSince1970]); [self performSelector:@selector(processNextScheduledVideo) withObject:nil afterDelay:2.0]; }); break; case AVAssetExportSessionStatusFailed: case AVAssetExportSessionStatusCancelled: dispatch_sync(dispatch_get_main_queue(), ^{ NSLog(@"export failed or cancelled"); }); break; } }]; }else { NSLog(@"wait for exporting added to queue"); [videosProcessingQueue addObject:originalVideoUrl]; } } **- (void)cancelVideoExportingWithUrl:(NSURL*)originalVideoUrl** { if (processingVideoUrl && [processingVideoUrl isEqual:originalVideoUrl] && exportSession.status == AVAssetExportSessionStatusExporting) { [exportSession cancelExport]; }else { [videosProcessingQueue removeObject:originalVideoUrl]; } } Thanks in advance for any assitence.
0
11,408,116
07/10/2012 06:57:14
625,189
02/20/2011 11:42:34
748
25
Parsing Java String to date
log(2 different dates): START TIME BEFORE PARSE: 06/27/2012 09:00 START TIME AFTER PARSE : Thu Mar 06 09:00:00 EET 2014 START TIME BEFORE PARSE: 07/06/2012 09:00 START TIME AFTER PARSE : Thu Jun 07 09:00:00 EEST 2012 code : DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); Date date = sdf.parse(time); System.out.println("TIME BEFORE PARSE: " + time); System.out.println("TIME AFTER PARSE : " + date); Why does it mess up the year? How to get it to work?
java
parsing
date
dateformat
null
null
open
Parsing Java String to date === log(2 different dates): START TIME BEFORE PARSE: 06/27/2012 09:00 START TIME AFTER PARSE : Thu Mar 06 09:00:00 EET 2014 START TIME BEFORE PARSE: 07/06/2012 09:00 START TIME AFTER PARSE : Thu Jun 07 09:00:00 EEST 2012 code : DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); Date date = sdf.parse(time); System.out.println("TIME BEFORE PARSE: " + time); System.out.println("TIME AFTER PARSE : " + date); Why does it mess up the year? How to get it to work?
0
11,429,709
07/11/2012 09:35:44
992,406
10/12/2011 22:46:44
25
2
How to Shrink array to specified length in java keeping elements uniformaly distributed?
I have source array, and I want to generate new array from the source array by removing a specified number of elements from the source array, I want the elements in the new array to cover as much as possible elements from the source array (the new elements are uniformly distributed over the source array) and keeping the first and last elements the same (if any). I tried this : public static void printArr(float[] arr) { for (int i = 0; i < arr.length; i++) System.out.println("arr[" + i + "]=" + arr[i]); } public static float[] removeElements(float[] inputArr , int numberOfElementToDelete) { float [] new_arr = new float[inputArr.length - numberOfElementToDelete]; int f = (inputArr.length ) / numberOfElementToDelete; System.out.println("f=" + f); if(f == 1) { f = 2; System.out.println("f=" + f); } int j = 1 ; for (int i = 1; i < inputArr.length ; i++) { if( (i + 1) % f != 0) { System.out.println("i=" + i + " j= " + j); if(j < new_arr.length) { new_arr[j] = inputArr[i]; j++; } } } new_arr[0] = inputArr[0]; new_arr[new_arr.length - 1] = inputArr[inputArr.length - 1]; return new_arr; } public static void main(String[] args) { float [] a = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; a = removeElements(a, 6); printArr(a); } I have made a test for(removeElements(a, 5) and removeElements(a, 4) and removeElements(a, 3)) but removeElements(a, 6); gave : arr[0]=1.0 arr[1]=3.0 arr[2]=5.0 arr[3]=7.0 arr[4]=9.0 arr[5]=11.0 arr[6]=13.0 arr[7]=15.0 arr[8]=0.0 arr[9]=16.0 the problem is (arr[8]=0.0) it must take a value .. How to solve this? is there any code that can remove a specified number of elements (and keep the elements distributed over the source array without generating zero in some elements)?
java
arrays
algorithm
null
null
null
open
How to Shrink array to specified length in java keeping elements uniformaly distributed? === I have source array, and I want to generate new array from the source array by removing a specified number of elements from the source array, I want the elements in the new array to cover as much as possible elements from the source array (the new elements are uniformly distributed over the source array) and keeping the first and last elements the same (if any). I tried this : public static void printArr(float[] arr) { for (int i = 0; i < arr.length; i++) System.out.println("arr[" + i + "]=" + arr[i]); } public static float[] removeElements(float[] inputArr , int numberOfElementToDelete) { float [] new_arr = new float[inputArr.length - numberOfElementToDelete]; int f = (inputArr.length ) / numberOfElementToDelete; System.out.println("f=" + f); if(f == 1) { f = 2; System.out.println("f=" + f); } int j = 1 ; for (int i = 1; i < inputArr.length ; i++) { if( (i + 1) % f != 0) { System.out.println("i=" + i + " j= " + j); if(j < new_arr.length) { new_arr[j] = inputArr[i]; j++; } } } new_arr[0] = inputArr[0]; new_arr[new_arr.length - 1] = inputArr[inputArr.length - 1]; return new_arr; } public static void main(String[] args) { float [] a = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; a = removeElements(a, 6); printArr(a); } I have made a test for(removeElements(a, 5) and removeElements(a, 4) and removeElements(a, 3)) but removeElements(a, 6); gave : arr[0]=1.0 arr[1]=3.0 arr[2]=5.0 arr[3]=7.0 arr[4]=9.0 arr[5]=11.0 arr[6]=13.0 arr[7]=15.0 arr[8]=0.0 arr[9]=16.0 the problem is (arr[8]=0.0) it must take a value .. How to solve this? is there any code that can remove a specified number of elements (and keep the elements distributed over the source array without generating zero in some elements)?
0
11,428,080
07/11/2012 07:56:54
1,517,020
07/11/2012 07:37:19
1
0
LinkedBlockingDeque.take() - separate instance in multipe thread
In our multithreaded java app, we are using LinkedBlockingDeque separate instance for each thread, assume threads (c1, c2, .... c200) Threads T1 & T2 receive data from socket & add the object to the specific Q's for c1 to c200. Infinite loop inside the run(), which calls LinkedBlockingDeque.take() In the load run the CPU usage for the javae.exe itself is 40%. When we sum up the other process in the system the overall CPU usage reaches 90%. By using JavaVisualVM the run() is taking more CPU and we suspect the LinkedBlockingDeque.take() So tried alternatives like thread.wait and notify and thread.sleep(0) but no change. The reason why each thread c1 to c200 having separate Q is for two reason, 1.there might be multiple request for c1 from T1 or T2 2.if we dump all req in single q, the seach time for c1 to c200 will be more and search criteria will extend. in need of your inputs... SD
java
multithreading
cpu
take
null
null
open
LinkedBlockingDeque.take() - separate instance in multipe thread === In our multithreaded java app, we are using LinkedBlockingDeque separate instance for each thread, assume threads (c1, c2, .... c200) Threads T1 & T2 receive data from socket & add the object to the specific Q's for c1 to c200. Infinite loop inside the run(), which calls LinkedBlockingDeque.take() In the load run the CPU usage for the javae.exe itself is 40%. When we sum up the other process in the system the overall CPU usage reaches 90%. By using JavaVisualVM the run() is taking more CPU and we suspect the LinkedBlockingDeque.take() So tried alternatives like thread.wait and notify and thread.sleep(0) but no change. The reason why each thread c1 to c200 having separate Q is for two reason, 1.there might be multiple request for c1 from T1 or T2 2.if we dump all req in single q, the seach time for c1 to c200 will be more and search criteria will extend. in need of your inputs... SD
0
11,428,081
07/11/2012 07:56:59
1,002,972
10/19/2011 10:52:29
526
12
Is OSGi production ready?
I've recently discovered OSGi and it seems very promising. I would like to ask people that already uses OSGi's implementations, to know if they are production ready. Do they provide the features generally required in production environment? I've read there are many implementations, but I've only looked at Apache Felix. Thanks
java
osgi
null
null
null
null
open
Is OSGi production ready? === I've recently discovered OSGi and it seems very promising. I would like to ask people that already uses OSGi's implementations, to know if they are production ready. Do they provide the features generally required in production environment? I've read there are many implementations, but I've only looked at Apache Felix. Thanks
0
11,430,223
07/11/2012 10:05:23
1,501,212
07/04/2012 09:56:23
8
0
Import large csv file using phpMyAdmin
I have a little question. I have a csv file, a big one, 30 000 rows. I've tried to import it using LOAD file etc.. from the terminal, as I found on google, but it didn't work. It was making the import but my table got to 30 000 rows of NULL cells. After that I tried phpMyAdmin and there I found out that my csv was too big. I've split it in 5 using CSV Splitter. I've made the import for the first file. Everything went great. Than I tried to import the second one, but I got thos error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes) in C:\xampp\phpMyAdmin\libraries\import\csv.php on line 370 or 1064 error sometimes. Do you know why and how can I solve it? Thank you.
mysql
csv
import
phpmyadmin
mysql-error-1064
null
open
Import large csv file using phpMyAdmin === I have a little question. I have a csv file, a big one, 30 000 rows. I've tried to import it using LOAD file etc.. from the terminal, as I found on google, but it didn't work. It was making the import but my table got to 30 000 rows of NULL cells. After that I tried phpMyAdmin and there I found out that my csv was too big. I've split it in 5 using CSV Splitter. I've made the import for the first file. Everything went great. Than I tried to import the second one, but I got thos error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes) in C:\xampp\phpMyAdmin\libraries\import\csv.php on line 370 or 1064 error sometimes. Do you know why and how can I solve it? Thank you.
0
11,430,225
07/11/2012 10:05:26
1,092,395
12/11/2011 16:02:50
8
0
jQuery - get text file, read it and then add results as class to multiples div
I have some data provided from a file.txt wich are display like this : <div class="nbvote">465</div> <div class="nbvote">12</div> <div class="nbvote">1862</div> [...] <div class="nbvote">3</div> And i have in the same page multiple div (90) like this : <div class="grid_4"> <div class="grid_4"> <div class="grid_4"> [...] <div class="grid_4"> Now i want to add each data (465,12,1862,...,3) as class to each div class="grid_4" like this : <div class="grid_4 465"> <div class="grid_4 12"> <div class="grid_4 1862"> [...] <div class="grid_4 3"> How can i do that ? I was thinking using lenght, but i wasn't be able to do this. By the way, the data are the number of vote and i would like to add them as class to each div grid_4 and then sort ascending. Sorry for my english, not my first langage. Ty
jquery
filter
each
length
addclass
null
open
jQuery - get text file, read it and then add results as class to multiples div === I have some data provided from a file.txt wich are display like this : <div class="nbvote">465</div> <div class="nbvote">12</div> <div class="nbvote">1862</div> [...] <div class="nbvote">3</div> And i have in the same page multiple div (90) like this : <div class="grid_4"> <div class="grid_4"> <div class="grid_4"> [...] <div class="grid_4"> Now i want to add each data (465,12,1862,...,3) as class to each div class="grid_4" like this : <div class="grid_4 465"> <div class="grid_4 12"> <div class="grid_4 1862"> [...] <div class="grid_4 3"> How can i do that ? I was thinking using lenght, but i wasn't be able to do this. By the way, the data are the number of vote and i would like to add them as class to each div grid_4 and then sort ascending. Sorry for my english, not my first langage. Ty
0
11,430,227
07/11/2012 10:05:34
353,985
05/30/2010 12:34:34
310
16
WebKitTransitionEvent constructor arguments of Chrome 14
I'm trying to do <pre> var event = new WebKitTransitionEvent( "webkitTransitionEnd", true, true, computedStyle.webkitTransitionProperty, 0.0); </pre> but I'm getting typeError on Chrome 14. Searching the internet I found this link http://opensource.apple.com/source/WebCore/WebCore-528.15/dom/WebKitTransitionEvent.h <pre> //some code void initWebKitTransitionEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, const String& propertyName, double elapsedTime); //some code </pre> From here i think that the problem is that the WebKitTransitionEvent constructor in Chrome 14 is different. I want to know which version of WebCore Chrome 14 is using. And find the source code of WebKitTransitionEvent. Bonus question: is there anyway to know what are the constructor args of an event before I call it. I know a first solution is to use try/catch... Thanks.
google-chrome
javascript-events
null
null
null
null
open
WebKitTransitionEvent constructor arguments of Chrome 14 === I'm trying to do <pre> var event = new WebKitTransitionEvent( "webkitTransitionEnd", true, true, computedStyle.webkitTransitionProperty, 0.0); </pre> but I'm getting typeError on Chrome 14. Searching the internet I found this link http://opensource.apple.com/source/WebCore/WebCore-528.15/dom/WebKitTransitionEvent.h <pre> //some code void initWebKitTransitionEvent(const AtomicString& type, bool canBubbleArg, bool cancelableArg, const String& propertyName, double elapsedTime); //some code </pre> From here i think that the problem is that the WebKitTransitionEvent constructor in Chrome 14 is different. I want to know which version of WebCore Chrome 14 is using. And find the source code of WebKitTransitionEvent. Bonus question: is there anyway to know what are the constructor args of an event before I call it. I know a first solution is to use try/catch... Thanks.
0
11,430,230
07/11/2012 10:05:40
1,330,137
04/12/2012 20:13:00
77
3
WMI: COM object that has been separated from its underlying RCW cannot be used
I get a "InvalidComObjectException was unhandled" "COM object that has been separated from its underlying RCW cannot be used" Whilst doing Usb drive detection using WMI. I don't know if I have the correction solution but this is what I've found out. I need to create a wrapper around WMI class and treat it like an Object using the IDispose interface to dispose of it and to stop GC from finalizing it. The only problem with this is that I don't know how to create a wrapper around events. public enum WMIActions { Added, Removed } public class WMIEventArgs : EventArgs { public USBDriveInfo Disk { get; set; } public WMIActions EventType { get; set; } } public delegate void WMIEventArrived(object sender, WMIEventArgs e); public class WMIEventWatcher { public WMIEventWatcher() { Devices = GetExistingDevices(); } private ManagementEventWatcher addedWatcher = null; private ManagementEventWatcher removedWatcher = null; public List<USBDriveInfo> Devices { get; set; } public event WMIEventArrived EventArrived; public void StartWatchUSB() { try { addedWatcher = new ManagementEventWatcher("SELECT * FROM __InstanceCreationEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_USBControllerDevice\""); addedWatcher.EventArrived += new EventArrivedEventHandler(HandleAddedEvent); addedWatcher.Start(); removedWatcher = new ManagementEventWatcher("SELECT * FROM __InstanceDeletionEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_USBControllerDevice\""); removedWatcher.EventArrived += new EventArrivedEventHandler(HandleRemovedEvent); removedWatcher.Start(); } catch (ManagementException err){} } public void StopWatchUSB() { try { // Stop listening for events if (addedWatcher != null) addedWatcher.Stop(); if (removedWatcher != null) removedWatcher.Stop(); } catch (ManagementException err) { } } private void HandleAddedEvent(object sender, EventArrivedEventArgs e) { USBDriveInfo device = null; try { ManagementBaseObject targetInstance = e.NewEvent["TargetInstance"] as ManagementBaseObject; // get the device name in the dependent property Dependent: extract the last part // \\FR-L25676\root\cimv2:Win32_PnPEntity.DeviceID="USBSTOR\\DISK&VEN_USB&PROD_FLASH_DISK&REV_1100\\AA04012700076941&0" string PNP_deviceID = Convert.ToString(targetInstance["Dependent"]).Split('=').Last().Replace("\"", "").Replace("\\", ""); string device_name = Convert.ToString(targetInstance["Dependent"]).Split('\\').Last().Replace("\"", ""); // query that device entity ObjectQuery objQuery = new ObjectQuery(string.Format("Select * from Win32_PnPEntity Where DeviceID like \"%{0}%\"", device_name)); // check if match usb removable disk using (ManagementObjectSearcher objSearcher = new ManagementObjectSearcher(objQuery)) { ManagementObjectCollection entities = objSearcher.Get(); //first loop to check USBSTOR foreach (var entity in entities) { string service = Convert.ToString(entity["Service"]); if (service == "USBSTOR") device = new USBDriveInfo(); } if (device != null) { foreach (var entity in entities) { string service = Convert.ToString(entity["Service"]); if (service == "disk") { GetDiskInformation(device, device_name); Devices.Add(device); if (EventArrived != null) EventArrived(this, new WMIEventArgs() { Disk = device, EventType = WMIActions.Added }); } } } } } catch (ManagementException err) { } } private ManagementObjectSearcher GetDiskInformation(USBDriveInfo device, string device_name) { ManagementObjectSearcher objSearcherInfo = null; ObjectQuery objQueryInfo = new ObjectQuery("SELECT * FROM Win32_DiskDrive where PNPDeviceID like '%" + device_name + "%'"); objSearcherInfo = new ManagementObjectSearcher(objQueryInfo); ManagementObjectCollection disks = objSearcherInfo.Get(); foreach (var disk in disks) { //Use the disk drive device id to find associated partition ObjectQuery objQueryAssoc = new ObjectQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + Convert.ToString(disk["DeviceID"]).Replace("\"", "\\") + "'} WHERE AssocClass=Win32_DiskDriveToDiskPartition"); objSearcherInfo = new ManagementObjectSearcher(objQueryAssoc); ManagementObjectCollection partitions = objSearcherInfo.Get(); foreach (var part in partitions) { //Use partition device id to find logical disk ObjectQuery objQueryLog = new ObjectQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" + Convert.ToString(part["DeviceID"]).Replace("\"", "\\") + "'} WHERE AssocClass=Win32_LogicalDiskToPartition"); objSearcherInfo = new ManagementObjectSearcher(objQueryLog); ManagementObjectCollection logicObjCol = objSearcherInfo.Get(); foreach (var driveLogic in logicObjCol) { ParseUsbDriveInfo(device, disk); ParseLogicalDiskInfo(device, driveLogic); } } } return objSearcherInfo; } private void HandleRemovedEvent(object sender, EventArrivedEventArgs e) { try { ManagementBaseObject targetInstance = e.NewEvent["TargetInstance"] as ManagementBaseObject; string PNP_deviceID = Convert.ToString(targetInstance["Dependent"]).Split('=').Last().Replace("\"", "").Replace("\\", ""); USBDriveInfo device = Devices.Find(x => x.PNPDeviceID == PNP_deviceID); if( device != null ) { Devices.Remove( device ); if (EventArrived != null) EventArrived(this, new WMIEventArgs() { Disk = device, EventType = WMIActions.Removed }); } } catch (ManagementException err) { } } private List<USBDriveInfo> GetExistingDevices() { try { List<USBDriveInfo> devices = new List<USBDriveInfo>(); ObjectQuery diskQuery = new ObjectQuery("Select * from Win32_DiskDrive where InterfaceType='USB'"); foreach (ManagementObject drive in new ManagementObjectSearcher(diskQuery).Get()) { ObjectQuery partQuery = new ObjectQuery(String.Format("associators of {{Win32_DiskDrive.DeviceID='{0}'}} where AssocClass = Win32_DiskDriveToDiskPartition", drive["DeviceID"])); foreach (ManagementObject partition in new ManagementObjectSearcher(partQuery).Get()) { // associate partitions with logical disks (drive letter volumes) ObjectQuery logicalQuery = new ObjectQuery(String.Format("associators of {{Win32_DiskPartition.DeviceID='{0}'}} where AssocClass = Win32_LogicalDiskToPartition", partition["DeviceID"])); foreach (ManagementObject logical in new ManagementObjectSearcher(logicalQuery).Get()) { USBDriveInfo disk = new USBDriveInfo(); ParseUsbDriveInfo(disk, drive); ParseLogicalDiskInfo(disk, logical); devices.Add(disk); } } } return devices; } catch (ManagementException err) { return null; } } private void ParseUsbDriveInfo(USBDriveInfo usbDriveInfo, ManagementBaseObject drive) { usbDriveInfo.PNPDeviceID = drive["PNPDeviceID"].ToString().Replace("\\", ""); usbDriveInfo.Model = drive["Model"].ToString(); usbDriveInfo.Caption = drive["Caption"].ToString(); } private void ParseLogicalDiskInfo(USBDriveInfo usbDriveInfo, ManagementBaseObject logicalDrive) { usbDriveInfo.Name = logicalDrive["Name"].ToString(); usbDriveInfo.Path = logicalDrive["Name"].ToString(); usbDriveInfo.VolumeName = logicalDrive["VolumeName"].ToString(); usbDriveInfo.FreeSpace = (ulong)logicalDrive["FreeSpace"]; usbDriveInfo.Size = (ulong)logicalDrive["Size"]; } } The code above is the namespace containing the code. I just need to wrap it up, but I have no idea how to do it with events? Thanks,
c#
mvvm
wmi
null
null
null
open
WMI: COM object that has been separated from its underlying RCW cannot be used === I get a "InvalidComObjectException was unhandled" "COM object that has been separated from its underlying RCW cannot be used" Whilst doing Usb drive detection using WMI. I don't know if I have the correction solution but this is what I've found out. I need to create a wrapper around WMI class and treat it like an Object using the IDispose interface to dispose of it and to stop GC from finalizing it. The only problem with this is that I don't know how to create a wrapper around events. public enum WMIActions { Added, Removed } public class WMIEventArgs : EventArgs { public USBDriveInfo Disk { get; set; } public WMIActions EventType { get; set; } } public delegate void WMIEventArrived(object sender, WMIEventArgs e); public class WMIEventWatcher { public WMIEventWatcher() { Devices = GetExistingDevices(); } private ManagementEventWatcher addedWatcher = null; private ManagementEventWatcher removedWatcher = null; public List<USBDriveInfo> Devices { get; set; } public event WMIEventArrived EventArrived; public void StartWatchUSB() { try { addedWatcher = new ManagementEventWatcher("SELECT * FROM __InstanceCreationEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_USBControllerDevice\""); addedWatcher.EventArrived += new EventArrivedEventHandler(HandleAddedEvent); addedWatcher.Start(); removedWatcher = new ManagementEventWatcher("SELECT * FROM __InstanceDeletionEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_USBControllerDevice\""); removedWatcher.EventArrived += new EventArrivedEventHandler(HandleRemovedEvent); removedWatcher.Start(); } catch (ManagementException err){} } public void StopWatchUSB() { try { // Stop listening for events if (addedWatcher != null) addedWatcher.Stop(); if (removedWatcher != null) removedWatcher.Stop(); } catch (ManagementException err) { } } private void HandleAddedEvent(object sender, EventArrivedEventArgs e) { USBDriveInfo device = null; try { ManagementBaseObject targetInstance = e.NewEvent["TargetInstance"] as ManagementBaseObject; // get the device name in the dependent property Dependent: extract the last part // \\FR-L25676\root\cimv2:Win32_PnPEntity.DeviceID="USBSTOR\\DISK&VEN_USB&PROD_FLASH_DISK&REV_1100\\AA04012700076941&0" string PNP_deviceID = Convert.ToString(targetInstance["Dependent"]).Split('=').Last().Replace("\"", "").Replace("\\", ""); string device_name = Convert.ToString(targetInstance["Dependent"]).Split('\\').Last().Replace("\"", ""); // query that device entity ObjectQuery objQuery = new ObjectQuery(string.Format("Select * from Win32_PnPEntity Where DeviceID like \"%{0}%\"", device_name)); // check if match usb removable disk using (ManagementObjectSearcher objSearcher = new ManagementObjectSearcher(objQuery)) { ManagementObjectCollection entities = objSearcher.Get(); //first loop to check USBSTOR foreach (var entity in entities) { string service = Convert.ToString(entity["Service"]); if (service == "USBSTOR") device = new USBDriveInfo(); } if (device != null) { foreach (var entity in entities) { string service = Convert.ToString(entity["Service"]); if (service == "disk") { GetDiskInformation(device, device_name); Devices.Add(device); if (EventArrived != null) EventArrived(this, new WMIEventArgs() { Disk = device, EventType = WMIActions.Added }); } } } } } catch (ManagementException err) { } } private ManagementObjectSearcher GetDiskInformation(USBDriveInfo device, string device_name) { ManagementObjectSearcher objSearcherInfo = null; ObjectQuery objQueryInfo = new ObjectQuery("SELECT * FROM Win32_DiskDrive where PNPDeviceID like '%" + device_name + "%'"); objSearcherInfo = new ManagementObjectSearcher(objQueryInfo); ManagementObjectCollection disks = objSearcherInfo.Get(); foreach (var disk in disks) { //Use the disk drive device id to find associated partition ObjectQuery objQueryAssoc = new ObjectQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + Convert.ToString(disk["DeviceID"]).Replace("\"", "\\") + "'} WHERE AssocClass=Win32_DiskDriveToDiskPartition"); objSearcherInfo = new ManagementObjectSearcher(objQueryAssoc); ManagementObjectCollection partitions = objSearcherInfo.Get(); foreach (var part in partitions) { //Use partition device id to find logical disk ObjectQuery objQueryLog = new ObjectQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" + Convert.ToString(part["DeviceID"]).Replace("\"", "\\") + "'} WHERE AssocClass=Win32_LogicalDiskToPartition"); objSearcherInfo = new ManagementObjectSearcher(objQueryLog); ManagementObjectCollection logicObjCol = objSearcherInfo.Get(); foreach (var driveLogic in logicObjCol) { ParseUsbDriveInfo(device, disk); ParseLogicalDiskInfo(device, driveLogic); } } } return objSearcherInfo; } private void HandleRemovedEvent(object sender, EventArrivedEventArgs e) { try { ManagementBaseObject targetInstance = e.NewEvent["TargetInstance"] as ManagementBaseObject; string PNP_deviceID = Convert.ToString(targetInstance["Dependent"]).Split('=').Last().Replace("\"", "").Replace("\\", ""); USBDriveInfo device = Devices.Find(x => x.PNPDeviceID == PNP_deviceID); if( device != null ) { Devices.Remove( device ); if (EventArrived != null) EventArrived(this, new WMIEventArgs() { Disk = device, EventType = WMIActions.Removed }); } } catch (ManagementException err) { } } private List<USBDriveInfo> GetExistingDevices() { try { List<USBDriveInfo> devices = new List<USBDriveInfo>(); ObjectQuery diskQuery = new ObjectQuery("Select * from Win32_DiskDrive where InterfaceType='USB'"); foreach (ManagementObject drive in new ManagementObjectSearcher(diskQuery).Get()) { ObjectQuery partQuery = new ObjectQuery(String.Format("associators of {{Win32_DiskDrive.DeviceID='{0}'}} where AssocClass = Win32_DiskDriveToDiskPartition", drive["DeviceID"])); foreach (ManagementObject partition in new ManagementObjectSearcher(partQuery).Get()) { // associate partitions with logical disks (drive letter volumes) ObjectQuery logicalQuery = new ObjectQuery(String.Format("associators of {{Win32_DiskPartition.DeviceID='{0}'}} where AssocClass = Win32_LogicalDiskToPartition", partition["DeviceID"])); foreach (ManagementObject logical in new ManagementObjectSearcher(logicalQuery).Get()) { USBDriveInfo disk = new USBDriveInfo(); ParseUsbDriveInfo(disk, drive); ParseLogicalDiskInfo(disk, logical); devices.Add(disk); } } } return devices; } catch (ManagementException err) { return null; } } private void ParseUsbDriveInfo(USBDriveInfo usbDriveInfo, ManagementBaseObject drive) { usbDriveInfo.PNPDeviceID = drive["PNPDeviceID"].ToString().Replace("\\", ""); usbDriveInfo.Model = drive["Model"].ToString(); usbDriveInfo.Caption = drive["Caption"].ToString(); } private void ParseLogicalDiskInfo(USBDriveInfo usbDriveInfo, ManagementBaseObject logicalDrive) { usbDriveInfo.Name = logicalDrive["Name"].ToString(); usbDriveInfo.Path = logicalDrive["Name"].ToString(); usbDriveInfo.VolumeName = logicalDrive["VolumeName"].ToString(); usbDriveInfo.FreeSpace = (ulong)logicalDrive["FreeSpace"]; usbDriveInfo.Size = (ulong)logicalDrive["Size"]; } } The code above is the namespace containing the code. I just need to wrap it up, but I have no idea how to do it with events? Thanks,
0
11,430,232
07/11/2012 10:05:47
1,131,491
01/05/2012 06:29:14
30
3
Notepad++ Regex Search & Replace White Space Up to A Limit
How do I write a regex in Notepad++ to search and replace all whitespaces (up to a certain point) with a comma? Original Text 468620438 [2012-07-07 00:00:00,307] [Thread-20] INFO BIZ,Handler,getJobs():Retrieving messages from A... 468620438 [2012-07-07 00:00:00,307] [Thread-20] INFO BIZ,InterfaceAdaptor,getMessages : Retrieving messages from B 468620453 [2012-07-07 00:00:00,322] [Thread-20] INFO BIZ,Handler,_getNextMessage():Retrieving messages from B Amended Text 468620438,[2012-07-07 00:00:00,307],[Thread-20],INFO,BIZ,Handler,getJobs():Retrieving messages from A... 468620438,[2012-07-07 00:00:00,307],[Thread-20],INFO,BIZ,InterfaceAdaptor,getMessages : Retrieving messages from B 468620453,[2012-07-07 00:00:00,322],[Thread-20],INFO,BIZ,Handler,_getNextMessage():Retrieving messages from B
regex
notepad++
null
null
null
null
open
Notepad++ Regex Search & Replace White Space Up to A Limit === How do I write a regex in Notepad++ to search and replace all whitespaces (up to a certain point) with a comma? Original Text 468620438 [2012-07-07 00:00:00,307] [Thread-20] INFO BIZ,Handler,getJobs():Retrieving messages from A... 468620438 [2012-07-07 00:00:00,307] [Thread-20] INFO BIZ,InterfaceAdaptor,getMessages : Retrieving messages from B 468620453 [2012-07-07 00:00:00,322] [Thread-20] INFO BIZ,Handler,_getNextMessage():Retrieving messages from B Amended Text 468620438,[2012-07-07 00:00:00,307],[Thread-20],INFO,BIZ,Handler,getJobs():Retrieving messages from A... 468620438,[2012-07-07 00:00:00,307],[Thread-20],INFO,BIZ,InterfaceAdaptor,getMessages : Retrieving messages from B 468620453,[2012-07-07 00:00:00,322],[Thread-20],INFO,BIZ,Handler,_getNextMessage():Retrieving messages from B
0
11,430,236
07/11/2012 10:05:53
1,513,807
09/01/2011 06:36:28
95
2
How do I sum() negative numbers in XSLT?
I am trying to sum a series of transactions over a period of time using XSLT. Some of the transactions might have negative numbers and some not. <xsl:variable name="sumSet"> <account> <in>501560</in> <in>-100000</in> <in>-608800</in> <in>280000</in> <in>2096413</in> <in>-75000</in> </account> </xsl:variable> If I try sum() I wont get the negative numbers. <xsl:value-of select="sum(ext:node-set($sumSet)//in)"/> Anyone got any suggestions?
xml
xslt
xpath
sum
value-of
null
open
How do I sum() negative numbers in XSLT? === I am trying to sum a series of transactions over a period of time using XSLT. Some of the transactions might have negative numbers and some not. <xsl:variable name="sumSet"> <account> <in>501560</in> <in>-100000</in> <in>-608800</in> <in>280000</in> <in>2096413</in> <in>-75000</in> </account> </xsl:variable> If I try sum() I wont get the negative numbers. <xsl:value-of select="sum(ext:node-set($sumSet)//in)"/> Anyone got any suggestions?
0
11,262,327
06/29/2012 13:03:51
1,156,094
01/18/2012 11:38:55
1
0
Reload a specif part of the website using Ajax
Hi Guys of the good life, I working on a website and i'm a bit stucked with the following problem and i hope that somebody can give me some help with it. The website is http://www.clothesmakemen.com/Nieuwewebsite/casual.html When you click on a thumbitem on the right the item loads with ajax without reloading the whole page, this is great. The problem is that the thumbitems disapear and i need them to be there. So i need some script that after clicking on a thumbitem the item loads without losing the thumbs on the right :) Hope you guys can understand what i mean :D
javascript
jquery
ajax
jquery-ajax
null
null
open
Reload a specif part of the website using Ajax === Hi Guys of the good life, I working on a website and i'm a bit stucked with the following problem and i hope that somebody can give me some help with it. The website is http://www.clothesmakemen.com/Nieuwewebsite/casual.html When you click on a thumbitem on the right the item loads with ajax without reloading the whole page, this is great. The problem is that the thumbitems disapear and i need them to be there. So i need some script that after clicking on a thumbitem the item loads without losing the thumbs on the right :) Hope you guys can understand what i mean :D
0
11,262,328
06/29/2012 13:03:59
1,221,846
02/20/2012 19:24:23
410
19
App close when use async method
I'm writting an application which has to contact a webservice. It's working. But, now I have to use the async task. I have to fill a list of category. I can't figure what's the problem. The async class : private class CallCategory extends AsyncTask<List<Category>,Void,List<Category>>{ private ProgressDialog dialog; protected void onPreExecute() { this.dialog = ProgressDialog.show(getApplicationContext(), "Calling", "Time Service...", true); } protected void onPostExecute() { this.dialog.cancel(); } @Override protected List<Category> doInBackground(List<Category>... params) { return ServerCall.GetCategory(); } } The call : CallCategory cc = new CallCategory(); _ListCategory = new ArrayList<Category>(); cc.execute(); StackTrace : > 06-29 12:58:57.746: W/dalvikvm(3087): threadid=3: thread exiting with > uncaught exception (group=0x4001b188) 06-29 12:58:57.746: > E/AndroidRuntime(3087): Uncaught handler: thread main exiting due to > uncaught exception 06-29 12:58:57.786: E/AndroidRuntime(3087): > java.lang.RuntimeException: Unable to start activity > ComponentInfo{ApPicture.Android/ApPicture.Android.ApPictureActivity}: > android.view.WindowManager$BadTokenException: Unable to add window -- > token null is not for an application 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread.access$2200(ActivityThread.java:119) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.os.Handler.dispatchMessage(Handler.java:99) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > android.os.Looper.loop(Looper.java:123) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.app.ActivityThread.main(ActivityThread.java:4363) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > java.lang.reflect.Method.invokeNative(Native Method) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > java.lang.reflect.Method.invoke(Method.java:521) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > dalvik.system.NativeStart.main(Native Method) 06-29 12:58:57.786: > E/AndroidRuntime(3087): Caused by: > android.view.WindowManager$BadTokenException: Unable to add window -- > token null is not for an application 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.view.ViewRoot.setView(ViewRoot.java:472) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.Dialog.show(Dialog.java:239) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.app.ProgressDialog.show(ProgressDialog.java:107) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ProgressDialog.show(ProgressDialog.java:90) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > ApPicture.Android.ApPictureActivity$CallCategory.onPreExecute(ApPictureActivity.java:406) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.os.AsyncTask.execute(AsyncTask.java:391) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > ApPicture.Android.ApPictureActivity.LoadCategory(ApPictureActivity.java:291) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > ApPicture.Android.ApPictureActivity.onCreate(ApPictureActivity.java:108) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) > 06-29 12:58:57.786: E/AndroidRuntime(3087): ... 11 more Regards.
android
null
null
null
null
null
open
App close when use async method === I'm writting an application which has to contact a webservice. It's working. But, now I have to use the async task. I have to fill a list of category. I can't figure what's the problem. The async class : private class CallCategory extends AsyncTask<List<Category>,Void,List<Category>>{ private ProgressDialog dialog; protected void onPreExecute() { this.dialog = ProgressDialog.show(getApplicationContext(), "Calling", "Time Service...", true); } protected void onPostExecute() { this.dialog.cancel(); } @Override protected List<Category> doInBackground(List<Category>... params) { return ServerCall.GetCategory(); } } The call : CallCategory cc = new CallCategory(); _ListCategory = new ArrayList<Category>(); cc.execute(); StackTrace : > 06-29 12:58:57.746: W/dalvikvm(3087): threadid=3: thread exiting with > uncaught exception (group=0x4001b188) 06-29 12:58:57.746: > E/AndroidRuntime(3087): Uncaught handler: thread main exiting due to > uncaught exception 06-29 12:58:57.786: E/AndroidRuntime(3087): > java.lang.RuntimeException: Unable to start activity > ComponentInfo{ApPicture.Android/ApPicture.Android.ApPictureActivity}: > android.view.WindowManager$BadTokenException: Unable to add window -- > token null is not for an application 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread.access$2200(ActivityThread.java:119) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.os.Handler.dispatchMessage(Handler.java:99) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > android.os.Looper.loop(Looper.java:123) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.app.ActivityThread.main(ActivityThread.java:4363) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > java.lang.reflect.Method.invokeNative(Native Method) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > java.lang.reflect.Method.invoke(Method.java:521) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > dalvik.system.NativeStart.main(Native Method) 06-29 12:58:57.786: > E/AndroidRuntime(3087): Caused by: > android.view.WindowManager$BadTokenException: Unable to add window -- > token null is not for an application 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.view.ViewRoot.setView(ViewRoot.java:472) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.Dialog.show(Dialog.java:239) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > android.app.ProgressDialog.show(ProgressDialog.java:107) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ProgressDialog.show(ProgressDialog.java:90) 06-29 > 12:58:57.786: E/AndroidRuntime(3087): at > ApPicture.Android.ApPictureActivity$CallCategory.onPreExecute(ApPictureActivity.java:406) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.os.AsyncTask.execute(AsyncTask.java:391) 06-29 12:58:57.786: > E/AndroidRuntime(3087): at > ApPicture.Android.ApPictureActivity.LoadCategory(ApPictureActivity.java:291) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > ApPicture.Android.ApPictureActivity.onCreate(ApPictureActivity.java:108) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) > 06-29 12:58:57.786: E/AndroidRuntime(3087): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) > 06-29 12:58:57.786: E/AndroidRuntime(3087): ... 11 more Regards.
0
11,262,252
06/29/2012 12:58:57
1,007,076
10/21/2011 12:18:39
483
33
login to wordpress through facebook
I want in my wordpress website that user can log in through their facebook account,, that means when the user click the button connect through facebook account on my website ,, it will create a user with exactly the same credentials that of facebook. Thanks
php
facebook
wordpress
null
null
06/29/2012 19:38:44
not a real question
login to wordpress through facebook === I want in my wordpress website that user can log in through their facebook account,, that means when the user click the button connect through facebook account on my website ,, it will create a user with exactly the same credentials that of facebook. Thanks
1
11,262,253
06/29/2012 12:58:57
383,691
07/05/2010 12:49:15
1,015
39
How to code an image slider?
How can I code an image slider similar to the [Nivo slider][1]? Must be in Javascript/Jquery. I want to learn and create my own solution, so I dont want any plugins suggested for this reason. Is there any advice any one can give me, i.e. what should I do not do? starting points etc? If anyone knows of any good tutorials that would be good. Helpful tutorials though only, not the ones that just tell you to download the source code at the end of a load of jumble. One way I thought of doing it was to insert all the images into divs, and hiding all those divs, and one by one unhiding those divs and sliding them in. [1]: http://nivo.dev7studios.com/
javascript
jquery
null
null
null
07/02/2012 19:42:55
not constructive
How to code an image slider? === How can I code an image slider similar to the [Nivo slider][1]? Must be in Javascript/Jquery. I want to learn and create my own solution, so I dont want any plugins suggested for this reason. Is there any advice any one can give me, i.e. what should I do not do? starting points etc? If anyone knows of any good tutorials that would be good. Helpful tutorials though only, not the ones that just tell you to download the source code at the end of a load of jumble. One way I thought of doing it was to insert all the images into divs, and hiding all those divs, and one by one unhiding those divs and sliding them in. [1]: http://nivo.dev7studios.com/
4
11,262,334
06/29/2012 13:04:14
679,886
03/28/2011 08:29:15
2,232
108
How to set focusable in a UserControl correctly?
what is the correct value for the Focusable property in a UserControl in case you have a single Control (e.g. TextBox) wrapped inside? All examples I have seen were about the case where you have multiple Controls wrapped inside a UserControl. Obviously I want to have the TextBox have the focus, but not the UserControl itself. How do I set the Focusable correctly and what more do I have to consider in this case? Thanks!
c#
.net
wpf
usercontrols
wpf-4.0
null
open
How to set focusable in a UserControl correctly? === what is the correct value for the Focusable property in a UserControl in case you have a single Control (e.g. TextBox) wrapped inside? All examples I have seen were about the case where you have multiple Controls wrapped inside a UserControl. Obviously I want to have the TextBox have the focus, but not the UserControl itself. How do I set the Focusable correctly and what more do I have to consider in this case? Thanks!
0
11,262,338
06/29/2012 13:04:23
1,401,020
05/17/2012 12:53:57
6
0
How to download a file through my server to the client? PHP
There's a file on a server. The file is a ZIP file. The file has to be downloaded through my server to the client. I tried using the readfile function but instead of downloading a file it just displays wierd symbols... This is the code: $file = "2title3.gif"; if(file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } I also tried using this: $url = 'http://example.com/some.url'; $src = fopen($url, 'r'); $dest = fopen('php://output', 'w'); $bytesCopied = stream_copy_to_stream($src, $dest); But it did the same thing... Just displayd wierd symbols. What am I doing wrong? http://php.net/manual/en/function.readfile.php Here it says it should work... Thanks!
php
file
download
remote
null
null
open
How to download a file through my server to the client? PHP === There's a file on a server. The file is a ZIP file. The file has to be downloaded through my server to the client. I tried using the readfile function but instead of downloading a file it just displays wierd symbols... This is the code: $file = "2title3.gif"; if(file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } I also tried using this: $url = 'http://example.com/some.url'; $src = fopen($url, 'r'); $dest = fopen('php://output', 'w'); $bytesCopied = stream_copy_to_stream($src, $dest); But it did the same thing... Just displayd wierd symbols. What am I doing wrong? http://php.net/manual/en/function.readfile.php Here it says it should work... Thanks!
0
11,262,343
06/29/2012 13:04:48
1,012,071
10/25/2011 04:15:13
33
2
Android: How to get the specific line of code that threw an error
I'm getting a java.lang.NullPointerException right when the app launches and it shuts down. The error from the emulator is "Unfortunately, appname has stopped". It was working fine, until I wrote a bunch of new code, and changed the manifest. Hopefully it's not the manifest, but my question is, how can I find out what line of code is the problem? The trace dump means nothing to me, and even though it's verbose, having ...11 more doesn't let me see the whole thing. I don't really know what that error means. I've searched for it, but there seems to be a list of things it could mean. I've tried Project>Clean, I've tried messing with the manifest again, but I still get the error. I've checked/unchecked external libraries. Just done what people have suggested to do for other people getting the same error. So I'd really like to know, what line set it off? Here is the output if this helps: 06-29 08:37:23.680: E/AndroidRuntime(1225): FATAL EXCEPTION: main 06-29 08:37:23.680: E/AndroidRuntime(1225): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.upliftly.android/com.upliftly.android.UpliftlyActivity}: java.lang.NullPointerException 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.access$600(ActivityThread.java:122) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.os.Handler.dispatchMessage(Handler.java:99) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.os.Looper.loop(Looper.java:137) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.main(ActivityThread.java:4340) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.reflect.Method.invokeNative(Native Method) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.reflect.Method.invoke(Method.java:511) 06-29 08:37:23.680: E/AndroidRuntime(1225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-29 08:37:23.680: E/AndroidRuntime(1225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-29 08:37:23.680: E/AndroidRuntime(1225): at dalvik.system.NativeStart.main(Native Method) 06-29 08:37:23.680: E/AndroidRuntime(1225): Caused by: java.lang.NullPointerException 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:101) 06-29 08:37:23.680: E/AndroidRuntime(1225): at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.Class.newInstanceImpl(Native Method) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.Class.newInstance(Class.java:1319) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870) 06-29 08:37:23.680: E/AndroidRuntime(1225): ... 11 more
android
error-handling
android-emulator
null
null
null
open
Android: How to get the specific line of code that threw an error === I'm getting a java.lang.NullPointerException right when the app launches and it shuts down. The error from the emulator is "Unfortunately, appname has stopped". It was working fine, until I wrote a bunch of new code, and changed the manifest. Hopefully it's not the manifest, but my question is, how can I find out what line of code is the problem? The trace dump means nothing to me, and even though it's verbose, having ...11 more doesn't let me see the whole thing. I don't really know what that error means. I've searched for it, but there seems to be a list of things it could mean. I've tried Project>Clean, I've tried messing with the manifest again, but I still get the error. I've checked/unchecked external libraries. Just done what people have suggested to do for other people getting the same error. So I'd really like to know, what line set it off? Here is the output if this helps: 06-29 08:37:23.680: E/AndroidRuntime(1225): FATAL EXCEPTION: main 06-29 08:37:23.680: E/AndroidRuntime(1225): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.upliftly.android/com.upliftly.android.UpliftlyActivity}: java.lang.NullPointerException 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.access$600(ActivityThread.java:122) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.os.Handler.dispatchMessage(Handler.java:99) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.os.Looper.loop(Looper.java:137) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.main(ActivityThread.java:4340) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.reflect.Method.invokeNative(Native Method) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.reflect.Method.invoke(Method.java:511) 06-29 08:37:23.680: E/AndroidRuntime(1225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-29 08:37:23.680: E/AndroidRuntime(1225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-29 08:37:23.680: E/AndroidRuntime(1225): at dalvik.system.NativeStart.main(Native Method) 06-29 08:37:23.680: E/AndroidRuntime(1225): Caused by: java.lang.NullPointerException 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:101) 06-29 08:37:23.680: E/AndroidRuntime(1225): at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.Class.newInstanceImpl(Native Method) 06-29 08:37:23.680: E/AndroidRuntime(1225): at java.lang.Class.newInstance(Class.java:1319) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 06-29 08:37:23.680: E/AndroidRuntime(1225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870) 06-29 08:37:23.680: E/AndroidRuntime(1225): ... 11 more
0
11,262,344
06/29/2012 13:04:56
1,324,125
04/10/2012 13:03:30
21
1
Accessing an old Progress v9.1e database
I have an old Progress version 9.1e Database file that I need to access. Is there some way to get an older version of OpenEdge to open this? I've had a thorough look at their website and have come up with nothing. I've also researched for two days with no luck. Any help or insights will be appreciated.
database
progress
openedge
progress-db
progress-database
null
open
Accessing an old Progress v9.1e database === I have an old Progress version 9.1e Database file that I need to access. Is there some way to get an older version of OpenEdge to open this? I've had a thorough look at their website and have come up with nothing. I've also researched for two days with no luck. Any help or insights will be appreciated.
0
11,234,677
06/27/2012 20:54:46
469,219
10/07/2010 14:37:13
145
7
JQGrid: Form isn't showing checkbox values
I have the following call to load a grid: $("#searchlist").jqGrid({ url:'./searchlibrary', datatype: 'json', mtype: 'POST', postData: {type: function(){return $('select[name="searchtype"]').val();}, criteria: function(){return getSearchData();} }, colNames:['Resource Name','Unit', 'Topic','Document Type','Content Type','Select'], colModel :[ {name:'resourceName', index:'resourceName', width:380, align:'left'}, {name:'unit', index:'unitID', width:40, align:'center',sortable:true,sorttype:'text'}, {name:'topic', index:'topicID', width:220, align:'center',sortable:true}, {name:'docType', index:'docTypeID', width:97, align:'center',sortable:true}, {name:'contentType', index:'contentTypeID', width:97, align:'center',sortable:true}, {name: 'select', width:55, align: "center", sortable: false, editable: true, edittype: "checkbox", editoptions: { value:"Yes:No" }, formatter:"checkbox",formatoptions: {disabled : false}} ], rowNum:20, sortname: 'resourceName', sortorder: 'asc', viewrecords: true, gridview: true, width:878, height:251 }); Notice the last item in the colModel section. Notice the editoptions section. When the grid is loaded it seems to be ignoring this. Checking the element in chrome shows the following code being generated: <input type="checkbox" value=" " offval="no"> Am I doing something wrong in the declaration?
jqgrid
null
null
null
null
null
open
JQGrid: Form isn't showing checkbox values === I have the following call to load a grid: $("#searchlist").jqGrid({ url:'./searchlibrary', datatype: 'json', mtype: 'POST', postData: {type: function(){return $('select[name="searchtype"]').val();}, criteria: function(){return getSearchData();} }, colNames:['Resource Name','Unit', 'Topic','Document Type','Content Type','Select'], colModel :[ {name:'resourceName', index:'resourceName', width:380, align:'left'}, {name:'unit', index:'unitID', width:40, align:'center',sortable:true,sorttype:'text'}, {name:'topic', index:'topicID', width:220, align:'center',sortable:true}, {name:'docType', index:'docTypeID', width:97, align:'center',sortable:true}, {name:'contentType', index:'contentTypeID', width:97, align:'center',sortable:true}, {name: 'select', width:55, align: "center", sortable: false, editable: true, edittype: "checkbox", editoptions: { value:"Yes:No" }, formatter:"checkbox",formatoptions: {disabled : false}} ], rowNum:20, sortname: 'resourceName', sortorder: 'asc', viewrecords: true, gridview: true, width:878, height:251 }); Notice the last item in the colModel section. Notice the editoptions section. When the grid is loaded it seems to be ignoring this. Checking the element in chrome shows the following code being generated: <input type="checkbox" value=" " offval="no"> Am I doing something wrong in the declaration?
0
11,234,678
06/27/2012 20:54:59
1,486,873
06/27/2012 20:43:34
1
0
Loading a pcap file
I am trying to write a tcp reconstruction program in c# , by using SharpPcap. So far I am doing a pretty good job, and the reconstruction is working fine. My only problem is, that in order to reconstruct big Pcap files by myself, I need to load them by parts/chunks to the memory, because sharppcap only let's me load the whole file( I think). Any suggestions? Thanks
c#
tcp
pcap
sharppcap
null
null
open
Loading a pcap file === I am trying to write a tcp reconstruction program in c# , by using SharpPcap. So far I am doing a pretty good job, and the reconstruction is working fine. My only problem is, that in order to reconstruct big Pcap files by myself, I need to load them by parts/chunks to the memory, because sharppcap only let's me load the whole file( I think). Any suggestions? Thanks
0
11,226,864
06/27/2012 13:03:40
1,214,054
02/16/2012 14:28:52
2
0
Fetch Php function variable with javascript
I need help, probobly an easy question for you that are good with javascript and php. I have an php file wich contains following code function render(){ //fetches all the data from input. $date = date("Y-m-d H:i:s"); $con = mysql_connect("127.0.0.1","root",""); $database = mysql_select_db("guestbook"); $name = $_POST['name']; $email = $_POST['email']; $post = $_POST['post']; $sql = "INSERT INTO gast(name, email, post, date) VALUES('$name','$email','$post','$date')"; $input = mysql_query($sql); mysql_close($con); and know a wan to with javscript fetch the variables set in the function. like document.getElementById('button').onclick = clicked; function clicked() { var namn = document.render.name.value; var post = document.render.post.value; var email = document.render.email.value; I have included the javascript file in my body. But it wont work, how do I get the value properly?
php
javascript
null
null
null
null
open
Fetch Php function variable with javascript === I need help, probobly an easy question for you that are good with javascript and php. I have an php file wich contains following code function render(){ //fetches all the data from input. $date = date("Y-m-d H:i:s"); $con = mysql_connect("127.0.0.1","root",""); $database = mysql_select_db("guestbook"); $name = $_POST['name']; $email = $_POST['email']; $post = $_POST['post']; $sql = "INSERT INTO gast(name, email, post, date) VALUES('$name','$email','$post','$date')"; $input = mysql_query($sql); mysql_close($con); and know a wan to with javscript fetch the variables set in the function. like document.getElementById('button').onclick = clicked; function clicked() { var namn = document.render.name.value; var post = document.render.post.value; var email = document.render.email.value; I have included the javascript file in my body. But it wont work, how do I get the value properly?
0
11,226,849
06/27/2012 13:02:55
920,796
08/31/2011 01:44:54
451
0
Is it possible to "dynamically" join a table only if that table is not joined yet?
I am using Ruby on Rails 3.2.2 and I would like to know if in a scope method it is possible to "dynamically" join a table only if that table is not joined yet. That it, I have: def self.scope_method_name(user) joins(:joining_association_name).where("joining_table_name.user_id = ?", user.it) end I would like to make something like the following (*note*: the following code is just a sample in order to understand what I mean): def self.scope_method_name(user) if table_is_joined(joining_table_name) where("joining_table_name.user_id = ?", user.it) else joins(:joining_association_name).where("joining_table_name.user_id = ?", user.it) end end **Is it possible? If so, how?** *Note*: I would like to use this approach in order to avoid [multiple database table statements in `INNER JOIN` of SQL queries][1]. [1]: http://stackoverflow.com/questions/11210241/what-means-happens-when-using-the-inner-join-with-multiple-database-table-st/11210262#11210262
ruby-on-rails
ruby
ruby-on-rails-3
join
conditional
null
open
Is it possible to "dynamically" join a table only if that table is not joined yet? === I am using Ruby on Rails 3.2.2 and I would like to know if in a scope method it is possible to "dynamically" join a table only if that table is not joined yet. That it, I have: def self.scope_method_name(user) joins(:joining_association_name).where("joining_table_name.user_id = ?", user.it) end I would like to make something like the following (*note*: the following code is just a sample in order to understand what I mean): def self.scope_method_name(user) if table_is_joined(joining_table_name) where("joining_table_name.user_id = ?", user.it) else joins(:joining_association_name).where("joining_table_name.user_id = ?", user.it) end end **Is it possible? If so, how?** *Note*: I would like to use this approach in order to avoid [multiple database table statements in `INNER JOIN` of SQL queries][1]. [1]: http://stackoverflow.com/questions/11210241/what-means-happens-when-using-the-inner-join-with-multiple-database-table-st/11210262#11210262
0
11,226,877
06/27/2012 13:04:11
169,640
09/07/2009 11:03:47
1,160
28
What identities are used for WCF Application running on IIS?
My web appkication has the following set up.. - WCF application hosted on IIS7 - Basic HTTP binding - SecurityMode = TransportCredentialOnly and ClientCredentialType = Windows. - .Net 4.0 - The app runs in a .Net 4.0 Application Pool using "ApplicationPoolIdentity". - IIS connects to the file system using "Application Pass Through" authentication. - The client and service both run under IIS - that is the client is a webste and the service is an IIS hosted WCF service. What I would like to understand is that what user accounts are used at the various points in authenticating too and using the service. - I understand that ApplicationPoolIdentity is a built in Windows account that is generated for each created application pool - is this the account under which w3wp.exe will run for the website? - No credentials are specified between clent and server - and this is the most interesting point. When my client connects to my WCF application what identity is used to authenticate to the service. I presume the application pool identity of the app pool hosting client website? - If so then what would happen if the two sites use two differnet app pools? - Or does the service just require a valid account on the machine (or domain) and that is good enough to authenticate? - If I changed the application pool to use a specific user account does this change anything? Again I presume as long as the client passes a valid machine account is that ok? Also,,, - What identity is used for the file system? - What permissions does "ApplicationPoolIdentity" have on the machine and for the file system. - Finally in the case of SQL Server Integrated security what identity is passed through to SQL server if my service talks to an SQL Server database. Thanks in advance.
wcf
iis
windows-server-2008
application-pool
null
null
open
What identities are used for WCF Application running on IIS? === My web appkication has the following set up.. - WCF application hosted on IIS7 - Basic HTTP binding - SecurityMode = TransportCredentialOnly and ClientCredentialType = Windows. - .Net 4.0 - The app runs in a .Net 4.0 Application Pool using "ApplicationPoolIdentity". - IIS connects to the file system using "Application Pass Through" authentication. - The client and service both run under IIS - that is the client is a webste and the service is an IIS hosted WCF service. What I would like to understand is that what user accounts are used at the various points in authenticating too and using the service. - I understand that ApplicationPoolIdentity is a built in Windows account that is generated for each created application pool - is this the account under which w3wp.exe will run for the website? - No credentials are specified between clent and server - and this is the most interesting point. When my client connects to my WCF application what identity is used to authenticate to the service. I presume the application pool identity of the app pool hosting client website? - If so then what would happen if the two sites use two differnet app pools? - Or does the service just require a valid account on the machine (or domain) and that is good enough to authenticate? - If I changed the application pool to use a specific user account does this change anything? Again I presume as long as the client passes a valid machine account is that ok? Also,,, - What identity is used for the file system? - What permissions does "ApplicationPoolIdentity" have on the machine and for the file system. - Finally in the case of SQL Server Integrated security what identity is passed through to SQL server if my service talks to an SQL Server database. Thanks in advance.
0
11,226,878
06/27/2012 13:04:11
263,525
02/01/2010 13:30:50
8,170
446
Why do I need to escape unicode in java source files?
Please note that I'm not asking how but why. And I don't know if it's a RCP specific problem or if it's something inherent to java. My java source files are encoded in UTF-8. If I define my literal strings like this : new Language("fr", "Français"), new Language("zh", "中文") It works as I expect when I use the string in the application by launching it from Eclipse as a RAP application : ![enter image description here][1] But if fails when I launch the .exe built by the "Eclipse Product Export Wizard" : ![enter image description here][2] The solution I use is to escape the chars like this : new Language("fr", "Fran\u00e7ais"), // Français new Language("zh", "\u4e2d\u6587") // 中文 There is no problem in doing this (all my other strings are in properties files, only the languages names are hardcoded) but I'd like to understand. I thought the compiler had to convert the java literal strings when building [the bytecode](http://en.wikipedia.org/wiki/Java_class_file#The_constant_pool). So why is the unicode escaping necessary ? Is it wrong to use use high range unicode chars in java source files ? What happens exactly to those chars at compilation and in what it is different from the handling of escaped chars ? [1]: http://i.stack.imgur.com/5iMfZ.png [2]: http://i.stack.imgur.com/anwJs.png
java
unicode
eclipse-rcp
unicode-escapes
null
null
open
Why do I need to escape unicode in java source files? === Please note that I'm not asking how but why. And I don't know if it's a RCP specific problem or if it's something inherent to java. My java source files are encoded in UTF-8. If I define my literal strings like this : new Language("fr", "Français"), new Language("zh", "中文") It works as I expect when I use the string in the application by launching it from Eclipse as a RAP application : ![enter image description here][1] But if fails when I launch the .exe built by the "Eclipse Product Export Wizard" : ![enter image description here][2] The solution I use is to escape the chars like this : new Language("fr", "Fran\u00e7ais"), // Français new Language("zh", "\u4e2d\u6587") // 中文 There is no problem in doing this (all my other strings are in properties files, only the languages names are hardcoded) but I'd like to understand. I thought the compiler had to convert the java literal strings when building [the bytecode](http://en.wikipedia.org/wiki/Java_class_file#The_constant_pool). So why is the unicode escaping necessary ? Is it wrong to use use high range unicode chars in java source files ? What happens exactly to those chars at compilation and in what it is different from the handling of escaped chars ? [1]: http://i.stack.imgur.com/5iMfZ.png [2]: http://i.stack.imgur.com/anwJs.png
0
11,226,882
06/27/2012 13:04:21
1,485,689
06/27/2012 12:49:16
1
0
How to navigate to dynamic view using ArrayList
sorry for my poor English. I seached for hours but I couldn't find any solution for my problem. I want to navigate my view to another from getting name of view from arrayList in DataProvider. How can I get the clicked item's url and navigate as View. Thanks.. <s:List id="listMenu" top="0" bottom="0" left="0" right="0" height="100%" width="100%" click="navigator.pushView(listMenu.url as View)"> <s:dataProvider> <s:ArrayList> <fx:Object name="Title1" detail="Detail1" src="@Embed('../media/graphics/credit-card.png')" url="View1" /> <fx:Object name="Title2 Sorgulama" detail="Detail2" src="@Embed('../media/graphics/IMEI.png')" url="View2" /> </s:ArrayList> </s:dataProvider> <s:itemRenderer> <fx:Component> <s:IconItemRenderer labelField="name" messageField="detail" iconField="src" iconWidth="64" iconHeight="64" height="68" /> </fx:Component> </s:itemRenderer> </s:List>
flex
flash-builder
flex4.5
null
null
null
open
How to navigate to dynamic view using ArrayList === sorry for my poor English. I seached for hours but I couldn't find any solution for my problem. I want to navigate my view to another from getting name of view from arrayList in DataProvider. How can I get the clicked item's url and navigate as View. Thanks.. <s:List id="listMenu" top="0" bottom="0" left="0" right="0" height="100%" width="100%" click="navigator.pushView(listMenu.url as View)"> <s:dataProvider> <s:ArrayList> <fx:Object name="Title1" detail="Detail1" src="@Embed('../media/graphics/credit-card.png')" url="View1" /> <fx:Object name="Title2 Sorgulama" detail="Detail2" src="@Embed('../media/graphics/IMEI.png')" url="View2" /> </s:ArrayList> </s:dataProvider> <s:itemRenderer> <fx:Component> <s:IconItemRenderer labelField="name" messageField="detail" iconField="src" iconWidth="64" iconHeight="64" height="68" /> </fx:Component> </s:itemRenderer> </s:List>
0
11,226,883
06/27/2012 13:04:22
1,132,627
01/05/2012 16:34:31
16
0
Using hidden in HTML form
<html> <head> <title>Student to search into database</title> <script language="javascript"> function validate2(objForm){ int k = 0; if(objForm.name.value.length==0){ objForm.name.focus(); k++; } if(objForm.year.value.length==0){ objForm.year.focus(); k++; } if(objForm.id.value.length==0){ objForm.year.focus(); k++; } if(k == 0){ return false; } return true; } </script> </head> <body bgcolor=#ADD8E6><center> <form action="FoundStudents.jsp" method="post" name="entry" onSubmit="validate(this)"> <input type="hidden" value="list" name="seek_stud"> <table border="1" cellpadding="5" cellspacing="5" bgcolor = #333366> <tr> <td> <table> <tr><td colspan="2" align="center"><h2><font color= #FFFF66>Please insert student data</font></h2></td></tr> <tr><td colspan="2">&nbsp;</td></tr> <tr><td><font color= #FFFF66>Name:</font></td><td><input name="name" type="text" size="50"></td></tr> <tr><td><font color= #FFFF66>Year:</td><td><input name="year" type="text" size="50"></td></tr> <tr><td><font color= #FFFF66>ID:</td><td><input name="id" type="text" size="10"></td></tr> <tr><td colspan="2" align="center"><input name= "submit_seek_stud" type="submit" value="Submit"></td></tr> </table> </td> </tr> </table> </form> </body> </html> The form works only with the `<input type="hidden" value="list" name="seek_stud">`. Could someone please explain me why is this line necessary(what does it actually do)? Because I found on Google that [B]hidden[/B] is used only when you submit some information(not visible to the user) in addition to what the user types, and I am not sending such additional information. :confused: Thank you in advance!
forms
hidden
null
null
null
null
open
Using hidden in HTML form === <html> <head> <title>Student to search into database</title> <script language="javascript"> function validate2(objForm){ int k = 0; if(objForm.name.value.length==0){ objForm.name.focus(); k++; } if(objForm.year.value.length==0){ objForm.year.focus(); k++; } if(objForm.id.value.length==0){ objForm.year.focus(); k++; } if(k == 0){ return false; } return true; } </script> </head> <body bgcolor=#ADD8E6><center> <form action="FoundStudents.jsp" method="post" name="entry" onSubmit="validate(this)"> <input type="hidden" value="list" name="seek_stud"> <table border="1" cellpadding="5" cellspacing="5" bgcolor = #333366> <tr> <td> <table> <tr><td colspan="2" align="center"><h2><font color= #FFFF66>Please insert student data</font></h2></td></tr> <tr><td colspan="2">&nbsp;</td></tr> <tr><td><font color= #FFFF66>Name:</font></td><td><input name="name" type="text" size="50"></td></tr> <tr><td><font color= #FFFF66>Year:</td><td><input name="year" type="text" size="50"></td></tr> <tr><td><font color= #FFFF66>ID:</td><td><input name="id" type="text" size="10"></td></tr> <tr><td colspan="2" align="center"><input name= "submit_seek_stud" type="submit" value="Submit"></td></tr> </table> </td> </tr> </table> </form> </body> </html> The form works only with the `<input type="hidden" value="list" name="seek_stud">`. Could someone please explain me why is this line necessary(what does it actually do)? Because I found on Google that [B]hidden[/B] is used only when you submit some information(not visible to the user) in addition to what the user types, and I am not sending such additional information. :confused: Thank you in advance!
0
11,567,640
07/19/2012 19:06:53
426,305
08/20/2010 11:51:58
517
25
Loading model using Jeff Lamarches script
I'm trying to load 3D model into scene using Jeff Lamarches python script to export 3D model into Objective C header file in Blender. I'm using Blender version : 2.63a Got Lamarche's script from here : https://github.com/jlamarche/iOS-OpenGLES-Stuff What I did - Installed the script as it is described in instructions - Opened blender with default cube - Tried to export Objective C header file of the default 3D The header file is generated without any vertex data, any idea why this happens ? Please provide any reference that might help me to load 3D model into iOS GL context with its texture.
iphone
objective-c
ios
opengl
opengl-es
null
open
Loading model using Jeff Lamarches script === I'm trying to load 3D model into scene using Jeff Lamarches python script to export 3D model into Objective C header file in Blender. I'm using Blender version : 2.63a Got Lamarche's script from here : https://github.com/jlamarche/iOS-OpenGLES-Stuff What I did - Installed the script as it is described in instructions - Opened blender with default cube - Tried to export Objective C header file of the default 3D The header file is generated without any vertex data, any idea why this happens ? Please provide any reference that might help me to load 3D model into iOS GL context with its texture.
0
11,567,644
07/19/2012 19:07:02
101,890
05/05/2009 22:39:46
507
9
Hibernate/JPA Bidirectional cascade saveOrUpdate
I am trying to have a many-to-many bidirectional relationship for 2 entities (News and Tag). But when I try to saveOrUpdate the News (which has Set<Tag>), somehow it always saves a new set of Tag even id is already populated in the Tag Is it something wrong with my annotation? News.java @Id @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") @Column(name = "NEWS_ID") public Long getId() { return id; } @ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @Cascade( org.hibernate.annotations.CascadeType.SAVE_UPDATE ) @JoinTable(name = "NEWS_TAGS", joinColumns = @JoinColumn(name = "NEWS_ID"), inverseJoinColumns = @JoinColumn(name = "TAG_ID")) public Set<Tag> getTags() { return tags; } Tag.java @Id @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") @Column(name = "TAG_ID") public Long getId() { return id; } private Collection<News> news; @JsonIgnore @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "tags") public Collection<News> getNews() { return news; } NewsDAO public void save(News news){ this.hibernateSessionFactory.getCurrentSession().saveOrUpdate(news); } What I want to do is when, I save "News", the related Set<Tag> will be ignored if Tag exist, and will insert new if Tag isn't, is this possible? Please advise
java
hibernate
jpa
hibernate-4.x
null
null
open
Hibernate/JPA Bidirectional cascade saveOrUpdate === I am trying to have a many-to-many bidirectional relationship for 2 entities (News and Tag). But when I try to saveOrUpdate the News (which has Set<Tag>), somehow it always saves a new set of Tag even id is already populated in the Tag Is it something wrong with my annotation? News.java @Id @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") @Column(name = "NEWS_ID") public Long getId() { return id; } @ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @Cascade( org.hibernate.annotations.CascadeType.SAVE_UPDATE ) @JoinTable(name = "NEWS_TAGS", joinColumns = @JoinColumn(name = "NEWS_ID"), inverseJoinColumns = @JoinColumn(name = "TAG_ID")) public Set<Tag> getTags() { return tags; } Tag.java @Id @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") @Column(name = "TAG_ID") public Long getId() { return id; } private Collection<News> news; @JsonIgnore @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "tags") public Collection<News> getNews() { return news; } NewsDAO public void save(News news){ this.hibernateSessionFactory.getCurrentSession().saveOrUpdate(news); } What I want to do is when, I save "News", the related Set<Tag> will be ignored if Tag exist, and will insert new if Tag isn't, is this possible? Please advise
0
11,567,652
07/19/2012 19:07:19
244,061
01/05/2010 15:56:02
1,515
39
How do you remove inex.php from a url using mod_write, while still allowing php to see the path with index.php in it?
For the past 3 days I have been playing around with Apache's mod_rewrite trying to get it to remove index.php from my url, while php still needs to see it in the path. Essentially PHP needs to see this http://site.com/index.php/Page/Param1/Param2 While the user needs to see this http://site.com/Page/Param1/Param2 What I have right now is the following in an htaccess file Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L,QSA] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC] RewriteRule ^ /%1 [R=301,L] Which was taken from another page, and is close to what I need. However this seems to be cutting off everything after the `http://site.com/` part. How can I get mod_rewrite to show the user one thing and have php see something else?
mod-rewrite
null
null
null
null
null
open
How do you remove inex.php from a url using mod_write, while still allowing php to see the path with index.php in it? === For the past 3 days I have been playing around with Apache's mod_rewrite trying to get it to remove index.php from my url, while php still needs to see it in the path. Essentially PHP needs to see this http://site.com/index.php/Page/Param1/Param2 While the user needs to see this http://site.com/Page/Param1/Param2 What I have right now is the following in an htaccess file Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L,QSA] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC] RewriteRule ^ /%1 [R=301,L] Which was taken from another page, and is close to what I need. However this seems to be cutting off everything after the `http://site.com/` part. How can I get mod_rewrite to show the user one thing and have php see something else?
0
11,567,654
07/19/2012 19:07:40
652,201
03/09/2011 18:57:43
122
4
Rails App doesn't work on production enviroment
I have a rails app set up with Nginx + Passenger. When i have rails_env development; on my nginx.conf everything works fine, but when I remove it so the app get server on production env it just doesnt work, seems like its not loading gems or something. Feel free to take a look at the errors here [www.luisurraca.co.cc][1] error message: undefined method `has_attached_file' for #<Class:0x00000003b0be10> Exception class: NoMethodError Right now its referring to the paperclip gem, but if i start removing gems from the gemfile it will display error from some other gem and so on. Any ideas what the issue might be? [1]: http://www.luisurraca.co.cc
ruby-on-rails-3
nginx
phusion-passenger
null
null
null
open
Rails App doesn't work on production enviroment === I have a rails app set up with Nginx + Passenger. When i have rails_env development; on my nginx.conf everything works fine, but when I remove it so the app get server on production env it just doesnt work, seems like its not loading gems or something. Feel free to take a look at the errors here [www.luisurraca.co.cc][1] error message: undefined method `has_attached_file' for #<Class:0x00000003b0be10> Exception class: NoMethodError Right now its referring to the paperclip gem, but if i start removing gems from the gemfile it will display error from some other gem and so on. Any ideas what the issue might be? [1]: http://www.luisurraca.co.cc
0
11,567,655
07/19/2012 19:07:45
1,538,798
07/19/2012 18:30:44
1
0
image registration: obtaining overlapped region for similarity measure when transforming template across reference
while we are registering one image to another image(of the same size),we transformed the template image to the reference image. Assuming that the template partially overlapped onto the reference boundary area,how do we extract out the overlapped region tocompute the similarity measure...(eg with ncc or mi) Likewise, what is the search range any reference example or code in opencv? thanks in advance
image
opencv
registration
null
null
null
open
image registration: obtaining overlapped region for similarity measure when transforming template across reference === while we are registering one image to another image(of the same size),we transformed the template image to the reference image. Assuming that the template partially overlapped onto the reference boundary area,how do we extract out the overlapped region tocompute the similarity measure...(eg with ncc or mi) Likewise, what is the search range any reference example or code in opencv? thanks in advance
0
11,558,157
07/19/2012 09:48:21
363,603
06/10/2010 15:18:52
522
7
Reading info from existing pom.xml file using Gradle?
In Ant the maven-ant-tasks.jar can be used to read maven properties like this: <artifact:pom id="mypom" file="maven-project/pom.xml" /> <property name="pom.version" value="${mypom.version}"/> Is there "native" support in Gradle for accessing pom elements from an existing physical pom.xml file or do I need to go through the above Ant approach in my .gradle file to make this work? This page: http://gradle.org/docs/current/userguide/maven_plugin.html has info on generating pom files but thats not what I am looking for.
ant
gradle
null
null
null
null
open
Reading info from existing pom.xml file using Gradle? === In Ant the maven-ant-tasks.jar can be used to read maven properties like this: <artifact:pom id="mypom" file="maven-project/pom.xml" /> <property name="pom.version" value="${mypom.version}"/> Is there "native" support in Gradle for accessing pom elements from an existing physical pom.xml file or do I need to go through the above Ant approach in my .gradle file to make this work? This page: http://gradle.org/docs/current/userguide/maven_plugin.html has info on generating pom files but thats not what I am looking for.
0
11,567,660
07/19/2012 19:07:53
1,538,578
07/19/2012 16:49:00
1
0
Apache 2.2 VirtualHosts URL not found
I'm hoping you can help. I have an existing Apache 2.2 server which serves a website I maintain. I am attempting to add additional websites for a colleague. Having done so, I get the following when I attempt to access the URL: > Not Found The requested URL / was not found on this server. Here's a summary of my httpd-vhosts.conf file. I have three new, roughly identical, hosts that aren't working. Only NDV and the default are working. NameVirtualHost *:80 <VirtualHost anycast.ns.cs.boeing.com:80> ServerName anycast.ns.cs.boeing.com ServerAdmin [email protected] DocumentRoot "/opt/www/anycast" ScriptAlias /cgi-bin "/opt/www/anycast/cgi-bin/" ErrorLog "logs/grant_error_log" CustomLog "logs/grant_access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/opt/httpd/manual" ServerAlias ntpm-application-01.ns.cs.boeing.com ErrorLog "logs/error_log" CustomLog "logs/access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/opt/www/ndv/html" ServerName ndv.web.boeing.com ScriptAlias /cgi-bin/ "/opt/www/ndv/cgi-bin/" ErrorLog "logs/error_log" CustomLog "logs/access_log" common </VirtualHost> <Directory "/opt/www/ndv/html/" > Options Indexes FollowSymLinks Includes AddType text/html .shtml AddOutputFilter INCLUDES .shtml Order allow,deny Allow from all </Directory> <Directory "/opt/www/anycast/html/" > Options Indexes FollowSymLinks Includes Order allow,deny Allow from all </Directory> Based on the config above, this is what the server is seeing. $ sudo bin/apachectl -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server ntpm-application-01.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:30) port 80 namevhost ntpm-application-01.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:30) port 80 namevhost ndv.web.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:39) port 80 namevhost anycast.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:48) port 80 namevhost ntpget.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:60) port 80 namevhost dnsdig.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:70) Syntax OK
apache
apache2
virtualhost
vhosts
virtual-hosts
null
open
Apache 2.2 VirtualHosts URL not found === I'm hoping you can help. I have an existing Apache 2.2 server which serves a website I maintain. I am attempting to add additional websites for a colleague. Having done so, I get the following when I attempt to access the URL: > Not Found The requested URL / was not found on this server. Here's a summary of my httpd-vhosts.conf file. I have three new, roughly identical, hosts that aren't working. Only NDV and the default are working. NameVirtualHost *:80 <VirtualHost anycast.ns.cs.boeing.com:80> ServerName anycast.ns.cs.boeing.com ServerAdmin [email protected] DocumentRoot "/opt/www/anycast" ScriptAlias /cgi-bin "/opt/www/anycast/cgi-bin/" ErrorLog "logs/grant_error_log" CustomLog "logs/grant_access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/opt/httpd/manual" ServerAlias ntpm-application-01.ns.cs.boeing.com ErrorLog "logs/error_log" CustomLog "logs/access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/opt/www/ndv/html" ServerName ndv.web.boeing.com ScriptAlias /cgi-bin/ "/opt/www/ndv/cgi-bin/" ErrorLog "logs/error_log" CustomLog "logs/access_log" common </VirtualHost> <Directory "/opt/www/ndv/html/" > Options Indexes FollowSymLinks Includes AddType text/html .shtml AddOutputFilter INCLUDES .shtml Order allow,deny Allow from all </Directory> <Directory "/opt/www/anycast/html/" > Options Indexes FollowSymLinks Includes Order allow,deny Allow from all </Directory> Based on the config above, this is what the server is seeing. $ sudo bin/apachectl -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server ntpm-application-01.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:30) port 80 namevhost ntpm-application-01.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:30) port 80 namevhost ndv.web.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:39) port 80 namevhost anycast.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:48) port 80 namevhost ntpget.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:60) port 80 namevhost dnsdig.ns.cs.boeing.com (/opt/httpd/conf/extra/httpd-vhosts.conf:70) Syntax OK
0
11,567,662
07/19/2012 19:08:05
627,684
02/22/2011 04:13:10
73
2
How do I run a windows installer via telnet using the trial version?
I'm evaluating install4j in our company. We build a win32 installer and we are trying to set up a continuous integration environment to test it. The CI server is able to upload the installer to the windows target machine (which is a virtualized environment) using FTP, and run batch script that looks like cd c:\tmp\upload\ my_installer.exe -q -varfile response.varfile -console Currently we're using the trial version of install4j 5. When the installer is ran from the command line (cmd.exe over remote desktop) I get a popup window that warns about the trial version. Installation is frozen until I click ok. When the installer is ran from telnet the command just hangs and never returns. I believe the reason is that popup window. To fully evaluate install4j we need to be able see how it fits our CI process. Is there any workaround for this?
install4j
null
null
null
null
null
open
How do I run a windows installer via telnet using the trial version? === I'm evaluating install4j in our company. We build a win32 installer and we are trying to set up a continuous integration environment to test it. The CI server is able to upload the installer to the windows target machine (which is a virtualized environment) using FTP, and run batch script that looks like cd c:\tmp\upload\ my_installer.exe -q -varfile response.varfile -console Currently we're using the trial version of install4j 5. When the installer is ran from the command line (cmd.exe over remote desktop) I get a popup window that warns about the trial version. Installation is frozen until I click ok. When the installer is ran from telnet the command just hangs and never returns. I believe the reason is that popup window. To fully evaluate install4j we need to be able see how it fits our CI process. Is there any workaround for this?
0
11,298,387
07/02/2012 17:30:49
414,414
08/08/2010 15:12:12
1
0
Self-signed Applet throws SecurityException when writing to file
I want to make an Applet that's capable of downloading files to a computer, and then opening them in the associated editor (when the file is saved, it is supposed to be uploaded back again). However, before I spend hours getting it to work, I have to make sure that it is actually manageable (Have done it with a Java Desktop Application just not an Applet). So I wrote a simple applet that creates a file if it doesn't exist. The app is **signed** and loads in the browser as it should. The following is written to the screen: > IO Exception: Access is denied I have labeled the different errors, so I know which one that fails. Below is my applet: import javax.swing.*; import java.security.*; import java.io.*; public class DocumentApplet extends JApplet { private static final long serialVersionUID = -2354727776089972258L; public void start () { add ( new JButton ("Hello, World") ); AccessControlContext acc = (AccessControlContext) System.getSecurityManager().getSecurityContext(); try { acc.checkPermission(new FilePermission("test.txt", "write")); } catch (SecurityException e) { add (new JLabel ("Permission Exception: " + e.getMessage())); return; } try { File f = AccessController.<File>doPrivileged(new PrivilegedAction<File>() { public File run() { return new File ("test.txt"); } }); if ( ! f.exists()) { f.createNewFile(); } } catch (AccessControlException e) { add (new JLabel ("Access: " + e.getMessage())); } catch (IOException e) { add ( new JLabel ("IO Exception: " + e.getMessage())); } } } It is the last exception that is being thrown. Note that the first thing I do, is to check permissions. That check does not fail. The Applet is self-signed, but this is only temporary. ***I do not want to spend hundreds of dollars in buying a certificate, if the applet is failing..***. When I run the app with *appletviewer*, the code works. That's OK, but I need to know that it will work when I buy a real certificate. HTML Code: <applet code="DocumentApplet" archive="applet.jar" width="300" height="200"> </applet> PS: I have also spent the last two days reading on Stackoverflow and searching Google. I strongly believe I have done everything I am supposed to do...
java
applet
securityexception
self-signed
null
null
open
Self-signed Applet throws SecurityException when writing to file === I want to make an Applet that's capable of downloading files to a computer, and then opening them in the associated editor (when the file is saved, it is supposed to be uploaded back again). However, before I spend hours getting it to work, I have to make sure that it is actually manageable (Have done it with a Java Desktop Application just not an Applet). So I wrote a simple applet that creates a file if it doesn't exist. The app is **signed** and loads in the browser as it should. The following is written to the screen: > IO Exception: Access is denied I have labeled the different errors, so I know which one that fails. Below is my applet: import javax.swing.*; import java.security.*; import java.io.*; public class DocumentApplet extends JApplet { private static final long serialVersionUID = -2354727776089972258L; public void start () { add ( new JButton ("Hello, World") ); AccessControlContext acc = (AccessControlContext) System.getSecurityManager().getSecurityContext(); try { acc.checkPermission(new FilePermission("test.txt", "write")); } catch (SecurityException e) { add (new JLabel ("Permission Exception: " + e.getMessage())); return; } try { File f = AccessController.<File>doPrivileged(new PrivilegedAction<File>() { public File run() { return new File ("test.txt"); } }); if ( ! f.exists()) { f.createNewFile(); } } catch (AccessControlException e) { add (new JLabel ("Access: " + e.getMessage())); } catch (IOException e) { add ( new JLabel ("IO Exception: " + e.getMessage())); } } } It is the last exception that is being thrown. Note that the first thing I do, is to check permissions. That check does not fail. The Applet is self-signed, but this is only temporary. ***I do not want to spend hundreds of dollars in buying a certificate, if the applet is failing..***. When I run the app with *appletviewer*, the code works. That's OK, but I need to know that it will work when I buy a real certificate. HTML Code: <applet code="DocumentApplet" archive="applet.jar" width="300" height="200"> </applet> PS: I have also spent the last two days reading on Stackoverflow and searching Google. I strongly believe I have done everything I am supposed to do...
0
11,298,388
07/02/2012 17:30:49
1,283,675
03/21/2012 14:45:47
6
0
Passing a member function pointer(s)
My situation is following, I have two different bisection functions what will be called at some point in my code. Basically some function calls Bisection2 and this function calls either the passed function or it passes the function pointer to Bisection function. in header I have std::vector<double> F(); double F1(double m1, double m2); double F2(double m1, double m2); typedef double (MyClass::*MyClassFn)(double,double); double Bisection(MyClassFn fEval,double min, double max,std::vector<double> args); bool Bisection2(MyClassFn fEval1,MyClassFn fEval2,double xmin, double xmax, double ymin, double ymax,double *ax, double *ay,std::vector<double> args); And my bisection functions look like this. I didn't include all the code because it's not necessary. double MyClass::F1(double m1, double m2) { m_m1 = m1; m_m2 = m2; F(); return m_my; } double MyClass::F2(double m1, double m2) { m_m1 = m1; m_m2 = m2; F(); return m_mx; } double MyClass::Bisection(MyClass fEval,double min, double max,std::vector<double> args) { // Setting a lot of stuff here, including auxiliary and leftvalue... MyClass *pObj = new MyClass(-1); leftvalue = pObj->*fEval(auxiliary, left); ightvalue = pObj->*fEval(auxiliary, right); // Comparing and setting values here etc. } bool MyClass::Bisection2(MyClassFn fEval1,MyClassFn fEval2,double xmin, double xmax, double ymin, double ymax,double *ax, double *ay,std::vector<double> args) { // Setting some values here but these have nothing to do with the problem. double yl; double leftvalue, rightvalue, middlevalue; MyClass *pObj = new MyClass(-1); // Setting some values here but these have nothing to do with the problem. std::vector <double> arg; // pushing some values yl = Bisection(fEval2,ymin,ymax,arg); // Here is the first way how I need to pass fEval2 to Bisection function. arg.clear(); if(isnan(yl)) { return M_NAN; } leftvalue = pObj->fEval1(xl, yl); // And here is the second way how I need to use fEval1. //..... } And then I have basically a function what calls `Bisection2(F1,F2, m_m2,0.0, 0.0, m_max2, &m_mu1, &m_mu2,args); The Bisection2(...) call may be incorrect at the moment because I've changed the functions a lot since this worked last time. Last time I basically called F1 and F2 function pointers directly inside the functions instead of fEval's but I'm quite sure it was incorrect way after all even thought it seemed to work somehow. Now leftvalue = pObj->*fEval(auxiliary, left); causes compiling errors: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘fEval (...)’, e.g. ‘(... ->* fEval) (...)’ I've tried to see help from here [http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2][1] and also checked maybe different solved problems in these forums but still can't figure out what I'm doing wrong. Thank you. [1]: http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2
c++
function-pointers
null
null
null
null
open
Passing a member function pointer(s) === My situation is following, I have two different bisection functions what will be called at some point in my code. Basically some function calls Bisection2 and this function calls either the passed function or it passes the function pointer to Bisection function. in header I have std::vector<double> F(); double F1(double m1, double m2); double F2(double m1, double m2); typedef double (MyClass::*MyClassFn)(double,double); double Bisection(MyClassFn fEval,double min, double max,std::vector<double> args); bool Bisection2(MyClassFn fEval1,MyClassFn fEval2,double xmin, double xmax, double ymin, double ymax,double *ax, double *ay,std::vector<double> args); And my bisection functions look like this. I didn't include all the code because it's not necessary. double MyClass::F1(double m1, double m2) { m_m1 = m1; m_m2 = m2; F(); return m_my; } double MyClass::F2(double m1, double m2) { m_m1 = m1; m_m2 = m2; F(); return m_mx; } double MyClass::Bisection(MyClass fEval,double min, double max,std::vector<double> args) { // Setting a lot of stuff here, including auxiliary and leftvalue... MyClass *pObj = new MyClass(-1); leftvalue = pObj->*fEval(auxiliary, left); ightvalue = pObj->*fEval(auxiliary, right); // Comparing and setting values here etc. } bool MyClass::Bisection2(MyClassFn fEval1,MyClassFn fEval2,double xmin, double xmax, double ymin, double ymax,double *ax, double *ay,std::vector<double> args) { // Setting some values here but these have nothing to do with the problem. double yl; double leftvalue, rightvalue, middlevalue; MyClass *pObj = new MyClass(-1); // Setting some values here but these have nothing to do with the problem. std::vector <double> arg; // pushing some values yl = Bisection(fEval2,ymin,ymax,arg); // Here is the first way how I need to pass fEval2 to Bisection function. arg.clear(); if(isnan(yl)) { return M_NAN; } leftvalue = pObj->fEval1(xl, yl); // And here is the second way how I need to use fEval1. //..... } And then I have basically a function what calls `Bisection2(F1,F2, m_m2,0.0, 0.0, m_max2, &m_mu1, &m_mu2,args); The Bisection2(...) call may be incorrect at the moment because I've changed the functions a lot since this worked last time. Last time I basically called F1 and F2 function pointers directly inside the functions instead of fEval's but I'm quite sure it was incorrect way after all even thought it seemed to work somehow. Now leftvalue = pObj->*fEval(auxiliary, left); causes compiling errors: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘fEval (...)’, e.g. ‘(... ->* fEval) (...)’ I've tried to see help from here [http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2][1] and also checked maybe different solved problems in these forums but still can't figure out what I'm doing wrong. Thank you. [1]: http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2
0
11,298,390
07/02/2012 17:30:58
1,418,227
05/25/2012 20:42:39
20
0
C++ socket server to Flash/Adobe AIR?
I am using AIR to do some augmented reality using fudicial marker tracking. I am using FLARToolkit and it works fine, except the frame rate drops to ridiculous lows in certain lighting conditions. This is because Flash only uses the CPU for processing, and every frame it is applying filters, adjusting thresholds, and analyzing the pixels to find the marker pattern. Without any hardware acceleration, it can get really slow. I did some searching and it looks like the fastest and most stable tracking library is Studierstube ( http://handheldar.icg.tugraz.at/stbtracker.php and http://studierstube.icg.tugraz.at/download.php ). Unfortunately, I am not a C++ developer. But it seems that the tracking is insanely fast using this tracker (especially since it isn't all CPU processing like Flash is). So my plan is to build (or rather have someone build) a small C++ program that leverages this tracker, and then sends the marker position data every frame (only need 30 FPS) to my Flash client application to display back the video and some augmented reality experiences. I believe this would be done through a socket server or something right? Is this possible and fairly easy for someone who is a decent C++ developer? I would ask him/her but I am in search for such a person.
c++
actionscript-3
air
augmented-reality
socketserver
null
open
C++ socket server to Flash/Adobe AIR? === I am using AIR to do some augmented reality using fudicial marker tracking. I am using FLARToolkit and it works fine, except the frame rate drops to ridiculous lows in certain lighting conditions. This is because Flash only uses the CPU for processing, and every frame it is applying filters, adjusting thresholds, and analyzing the pixels to find the marker pattern. Without any hardware acceleration, it can get really slow. I did some searching and it looks like the fastest and most stable tracking library is Studierstube ( http://handheldar.icg.tugraz.at/stbtracker.php and http://studierstube.icg.tugraz.at/download.php ). Unfortunately, I am not a C++ developer. But it seems that the tracking is insanely fast using this tracker (especially since it isn't all CPU processing like Flash is). So my plan is to build (or rather have someone build) a small C++ program that leverages this tracker, and then sends the marker position data every frame (only need 30 FPS) to my Flash client application to display back the video and some augmented reality experiences. I believe this would be done through a socket server or something right? Is this possible and fairly easy for someone who is a decent C++ developer? I would ask him/her but I am in search for such a person.
0
11,298,391
07/02/2012 17:31:05
507,043
11/13/2010 23:31:13
186
4
glBlitFramebuffer() renders empty screen when fragment out is vec3
I am using OpenGL 4.0, formerly was using 3.3 I have a fragment shader with 3 outputs -each one is vec3 .I am writing these outputs to some FBO then trying to test the content using The glBlitFramebuffer() method.I am getting the empty screen.Now ,I figured out that setting the outputs to be of vec4 type works correctly.I don't understand why! My FBO textures are set to RGB32F so they should be able to accept vec3 from fragments. Here is my FBO setup (That is Java LWJGL wrapper but it doesn't matter here): _fbo = glGenFramebuffers(); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo); glGenTextures(m_textures); _depthTexture = glGenTextures(); for (int i = 0; i < GBUFFER_NUM_TEXTURES; i++) { glBindTexture(GL_TEXTURE_2D, m_textures.get(i));// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, (ByteBuffer) null); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i , GL_TEXTURE_2D,m_textures.get(i), 0);// } // depth glBindTexture(GL_TEXTURE_2D, _depthTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, (ByteBuffer) null); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _depthTexture, 0); DrawBuffers = BufferUtils.createIntBuffer(GBUFFER_NUM_TEXTURES); DrawBuffers.put(0, GL_COLOR_ATTACHMENT0); DrawBuffers.put(1, GL_COLOR_ATTACHMENT1); DrawBuffers.put(2, GL_COLOR_ATTACHMENT2); glDrawBuffers(DrawBuffers);
opengl
fbo
blit
null
null
null
open
glBlitFramebuffer() renders empty screen when fragment out is vec3 === I am using OpenGL 4.0, formerly was using 3.3 I have a fragment shader with 3 outputs -each one is vec3 .I am writing these outputs to some FBO then trying to test the content using The glBlitFramebuffer() method.I am getting the empty screen.Now ,I figured out that setting the outputs to be of vec4 type works correctly.I don't understand why! My FBO textures are set to RGB32F so they should be able to accept vec3 from fragments. Here is my FBO setup (That is Java LWJGL wrapper but it doesn't matter here): _fbo = glGenFramebuffers(); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo); glGenTextures(m_textures); _depthTexture = glGenTextures(); for (int i = 0; i < GBUFFER_NUM_TEXTURES; i++) { glBindTexture(GL_TEXTURE_2D, m_textures.get(i));// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, (ByteBuffer) null); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i , GL_TEXTURE_2D,m_textures.get(i), 0);// } // depth glBindTexture(GL_TEXTURE_2D, _depthTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, (ByteBuffer) null); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _depthTexture, 0); DrawBuffers = BufferUtils.createIntBuffer(GBUFFER_NUM_TEXTURES); DrawBuffers.put(0, GL_COLOR_ATTACHMENT0); DrawBuffers.put(1, GL_COLOR_ATTACHMENT1); DrawBuffers.put(2, GL_COLOR_ATTACHMENT2); glDrawBuffers(DrawBuffers);
0
11,298,392
07/02/2012 17:31:11
1,293,695
03/26/2012 18:10:58
392
12
Initial value for django model autofield
I'm creating an app in django that will eventually be filled with data from its predecessor. I'd like to have certain models start their auto-increment counter at 10000 to differentiate this data in advance and keep the pk accounting consistant. How can I do this in the model? AutoField doesn't seem to take parameters that would let me do this.
django
django-models
auto-increment
null
null
null
open
Initial value for django model autofield === I'm creating an app in django that will eventually be filled with data from its predecessor. I'd like to have certain models start their auto-increment counter at 10000 to differentiate this data in advance and keep the pk accounting consistant. How can I do this in the model? AutoField doesn't seem to take parameters that would let me do this.
0
11,298,394
07/02/2012 17:31:14
89,339
04/10/2009 04:36:18
1,398
53
How to install FlashBuilder 4.6 Eclipse plug-in on Mac?
**Problem** A few of us running either Mac OS X Snow Leopard or Lion and installing the FlashBuilder 4.6 eclipse plug-in are experiencing an issue where the plug-in simply does not show up in Eclipse. The installation adds a file under the <eclipse_installation>/dropins directory called **fb-4_6-plugin-encoded.link** that is supposed to tell Eclipse the location of the Adobe FlashBuilder installation. The scenarios we have encountered are as follows: - Installation works without any problems and the plug-in is registered. - Plug-in is registered, but does not show up. Running Eclipse with `-consoleLog` shows no errors. - Eclipse running with the -consoleLog switch says that the **fb-4_6-plugin-encoded.link** file is not accessible. Doing a `chmod 777` on the file fixes the issue and the plug-in is registered. Here are the notes from the **README** that comes with FlashBuilder: ---------- > Flash Builder 4.6 supports installation as a plugin to an existing > Eclipse instance. > To do so: > 1. Complete the installation process as described above. > 2. Navigate to the installed Flash Builder installation location and open the utilities folder. > 3. Run the executable Adobe Flash Builder 4.6 Plug-in Utility.app. > 4. Select the language and click on OK. > 5. Select the Flash Builder installation location if prompted. > 6. Select the eclipse folder into which you want Flash Builder 4.6 to be plugged into and click Next. (Note: Your copy of Eclipse must be > version 3.6/3.6.1/3.6.2/3.7, 32-bit, Cocoa, containing a folder named > “dropins”). > 7. Review the pre-Installation summary and click on Install. > 8. Following installation it is recommended that you edit the eclipse.ini file for your Eclipse instance, so that it includes the > following settings: > -vmargs -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=64m ---------- **Questions** Is there any Eclipse magic that can be performed to further investigate the issue? Is there any way to manually register the FlashBuilder plug-in (or generally a dropins style plug-in)?
eclipse
flex
eclipse-plugin
adobe
flash-builder
null
open
How to install FlashBuilder 4.6 Eclipse plug-in on Mac? === **Problem** A few of us running either Mac OS X Snow Leopard or Lion and installing the FlashBuilder 4.6 eclipse plug-in are experiencing an issue where the plug-in simply does not show up in Eclipse. The installation adds a file under the <eclipse_installation>/dropins directory called **fb-4_6-plugin-encoded.link** that is supposed to tell Eclipse the location of the Adobe FlashBuilder installation. The scenarios we have encountered are as follows: - Installation works without any problems and the plug-in is registered. - Plug-in is registered, but does not show up. Running Eclipse with `-consoleLog` shows no errors. - Eclipse running with the -consoleLog switch says that the **fb-4_6-plugin-encoded.link** file is not accessible. Doing a `chmod 777` on the file fixes the issue and the plug-in is registered. Here are the notes from the **README** that comes with FlashBuilder: ---------- > Flash Builder 4.6 supports installation as a plugin to an existing > Eclipse instance. > To do so: > 1. Complete the installation process as described above. > 2. Navigate to the installed Flash Builder installation location and open the utilities folder. > 3. Run the executable Adobe Flash Builder 4.6 Plug-in Utility.app. > 4. Select the language and click on OK. > 5. Select the Flash Builder installation location if prompted. > 6. Select the eclipse folder into which you want Flash Builder 4.6 to be plugged into and click Next. (Note: Your copy of Eclipse must be > version 3.6/3.6.1/3.6.2/3.7, 32-bit, Cocoa, containing a folder named > “dropins”). > 7. Review the pre-Installation summary and click on Install. > 8. Following installation it is recommended that you edit the eclipse.ini file for your Eclipse instance, so that it includes the > following settings: > -vmargs -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=64m ---------- **Questions** Is there any Eclipse magic that can be performed to further investigate the issue? Is there any way to manually register the FlashBuilder plug-in (or generally a dropins style plug-in)?
0
11,298,395
07/02/2012 17:31:14
1,489,513
06/28/2012 18:46:16
1
0
Meaning of a native heap allocation file created in DDMS
I created a native heap allocation file in DDMS, but I haven't found what is the meaning of its fields (Allocations, Size and Total Size) in order to help me debug a memory leak issue for an Android app... The file looks something like this: Allocations: 93 Size: 32768 Total Size: 3047424 40103a18 /system/lib/libc_malloc_debug_leak.so --- 40103a18 --- 40093f16 /system/lib/libc.so --- 40093f16 --- 4002f9ce /system/lib/libstdc++.so --- 4002f9ce --- 59738d52 /system/lib/libchromium_net.so --- 59738d52 --- 5a0b1dba /system/lib/libwebcore.so --- 5a0b1dba --- : : Allocations: 1 Size: 356506 Total Size: 356506 40103a18 /system/lib/libc_malloc_debug_leak.so --- 40103a18 --- 40093f16 /system/lib/libc.so --- 40093f16 --- 59f62bea /system/lib/libwebcore.so --- 59f62bea --- 5a1f16b0 /system/lib/libwebcore.so --- 5a1f16b0 --- 59fb1518 /system/lib/libwebcore.so --- 59fb1518 --- : : Allocations: 1 Size: 0 Total Size: 0 40103a18 /system/lib/libc_malloc_debug_leak.so --- 40103a18 --- 40093f16 /system/lib/libc.so --- 40093f16 --- 4002f9ce /system/lib/libstdc++.so --- 4002f9ce --- 406c6328 /system/lib/libskia.so --- 406c6328 --- 406c6a8c /system/lib/libskia.so --- 406c6a8c --- : : What do these fields mean and how can this allocation file help me debug the memory leak issue that I'm trying to root cause ?... I'll appreciate your comments on this... Thanks. BRs, Rogelio M.
android
null
null
null
null
null
open
Meaning of a native heap allocation file created in DDMS === I created a native heap allocation file in DDMS, but I haven't found what is the meaning of its fields (Allocations, Size and Total Size) in order to help me debug a memory leak issue for an Android app... The file looks something like this: Allocations: 93 Size: 32768 Total Size: 3047424 40103a18 /system/lib/libc_malloc_debug_leak.so --- 40103a18 --- 40093f16 /system/lib/libc.so --- 40093f16 --- 4002f9ce /system/lib/libstdc++.so --- 4002f9ce --- 59738d52 /system/lib/libchromium_net.so --- 59738d52 --- 5a0b1dba /system/lib/libwebcore.so --- 5a0b1dba --- : : Allocations: 1 Size: 356506 Total Size: 356506 40103a18 /system/lib/libc_malloc_debug_leak.so --- 40103a18 --- 40093f16 /system/lib/libc.so --- 40093f16 --- 59f62bea /system/lib/libwebcore.so --- 59f62bea --- 5a1f16b0 /system/lib/libwebcore.so --- 5a1f16b0 --- 59fb1518 /system/lib/libwebcore.so --- 59fb1518 --- : : Allocations: 1 Size: 0 Total Size: 0 40103a18 /system/lib/libc_malloc_debug_leak.so --- 40103a18 --- 40093f16 /system/lib/libc.so --- 40093f16 --- 4002f9ce /system/lib/libstdc++.so --- 4002f9ce --- 406c6328 /system/lib/libskia.so --- 406c6328 --- 406c6a8c /system/lib/libskia.so --- 406c6a8c --- : : What do these fields mean and how can this allocation file help me debug the memory leak issue that I'm trying to root cause ?... I'll appreciate your comments on this... Thanks. BRs, Rogelio M.
0
11,654,024
07/25/2012 16:08:49
463,183
09/30/2010 19:01:34
355
16
Detect landscape to landscape orientation change
I do some custom layout including an animation in willAnimateRotationToInterfaceOrientation:duration: The problem I have is that if the device changes from landscapeLeft to landscapeRight the interface should rotate but the layout code, especially the animation should not be run. How can I detect that it is changing from one landscape to another? self.interfaceOrientation as well as [[UIApplication sharedApplication] statusBarOrientation] don't return valid results, they seem to think the device is already rotated. As a result the following *does not work*. if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation) && UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) {...}
ios
uiviewcontroller
orientation
null
null
null
open
Detect landscape to landscape orientation change === I do some custom layout including an animation in willAnimateRotationToInterfaceOrientation:duration: The problem I have is that if the device changes from landscapeLeft to landscapeRight the interface should rotate but the layout code, especially the animation should not be run. How can I detect that it is changing from one landscape to another? self.interfaceOrientation as well as [[UIApplication sharedApplication] statusBarOrientation] don't return valid results, they seem to think the device is already rotated. As a result the following *does not work*. if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation) && UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) {...}
0
11,660,254
07/25/2012 23:34:19
1,462,539
06/18/2012 00:53:17
49
1
Why does my simple test Invoke method not work?
I have this getValue method: NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { if (! instance) { return NPERR_INVALID_INSTANCE_ERROR; } struct NPClass class; class.structVersion = NP_CLASS_STRUCT_VERSION; class.construct = NULL; class.deallocate = NULL; class.hasMethod = hasmethod; class.getProperty=NULL; class.enumerate=NULL; class.removeProperty= NULL; class.hasProperty = NULL; class.invoke = pinvoke; class.invokeDefault = NULL; class.invalidate = NULL; class.setProperty = NULL; class.allocate = NULL; if (! so) { so = NPN_CreateObject(instance, &class); NPN_RetainObject(so); } value = so; return NPERR_NO_ERROR; } Here are the two methods the class points to: bool hasmethod(NPObject *npobj, NPIdentifier name) { return true; } static bool pinvoke(NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) { int32_t val; val = 32; result-> type = NPVariantType_Int32; result -> value.intValue = val; return true; } Basically, I wanted the object to return 32 when anything was called just to test. Here are my create & retain methods: NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) { return browser->createobject(npp, aClass); } NPObject *NPN_RetainObject(NPObject *npobj) { return browser->retainobject(npobj); } In my Javascript: <embed type="application/x-my-extension" id="pluginId"> <script> var plugin = document.getElementById("pluginId"); console.log(plugin.something); The window is drawn on the page, but the console outputs undefined. Help would be greatly appreciated. Thanks!
plugins
npapi
npruntime
null
null
null
open
Why does my simple test Invoke method not work? === I have this getValue method: NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { if (! instance) { return NPERR_INVALID_INSTANCE_ERROR; } struct NPClass class; class.structVersion = NP_CLASS_STRUCT_VERSION; class.construct = NULL; class.deallocate = NULL; class.hasMethod = hasmethod; class.getProperty=NULL; class.enumerate=NULL; class.removeProperty= NULL; class.hasProperty = NULL; class.invoke = pinvoke; class.invokeDefault = NULL; class.invalidate = NULL; class.setProperty = NULL; class.allocate = NULL; if (! so) { so = NPN_CreateObject(instance, &class); NPN_RetainObject(so); } value = so; return NPERR_NO_ERROR; } Here are the two methods the class points to: bool hasmethod(NPObject *npobj, NPIdentifier name) { return true; } static bool pinvoke(NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) { int32_t val; val = 32; result-> type = NPVariantType_Int32; result -> value.intValue = val; return true; } Basically, I wanted the object to return 32 when anything was called just to test. Here are my create & retain methods: NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) { return browser->createobject(npp, aClass); } NPObject *NPN_RetainObject(NPObject *npobj) { return browser->retainobject(npobj); } In my Javascript: <embed type="application/x-my-extension" id="pluginId"> <script> var plugin = document.getElementById("pluginId"); console.log(plugin.something); The window is drawn on the page, but the console outputs undefined. Help would be greatly appreciated. Thanks!
0
11,660,258
07/25/2012 23:34:59
1,383,642
05/09/2012 04:20:33
1
0
Entering text into a textarea
I have a form: function show_welcome() { print_r($_REQUEST); global $error_flag , $date_error_flag; $first_name = isset($_REQUEST['Fname']) ? $_REQUEST['Fname'] : ""; $last_name = isset($_REQUEST["Lname"]) ? $_REQUEST["Lname"] : ""; $phone = isset($_REQUEST["Phone"]) ? $_REQUEST["Phone"] : ""; $height = isset($_REQUEST["Height"]) ? $_REQUEST["Height"] : ""; $birthday = isset($_REQUEST["Bday"]) ? $_REQUEST["Bday"] : ""; $sex = isset($_REQUEST["Sex"]) ? $_REQUEST["Sex"] : ""; $history = isset($_REQUEST["Hx"]) ? $_REQUEST["Hx"] : ""; $age = isset($_REQUEST["Age"]) ? $_REQUEST["Age"] : ""; ?> <form method='post' action="" > <center> First Name: <input type='text' name='Fname' maxlength = '10' value = <?php echo $first_name ?> ></input> Last Name: <input type='text' name='Lname' maxlength = '20' size = '25' value = <?php echo $last_name ?> ></input><br /> </center> <div id="I1">Ten Characters</div> <div id="I2"> Twenty Characters</div><br /><br /> <center> Phone: <input type="text" name="Phone" value = <?php echo $phone ?> ></input> Height: <input type="text" name="Height" value = <?php echo $height ?> ></input><br ></center> <div id="I3">XXX-XXX-XXXX</div> <div id= "I4"> Inches</div><br /><br /> <center>Birthday: <input type='text' name='Bday' value = <?php echo $birthday ?> ></input><br /> <?php printf(" \t\t\t\t YYYY-MM-DD \n\n"); ?> <p ><input type="radio" name="Sex" value = <?php echo $sex ?> value = "0"/>Male <input type="radio" name="Sex" value = <?php echo $sex ?> value = "1"/>Female </p > Hx: <br /> <textarea style="overflow: scroll" cols="60" rows="10" wrap="hard" name="Hx" value = <?php echo $history ?> ></textarea> <p /> <input type="text" hidden="true" name="Age" ></input> <br /><br /><input type="submit" /> <br /><br /><input type = "reset" value="Clear Form"/></center> <input type=hidden name='welcome_already_seen' value='already_seen'> </form> <?php } The form is filled out by the user and then checked for valid format. Invalid format triggers an error message and the script returns to the form. I wish to show all the data entered, so that the user can more easily make corrections. Everything is re-entered into the form except the history (Hx). The $_REQUEST contains the history: Array ( [Fname] => 44444444 [Lname] => Jones [Phone] => 123-123-4656 [Height] => 62 [Bday] => 1989-03-05 [Sex] => 0 [Hx] => good pt [Age] => [welcome_already_seen] => already_seen ) As an side issue, how can I ensure that the correct radio buttons are re-checked at data re-entry. Advice and help, please. Thanks
php
html
null
null
null
null
open
Entering text into a textarea === I have a form: function show_welcome() { print_r($_REQUEST); global $error_flag , $date_error_flag; $first_name = isset($_REQUEST['Fname']) ? $_REQUEST['Fname'] : ""; $last_name = isset($_REQUEST["Lname"]) ? $_REQUEST["Lname"] : ""; $phone = isset($_REQUEST["Phone"]) ? $_REQUEST["Phone"] : ""; $height = isset($_REQUEST["Height"]) ? $_REQUEST["Height"] : ""; $birthday = isset($_REQUEST["Bday"]) ? $_REQUEST["Bday"] : ""; $sex = isset($_REQUEST["Sex"]) ? $_REQUEST["Sex"] : ""; $history = isset($_REQUEST["Hx"]) ? $_REQUEST["Hx"] : ""; $age = isset($_REQUEST["Age"]) ? $_REQUEST["Age"] : ""; ?> <form method='post' action="" > <center> First Name: <input type='text' name='Fname' maxlength = '10' value = <?php echo $first_name ?> ></input> Last Name: <input type='text' name='Lname' maxlength = '20' size = '25' value = <?php echo $last_name ?> ></input><br /> </center> <div id="I1">Ten Characters</div> <div id="I2"> Twenty Characters</div><br /><br /> <center> Phone: <input type="text" name="Phone" value = <?php echo $phone ?> ></input> Height: <input type="text" name="Height" value = <?php echo $height ?> ></input><br ></center> <div id="I3">XXX-XXX-XXXX</div> <div id= "I4"> Inches</div><br /><br /> <center>Birthday: <input type='text' name='Bday' value = <?php echo $birthday ?> ></input><br /> <?php printf(" \t\t\t\t YYYY-MM-DD \n\n"); ?> <p ><input type="radio" name="Sex" value = <?php echo $sex ?> value = "0"/>Male <input type="radio" name="Sex" value = <?php echo $sex ?> value = "1"/>Female </p > Hx: <br /> <textarea style="overflow: scroll" cols="60" rows="10" wrap="hard" name="Hx" value = <?php echo $history ?> ></textarea> <p /> <input type="text" hidden="true" name="Age" ></input> <br /><br /><input type="submit" /> <br /><br /><input type = "reset" value="Clear Form"/></center> <input type=hidden name='welcome_already_seen' value='already_seen'> </form> <?php } The form is filled out by the user and then checked for valid format. Invalid format triggers an error message and the script returns to the form. I wish to show all the data entered, so that the user can more easily make corrections. Everything is re-entered into the form except the history (Hx). The $_REQUEST contains the history: Array ( [Fname] => 44444444 [Lname] => Jones [Phone] => 123-123-4656 [Height] => 62 [Bday] => 1989-03-05 [Sex] => 0 [Hx] => good pt [Age] => [welcome_already_seen] => already_seen ) As an side issue, how can I ensure that the correct radio buttons are re-checked at data re-entry. Advice and help, please. Thanks
0
11,660,039
07/25/2012 23:11:47
1,076,743
12/02/2011 05:14:20
415
5
JS Array passing value changes for no reason
I have a function which loops an array... whilst it works it seems to change the value of the information being sent from "begin" function to "process" function, but i don't know why... I'm sure i made a silly mistake but I cannot see the mistake =/ This is my function: var array_data = data[9]; //global array to use console.log(array_data); //debug function process(i){ alert('Number is '+i); // shows the value "7" (should show value "1") } function begin(){ var count = 0; for(i in array_data){ if(parseInt(array_data[i][9])){ //if true var result = create_layout(i); //function to make the layout alert('Number is '+i); //shows the value "1" (this is correct so far) document.getElementById('result'+count).innerHTML = result; document.getElementById('result'+count).onclick = function() { process(i); }; count++; } } window.onload = function() { begin(); }; Below is my array for (array_data) from the console log: 1: Array[10] 0: "Car One" 1: "1" 2: "3" 3: "d2.jpg" 4: "1" 5: "1" 6: "200" 7: "85" 8: "5000" 9: "1" length: 10 7: Array[10] 0: "Car Two" 1: "1" 2: "1" 3: "e2.jpg" 4: "1" 5: "0" 6: "500" 7: "50" 8: "3000" 9: "0" length: 10 So I'm wondering why might it is changing the value of "i" when it reaches the process function ?
javascript
null
null
null
null
null
open
JS Array passing value changes for no reason === I have a function which loops an array... whilst it works it seems to change the value of the information being sent from "begin" function to "process" function, but i don't know why... I'm sure i made a silly mistake but I cannot see the mistake =/ This is my function: var array_data = data[9]; //global array to use console.log(array_data); //debug function process(i){ alert('Number is '+i); // shows the value "7" (should show value "1") } function begin(){ var count = 0; for(i in array_data){ if(parseInt(array_data[i][9])){ //if true var result = create_layout(i); //function to make the layout alert('Number is '+i); //shows the value "1" (this is correct so far) document.getElementById('result'+count).innerHTML = result; document.getElementById('result'+count).onclick = function() { process(i); }; count++; } } window.onload = function() { begin(); }; Below is my array for (array_data) from the console log: 1: Array[10] 0: "Car One" 1: "1" 2: "3" 3: "d2.jpg" 4: "1" 5: "1" 6: "200" 7: "85" 8: "5000" 9: "1" length: 10 7: Array[10] 0: "Car Two" 1: "1" 2: "1" 3: "e2.jpg" 4: "1" 5: "0" 6: "500" 7: "50" 8: "3000" 9: "0" length: 10 So I'm wondering why might it is changing the value of "i" when it reaches the process function ?
0
11,660,040
07/25/2012 23:11:47
1,076,546
12/02/2011 00:30:45
22
1
C# convert functions naming convention
I have a function that converts an object into nullable int: public int? ToInt(object x) { ... } Now I need another function that would return 0 instead of null if conversion is not possible: public int ToIntSomeOtherName(object x) { ... } What would be a good name for that other function ? I know this seems trivial, but I'll be using these functions in many places and a good naming convention would be a big plus.
c#
naming-conventions
util
null
null
null
open
C# convert functions naming convention === I have a function that converts an object into nullable int: public int? ToInt(object x) { ... } Now I need another function that would return 0 instead of null if conversion is not possible: public int ToIntSomeOtherName(object x) { ... } What would be a good name for that other function ? I know this seems trivial, but I'll be using these functions in many places and a good naming convention would be a big plus.
0
11,660,272
07/25/2012 23:36:19
604,864
02/06/2011 00:17:42
914
9
What does it mean that statement S immediately contains statement U?
Java Language Specification 14: docs.oracle.com/javase/specs/jls/se7/html/jls-14.html THE sequence of execution of a program is controlled by statements, which are executed for their effect and do not have values. Some statements contain other statements as part of their structure; such other statements are substatements of the statement. We say that statement S immediately contains statement U if there is no statement T different from S and U such that S contains T and T contains U. In the same manner, some statements contain expressions as part of their structure. What does it mean that statement S immediately contains statement U if there is no statement T different from S and U such that S contains T and T contains U.?
java
null
null
null
null
null
open
What does it mean that statement S immediately contains statement U? === Java Language Specification 14: docs.oracle.com/javase/specs/jls/se7/html/jls-14.html THE sequence of execution of a program is controlled by statements, which are executed for their effect and do not have values. Some statements contain other statements as part of their structure; such other statements are substatements of the statement. We say that statement S immediately contains statement U if there is no statement T different from S and U such that S contains T and T contains U. In the same manner, some statements contain expressions as part of their structure. What does it mean that statement S immediately contains statement U if there is no statement T different from S and U such that S contains T and T contains U.?
0
11,660,274
07/25/2012 23:36:29
1,022,923
11/01/2011 00:50:08
36
1
redirect after form submit when coming from different controllers
Let's say I have a **comment** model, which can be updated by the user, when he is in the **tasks** view (comments belong to tasks), but also from **projects** view. After submitting the form I want the user to be redirected to the view the user came from. I tried redirect_to :back but this results in redirecting to the form itself.
ruby-on-rails-3
redirect
view
controller
null
null
open
redirect after form submit when coming from different controllers === Let's say I have a **comment** model, which can be updated by the user, when he is in the **tasks** view (comments belong to tasks), but also from **projects** view. After submitting the form I want the user to be redirected to the view the user came from. I tried redirect_to :back but this results in redirecting to the form itself.
0
11,499,729
07/16/2012 07:19:46
1,528,047
07/16/2012 06:18:10
1
0
How to grab data from JSON array and put into a listview?
Hi i am new to javascript programming, i am making a dropdown list view(picker view) in jquery mobile, for the data to be in that picker view i created a json array. the problem is that i need the code for when i click on a particular list view it should run a js function which grabs the data from the json array and put that in the picker(list) view. my jquery code is: <form method="get" name="datarange"> <div data-role="fieldcontain"> <select id="number" name="day you need" onclick="dayLoad();"> <option value="select-value" selected="selected" >--Select Day--</option> <option value="01">/* here i want my data from array "day"/*</option> <option value="02">/* here i want my data from array "day"/*</option> </select> </div> <div data-role="fieldcontain"> <select id="time" name="time you need"> <option value="select-value" selected="selected">--Select Time--</option> <option value="101">/* here i want my data from array "Time" /*</option> <option value="102">/* here i want my data from array "Time"/*</option> <option value="103">/* here i want my data from array "Time"/*</option> .... <option value="116">/* here i want my data from array "Time"/*</option> </select> </div> <div data-role="fieldcontain"> <select id="pid" name="pid you need"> <option value="select-value" selected="selected">--No PID allocation found--</option> <option value="301">/* here i want my data from array "pid"/*</option> <option value="302">/* here i want my data from array "pid"/*</option> </select> </div> <div data-role="fieldcontain"> <select id="jus" name="justification you need"> <option value="select-value" selected="selected">--Select Justification--</option> <option value="201">Project Work</option> <option value="202">Client Call</option> <option value="203">Team Meeting<option> <option value="204">Others</option> </select> </div> </form> <div id="display" class="rss-box"></div> In my js file: var day=[ {"dayTime" : "Today-Drop"}, {"dayTime" : "Tomorrow-Pick up"}]; var time=[ {"PM" : "3:00 PM"}, {"PM" : "4:00 PM"}, {"PM" : "7:30 PM"}, {"PM" : "9:00 PM"}, {"PM" : "10:15 PM"}, {"PM" : "11:00 PM"}]; var Pid=[ {"pidno" : "7813"}, {"pidno" : "8133"},]; function dayLoad(){//i need the code to put in this function which grabs the data from array and gonna put into the listview}
javascript
jquery-mobile
null
null
null
null
open
How to grab data from JSON array and put into a listview? === Hi i am new to javascript programming, i am making a dropdown list view(picker view) in jquery mobile, for the data to be in that picker view i created a json array. the problem is that i need the code for when i click on a particular list view it should run a js function which grabs the data from the json array and put that in the picker(list) view. my jquery code is: <form method="get" name="datarange"> <div data-role="fieldcontain"> <select id="number" name="day you need" onclick="dayLoad();"> <option value="select-value" selected="selected" >--Select Day--</option> <option value="01">/* here i want my data from array "day"/*</option> <option value="02">/* here i want my data from array "day"/*</option> </select> </div> <div data-role="fieldcontain"> <select id="time" name="time you need"> <option value="select-value" selected="selected">--Select Time--</option> <option value="101">/* here i want my data from array "Time" /*</option> <option value="102">/* here i want my data from array "Time"/*</option> <option value="103">/* here i want my data from array "Time"/*</option> .... <option value="116">/* here i want my data from array "Time"/*</option> </select> </div> <div data-role="fieldcontain"> <select id="pid" name="pid you need"> <option value="select-value" selected="selected">--No PID allocation found--</option> <option value="301">/* here i want my data from array "pid"/*</option> <option value="302">/* here i want my data from array "pid"/*</option> </select> </div> <div data-role="fieldcontain"> <select id="jus" name="justification you need"> <option value="select-value" selected="selected">--Select Justification--</option> <option value="201">Project Work</option> <option value="202">Client Call</option> <option value="203">Team Meeting<option> <option value="204">Others</option> </select> </div> </form> <div id="display" class="rss-box"></div> In my js file: var day=[ {"dayTime" : "Today-Drop"}, {"dayTime" : "Tomorrow-Pick up"}]; var time=[ {"PM" : "3:00 PM"}, {"PM" : "4:00 PM"}, {"PM" : "7:30 PM"}, {"PM" : "9:00 PM"}, {"PM" : "10:15 PM"}, {"PM" : "11:00 PM"}]; var Pid=[ {"pidno" : "7813"}, {"pidno" : "8133"},]; function dayLoad(){//i need the code to put in this function which grabs the data from array and gonna put into the listview}
0
11,499,730
07/16/2012 07:19:49
1,528,139
07/16/2012 07:13:39
1
0
removing potentially hung connection from busy pool ... socket in pool for 56476ms
I'm using Memcache for my site. As soon as it starts to get load, I get following errors from my memcache client which is Danga - 2.0.1. Memcache version is : 1.4.5. 2012-07-14 11:00:55,841 ERROR [MaintThread] com.danga.MemCached.SockIOPool:1435 - ++++ failed to close SockIO obj from deadPool 2012-07-14 11:00:55,841 ERROR [MaintThread] com.danga.MemCached.SockIOPool:1436 - ++++ socket or its streams already null in trueClose call java.io.IOException: ++++ socket or its streams already null in trueClose call at com.danga.MemCached.SockIOPool$SockIO.trueClose(SockIOPool.java:1704) ~[MemCached-2.0.1.jar:na] at com.danga.MemCached.SockIOPool.selfMaint(SockIOPool.java:1432) ~[MemCached-2.0.1.jar:na] at com.danga.MemCached.SockIOPool$MaintThread.run(SockIOPool.java:1497) [MemCached-2.0.1.jar:na] This slows down the site causing eventual breakdown. Any suggestions would be helpful ! Thanks
sockets
memcached
null
null
null
null
open
removing potentially hung connection from busy pool ... socket in pool for 56476ms === I'm using Memcache for my site. As soon as it starts to get load, I get following errors from my memcache client which is Danga - 2.0.1. Memcache version is : 1.4.5. 2012-07-14 11:00:55,841 ERROR [MaintThread] com.danga.MemCached.SockIOPool:1435 - ++++ failed to close SockIO obj from deadPool 2012-07-14 11:00:55,841 ERROR [MaintThread] com.danga.MemCached.SockIOPool:1436 - ++++ socket or its streams already null in trueClose call java.io.IOException: ++++ socket or its streams already null in trueClose call at com.danga.MemCached.SockIOPool$SockIO.trueClose(SockIOPool.java:1704) ~[MemCached-2.0.1.jar:na] at com.danga.MemCached.SockIOPool.selfMaint(SockIOPool.java:1432) ~[MemCached-2.0.1.jar:na] at com.danga.MemCached.SockIOPool$MaintThread.run(SockIOPool.java:1497) [MemCached-2.0.1.jar:na] This slows down the site causing eventual breakdown. Any suggestions would be helpful ! Thanks
0
11,499,731
07/16/2012 07:19:51
1,300,444
03/29/2012 09:52:44
71
4
How to resize uploaded image in zend framework
I have a form with upload image field. How to resize the recently uploaded image to desired size? My current form is : <?php class Application_Form_User extends Zend_Form { public function init() { $this->setAttrib('enctype', 'multipart/form-data'); $this->setAction(""); $this->setMethod("post"); $element = new Zend_Form_Element_File('photo'); $element->setLabel('Upload an image:') ->setValueDisabled(true); $this->addElement($element, 'photo'); $element->addValidator('Count', false, 1); // limit to 1000K $element->addValidator('Size', false, 1024000); // only JPEG, PNG, and GIFs $element->addValidator('Extension', false, 'jpg,png,gif'); $submit = $this->createElement('submit', 'submit'); $submit->setLabel('Save'); $this->addElement($submit); } } And my controller: public function indexAction() { $form=new Application_Form_User(); if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData)) { $file=pathinfo($form->photo->getFileName()); $form->photo->addFilter('Rename', PUBLIC_PATH.'/images/'.uniqid().time().'.'.$file['extension']); if ($form->photo->receive()) { $this->view->photo=pathinfo($form->photo->getFileName()); } } } $this->view->form=$form; } Can somebody provide me with an example? How can i use plugins like php thumbnailer or similar plugin to resize the uploaded image?
zend-framework
zend-form
null
null
null
null
open
How to resize uploaded image in zend framework === I have a form with upload image field. How to resize the recently uploaded image to desired size? My current form is : <?php class Application_Form_User extends Zend_Form { public function init() { $this->setAttrib('enctype', 'multipart/form-data'); $this->setAction(""); $this->setMethod("post"); $element = new Zend_Form_Element_File('photo'); $element->setLabel('Upload an image:') ->setValueDisabled(true); $this->addElement($element, 'photo'); $element->addValidator('Count', false, 1); // limit to 1000K $element->addValidator('Size', false, 1024000); // only JPEG, PNG, and GIFs $element->addValidator('Extension', false, 'jpg,png,gif'); $submit = $this->createElement('submit', 'submit'); $submit->setLabel('Save'); $this->addElement($submit); } } And my controller: public function indexAction() { $form=new Application_Form_User(); if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); if ($form->isValid($formData)) { $file=pathinfo($form->photo->getFileName()); $form->photo->addFilter('Rename', PUBLIC_PATH.'/images/'.uniqid().time().'.'.$file['extension']); if ($form->photo->receive()) { $this->view->photo=pathinfo($form->photo->getFileName()); } } } $this->view->form=$form; } Can somebody provide me with an example? How can i use plugins like php thumbnailer or similar plugin to resize the uploaded image?
0
11,499,732
07/16/2012 07:19:59
709,537
04/15/2011 09:15:58
694
27
Putting derived classes into STL maps as values
I have 2 simple classes. Base class `A`, and a derived class `B`. For debugging purposes, copy constructor and destructor are overridden to `cout` stuff: class A { protected: char * c; public: A(char * c) : c(c) { cout << "+A " << this << "\n"; } A(const A& other) : c(other.c) { cout << "*A " << this << "\n"; } ~A() { cout << "-A " << this << "\n"; } }; class B : public A { public: B(char * c) : A(c) { cout << "+B " << this << "\n"; } B(const B& other) : A(other.c) { cout << "*B " << this << "\n"; } ~B() { cout << "-B " << this << "\n"; } }; Here's how I `insert` an instance of `B` into the `map`: { cout << "-- 1\n"; map<string, A> m; cout << "-- 2\n"; m.insert(pair<string, A>( "b", B("bVal"))); cout << "-- 3\n"; } cout << "-- 4 --\n"; The result of that: -- 1 -- 2 +A 0051F620 +B 0051F620 *A 0051F5EC *A 00BD8BAC -A 0051F5EC -B 0051F620 -A 0051F620 -- 3 -A 00BD8BAC -- 4 -- As regards creation of instances, I read this as follows: 1. `B` gets created by my own code 1. that `B` gets copy-constructed into an `A` by `pair` 1. that last `A` instance then gets copied once more by the `map`, where it is inserted Btw changing the `pair` in the `insert` line to a `pair<string, B>` did not do the trick, it only changed the 2nd step to create an `B` instead of the `A`, but the last step would *downgrade* it to an `A` again. The only instance in the map that remains until the map itself is eligible for destruction seems to be that last `A` instance. What am I doing wrong and how am I supposed to get a derived class into a map? Use maps of the format map<string, A*> perhaps?
c++
stl
map
derived-class
null
null
open
Putting derived classes into STL maps as values === I have 2 simple classes. Base class `A`, and a derived class `B`. For debugging purposes, copy constructor and destructor are overridden to `cout` stuff: class A { protected: char * c; public: A(char * c) : c(c) { cout << "+A " << this << "\n"; } A(const A& other) : c(other.c) { cout << "*A " << this << "\n"; } ~A() { cout << "-A " << this << "\n"; } }; class B : public A { public: B(char * c) : A(c) { cout << "+B " << this << "\n"; } B(const B& other) : A(other.c) { cout << "*B " << this << "\n"; } ~B() { cout << "-B " << this << "\n"; } }; Here's how I `insert` an instance of `B` into the `map`: { cout << "-- 1\n"; map<string, A> m; cout << "-- 2\n"; m.insert(pair<string, A>( "b", B("bVal"))); cout << "-- 3\n"; } cout << "-- 4 --\n"; The result of that: -- 1 -- 2 +A 0051F620 +B 0051F620 *A 0051F5EC *A 00BD8BAC -A 0051F5EC -B 0051F620 -A 0051F620 -- 3 -A 00BD8BAC -- 4 -- As regards creation of instances, I read this as follows: 1. `B` gets created by my own code 1. that `B` gets copy-constructed into an `A` by `pair` 1. that last `A` instance then gets copied once more by the `map`, where it is inserted Btw changing the `pair` in the `insert` line to a `pair<string, B>` did not do the trick, it only changed the 2nd step to create an `B` instead of the `A`, but the last step would *downgrade* it to an `A` again. The only instance in the map that remains until the map itself is eligible for destruction seems to be that last `A` instance. What am I doing wrong and how am I supposed to get a derived class into a map? Use maps of the format map<string, A*> perhaps?
0
11,499,740
07/16/2012 07:20:26
951,135
09/18/2011 10:42:04
38
1
significance of question mark in java cron
Source wikipedia: **Question mark** (?) is used instead of '*' for leaving either day-of-month or day-of-week blank. above statement is not making much sense to me. So if I write some cron as **0 0 0 ? * *** then does it means first of every month or it means it will execute daily. It is bit confusing as JAVA crons start with seconds while other crons start with minute.
java
cron
crontab
null
null
null
open
significance of question mark in java cron === Source wikipedia: **Question mark** (?) is used instead of '*' for leaving either day-of-month or day-of-week blank. above statement is not making much sense to me. So if I write some cron as **0 0 0 ? * *** then does it means first of every month or it means it will execute daily. It is bit confusing as JAVA crons start with seconds while other crons start with minute.
0
11,499,743
07/16/2012 07:20:33
1,500,524
07/04/2012 04:39:04
126
26
How to disable submit button after clicking one time in a day and re-enable this button on next day using php?
I want to disable submit button for a user after clicking one time in a day and re-enable this button on next day. <input type="submit" class="myButton" id="option" value="submit"/> What i require is, when i click a submit button the form submits and disables the button for that day. Then it renables for that user only on the next day.
php
submit
disable
null
null
null
open
How to disable submit button after clicking one time in a day and re-enable this button on next day using php? === I want to disable submit button for a user after clicking one time in a day and re-enable this button on next day. <input type="submit" class="myButton" id="option" value="submit"/> What i require is, when i click a submit button the form submits and disables the button for that day. Then it renables for that user only on the next day.
0
11,499,747
07/16/2012 07:20:54
1,472,320
06/21/2012 13:52:57
1
0
c# devexpress gridView.Rows?
i want to do it with devexpress extension (gridview) string dataInCell = dataGridView1.Rows[i].Cells[j].Value.ToString(); like gridView1.Rows[i].Cells[j]
gridview
datagridview
devexpress
gridcontrol
null
null
open
c# devexpress gridView.Rows? === i want to do it with devexpress extension (gridview) string dataInCell = dataGridView1.Rows[i].Cells[j].Value.ToString(); like gridView1.Rows[i].Cells[j]
0
11,499,507
07/16/2012 07:02:16
1,068,676
11/28/2011 04:02:52
165
5
How to check current path in ssh connection by Python's paramiko packet?
I am using Python's paramiko packet to keep an ssh-connection with an host like this: s = paramiko.SSHClient() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect("xxx.xxx.xxx.xxx",22,username=xxx,password='',timeout=4) stdin,stdout,stderr = s.exec_command("pwd") print stdout.readline() stdin,stdout,stderr = s.exec_command("cd xxx") stdin,stdout,stderr = s.exec_command("pwd") print stdout.readline() the outputs are: /aaa/bbb /aaa/bbb shouldn't the second path be /aaa/bbb/xxx ?
python
ssh
paramiko
pwd
null
null
open
How to check current path in ssh connection by Python's paramiko packet? === I am using Python's paramiko packet to keep an ssh-connection with an host like this: s = paramiko.SSHClient() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect("xxx.xxx.xxx.xxx",22,username=xxx,password='',timeout=4) stdin,stdout,stderr = s.exec_command("pwd") print stdout.readline() stdin,stdout,stderr = s.exec_command("cd xxx") stdin,stdout,stderr = s.exec_command("pwd") print stdout.readline() the outputs are: /aaa/bbb /aaa/bbb shouldn't the second path be /aaa/bbb/xxx ?
0
11,499,749
07/16/2012 07:21:20
1,527,908
07/16/2012 04:35:49
1
0
Where do I put ruby code that I want to run when users access certain pages?
I have a bit of code that I need to run when a user loads a page. What it does specifically is update my database based on an xml file using a gem. So far I've found answers that tell me I should put it in everything from a rake task to the lib folder itself to the model. It's all a little confusing. Here's the code in question: require 'rubygems' require 'eaal' EAAL.cache = EAAL::Cache::FileCache.new api = EAAL::API.new("id", "vcode", "char") result = api.MarketOrders("characterID" => "id") result.orders.each do |order| @found = MarketItem.find_by_typeid(order.typeID.to_i) MarketItem.update(@found.id, :remaining => order.volRemaining.to_i) end I'm sorry if this is an obvious question and I'm sure my code is horrible. I'm really new to rails and the only way I seem to be able to learn new languages is the bull-in-a-china-shop method.
ruby-on-rails
ruby-on-rails-3
null
null
null
null
open
Where do I put ruby code that I want to run when users access certain pages? === I have a bit of code that I need to run when a user loads a page. What it does specifically is update my database based on an xml file using a gem. So far I've found answers that tell me I should put it in everything from a rake task to the lib folder itself to the model. It's all a little confusing. Here's the code in question: require 'rubygems' require 'eaal' EAAL.cache = EAAL::Cache::FileCache.new api = EAAL::API.new("id", "vcode", "char") result = api.MarketOrders("characterID" => "id") result.orders.each do |order| @found = MarketItem.find_by_typeid(order.typeID.to_i) MarketItem.update(@found.id, :remaining => order.volRemaining.to_i) end I'm sorry if this is an obvious question and I'm sure my code is horrible. I'm really new to rails and the only way I seem to be able to learn new languages is the bull-in-a-china-shop method.
0
11,499,754
07/16/2012 07:21:53
1,306,464
04/01/2012 15:27:42
27
10
Display of improper array structure in cakephp
I have a weird array result in which I got as a result from a stored procedure. Well, here's the array I have array( (int) 0 =&gt; array( &#039;t&#039; =&gt; array( &#039;level&#039; =&gt; &#039;-5&#039;, &#039;longtitude&#039; =&gt; &#039;121.05123&#039;, &#039;latitude&#039; =&gt; &#039;14.62163&#039;, &#039;color&#039; =&gt; &#039;#000000&#039; ) ), (int) 1 =&gt; array( &#039;t&#039; =&gt; array( &#039;level&#039; =&gt; &#039;-5&#039;, &#039;longtitude&#039; =&gt; &#039;121.051183333333&#039;, &#039;latitude&#039; =&gt; &#039;14.6216233333333&#039;, &#039;color&#039; =&gt; &#039;#000000&#039; ) ), As you can see, it's kinda weird. Wherein it should be something like this Array ( [0] => Array ( [t] => Array ( [level] => -57 [longtitude] => 121.050321666667 [latitude] => 14.6215366666667 [color] => #040098 ) ) [1] => Array ( [t] => Array ( [level] => -61 [longtitude] => 121.050316666667 [latitude] => 14.621545 [color] => #040098 ) ) [2] => Array ( [t] => Array ( [level] => -63 [longtitude] => 121.050323333333 [latitude] => 14.62153 [color] => #040098 ) ) Since i directly debug it after I got the results from the stored procedure, I really have no idea where to deal with this problem first.. By the way here's my controller which called the SP: $this->loadModel('User'); $username = $this->Session->read('user'); $category = trim($_POST["category"]); $file_name = trim($_POST["file_name"]); $ssid = trim($_POST["ssid"]); $settings = trim($_POST["settings"]); $color_type = trim($_POST["color_type"]); App::import('Xml'); $this->header('Content-type:text/xml'); $this->layout=false; $query = "CALL GetSingleReportByCategory('$username','$file_name','$ssid','$category', '$settings','$color_type');"; $mydata = $this->User->query($query); debug($mydata);
xml
arrays
cakephp
null
null
null
open
Display of improper array structure in cakephp === I have a weird array result in which I got as a result from a stored procedure. Well, here's the array I have array( (int) 0 =&gt; array( &#039;t&#039; =&gt; array( &#039;level&#039; =&gt; &#039;-5&#039;, &#039;longtitude&#039; =&gt; &#039;121.05123&#039;, &#039;latitude&#039; =&gt; &#039;14.62163&#039;, &#039;color&#039; =&gt; &#039;#000000&#039; ) ), (int) 1 =&gt; array( &#039;t&#039; =&gt; array( &#039;level&#039; =&gt; &#039;-5&#039;, &#039;longtitude&#039; =&gt; &#039;121.051183333333&#039;, &#039;latitude&#039; =&gt; &#039;14.6216233333333&#039;, &#039;color&#039; =&gt; &#039;#000000&#039; ) ), As you can see, it's kinda weird. Wherein it should be something like this Array ( [0] => Array ( [t] => Array ( [level] => -57 [longtitude] => 121.050321666667 [latitude] => 14.6215366666667 [color] => #040098 ) ) [1] => Array ( [t] => Array ( [level] => -61 [longtitude] => 121.050316666667 [latitude] => 14.621545 [color] => #040098 ) ) [2] => Array ( [t] => Array ( [level] => -63 [longtitude] => 121.050323333333 [latitude] => 14.62153 [color] => #040098 ) ) Since i directly debug it after I got the results from the stored procedure, I really have no idea where to deal with this problem first.. By the way here's my controller which called the SP: $this->loadModel('User'); $username = $this->Session->read('user'); $category = trim($_POST["category"]); $file_name = trim($_POST["file_name"]); $ssid = trim($_POST["ssid"]); $settings = trim($_POST["settings"]); $color_type = trim($_POST["color_type"]); App::import('Xml'); $this->header('Content-type:text/xml'); $this->layout=false; $query = "CALL GetSingleReportByCategory('$username','$file_name','$ssid','$category', '$settings','$color_type');"; $mydata = $this->User->query($query); debug($mydata);
0
11,734,278
07/31/2012 06:22:56
1,108,055
12/20/2011 14:39:30
1
0
Do you can help me about speedup in cuda&&gpu?
I write a program in the cuda But my problem is the speed, because my program is slow. my program is k_means alghorithm. What do I do? thish is code program!. ` typedef long int LONGI; typedef long int** LONGINTPTRPTR; typedef double** DOUBLEPTRPTR; typedef long int* LONGINTPTR; typedef double& DOUBLEREF; typedef double* DOUBLEPTR; __device__ LONGI CurentClus = 0; __global__ void ClusterAssignment(LONGI NumOfCol, LONGI NumOfInputDataId, LONGI ClusCounter, double* DocDetails, double* ClusDetails, LONGI* Cent1, LONGI* Cent2, LONGI* InputData, LONGI* TmpCentroid, LONGI* TmpData) { long int ClusId1Counter = 0; //count number of each cluster members long int ClusId2Counter = 0; double Dis1 = 0; double Dis2 = 0; int idx = threadIdx.x + blockIdx.x * blockDim.x; //LONGINTPTR TmpCentroid = new LONGI[NumOfCol]; // LONGINTPTR TmpData = new LONGI[NumOfCol]; double CosineDis = 0; for (LONGI i = 0; i < NumOfInputDataId; i++) { if (DocDetails[i * 4 + 3] == CurentClus || DocDetails[i * 4 + 3] == lusCounter) { //3=clusid column in DocDetails for (LONGI j = idx; j < NumOfCol; ++j) TmpCentroid[j] = Cent1[j]; for (LONGI j = idx; j < NumOfCol; ++j) TmpData[j] = InputData[i * NumOfCol + j]; Dis1 = CosineSimilarityCalculation(NumOfCol, NumOfInputDataId, TmpCentroid, TmpData, CosineDis); //cluscounter=main loop counter // Dis1=CosineDis; for (LONGI j = idx; j < NumOfCol; ++j) TmpCentroid[j] = Cent2[j]; Dis2 = CosineSimilarityCalculation(NumOfCol, NumOfInputDataId, TmpCentroid, TmpData, CosineDis); //cluscounter=main loop counter //Dis2=CosineDis; if (Dis1 >= Dis2) { DocDetails[i * 4 + 3] = CurentClus; ClusId1Counter++; } else { DocDetails[i * 4 + 3] = ClusCounter; ClusId2Counter++; } } } ClusDetails[CurentClus * 4 + 3] = ClusId1Counter; //3=num of rows column ClusDetails[ClusCounter * 4 + 3] = ClusId2Counter; ClusId1Counter = 0; ClusId2Counter = 0; __syncthreads(); } __global__ void UpdateCenter(LONGI NumOfCol, LONGI NumOfInputDataId, LONGI ClusCounter, double* DocDetails, double* ClusDetails, LONGI* Cent1, LONGI* Cent2, LONGI* CentList, LONGI* InputData) { double sum1 = 0; //to hold sum of avg for each cluster members double sum2 = 0; //each document has a avrage,we calculate avrage of this avrage,then find closest document avrage to this.now we have id of closest document to centroid avrage.this document is centroid LONGI Cent1Index = 1; LONGI Cent2Index = 1; int idx = threadIdx.x + blockIdx.x * blockDim.x; for (LONGI i = idx; i < NumOfInputDataId; i++) { if (DocDetails[i * 4 + 3] == CurentClus) //3=clus id sum1 += DocDetails[i * 4 + 2]; //2= avg col if (DocDetails[i * 4 + 3] == ClusCounter) //3=clus id sum2 += DocDetails[i * 4 + 2]; } double Cent1Avg = sum1 / ClusDetails[CurentClus * 4 + 3]; //centroids of clusters sum/number of data) double Cent2Avg = sum2 / ClusDetails[ClusCounter * 4 + 3]; sum1 = 0; sum2 = 0; ClusDetails[CurentClus * 4 + 1] = Cent1Avg; //1=centroid column ClusDetails[ClusCounter * 4 + 1] = Cent2Avg; double closer1 = 999999999; double closer2 = 999999999; for (LONGI i = 0; i < NumOfInputDataId; i++) { if (DocDetails[i * 4 + 3] == CurentClus) { if (abs(DocDetails[i * 4 + 2] - Cent1Avg) <= closer1) { closer1 = DocDetails[i * 4 + 2]; Cent1Index = i; } } if (DocDetails[i * 4 + 3] == ClusCounter) { if (abs(DocDetails[i * 4 + 2] - Cent2Avg) <= closer2) { closer2 = DocDetails[i * 4 + 2]; Cent2Index = i; } } } LONGI j1 = DocDetails[Cent1Index * 4]; LONGI j2 = DocDetails[Cent2Index * 4]; for (LONGI i = idx; i < NumOfCol; i++) { Cent1[i] = InputData[j1 * NumOfCol + i]; Cent2[i] = InputData[j2 * NumOfCol + i]; } for (LONGI j = idx; j < NumOfCol; j++) { CentList[CurentClus * NumOfCol + j] = Cent1[j]; CentList[ClusCounter * NumOfCol + j] = Cent2[j]; } __syncthreads(); } int main() { LONGI NumOfClusters; LONGI NumOfInputDataId; LONGI NumOfCol = 1000; // LONGI CurentClus=0; //to know that,wich cluster is under process LONGI ClusCounter = 1; cudaError_t cudastatuse; float percent; //-----------------------------------------------------objects long int *InputDataIdList = (long int *) malloc(NumOfInputDataId * 2 * sizeof (long int)); double* DocDetails = new double [NumOfInputDataId * 4]; double* ClusDetails = new double [NumOfClusters * 4 ]; LONGI NumEnd = (NumOfInputDataId)*10; //matrix morabaee PresentData baraye negahdari LONGINTPTRPTR PresentData = new LONGI *[NumOfInputDataId]; for (LONGI i = 0; i < NumOfInputDataId; ++i) PresentData[i] = new LONGI[NumOfCol]; LONGI* InputData = (LONGI*) malloc(NumOfInputDataId * NumOfCol * sizeof (LONGI)); cout << " LONGI* InputData" << endl; LONGI* CentList = (LONGI*) malloc(NumOfClusters * NumOfCol * sizeof (LONGI)); LONGI *d_CentList; (cudaMalloc((void **) &d_CentList, NumOfClusters * NumOfCol * sizeof (LONGI))); double *d_ClusDetails; (cudaMalloc((void **) &d_ClusDetails, NumOfClusters * 4 * sizeof (double *))); double *d_DocDetails; (cudaMalloc((void **) &d_DocDetails, NumOfInputDataId * 4 * sizeof (double *))); LONGI* Cent1 = new LONGI[NumOfInputDataId]; LONGI* Cent2 = new LONGI[NumOfInputDataId]; LONGINTPTR Cent1_dev; LONGINTPTR Cent2_dev; if (cudaMalloc((void **) &Cent1_dev, NumOfInputDataId * sizeof (LONGI)) != cudaSuccess) { cout << "can not malloc centdev1" << endl; getchar(); } if (cudaMalloc((void **) &Cent2_dev, NumOfInputDataId * sizeof (LONGI)) != cudaSuccess) { cout << "can not alloc centdev2" << endl; getchar(); } LONGI *d_InputData; (cudaMalloc((void **) &d_InputData, NumOfInputDataId * NumOfCol * sizeof (LONGI*))); LONGI* TmpCentroid; LONGI* TmpData; if (cudaMalloc((void **) &TmpCentroid, NumOfCol * sizeof (LONGI)) != cudaSuccess) { cout << "can not malloc TmpCentroid" << endl; getchar(); } if (cudaMalloc((void **) &TmpData, NumOfCol * sizeof (LONGI)) != cudaSuccess) { cout << "can not alloc TmpData" << endl; getchar(); } if (cudaMemcpy(d_InputData, InputData, NumOfInputDataId * NumOfCol * sizeof (LONGI*), cudaMemcpyHostToDevice) != cudaSuccess) { cout << "can not copy InputData " << endl; getchar(); } if (cudaMemcpy(d_ClusDetails, ClusDetails, NumOfClusters * 4 * sizeof (double *), cudaMemcpyHostToDevice) != cudaSuccess) { cout << "can not copy d_ClusDetails " << endl; getchar(); } if (cudaMemcpy(d_DocDetails, DocDetails, NumOfInputDataId * 4 * sizeof (double *), cudaMemcpyHostToDevice) != cudaSuccess) { cout << "can not copy d_ClusDetails " << endl; getchar(); } cout << "test global kernel" << endl; // getchar(); int B = 1; // number of blocks, entered at keyboard dim3 Block(BlockSize, BlockSize); //Block structure, 32 x 32 max dim3 Grid(B, B); int blockneded = (NumOfInputDataId / 512) + 1; int threadperblock = (512 / blockneded) + 1; cudaEventRecord(start, 0); while (ClusCounter < NumOfClusters) { //until we didn`t arived to desired num of clusters: ChooseRandomCentroids << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, d_DocDetails, d_ClusDetails, d_InputData, Cent1_dev, Cent2_dev); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel ChooseRandomCentroids" << endl; getchar(); } ClusterAssignment << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, ClusCounter, d_DocDetails, d_ClusDetails, Cent1_dev, Cent2_dev, d_InputData, TmpCentroid, TmpData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel ClusterAssignment" << endl; getchar(); } for (int h = 0; h < 1; ++h) { UpdateCenter << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, ClusCounter, d_DocDetails, d_ClusDetails, Cent1_dev, Cent2_dev, d_CentList, d_InputData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel UpdateCenter" << endl; getchar(); } ClusterAssignment << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, ClusCounter, d_DocDetails, d_ClusDetails, Cent1_dev, Cent2_dev, d_InputData, TmpCentroid, TmpData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel ClusterAssignment" << endl; getchar(); } } SSECalculation << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, d_DocDetails, d_ClusDetails, ClusCounter, Cent1_dev, Cent2_dev, d_InputData, TmpCentroid, TmpData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel SSECalculation" << endl; getchar(); } SelectClusterToSplit << <blockneded, threadperblock >> >(ClusCounter, d_ClusDetails); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel SelectClusterToSplit" << endl; getchar(); } cout << " ClusCounter=" << ClusCounter << endl; ClusCounter++; } if (cudaMemcpy(Cent1, Cent1_dev, sizeof (LONGI) * NumOfInputDataId, cudaMemcpyDeviceToHost) != cudaSuccess) { cout << "can not copy from device Cent1_dev,Cent1" << endl; getchar(); } if (cudaMemcpy(Cent2, Cent2_dev, sizeof (LONGI) * NumOfInputDataId, cudaMemcpyDeviceToHost) != cudaSuccess) { cout << "can not copy from device Cent2_dev,Cent2" << endl; getchar(); } if (cudaMemcpy(DocDetails, d_DocDetails, NumOfInputDataId * 4 * sizeof (double*), cudaMemcpyDeviceToHost) != cudaSuccess) { cout << "gpu not copy to host DocDetails" << endl; getchar(); } if (cudaMemcpy(ClusDetails, d_ClusDetails, NumOfClusters * 4 * sizeof (double*), cudaMemcpyDeviceToHost) != cudaSuccess) { cout << " gpu not copy to host ClusDetails" << endl; getchar(); } cout << "\n------clusDetails\n "; for (int i = 0; i < NumOfClusters; i++) { cout << " \n "; for (int j = 0; j < 4; j++) cout << " " << ClusDetails[i * 4 + j]; } cout << endl << " success " << endl; return 0; } ` Thnx for your help.
cuda
gpu
cuda-gdb
null
null
null
open
Do you can help me about speedup in cuda&&gpu? === I write a program in the cuda But my problem is the speed, because my program is slow. my program is k_means alghorithm. What do I do? thish is code program!. ` typedef long int LONGI; typedef long int** LONGINTPTRPTR; typedef double** DOUBLEPTRPTR; typedef long int* LONGINTPTR; typedef double& DOUBLEREF; typedef double* DOUBLEPTR; __device__ LONGI CurentClus = 0; __global__ void ClusterAssignment(LONGI NumOfCol, LONGI NumOfInputDataId, LONGI ClusCounter, double* DocDetails, double* ClusDetails, LONGI* Cent1, LONGI* Cent2, LONGI* InputData, LONGI* TmpCentroid, LONGI* TmpData) { long int ClusId1Counter = 0; //count number of each cluster members long int ClusId2Counter = 0; double Dis1 = 0; double Dis2 = 0; int idx = threadIdx.x + blockIdx.x * blockDim.x; //LONGINTPTR TmpCentroid = new LONGI[NumOfCol]; // LONGINTPTR TmpData = new LONGI[NumOfCol]; double CosineDis = 0; for (LONGI i = 0; i < NumOfInputDataId; i++) { if (DocDetails[i * 4 + 3] == CurentClus || DocDetails[i * 4 + 3] == lusCounter) { //3=clusid column in DocDetails for (LONGI j = idx; j < NumOfCol; ++j) TmpCentroid[j] = Cent1[j]; for (LONGI j = idx; j < NumOfCol; ++j) TmpData[j] = InputData[i * NumOfCol + j]; Dis1 = CosineSimilarityCalculation(NumOfCol, NumOfInputDataId, TmpCentroid, TmpData, CosineDis); //cluscounter=main loop counter // Dis1=CosineDis; for (LONGI j = idx; j < NumOfCol; ++j) TmpCentroid[j] = Cent2[j]; Dis2 = CosineSimilarityCalculation(NumOfCol, NumOfInputDataId, TmpCentroid, TmpData, CosineDis); //cluscounter=main loop counter //Dis2=CosineDis; if (Dis1 >= Dis2) { DocDetails[i * 4 + 3] = CurentClus; ClusId1Counter++; } else { DocDetails[i * 4 + 3] = ClusCounter; ClusId2Counter++; } } } ClusDetails[CurentClus * 4 + 3] = ClusId1Counter; //3=num of rows column ClusDetails[ClusCounter * 4 + 3] = ClusId2Counter; ClusId1Counter = 0; ClusId2Counter = 0; __syncthreads(); } __global__ void UpdateCenter(LONGI NumOfCol, LONGI NumOfInputDataId, LONGI ClusCounter, double* DocDetails, double* ClusDetails, LONGI* Cent1, LONGI* Cent2, LONGI* CentList, LONGI* InputData) { double sum1 = 0; //to hold sum of avg for each cluster members double sum2 = 0; //each document has a avrage,we calculate avrage of this avrage,then find closest document avrage to this.now we have id of closest document to centroid avrage.this document is centroid LONGI Cent1Index = 1; LONGI Cent2Index = 1; int idx = threadIdx.x + blockIdx.x * blockDim.x; for (LONGI i = idx; i < NumOfInputDataId; i++) { if (DocDetails[i * 4 + 3] == CurentClus) //3=clus id sum1 += DocDetails[i * 4 + 2]; //2= avg col if (DocDetails[i * 4 + 3] == ClusCounter) //3=clus id sum2 += DocDetails[i * 4 + 2]; } double Cent1Avg = sum1 / ClusDetails[CurentClus * 4 + 3]; //centroids of clusters sum/number of data) double Cent2Avg = sum2 / ClusDetails[ClusCounter * 4 + 3]; sum1 = 0; sum2 = 0; ClusDetails[CurentClus * 4 + 1] = Cent1Avg; //1=centroid column ClusDetails[ClusCounter * 4 + 1] = Cent2Avg; double closer1 = 999999999; double closer2 = 999999999; for (LONGI i = 0; i < NumOfInputDataId; i++) { if (DocDetails[i * 4 + 3] == CurentClus) { if (abs(DocDetails[i * 4 + 2] - Cent1Avg) <= closer1) { closer1 = DocDetails[i * 4 + 2]; Cent1Index = i; } } if (DocDetails[i * 4 + 3] == ClusCounter) { if (abs(DocDetails[i * 4 + 2] - Cent2Avg) <= closer2) { closer2 = DocDetails[i * 4 + 2]; Cent2Index = i; } } } LONGI j1 = DocDetails[Cent1Index * 4]; LONGI j2 = DocDetails[Cent2Index * 4]; for (LONGI i = idx; i < NumOfCol; i++) { Cent1[i] = InputData[j1 * NumOfCol + i]; Cent2[i] = InputData[j2 * NumOfCol + i]; } for (LONGI j = idx; j < NumOfCol; j++) { CentList[CurentClus * NumOfCol + j] = Cent1[j]; CentList[ClusCounter * NumOfCol + j] = Cent2[j]; } __syncthreads(); } int main() { LONGI NumOfClusters; LONGI NumOfInputDataId; LONGI NumOfCol = 1000; // LONGI CurentClus=0; //to know that,wich cluster is under process LONGI ClusCounter = 1; cudaError_t cudastatuse; float percent; //-----------------------------------------------------objects long int *InputDataIdList = (long int *) malloc(NumOfInputDataId * 2 * sizeof (long int)); double* DocDetails = new double [NumOfInputDataId * 4]; double* ClusDetails = new double [NumOfClusters * 4 ]; LONGI NumEnd = (NumOfInputDataId)*10; //matrix morabaee PresentData baraye negahdari LONGINTPTRPTR PresentData = new LONGI *[NumOfInputDataId]; for (LONGI i = 0; i < NumOfInputDataId; ++i) PresentData[i] = new LONGI[NumOfCol]; LONGI* InputData = (LONGI*) malloc(NumOfInputDataId * NumOfCol * sizeof (LONGI)); cout << " LONGI* InputData" << endl; LONGI* CentList = (LONGI*) malloc(NumOfClusters * NumOfCol * sizeof (LONGI)); LONGI *d_CentList; (cudaMalloc((void **) &d_CentList, NumOfClusters * NumOfCol * sizeof (LONGI))); double *d_ClusDetails; (cudaMalloc((void **) &d_ClusDetails, NumOfClusters * 4 * sizeof (double *))); double *d_DocDetails; (cudaMalloc((void **) &d_DocDetails, NumOfInputDataId * 4 * sizeof (double *))); LONGI* Cent1 = new LONGI[NumOfInputDataId]; LONGI* Cent2 = new LONGI[NumOfInputDataId]; LONGINTPTR Cent1_dev; LONGINTPTR Cent2_dev; if (cudaMalloc((void **) &Cent1_dev, NumOfInputDataId * sizeof (LONGI)) != cudaSuccess) { cout << "can not malloc centdev1" << endl; getchar(); } if (cudaMalloc((void **) &Cent2_dev, NumOfInputDataId * sizeof (LONGI)) != cudaSuccess) { cout << "can not alloc centdev2" << endl; getchar(); } LONGI *d_InputData; (cudaMalloc((void **) &d_InputData, NumOfInputDataId * NumOfCol * sizeof (LONGI*))); LONGI* TmpCentroid; LONGI* TmpData; if (cudaMalloc((void **) &TmpCentroid, NumOfCol * sizeof (LONGI)) != cudaSuccess) { cout << "can not malloc TmpCentroid" << endl; getchar(); } if (cudaMalloc((void **) &TmpData, NumOfCol * sizeof (LONGI)) != cudaSuccess) { cout << "can not alloc TmpData" << endl; getchar(); } if (cudaMemcpy(d_InputData, InputData, NumOfInputDataId * NumOfCol * sizeof (LONGI*), cudaMemcpyHostToDevice) != cudaSuccess) { cout << "can not copy InputData " << endl; getchar(); } if (cudaMemcpy(d_ClusDetails, ClusDetails, NumOfClusters * 4 * sizeof (double *), cudaMemcpyHostToDevice) != cudaSuccess) { cout << "can not copy d_ClusDetails " << endl; getchar(); } if (cudaMemcpy(d_DocDetails, DocDetails, NumOfInputDataId * 4 * sizeof (double *), cudaMemcpyHostToDevice) != cudaSuccess) { cout << "can not copy d_ClusDetails " << endl; getchar(); } cout << "test global kernel" << endl; // getchar(); int B = 1; // number of blocks, entered at keyboard dim3 Block(BlockSize, BlockSize); //Block structure, 32 x 32 max dim3 Grid(B, B); int blockneded = (NumOfInputDataId / 512) + 1; int threadperblock = (512 / blockneded) + 1; cudaEventRecord(start, 0); while (ClusCounter < NumOfClusters) { //until we didn`t arived to desired num of clusters: ChooseRandomCentroids << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, d_DocDetails, d_ClusDetails, d_InputData, Cent1_dev, Cent2_dev); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel ChooseRandomCentroids" << endl; getchar(); } ClusterAssignment << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, ClusCounter, d_DocDetails, d_ClusDetails, Cent1_dev, Cent2_dev, d_InputData, TmpCentroid, TmpData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel ClusterAssignment" << endl; getchar(); } for (int h = 0; h < 1; ++h) { UpdateCenter << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, ClusCounter, d_DocDetails, d_ClusDetails, Cent1_dev, Cent2_dev, d_CentList, d_InputData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel UpdateCenter" << endl; getchar(); } ClusterAssignment << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, ClusCounter, d_DocDetails, d_ClusDetails, Cent1_dev, Cent2_dev, d_InputData, TmpCentroid, TmpData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel ClusterAssignment" << endl; getchar(); } } SSECalculation << <blockneded, threadperblock >> >(NumOfCol, NumOfInputDataId, d_DocDetails, d_ClusDetails, ClusCounter, Cent1_dev, Cent2_dev, d_InputData, TmpCentroid, TmpData); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel SSECalculation" << endl; getchar(); } SelectClusterToSplit << <blockneded, threadperblock >> >(ClusCounter, d_ClusDetails); cudastatuse = cudaThreadSynchronize(); if (cudastatuse != cudaSuccess) { cout << " can not lunch kernel SelectClusterToSplit" << endl; getchar(); } cout << " ClusCounter=" << ClusCounter << endl; ClusCounter++; } if (cudaMemcpy(Cent1, Cent1_dev, sizeof (LONGI) * NumOfInputDataId, cudaMemcpyDeviceToHost) != cudaSuccess) { cout << "can not copy from device Cent1_dev,Cent1" << endl; getchar(); } if (cudaMemcpy(Cent2, Cent2_dev, sizeof (LONGI) * NumOfInputDataId, cudaMemcpyDeviceToHost) != cudaSuccess) { cout << "can not copy from device Cent2_dev,Cent2" << endl; getchar(); } if (cudaMemcpy(DocDetails, d_DocDetails, NumOfInputDataId * 4 * sizeof (double*), cudaMemcpyDeviceToHost) != cudaSuccess) { cout << "gpu not copy to host DocDetails" << endl; getchar(); } if (cudaMemcpy(ClusDetails, d_ClusDetails, NumOfClusters * 4 * sizeof (double*), cudaMemcpyDeviceToHost) != cudaSuccess) { cout << " gpu not copy to host ClusDetails" << endl; getchar(); } cout << "\n------clusDetails\n "; for (int i = 0; i < NumOfClusters; i++) { cout << " \n "; for (int j = 0; j < 4; j++) cout << " " << ClusDetails[i * 4 + j]; } cout << endl << " success " << endl; return 0; } ` Thnx for your help.
0
11,734,291
07/31/2012 06:23:47
1,546,659
07/23/2012 18:33:29
1
0
Omniauth + Devise Redirect Error
I have the following problem: My app is running as a Facebook app, but on the first time that the user accept's it's Facebook permissions, it's redirected to the right URL, but outside the Facebook (canvas). How can I fix it? Here is my actual settings: devise.rb:` config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET'], scope: "email,publish_stream" ` app/controllers/omniauth_callback_controller.rb class OmniauthCallbacksController < Devise::OmniauthCallbacksController def passthru render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false end def facebook @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user) if @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook" sign_in_and_redirect @user, :event => :authentication else session["devise.facebook_data"] = request.env["omniauth.auth"] redirect_to root_path end end def after_sign_in_path_for(resource) inicio_path end end routes.rb Pl::Application.routes.draw do ActiveAdmin.routes(self) mount Resque::Server, :at => "/resque" devise_for :admin_users, ActiveAdmin::Devise.config devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" } devise_scope :user do get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' end match 'states' => 'game_plays#states' match 'cities' => 'game_plays#cities' match 'parties' => 'game_plays#parties' match 'prefeito' => 'game_plays#prefeito' match 'prefeitos' => 'game_plays#prefeitos' match 'vereadores' => 'game_plays#vereadores' match 'parties' => 'game_plays#parties' match 'qualities' => 'game_plays#qualities' match 'start' => 'game_plays#start' match 'generated_image' => 'game_plays#generated_image' match 'save_game_play' => 'game_plays#save_game_play' match 'final' => 'game_plays#final', :as => :final match 'inicio' => 'game_plays#index' root :to => 'game_plays#bem_vindo' end Any sugestions?
ruby-on-rails
facebook
devise
omniauth
facebook-iframe
null
open
Omniauth + Devise Redirect Error === I have the following problem: My app is running as a Facebook app, but on the first time that the user accept's it's Facebook permissions, it's redirected to the right URL, but outside the Facebook (canvas). How can I fix it? Here is my actual settings: devise.rb:` config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET'], scope: "email,publish_stream" ` app/controllers/omniauth_callback_controller.rb class OmniauthCallbacksController < Devise::OmniauthCallbacksController def passthru render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false end def facebook @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user) if @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook" sign_in_and_redirect @user, :event => :authentication else session["devise.facebook_data"] = request.env["omniauth.auth"] redirect_to root_path end end def after_sign_in_path_for(resource) inicio_path end end routes.rb Pl::Application.routes.draw do ActiveAdmin.routes(self) mount Resque::Server, :at => "/resque" devise_for :admin_users, ActiveAdmin::Devise.config devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" } devise_scope :user do get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' end match 'states' => 'game_plays#states' match 'cities' => 'game_plays#cities' match 'parties' => 'game_plays#parties' match 'prefeito' => 'game_plays#prefeito' match 'prefeitos' => 'game_plays#prefeitos' match 'vereadores' => 'game_plays#vereadores' match 'parties' => 'game_plays#parties' match 'qualities' => 'game_plays#qualities' match 'start' => 'game_plays#start' match 'generated_image' => 'game_plays#generated_image' match 'save_game_play' => 'game_plays#save_game_play' match 'final' => 'game_plays#final', :as => :final match 'inicio' => 'game_plays#index' root :to => 'game_plays#bem_vindo' end Any sugestions?
0
11,734,292
07/31/2012 06:23:48
788,605
06/08/2011 05:18:28
68
17
Flash scope not working in glassfish with jsf2.1
When I am using flash scope in glassfish it lives longer than one request but works fine with jetty8 and even tried the latest version of glassfish but its not working. The JSF has a jira about it and they have solved it in the next version, I have even tried that version of jars for JSF but still same problem persists in Glassfish but works fine for Jetty8. Facing this problem from many days can anyone throw some light on this??
jsf
glassfish
null
null
null
null
open
Flash scope not working in glassfish with jsf2.1 === When I am using flash scope in glassfish it lives longer than one request but works fine with jetty8 and even tried the latest version of glassfish but its not working. The JSF has a jira about it and they have solved it in the next version, I have even tried that version of jars for JSF but still same problem persists in Glassfish but works fine for Jetty8. Facing this problem from many days can anyone throw some light on this??
0
11,734,293
07/31/2012 06:23:49
1,534,457
07/18/2012 10:30:32
6
0
$(window) or $(document) to measure width and height to auto fit images in browser with every screen
I have to fit all the images on a screen with every screen resolution. Which should i use $(window) or $(document) to measure height /width to auto fit images.
jquery
html
null
null
null
null
open
$(window) or $(document) to measure width and height to auto fit images in browser with every screen === I have to fit all the images on a screen with every screen resolution. Which should i use $(window) or $(document) to measure height /width to auto fit images.
0
11,734,295
07/31/2012 06:23:54
992,774
10/13/2011 05:56:25
840
80
build failed without error in xcode 4.4
My project is running fine up to xcode version 4.3, when I updated it to version 4.4 it shows failed without any error on building the code, I have tried searching over Google and try every possible step but not able to solve my problem.
iphone
ios
xcode
xcode4.4
null
null
open
build failed without error in xcode 4.4 === My project is running fine up to xcode version 4.3, when I updated it to version 4.4 it shows failed without any error on building the code, I have tried searching over Google and try every possible step but not able to solve my problem.
0
11,734,297
07/31/2012 06:24:04
1,468,481
06/20/2012 07:44:18
56
1
log4j:WARN Please initialize the log4j system properly; still Log file created,but not in UNIX
I'm developing web application which has commons-logging.jar and for logging log4j.jar. I got the following message when server start up. log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). log4j:WARN Please initialize the log4j system properly. But still log file is created and the format also same as specified in the log4j.properties. **The application log file is creating in Windows environment, But not in Unix environment.** Why it is not creating log file in UNIX ? Folder has write permissions.. Any idea? Laxman Chowdary
log4j
struts
null
null
null
null
open
log4j:WARN Please initialize the log4j system properly; still Log file created,but not in UNIX === I'm developing web application which has commons-logging.jar and for logging log4j.jar. I got the following message when server start up. log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). log4j:WARN Please initialize the log4j system properly. But still log file is created and the format also same as specified in the log4j.properties. **The application log file is creating in Windows environment, But not in Unix environment.** Why it is not creating log file in UNIX ? Folder has write permissions.. Any idea? Laxman Chowdary
0
11,734,304
07/31/2012 06:24:28
546,801
12/18/2010 05:12:33
193
20
How to read the path compiled in a javax.xml.xpath.XPathExpression?
If I am given a javax.xml.xpath.XPathExpression object in Java, how can I get the path that was used to compile it (assuming I do not have access to the path itself)? For example: Somewhere in code that I do not have access to are these lines: String path = "/this/is/my/path"; XPath xp = XPathFactory.newInstance().newXPath(); XPathExpression xpe = XPATH.compile(xp); ... then later I am only given the XPathExpression object *xpe* to work with. How can I get the value of *path* (the string path used to compile xpe) again?
java
xpath
null
null
null
null
open
How to read the path compiled in a javax.xml.xpath.XPathExpression? === If I am given a javax.xml.xpath.XPathExpression object in Java, how can I get the path that was used to compile it (assuming I do not have access to the path itself)? For example: Somewhere in code that I do not have access to are these lines: String path = "/this/is/my/path"; XPath xp = XPathFactory.newInstance().newXPath(); XPathExpression xpe = XPATH.compile(xp); ... then later I am only given the XPathExpression object *xpe* to work with. How can I get the value of *path* (the string path used to compile xpe) again?
0
11,734,307
07/31/2012 06:24:44
1,220,350
02/20/2012 06:16:50
511
6
giving "Microsoft sharepoint soapserver soap server exception" while getting the list items
I am trying to get the list items by using the webservice reference model. I am trying to get the details of the list as this SPSeriveReference.Lists client = new SPSeriveReference.Lists(); client.Credentials = new NetworkCredential("Administrator", "pswd","MyDomain"); XmlDocument mydoc = new XmlDocument(); XmlElement viewFileds = mydoc.CreateElement("ViewFields"); viewFileds.InnerXml = "<FieldRef Name=\"Title\" />" + "<FieldRef Name=\"Name\" />" + "<FieldRef Name=\"Address\" />"; XmlNode listItems = client.GetListItems("Manager", null, null, viewFileds, null, null, null); //a4af13f3-69f6-45e3-930d-8c2ce61a10fd //XmlNode listItems = client.GetListItems("Manager", null, null, viewFileds, null, null, null); foreach (XmlNode node in listItems) { if (node.Name == "rs:data") { for (int i = 0; i < node.ChildNodes.Count; i++) { if (node.ChildNodes[i].Name=="z:row") { string title = node.ChildNodes[i].Attributes["ows_Title"].Name; string name = node.ChildNodes[i].Attributes["ows_Name"].Name; string address = node.ChildNodes[i].Attributes["ows_Address"].Name; Console.WriteLine(title + " " + name + " " + address); } } } } But this is giving run time exception as "Microsoft.SharePoint.SoapServer.SoapServerException" What is the solution for this one? I verified the questions in stack overflow which were asked previously regarding the same error. But none of the provided the solution for this problem.
sharepoint
sharepoint2010
null
null
null
null
open
giving "Microsoft sharepoint soapserver soap server exception" while getting the list items === I am trying to get the list items by using the webservice reference model. I am trying to get the details of the list as this SPSeriveReference.Lists client = new SPSeriveReference.Lists(); client.Credentials = new NetworkCredential("Administrator", "pswd","MyDomain"); XmlDocument mydoc = new XmlDocument(); XmlElement viewFileds = mydoc.CreateElement("ViewFields"); viewFileds.InnerXml = "<FieldRef Name=\"Title\" />" + "<FieldRef Name=\"Name\" />" + "<FieldRef Name=\"Address\" />"; XmlNode listItems = client.GetListItems("Manager", null, null, viewFileds, null, null, null); //a4af13f3-69f6-45e3-930d-8c2ce61a10fd //XmlNode listItems = client.GetListItems("Manager", null, null, viewFileds, null, null, null); foreach (XmlNode node in listItems) { if (node.Name == "rs:data") { for (int i = 0; i < node.ChildNodes.Count; i++) { if (node.ChildNodes[i].Name=="z:row") { string title = node.ChildNodes[i].Attributes["ows_Title"].Name; string name = node.ChildNodes[i].Attributes["ows_Name"].Name; string address = node.ChildNodes[i].Attributes["ows_Address"].Name; Console.WriteLine(title + " " + name + " " + address); } } } } But this is giving run time exception as "Microsoft.SharePoint.SoapServer.SoapServerException" What is the solution for this one? I verified the questions in stack overflow which were asked previously regarding the same error. But none of the provided the solution for this problem.
0
11,733,817
07/31/2012 05:41:08
735,574
05/03/2011 06:21:45
14
1
How to have a default value for the not found keys in a map in spring
I have three classes a,b, and c. All inherit the same class, and I have to select which class to use during runtime on the basis of a key. Here is the Spring code I wrote: <bean id="ConfigurationAdapterMap" class="abc"> <property name="adapterMap"> <map> <entry key="key1"> <bean class="class1"/> </entry> <entry key="Other"> <bean class="class2"/> </entry> </map> </property> </bean> I don't want to pass 'Other' explicitly, and I want to return class2, if the given key does not match any key in the keyset. Can I get spring to do this?
java
spring
null
null
null
null
open
How to have a default value for the not found keys in a map in spring === I have three classes a,b, and c. All inherit the same class, and I have to select which class to use during runtime on the basis of a key. Here is the Spring code I wrote: <bean id="ConfigurationAdapterMap" class="abc"> <property name="adapterMap"> <map> <entry key="key1"> <bean class="class1"/> </entry> <entry key="Other"> <bean class="class2"/> </entry> </map> </property> </bean> I don't want to pass 'Other' explicitly, and I want to return class2, if the given key does not match any key in the keyset. Can I get spring to do this?
0
11,733,818
07/31/2012 05:41:11
1,061,967
11/23/2011 13:10:21
1,011
57
Border is overlapping content
So i've run into an annoying issue where i've set a wide border (15px) on a div and I have an element that is floated right inside of that div with a negative margin to top so that it slightly overlaps the border. This was working fine until I set the div to overflow-y:scroll and now instead of the the text overlapping the border the border overlaps the text. I'm at a loss as to why this occurs and how to fix it. - [**live demo**][1] | the h1 element at the top of each `.window` is being overlapped by the border but if you disable the `overflow-y:scroll` on `.window` then it is fine. **What i've tried so far** - I tried giving the `h1` a higher z-index than the `.window` [1]: http://thepelican.me/me/index.html
html
css
null
null
null
null
open
Border is overlapping content === So i've run into an annoying issue where i've set a wide border (15px) on a div and I have an element that is floated right inside of that div with a negative margin to top so that it slightly overlaps the border. This was working fine until I set the div to overflow-y:scroll and now instead of the the text overlapping the border the border overlaps the text. I'm at a loss as to why this occurs and how to fix it. - [**live demo**][1] | the h1 element at the top of each `.window` is being overlapped by the border but if you disable the `overflow-y:scroll` on `.window` then it is fine. **What i've tried so far** - I tried giving the `h1` a higher z-index than the `.window` [1]: http://thepelican.me/me/index.html
0
11,734,312
07/31/2012 06:24:54
1,564,830
07/31/2012 06:06:39
1
0
wordpress simple paypal shopping cart shortcode in custom fields
i”m using wordpress simple paypal shopping cart and i want to parse the shortcode into custom field, i”ve found an example but it”s not working above the loop i”ve put this `<?php $price = get_post_meta( $post->ID, ‘price’, true ); ?>` and i want to display the add to cart button i have this `<?php echo print_wp_cart_button_for_product($name, $price); ?>` it”s not working right the add to cart button apear on every post, when u press it it add product in cart with no name and no price when i add key=price and value= 25 it add to cart same noname and noprice product :( btw the shortcode i want to parse it”s looks like this [wp_cart:PRODUCT NAME:price:PRODUCT PRICE:end]
wordpress
null
null
null
null
null
open
wordpress simple paypal shopping cart shortcode in custom fields === i”m using wordpress simple paypal shopping cart and i want to parse the shortcode into custom field, i”ve found an example but it”s not working above the loop i”ve put this `<?php $price = get_post_meta( $post->ID, ‘price’, true ); ?>` and i want to display the add to cart button i have this `<?php echo print_wp_cart_button_for_product($name, $price); ?>` it”s not working right the add to cart button apear on every post, when u press it it add product in cart with no name and no price when i add key=price and value= 25 it add to cart same noname and noprice product :( btw the shortcode i want to parse it”s looks like this [wp_cart:PRODUCT NAME:price:PRODUCT PRICE:end]
0
11,280,461
07/01/2012 08:08:31
1,061,531
11/23/2011 09:16:14
8
0
Google Analytics custom variables usage
I am a newbie to GA. I am not sure whether GA is the right fit for the reports i m looking for. Kindly help **My situation is:** **I have a ajax form with submit and skip buttons for each question.** **I need to track who all skipped or answered along with their user_id, question_id, campaign_id and category_id** **And I should be able to retrieve the users who answered/skipped a particular campaign/question/category** I tried using custom variables like: _gaq.push(['_setCustomVar', 1, 'skip', 'yes', 1]) _gaq.push(['_setCustomVar', 2, 'Campaign', campaign_id, 1]) _gaq.push(['_setCustomVar', 3, 'Engagement', question_id, 1]) _gaq.push(['_setCustomVar', 4, 'Property', category_id, 1]) _gaq.push(['_setCustomVar', 5, 'User', user_id, 1]) _gaq.push(['_trackEvent']) How do i get all the skipped users for a particular campaign or a question from this? Does GA fit my requirements?
javascript
google-analytics
google-api
google-analytics-api
null
null
open
Google Analytics custom variables usage === I am a newbie to GA. I am not sure whether GA is the right fit for the reports i m looking for. Kindly help **My situation is:** **I have a ajax form with submit and skip buttons for each question.** **I need to track who all skipped or answered along with their user_id, question_id, campaign_id and category_id** **And I should be able to retrieve the users who answered/skipped a particular campaign/question/category** I tried using custom variables like: _gaq.push(['_setCustomVar', 1, 'skip', 'yes', 1]) _gaq.push(['_setCustomVar', 2, 'Campaign', campaign_id, 1]) _gaq.push(['_setCustomVar', 3, 'Engagement', question_id, 1]) _gaq.push(['_setCustomVar', 4, 'Property', category_id, 1]) _gaq.push(['_setCustomVar', 5, 'User', user_id, 1]) _gaq.push(['_trackEvent']) How do i get all the skipped users for a particular campaign or a question from this? Does GA fit my requirements?
0
11,280,469
07/01/2012 08:09:17
622,829
02/18/2011 08:52:38
47
4
why java.nio.charset.Charsets compile error?
in my class UriCodec.java,but when i use javac(jdk6) compile this class error. for example: javac UriCodec.java java code: import java.io.ByteArrayOutputStream; import java.net.URISyntaxException; import java.nio.charset.Charset; import java.nio.charset.Charsets; public abstract class UriCodec { protected abstract boolean isRetained(char c); public final String encode(String s, Charset charset) { // Guess a bit larger for encoded form StringBuilder builder = new StringBuilder(s.length() + 16); appendEncoded(builder, s, charset, false); return builder.toString(); } public final void appendEncoded(StringBuilder builder, String s) { appendEncoded(builder, s, Charsets.UTF_8, false); } public final void appendPartiallyEncoded(StringBuilder builder, String s) { appendEncoded(builder, s, Charsets.UTF_8, true); } public static String decode(String s) { return decode(s, false, Charsets.UTF_8); } private static void appendHex(StringBuilder builder, String s, Charset charset) { for (byte b : s.getBytes(charset)) { appendHex(builder, b); } } private static void appendHex(StringBuilder sb, byte b) { sb.append('%'); sb.append(Byte.toHexString(b, true)); } } error code: import java.nio.charset.Charsets; ^ UriCodec.java:140: Can not find symbol symbol: Variable Charsets location: class com.android.exchange.utility.UriCodec appendEncoded(builder, s, Charsets.UTF_8, false); ^ UriCodec.java:144: Can not find symbol symbol: Variable Charsets location: class com.android.exchange.utility.UriCodec appendEncoded(builder, s, Charsets.UTF_8, true); ^ UriCodec.java:203: Can not find symbol symbol: Variable Charsets location: class com.android.exchange.utility.UriCodec return decode(s, false, Charsets.UTF_8); ^ UriCodec.java:214: Can not find symbol symbol: Method toHexString(byte,boolean) location: class java.lang.Byte sb.append(Byte.toHexString(b, true)); ^ 5 error The class UriCodec.java is compile Correctly in eclipse ,but use javac UriCodec.java is not correct.Who can tell me why?
compilation
javac
jdk6
null
null
null
open
why java.nio.charset.Charsets compile error? === in my class UriCodec.java,but when i use javac(jdk6) compile this class error. for example: javac UriCodec.java java code: import java.io.ByteArrayOutputStream; import java.net.URISyntaxException; import java.nio.charset.Charset; import java.nio.charset.Charsets; public abstract class UriCodec { protected abstract boolean isRetained(char c); public final String encode(String s, Charset charset) { // Guess a bit larger for encoded form StringBuilder builder = new StringBuilder(s.length() + 16); appendEncoded(builder, s, charset, false); return builder.toString(); } public final void appendEncoded(StringBuilder builder, String s) { appendEncoded(builder, s, Charsets.UTF_8, false); } public final void appendPartiallyEncoded(StringBuilder builder, String s) { appendEncoded(builder, s, Charsets.UTF_8, true); } public static String decode(String s) { return decode(s, false, Charsets.UTF_8); } private static void appendHex(StringBuilder builder, String s, Charset charset) { for (byte b : s.getBytes(charset)) { appendHex(builder, b); } } private static void appendHex(StringBuilder sb, byte b) { sb.append('%'); sb.append(Byte.toHexString(b, true)); } } error code: import java.nio.charset.Charsets; ^ UriCodec.java:140: Can not find symbol symbol: Variable Charsets location: class com.android.exchange.utility.UriCodec appendEncoded(builder, s, Charsets.UTF_8, false); ^ UriCodec.java:144: Can not find symbol symbol: Variable Charsets location: class com.android.exchange.utility.UriCodec appendEncoded(builder, s, Charsets.UTF_8, true); ^ UriCodec.java:203: Can not find symbol symbol: Variable Charsets location: class com.android.exchange.utility.UriCodec return decode(s, false, Charsets.UTF_8); ^ UriCodec.java:214: Can not find symbol symbol: Method toHexString(byte,boolean) location: class java.lang.Byte sb.append(Byte.toHexString(b, true)); ^ 5 error The class UriCodec.java is compile Correctly in eclipse ,but use javac UriCodec.java is not correct.Who can tell me why?
0
11,280,280
07/01/2012 07:31:28
1,493,969
07/01/2012 07:13:05
1
1
TCPDF - how to make header on page 2 and up without including page 1?
i have a problem in TCPDF, perhaps someone could help me? here is the scenario, i have a PDF lets say it can reach up to 50pages depending on the page breaks, now what i need is to give each of them a HEADER, WITHOUT INCLUDING the FIRST PAGE is there any way to do this? i tried to make a function that knows only pages 2 and up are supposed to have headers but i failed. thanks in advance . . .
header
tcpdf
null
null
null
null
open
TCPDF - how to make header on page 2 and up without including page 1? === i have a problem in TCPDF, perhaps someone could help me? here is the scenario, i have a PDF lets say it can reach up to 50pages depending on the page breaks, now what i need is to give each of them a HEADER, WITHOUT INCLUDING the FIRST PAGE is there any way to do this? i tried to make a function that knows only pages 2 and up are supposed to have headers but i failed. thanks in advance . . .
0
11,688,457
07/27/2012 13:12:38
1,521,000
07/12/2012 13:53:35
1
0
Phone gap geolocation with google maps
I wanna make an app which requires me to get my position and display it on google maps. I used the code from http://wiki.phonegap.com/w/page/16494764/PhoneGap%20Geolocation%20Sample%20Application. I am developing for Android 2.2 using phonegap 2.0.0. I am using the emulator 2.2. I have installed everything from Phonegap correctly and i obtained a google Api3 key for the map. I place the key after: http://maps.google.com/maps/api/staticmap?center=(here i place the key). Now when i start the app i use CMD to send coördinates. Telnet Localhost 5554, geo fix et cetera. When i start the app it will give an error: Cant retrieve position Error[object PositionError]. Could anyone help me?
android
google-maps
phonegap
geolocation
null
null
open
Phone gap geolocation with google maps === I wanna make an app which requires me to get my position and display it on google maps. I used the code from http://wiki.phonegap.com/w/page/16494764/PhoneGap%20Geolocation%20Sample%20Application. I am developing for Android 2.2 using phonegap 2.0.0. I am using the emulator 2.2. I have installed everything from Phonegap correctly and i obtained a google Api3 key for the map. I place the key after: http://maps.google.com/maps/api/staticmap?center=(here i place the key). Now when i start the app i use CMD to send coördinates. Telnet Localhost 5554, geo fix et cetera. When i start the app it will give an error: Cant retrieve position Error[object PositionError]. Could anyone help me?
0
11,693,112
07/27/2012 17:55:21
218,125
11/24/2009 20:59:04
280
9
Why doesn't Internet Explorer 8 recognize the doctype when inserted at runtime?
<!-- language-all: lang-html --> As the title suggests, I'm trying to inject a doctype at runtime on a page-by-page basis. The application uses a single master with a gazillion content pages, so naturally I've tried inserting an `asp:contentplaceholder` control on the master, and using an `asp:content` control on the content page. This works in that the doctype element shows up when you view source, but it doesn't work in that the browser (IE8) is still running in Quirks mode for some god-forsaken reason. Here's the placeholder on the master: <asp:contentplaceholder id="doctype" runat="server" /> Here's the content panel on the page: <asp:content contentplaceholderid="doctype" runat="server" > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> </asp:content> I'm a bit baffled as to why this isn't working, since the replacement should happen server-side, then the output gets sent to the browser with the doctype already in place... Why am I doing this? -------------------- I'm only doing this because specifying a doctype on the master means I would then need to go and fix the gazillion content pages before I can even begin to work on the assigned task. If I can figure out a way to inject a doctype via certain content pages, then I can effectively fix one page at a time until they are finished. Which browsers does this affect? -------------------------------- *Internet Explorer 8* is our primary target. It is, ironically, the browser that is effectively ignoring the injected doctype. When checking `document.doctype` at runtime after the DOM is loaded, it's returning `null`. *Firefox* behaves differently. This technique actually works in Firefox, but doesn't really help [me] since all of our users are stuck with Internet Explorer 8.
asp.net
doctype
null
null
null
null
open
Why doesn't Internet Explorer 8 recognize the doctype when inserted at runtime? === <!-- language-all: lang-html --> As the title suggests, I'm trying to inject a doctype at runtime on a page-by-page basis. The application uses a single master with a gazillion content pages, so naturally I've tried inserting an `asp:contentplaceholder` control on the master, and using an `asp:content` control on the content page. This works in that the doctype element shows up when you view source, but it doesn't work in that the browser (IE8) is still running in Quirks mode for some god-forsaken reason. Here's the placeholder on the master: <asp:contentplaceholder id="doctype" runat="server" /> Here's the content panel on the page: <asp:content contentplaceholderid="doctype" runat="server" > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> </asp:content> I'm a bit baffled as to why this isn't working, since the replacement should happen server-side, then the output gets sent to the browser with the doctype already in place... Why am I doing this? -------------------- I'm only doing this because specifying a doctype on the master means I would then need to go and fix the gazillion content pages before I can even begin to work on the assigned task. If I can figure out a way to inject a doctype via certain content pages, then I can effectively fix one page at a time until they are finished. Which browsers does this affect? -------------------------------- *Internet Explorer 8* is our primary target. It is, ironically, the browser that is effectively ignoring the injected doctype. When checking `document.doctype` at runtime after the DOM is loaded, it's returning `null`. *Firefox* behaves differently. This technique actually works in Firefox, but doesn't really help [me] since all of our users are stuck with Internet Explorer 8.
0
11,693,113
07/27/2012 17:55:32
1,115,394
12/25/2011 15:10:31
41
0
WinApi: How to resize the window region on MouseMove event correctly?
My application is screenshot maker. User needs to select screen area to make a screenshot. I use Win32 API with PureBasic, but it doesn't matter, all is similar with C++. When user runs application, the semitransparent borderless form is shown on full screen to hook mouse over all other windows. On mouse down event selection is started and I apply XORed region to the form to cut a hole in it with size of current selection. I create and apply a new region on every **mousemove** event: rgn1 = CreateRectRgn_(0,0,DWidth,DHeight) ; full size of desktop rgn2 = CreateRectRgn_(sx, sy, ex, ey) ; current selection points CombineRgn_(rgn1, rgn1, rgn2, #RGN_XOR) SetWindowRgn_(WindowID(0), rgn1, #True); apply region It works well on my computer with Windows XP, but works buggy on other computer with Vista. I think it is wrong when I create the new region object on every mouse move. Maybe I need to create it once and then to resize? Can anybody explain how to do this right? Examples on C++ are ok.
winapi
regions
null
null
null
null
open
WinApi: How to resize the window region on MouseMove event correctly? === My application is screenshot maker. User needs to select screen area to make a screenshot. I use Win32 API with PureBasic, but it doesn't matter, all is similar with C++. When user runs application, the semitransparent borderless form is shown on full screen to hook mouse over all other windows. On mouse down event selection is started and I apply XORed region to the form to cut a hole in it with size of current selection. I create and apply a new region on every **mousemove** event: rgn1 = CreateRectRgn_(0,0,DWidth,DHeight) ; full size of desktop rgn2 = CreateRectRgn_(sx, sy, ex, ey) ; current selection points CombineRgn_(rgn1, rgn1, rgn2, #RGN_XOR) SetWindowRgn_(WindowID(0), rgn1, #True); apply region It works well on my computer with Windows XP, but works buggy on other computer with Vista. I think it is wrong when I create the new region object on every mouse move. Maybe I need to create it once and then to resize? Can anybody explain how to do this right? Examples on C++ are ok.
0
11,693,114
07/27/2012 17:55:43
1,544,336
07/22/2012 18:25:15
198
17
basic and minimal java development setup
I am using Ubuntu and I would like to know the basic tools to install so I can begin develop in java. With 'minimal' I mean the most transparent way without fancy tools and stacks etc. Like for minimal C programming you just write code and run 'gcc file.c -o myapp'. Thank you
java
null
null
null
null
null
open
basic and minimal java development setup === I am using Ubuntu and I would like to know the basic tools to install so I can begin develop in java. With 'minimal' I mean the most transparent way without fancy tools and stacks etc. Like for minimal C programming you just write code and run 'gcc file.c -o myapp'. Thank you
0
11,693,115
07/27/2012 17:55:55
1,186,582
02/03/2012 02:28:18
1
0
Writing shorter, readable, pythonic code
I'm trying to produce shorter, more pythonic, readable python. And I have this working solution for **[Project Euler's problem 8][1]** (find the greatest product of 5 sequential digits in a 1000 digit number). Suggestions for writing a more pythonic version of this script? numstring = '' for line in open('8.txt'): numstring += line.rstrip() nums = [int(x) for x in numstring] best=0 for i in range(len(nums)-4): subset = nums[i:i+5] product=1 for x in subset: product *= x if product>best: best=product bestsubset=subset print best print bestsubset For example: there's gotta be a one-liner for the below snippet. I'm sure there's a past topic on here but I'm not sure how to describe what I'm doing below. numstring = '' for line in open('8.txt'): numstring += line.rstrip() Any suggestions? thanks guys! [1]: http://projecteuler.net/problem=8
python
project-euler
null
null
null
null
open
Writing shorter, readable, pythonic code === I'm trying to produce shorter, more pythonic, readable python. And I have this working solution for **[Project Euler's problem 8][1]** (find the greatest product of 5 sequential digits in a 1000 digit number). Suggestions for writing a more pythonic version of this script? numstring = '' for line in open('8.txt'): numstring += line.rstrip() nums = [int(x) for x in numstring] best=0 for i in range(len(nums)-4): subset = nums[i:i+5] product=1 for x in subset: product *= x if product>best: best=product bestsubset=subset print best print bestsubset For example: there's gotta be a one-liner for the below snippet. I'm sure there's a past topic on here but I'm not sure how to describe what I'm doing below. numstring = '' for line in open('8.txt'): numstring += line.rstrip() Any suggestions? thanks guys! [1]: http://projecteuler.net/problem=8
0
11,693,118
07/27/2012 17:56:09
1,401,429
05/17/2012 16:02:59
421
10
Problems linking RestKit. to iOS application
I am building an app that will use RestKit. I have a directory hierarchy that looks like: ProjectBaseDir RestKit TestApp I created the Project and dragged RestKit.xcodeproj into it. I added **$(SRCROOT)/../RestKit/Build/Headers** to the **Header Search Paths** build settings and **$(SRCROOT)/../Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)** to the **Library Search Paths**. as well as **-Objc -all_load** **Other Linker Flags** I'm getting the following linker error ... clang: error: no such file or directory: '/Users/jb/IPHONE_DEVELOPMENT/RestKit/build/Debug-iphonesimulator/RestKit/RestKit'
objective-c
restkit
null
null
null
null
open
Problems linking RestKit. to iOS application === I am building an app that will use RestKit. I have a directory hierarchy that looks like: ProjectBaseDir RestKit TestApp I created the Project and dragged RestKit.xcodeproj into it. I added **$(SRCROOT)/../RestKit/Build/Headers** to the **Header Search Paths** build settings and **$(SRCROOT)/../Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)** to the **Library Search Paths**. as well as **-Objc -all_load** **Other Linker Flags** I'm getting the following linker error ... clang: error: no such file or directory: '/Users/jb/IPHONE_DEVELOPMENT/RestKit/build/Debug-iphonesimulator/RestKit/RestKit'
0
11,693,119
07/27/2012 17:56:09
1,442,995
06/07/2012 18:47:24
177
16
Open a Colorbox within a div block instead of whole page
I am currently building a Jquery interactive game and I'm using the jQuery Colorbox plugin to show messages to user. The thing is, all the game is inside a div and I need that Colorbox to open inside that div (that container div is `overflow:hidden`). I want Colorbox to work the same way it does by default, centered, but in a div block instead of the whole body. I tried to change this line in colorbox.js: $(document.body).append($overlay, $box.append($wrap, $loadingBay)); Into this: $("#game").append($overlay, $box.append($wrap, $loadingBay)); But it isn't working. Do you have any idea? Thank you so much!
jquery
jquery-plugins
colorbox
null
null
null
open
Open a Colorbox within a div block instead of whole page === I am currently building a Jquery interactive game and I'm using the jQuery Colorbox plugin to show messages to user. The thing is, all the game is inside a div and I need that Colorbox to open inside that div (that container div is `overflow:hidden`). I want Colorbox to work the same way it does by default, centered, but in a div block instead of the whole body. I tried to change this line in colorbox.js: $(document.body).append($overlay, $box.append($wrap, $loadingBay)); Into this: $("#game").append($overlay, $box.append($wrap, $loadingBay)); But it isn't working. Do you have any idea? Thank you so much!
0
11,693,120
07/27/2012 17:56:10
1,393,881
05/14/2012 13:43:18
1
0
Xtext cross referencing and scoping
I have some problems with xtext cross referencing Heere is a very simple grammer: grammar org.xtext.example.mydsl1.Test with org.eclipse.xtext.common.Terminals generate test "http://www.xtext.org/example/mydsl1/Test" Model: block=Block? cs+=Company* ; Block: '{' g=[Employee] '}'; Company: 'Company' name=ID '{' es+= Employee* '}'; Employee: 'Employee' name=ID ';' ; and it is my dsl : { Pooyan } Company Sony{ Employee Pooyan; Employee John; } It always shown that "Couldn't resolve reference to Employee 'Pooyan'." Could anyone please help me? I have no idea...
reference
xtext
scoping
null
null
null
open
Xtext cross referencing and scoping === I have some problems with xtext cross referencing Heere is a very simple grammer: grammar org.xtext.example.mydsl1.Test with org.eclipse.xtext.common.Terminals generate test "http://www.xtext.org/example/mydsl1/Test" Model: block=Block? cs+=Company* ; Block: '{' g=[Employee] '}'; Company: 'Company' name=ID '{' es+= Employee* '}'; Employee: 'Employee' name=ID ';' ; and it is my dsl : { Pooyan } Company Sony{ Employee Pooyan; Employee John; } It always shown that "Couldn't resolve reference to Employee 'Pooyan'." Could anyone please help me? I have no idea...
0
11,693,105
07/27/2012 17:54:47
1,226,062
02/22/2012 14:19:05
35
0
Options Theme - Wordpress
Searching about options page, I found a lot of themes that uses a options theme page like this one: ![enter image description here][1] [1]: http://i.stack.imgur.com/zoImJ.jpg There is an pre-built option? What framework do you advise? Thanks
wordpress
frameworks
themes
options-menu
null
null
open
Options Theme - Wordpress === Searching about options page, I found a lot of themes that uses a options theme page like this one: ![enter image description here][1] [1]: http://i.stack.imgur.com/zoImJ.jpg There is an pre-built option? What framework do you advise? Thanks
0
11,327,536
07/04/2012 10:46:01
1,501,267
07/04/2012 10:17:45
1
0
Export HTML table to excel and send mail
I've a table of HTML which I have exported to exceltry.xls file. But I want to send this exported file as an attachment in a mail not to download it as happening in the following script: <?php if(isset($_POST['submit'])){ //create html table in variable (ie $data="<table>..") $data="<table><tr><td>Table with single row has single data.</td></tr></table>"; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename='exceltry.xls'"); // Clean the output buffer so it won't mess up your excel export ob_clean(); echo $data;//writing data to excel file. } else { ?> <form method='POST'> <input type='submit' name='submit' value='submit'/> </form> <?php } ?> Please suggest me, how to email this excel file as an attachment instead of downloading.
reporting
actionmailer
export-to-excel
html-email
email-attachments
null
open
Export HTML table to excel and send mail === I've a table of HTML which I have exported to exceltry.xls file. But I want to send this exported file as an attachment in a mail not to download it as happening in the following script: <?php if(isset($_POST['submit'])){ //create html table in variable (ie $data="<table>..") $data="<table><tr><td>Table with single row has single data.</td></tr></table>"; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename='exceltry.xls'"); // Clean the output buffer so it won't mess up your excel export ob_clean(); echo $data;//writing data to excel file. } else { ?> <form method='POST'> <input type='submit' name='submit' value='submit'/> </form> <?php } ?> Please suggest me, how to email this excel file as an attachment instead of downloading.
0
11,327,590
07/04/2012 10:49:09
989,121
10/11/2011 08:40:52
12,185
384
Is this a valid use case for a context manager?
I'm making a progress indicator for some long-running console process with intent to use it like this: pi = ProgressIndicator() for x in somelongstuff: do stuff pi.update() pi.print_totals() Basically, it should output some kind of a progress bar with dots and dashes, and something like "234234 bytes processed" at the end. I thought it would be nice to use it as a context manager: with ProgressIndicator() as pi: for x in somelongstuff: do stuff pi.update() However there are a few things that concern me about this solution: - extra amount of indentation makes the indicator feature appear more important than it actually is - I don't want `ProgressIndicator` to handle any exceptions that might occur in the loop Is this a valid use case for a context manager? What other solutions can you suggest?
python
with-statement
null
null
null
null
open
Is this a valid use case for a context manager? === I'm making a progress indicator for some long-running console process with intent to use it like this: pi = ProgressIndicator() for x in somelongstuff: do stuff pi.update() pi.print_totals() Basically, it should output some kind of a progress bar with dots and dashes, and something like "234234 bytes processed" at the end. I thought it would be nice to use it as a context manager: with ProgressIndicator() as pi: for x in somelongstuff: do stuff pi.update() However there are a few things that concern me about this solution: - extra amount of indentation makes the indicator feature appear more important than it actually is - I don't want `ProgressIndicator` to handle any exceptions that might occur in the loop Is this a valid use case for a context manager? What other solutions can you suggest?
0
11,327,541
07/04/2012 10:46:29
827,709
07/04/2011 07:52:35
11
1
starting jenkins with jmx (via winstone)
Is there a way to start jenkins with JMX without tomcat? if you add into jenkins start script the typical jvm system parameters for jmx: -Dcom.sun.management.jmxremote.port=XXXX -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false you will always get Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: XXXX; nested exception is: java.net.BindException: Address already in use Excluding problems about /etc/hosts name resolutions or not free ports (already checked...). Looking at documentation, jenkins' scripts are based on [winstone](http://winstone.sourceforge.net/). As far as I can see, winstone handles by itself another jvm process other than the one started via jenkins scripts. I think both starting jvm and winstone inherit jvm system properties so the latter raises the exception above. Following this thought, I tried removing the jvm parameters for jmx and setting them in a file winstone.properties (specifying --config parameter ) but this approach had no effects.. Any idea?
jenkins
jmx
winstone
null
null
null
open
starting jenkins with jmx (via winstone) === Is there a way to start jenkins with JMX without tomcat? if you add into jenkins start script the typical jvm system parameters for jmx: -Dcom.sun.management.jmxremote.port=XXXX -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false you will always get Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: XXXX; nested exception is: java.net.BindException: Address already in use Excluding problems about /etc/hosts name resolutions or not free ports (already checked...). Looking at documentation, jenkins' scripts are based on [winstone](http://winstone.sourceforge.net/). As far as I can see, winstone handles by itself another jvm process other than the one started via jenkins scripts. I think both starting jvm and winstone inherit jvm system properties so the latter raises the exception above. Following this thought, I tried removing the jvm parameters for jmx and setting them in a file winstone.properties (specifying --config parameter ) but this approach had no effects.. Any idea?
0
11,326,788
07/04/2012 10:01:29
1,116,525
12/26/2011 16:24:41
26
0
IIS m4v deliver iphone
I'm using Windows Server 2008 R2, IIS 7.5. I added this mime-type for my website: .m4v video/m4v. My webpage is using html5 <video> tag with an m4v format video file. My problem is i can't see the video on my iPhone. If I open the video (without using an url), I can read it. So I suppose the video is correct but IIS doesn't deliver the proper format file. I tried sevral other mime types, service and server restart but I can't get the video on the webpage on iPhone. Any idea on how to manage this? Thank you.
iphone
iis
mime-types
m4v
null
null
open
IIS m4v deliver iphone === I'm using Windows Server 2008 R2, IIS 7.5. I added this mime-type for my website: .m4v video/m4v. My webpage is using html5 <video> tag with an m4v format video file. My problem is i can't see the video on my iPhone. If I open the video (without using an url), I can read it. So I suppose the video is correct but IIS doesn't deliver the proper format file. I tried sevral other mime types, service and server restart but I can't get the video on the webpage on iPhone. Any idea on how to manage this? Thank you.
0
11,327,582
07/04/2012 10:48:43
1,147,133
01/13/2012 07:03:04
44
3
puppet recipe installing tarball
I would like to install apache maven by using puppet recipe, but I can not find anywhere an example on how to do this. Can someone help with this? Apache maven is packed as tar.gz file. I am using a stand-alone setup for puppet.
installation
tar
puppet
recipe
null
null
open
puppet recipe installing tarball === I would like to install apache maven by using puppet recipe, but I can not find anywhere an example on how to do this. Can someone help with this? Apache maven is packed as tar.gz file. I am using a stand-alone setup for puppet.
0
11,327,593
07/04/2012 10:49:54
445,492
05/24/2009 12:59:38
2,692
144
Google Chrome Extension - prevent cookie on jquery ajax request or Use a chome.extension
I have a great working chrome extension now. It basically loops over a list of HTML of a web auction site, if a user has not paid for to have the image shown in the main list. A default image is shown. - My plugin use a jQuery Ajax request to load the auction page and find the main image to display as a thumbnail for any missing images. WORKS GREAT. - The plugin finds the correct image url and update the HTML Dom to the new image and sets a new width. The issue is, that the auction site tracks all pages views and saves it to a "recently viewed" section of the site "users can see any auctions they have clicked on" ISSUE - My plugin uses ajax and the cookies are sent via the jQuery ajax request. I am pretty sure I cannot modify the cookies in this request so the auction site tracks the request and for any listing that has a missing image this listing is now shown in my "recently viewed" even though I have not actually navigated to it. 1. Can I remove cookies for ajax request (I dont think I can) 2. Can chrome remove the cookie (only for the ajax requests) 3. Could I get chrome to make the request (eg curl, with no cookie?) Just for the curious. Here is a page with missing images on this auction site http://www.trademe.co.nz/Browse/SearchResults.aspx?searchType=all&searchString=toaster&type=Search&generalSearch_keypresses=9&generalSearch_suggested=0 Thanks for any input, John.
google-chrome-extension
null
null
null
null
null
open
Google Chrome Extension - prevent cookie on jquery ajax request or Use a chome.extension === I have a great working chrome extension now. It basically loops over a list of HTML of a web auction site, if a user has not paid for to have the image shown in the main list. A default image is shown. - My plugin use a jQuery Ajax request to load the auction page and find the main image to display as a thumbnail for any missing images. WORKS GREAT. - The plugin finds the correct image url and update the HTML Dom to the new image and sets a new width. The issue is, that the auction site tracks all pages views and saves it to a "recently viewed" section of the site "users can see any auctions they have clicked on" ISSUE - My plugin uses ajax and the cookies are sent via the jQuery ajax request. I am pretty sure I cannot modify the cookies in this request so the auction site tracks the request and for any listing that has a missing image this listing is now shown in my "recently viewed" even though I have not actually navigated to it. 1. Can I remove cookies for ajax request (I dont think I can) 2. Can chrome remove the cookie (only for the ajax requests) 3. Could I get chrome to make the request (eg curl, with no cookie?) Just for the curious. Here is a page with missing images on this auction site http://www.trademe.co.nz/Browse/SearchResults.aspx?searchType=all&searchString=toaster&type=Search&generalSearch_keypresses=9&generalSearch_suggested=0 Thanks for any input, John.
0
11,327,597
07/04/2012 10:50:27
1,086,159
12/07/2011 17:12:59
63
1
Data tab and dataset in Visual Studio 2005 / 2008
I have built some reports in both VS 2005 and VS 2008. In VS 2005 I have 3 tabs available on Design page - 'Preview' 'Layout' and 'Data'. In VS 2008 I have only the 2 - 'Design' and 'Preview' Can anyone pioint me in the correct direction as it is what is held in the **2005 tab of **'Data'**** that I am looking for in VS 2008 **This shows a very simple view of what SQL query's are being used and easily allows modification.** I cannot find this in VS 2008 and only a 'view code' option that shows all HTML code as well??? Any help much appreciated. (the reason for me tryng to do this is the original reports were built in VS 2005 and have been converted to VS 2008 and now need editing and it would be much easier if I had a simple view of just the SQL query's in the reports)
visual-studio
visual-studio-2008
visual-studio-2005
bids
null
null
open
Data tab and dataset in Visual Studio 2005 / 2008 === I have built some reports in both VS 2005 and VS 2008. In VS 2005 I have 3 tabs available on Design page - 'Preview' 'Layout' and 'Data'. In VS 2008 I have only the 2 - 'Design' and 'Preview' Can anyone pioint me in the correct direction as it is what is held in the **2005 tab of **'Data'**** that I am looking for in VS 2008 **This shows a very simple view of what SQL query's are being used and easily allows modification.** I cannot find this in VS 2008 and only a 'view code' option that shows all HTML code as well??? Any help much appreciated. (the reason for me tryng to do this is the original reports were built in VS 2005 and have been converted to VS 2008 and now need editing and it would be much easier if I had a simple view of just the SQL query's in the reports)
0
11,327,598
07/04/2012 10:50:26
138,601
07/15/2009 09:32:10
1,167
24
Incorrect route resolved
I have the following in my routes.rb resources :webcasts do resource :slide_deck do get 'wizard', :on => :collection resources :slides end end [ Note that slide_deck is a singular resource ] Running `$rake routes` gets me the following route related to slide_deck#wizard: wizard_webcast_slide_deck GET /webcasts/:webcast_id/slide_deck/wizard(.:format) slide_decks#wizard I can hit the url: `/webcasts/:webcast_id/slide_deck/wizard` without issues. My problem is that the url helper; wizard_webcast_slide_deck, doesn't resolve to this url. It resolves to: `/webcasts/:webcast_id/slide_decks/wizard` [ Note the plural of slide_decks ] Obviously I can get round this by using a hardcoded url instead of the url helper, but what is causing this and how can I fix it?
ruby
ruby-on-rails-3
resources
routing
routes
null
open
Incorrect route resolved === I have the following in my routes.rb resources :webcasts do resource :slide_deck do get 'wizard', :on => :collection resources :slides end end [ Note that slide_deck is a singular resource ] Running `$rake routes` gets me the following route related to slide_deck#wizard: wizard_webcast_slide_deck GET /webcasts/:webcast_id/slide_deck/wizard(.:format) slide_decks#wizard I can hit the url: `/webcasts/:webcast_id/slide_deck/wizard` without issues. My problem is that the url helper; wizard_webcast_slide_deck, doesn't resolve to this url. It resolves to: `/webcasts/:webcast_id/slide_decks/wizard` [ Note the plural of slide_decks ] Obviously I can get round this by using a hardcoded url instead of the url helper, but what is causing this and how can I fix it?
0
11,327,599
07/04/2012 10:50:29
1,218,626
02/19/2012 00:38:08
98
8
Activity buttons do not trigger onClick function after network connectivity is disabled
I am writing an application which sends HTTP requests to a server if the network is available or queues them up if the network is not available. I am facing an issue with buttons on the activity not working after disabling the network (via `F8` or Airplane mode). Before the network is disabled the buttons correctly trigger their onClick functions, after disabling the network the buttons simply do not trigger their onClick functions. Below is the code I'm using. It's a very trivial application at the moment (all stub code generated by Eclipse) and I just cannot work out what is causing this issue. Has anyone come across any issues like this before? Thanks for any advice. *Running this code in an Android 4.0.1 AVD on the Emulator.* **Activity_Main.xml** <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignParentBottom="true" android:layout_marginBottom="24dp" android:text="Send Request" android:onClick="SendRequestOnClick" /> </RelativeLayout> **MainActivity.java** public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } public void SendRequestOnClick(View v) { Log.i(getPackageName(), "Button 1 Clicked!"); } }
android
android-emulator
android-activity
null
null
null
open
Activity buttons do not trigger onClick function after network connectivity is disabled === I am writing an application which sends HTTP requests to a server if the network is available or queues them up if the network is not available. I am facing an issue with buttons on the activity not working after disabling the network (via `F8` or Airplane mode). Before the network is disabled the buttons correctly trigger their onClick functions, after disabling the network the buttons simply do not trigger their onClick functions. Below is the code I'm using. It's a very trivial application at the moment (all stub code generated by Eclipse) and I just cannot work out what is causing this issue. Has anyone come across any issues like this before? Thanks for any advice. *Running this code in an Android 4.0.1 AVD on the Emulator.* **Activity_Main.xml** <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignParentBottom="true" android:layout_marginBottom="24dp" android:text="Send Request" android:onClick="SendRequestOnClick" /> </RelativeLayout> **MainActivity.java** public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } public void SendRequestOnClick(View v) { Log.i(getPackageName(), "Button 1 Clicked!"); } }
0
11,627,947
07/24/2012 09:29:45
923,242
02/10/2011 16:49:26
1
0
How to disable Suspending || Closing || Terminating event for my Metro Style App on Windows 8 Pro
I'm a french developer and I need to develop an Metro Style app for Windows 8 Pro who is always launched. I wanted to know how can I disable the close event of my app. My app need to be in front all the time and the user couldn't quit the app. I thought I could disable all the shortcut with the GPO but the close gesture (drag the app from the top to the bottom) need to me disabled too. I hope I was clear and everybody will understand the question :-). Feel free to ask me more specific questions. Cordially Renaud.
c#
windows-8
winrt
winrt-xaml
null
null
open
How to disable Suspending || Closing || Terminating event for my Metro Style App on Windows 8 Pro === I'm a french developer and I need to develop an Metro Style app for Windows 8 Pro who is always launched. I wanted to know how can I disable the close event of my app. My app need to be in front all the time and the user couldn't quit the app. I thought I could disable all the shortcut with the GPO but the close gesture (drag the app from the top to the bottom) need to me disabled too. I hope I was clear and everybody will understand the question :-). Feel free to ask me more specific questions. Cordially Renaud.
0
11,627,950
07/24/2012 09:30:14
1,222,982
02/21/2012 09:28:26
164
4
android width of linearlayout the same as image
I have my `layout` : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" android:gravity="center_horizontal" > <ImageView android:id="@+id/id_new_big_list_item_image" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:layout_centerHorizontal="true" /> <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:background="@drawable/round_corners_new_bottom" > <TextView android:id="@+id/id_new_big_list_item_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="@color/new_restaurant_name" android:paddingTop="5dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingBottom="0dp" /> </LinearLayout> </LinearLayout> I need to show image at the top (center horizontal) and below linearlayout with textview. Image can have different width, but i want to set the width of the linearlayout the same as image has. But if text is too long, the width becomes more. How can i do that? if text's width more than image width is, make 2 lines of text. Is it possible?? here snap of my layout : ![enter image description here][1] [1]: http://i.stack.imgur.com/4Yz9C.jpg
android
image
layout
width
null
null
open
android width of linearlayout the same as image === I have my `layout` : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" android:gravity="center_horizontal" > <ImageView android:id="@+id/id_new_big_list_item_image" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:layout_centerHorizontal="true" /> <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:background="@drawable/round_corners_new_bottom" > <TextView android:id="@+id/id_new_big_list_item_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="@color/new_restaurant_name" android:paddingTop="5dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingBottom="0dp" /> </LinearLayout> </LinearLayout> I need to show image at the top (center horizontal) and below linearlayout with textview. Image can have different width, but i want to set the width of the linearlayout the same as image has. But if text is too long, the width becomes more. How can i do that? if text's width more than image width is, make 2 lines of text. Is it possible?? here snap of my layout : ![enter image description here][1] [1]: http://i.stack.imgur.com/4Yz9C.jpg
0
11,627,952
07/24/2012 09:30:15
1,233,133
02/25/2012 22:50:15
6
0
Dynamically adding fields to Form with DB values, php
Alright so, I have a form consisted of a number of elements and I want the user to be able to dynamically add contents to the form (ideally without the use of JS to not reveal SQL queries and stuff). At the moment I'm trying to do that in php and a sample of the code is as below: Let's assume that there is a form and a table, t1, in it. I want the user to be able to add ,by pressing a button or w/e, an identical table, t2 up to a set tn, to the form, with changed ids (which is simple). To what extent is this possible w/o revealing SQL stuff and w/o the need to reload the page? <form ...> ... echo'<table id="t1" ...> <tr> <td>Text</td> <td>Text</td> <td>Text</td> <td>Text</td> </tr> <tr> <td>'; $query = "SELECT * FROM randomTable"; $exec = mysql_query($getShows) or die(mysql_error()); $num = 0; while ($row= mysql_fetch_array($exec)) { if ($num == 0) { echo '<select id="t1_show"> <option value="" selected="selected"> <option value="' . $row['id'] . '">' . $row['name'] . '</option>'; $num ++; } else { echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>'; $num ++; } } if ($num > 0) echo '</select>'; echo '</td> <td><input id="t1_input1" type="text"/></td> <td><input id="t1_input2" type="text"/></td> <td><input id="t1_input3" type="text"/></td> </tr> </table>'; ... </form>
php
forms
dynamic
content
null
null
open
Dynamically adding fields to Form with DB values, php === Alright so, I have a form consisted of a number of elements and I want the user to be able to dynamically add contents to the form (ideally without the use of JS to not reveal SQL queries and stuff). At the moment I'm trying to do that in php and a sample of the code is as below: Let's assume that there is a form and a table, t1, in it. I want the user to be able to add ,by pressing a button or w/e, an identical table, t2 up to a set tn, to the form, with changed ids (which is simple). To what extent is this possible w/o revealing SQL stuff and w/o the need to reload the page? <form ...> ... echo'<table id="t1" ...> <tr> <td>Text</td> <td>Text</td> <td>Text</td> <td>Text</td> </tr> <tr> <td>'; $query = "SELECT * FROM randomTable"; $exec = mysql_query($getShows) or die(mysql_error()); $num = 0; while ($row= mysql_fetch_array($exec)) { if ($num == 0) { echo '<select id="t1_show"> <option value="" selected="selected"> <option value="' . $row['id'] . '">' . $row['name'] . '</option>'; $num ++; } else { echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>'; $num ++; } } if ($num > 0) echo '</select>'; echo '</td> <td><input id="t1_input1" type="text"/></td> <td><input id="t1_input2" type="text"/></td> <td><input id="t1_input3" type="text"/></td> </tr> </table>'; ... </form>
0
11,627,955
07/24/2012 09:30:21
1,390,598
05/12/2012 03:51:52
1
0
Why do we need a function plugin when we write a method plugin
I am a JQuery newbie and I came across this jquery plugin sample code when I was reading a Jquery book. //adding a function to JQuery object jQuery.slowEach = function( array, interval, callback ) { if( ! array.length ) return; var i = 0; next(); function next() { if( callback.call( array[i], i, array[i] ) !== false ) if( ++i < array.length ) setTimeout( next, interval ); } return array; }; //attaching a new method .slowEach() jQuery.fn.slowEach = function( interval, callback ) { return jQuery.slowEach( this, interval, callback ); }; // Show an element every half second $('.reveal').slowEach( 500, function() { $(this).show(); }) I just want to know if it's necessary to write the function plugin when I'm writing such method plugin, and whats the significance? If not, can I write the whole thing in the jQuery.fn.slowEach method without the function plugin? Thanks!
jquery
null
null
null
null
null
open
Why do we need a function plugin when we write a method plugin === I am a JQuery newbie and I came across this jquery plugin sample code when I was reading a Jquery book. //adding a function to JQuery object jQuery.slowEach = function( array, interval, callback ) { if( ! array.length ) return; var i = 0; next(); function next() { if( callback.call( array[i], i, array[i] ) !== false ) if( ++i < array.length ) setTimeout( next, interval ); } return array; }; //attaching a new method .slowEach() jQuery.fn.slowEach = function( interval, callback ) { return jQuery.slowEach( this, interval, callback ); }; // Show an element every half second $('.reveal').slowEach( 500, function() { $(this).show(); }) I just want to know if it's necessary to write the function plugin when I'm writing such method plugin, and whats the significance? If not, can I write the whole thing in the jQuery.fn.slowEach method without the function plugin? Thanks!
0
11,627,956
07/24/2012 09:30:22
1,254,579
03/07/2012 11:45:22
11
1
how to batch replace the files in a directory windows vista(from .txt.txt to .txt)
I have a couple of flat files(.txt) in a directory.all those files are in the format *.txt.txt so i want to rename it to *.txt ?Is there any simple way to rename all together? when I tried ren *.txt.txt ***.txt** is is not working
windows
batch
batch-file
dos
batch-script
null
open
how to batch replace the files in a directory windows vista(from .txt.txt to .txt) === I have a couple of flat files(.txt) in a directory.all those files are in the format *.txt.txt so i want to rename it to *.txt ?Is there any simple way to rename all together? when I tried ren *.txt.txt ***.txt** is is not working
0