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,350,876
07/05/2012 19:04:26
165,110
08/28/2009 21:00:46
11
1
xQuery convert string to xhtml
My script builds a string that I need to output to xhtml, but xdmp:unquote() does not seem to like quoted attribute values--specifically the quotes. I end up with the quote character entity in the output where that actual quote mark (") should be. Here is the string: let $title_opts := if ( "M.D." eq $acad_title ) then '<option selected="SELECTED" value="M.D.">M.D.</option><option value="D.O.">D.O.</option>' else if ( "D.O." eq $acad_title ) then '<option value="M.D.">M.D.</option><option selected="SELECTED" value="D.O.">D.O.</option>' else '<option value="M.D.">M.D.</option><option value="D.O.">D.O.</option>' and the output: return <select name="title" id="title"> { xdmp:unquote( $title_opts ) } </select> The angle brackets come out fine with xdmp:unquote(), but the quotes do not. How do I get everything to display properly?
xml
xquery
marklogic
null
null
null
open
xQuery convert string to xhtml === My script builds a string that I need to output to xhtml, but xdmp:unquote() does not seem to like quoted attribute values--specifically the quotes. I end up with the quote character entity in the output where that actual quote mark (") should be. Here is the string: let $title_opts := if ( "M.D." eq $acad_title ) then '<option selected="SELECTED" value="M.D.">M.D.</option><option value="D.O.">D.O.</option>' else if ( "D.O." eq $acad_title ) then '<option value="M.D.">M.D.</option><option selected="SELECTED" value="D.O.">D.O.</option>' else '<option value="M.D.">M.D.</option><option value="D.O.">D.O.</option>' and the output: return <select name="title" id="title"> { xdmp:unquote( $title_opts ) } </select> The angle brackets come out fine with xdmp:unquote(), but the quotes do not. How do I get everything to display properly?
0
11,542,402
07/18/2012 13:20:30
1,185,482
02/02/2012 15:24:55
182
10
Properties in Maven
I would like to create a property of this kind : <properties> <ignoredpackage> <ignore>com.example.*</ignore> <ignore>com.another.example.*</ignore> </ignoredpackage> <properties> So that I can use it in my pom like that : <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <configuration> <instrumentation> <ignores> ${ignoredpackage} </ignores> <excludes> ... But this doesn't work, is there any other way ?
maven
null
null
null
null
null
open
Properties in Maven === I would like to create a property of this kind : <properties> <ignoredpackage> <ignore>com.example.*</ignore> <ignore>com.another.example.*</ignore> </ignoredpackage> <properties> So that I can use it in my pom like that : <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <configuration> <instrumentation> <ignores> ${ignoredpackage} </ignores> <excludes> ... But this doesn't work, is there any other way ?
0
11,542,322
07/18/2012 13:16:43
1,277,040
03/18/2012 15:02:13
17
0
revoke certificate request
I try to submit my iOS app for validation. Unfortunately i have this message after archiving the app on xcode and clic on the validate button : "The private key for "xxxxxx" is not installed on this Mac" but i can't export the profil from the device who created this certificate. Can i revoke developement and distribution certificates from ios developer portal and create new ones? i want to say that the actual certificate is the one used by another app to be submit. If i revoke, is there a risk if i want to update this app?
ios
apple
certificate
null
null
null
open
revoke certificate request === I try to submit my iOS app for validation. Unfortunately i have this message after archiving the app on xcode and clic on the validate button : "The private key for "xxxxxx" is not installed on this Mac" but i can't export the profil from the device who created this certificate. Can i revoke developement and distribution certificates from ios developer portal and create new ones? i want to say that the actual certificate is the one used by another app to be submit. If i revoke, is there a risk if i want to update this app?
0
11,542,413
07/18/2012 13:21:09
696,627
04/07/2011 10:42:17
1,075
20
Context Per Request: How to update Entity
I have a repository class as shown below. There is a method to get entity object – GetPaymentByID. I am retrieving a Payment object and making a change to its PaymentType property. But this is not reflected in databse. I know the reason – the SaveContextChanges method uses a new context. I need to use **Context Per Request** approach. Hence I am creating new context in each method. In this scenario, how can I modify the code to successfully update the database? namespace MyRepository { public interface ILijosPaymentRepository { } public class MyPaymentRepository { private string connectionStringVal; public MyPaymentRepository() { SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(); sqlBuilder.DataSource = "."; sqlBuilder.InitialCatalog = "LibraryReservationSystem"; sqlBuilder.IntegratedSecurity = true; // Initialize the EntityConnectionStringBuilder. EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder(); entityBuilder.Provider = "System.Data.SqlClient"; entityBuilder.ProviderConnectionString = sqlBuilder.ToString(); entityBuilder.Metadata = @"res://*/MyEDMtest.csdl|res://*/MyEDMtest.ssdl|res://*/MyEDMtest.msl"; connectionStringVal = entityBuilder.ToString(); } public MyEntityDataModelEDM.Payment GetPaymentByID(int paymentID) { MyEntityDataModelEDM.Payment payment; using (var myObjectContext2 = new MyEntityDataModelEDM.LibraryReservationSystemEntities(connectionStringVal)) { Func<MyEntityDataModelEDM.Payment, bool> predicate = (p => p.PaymentID == paymentID); payment = myObjectContext2.Payments.SingleOrDefault(predicate); } return payment; } public void SaveContextChanges(MyEntityDataModelEDM.Payment paymentEntity) { using (var myObjectContext = new MyEntityDataModelEDM.LibraryReservationSystemEntities(connectionStringVal)) { myObjectContext.SaveChanges(); } } } } Client MyRepository.MyPaymentRepository rep = new MyRepository.MyPaymentRepository(); MyEntityDataModelEDM.Payment p2= rep.GetPaymentByID(1); p2.PaymentType = "TeSSS"; rep.SaveContextChanges(p2);
c#
.net
entity-framework
design-patterns
domain-driven-design
null
open
Context Per Request: How to update Entity === I have a repository class as shown below. There is a method to get entity object – GetPaymentByID. I am retrieving a Payment object and making a change to its PaymentType property. But this is not reflected in databse. I know the reason – the SaveContextChanges method uses a new context. I need to use **Context Per Request** approach. Hence I am creating new context in each method. In this scenario, how can I modify the code to successfully update the database? namespace MyRepository { public interface ILijosPaymentRepository { } public class MyPaymentRepository { private string connectionStringVal; public MyPaymentRepository() { SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(); sqlBuilder.DataSource = "."; sqlBuilder.InitialCatalog = "LibraryReservationSystem"; sqlBuilder.IntegratedSecurity = true; // Initialize the EntityConnectionStringBuilder. EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder(); entityBuilder.Provider = "System.Data.SqlClient"; entityBuilder.ProviderConnectionString = sqlBuilder.ToString(); entityBuilder.Metadata = @"res://*/MyEDMtest.csdl|res://*/MyEDMtest.ssdl|res://*/MyEDMtest.msl"; connectionStringVal = entityBuilder.ToString(); } public MyEntityDataModelEDM.Payment GetPaymentByID(int paymentID) { MyEntityDataModelEDM.Payment payment; using (var myObjectContext2 = new MyEntityDataModelEDM.LibraryReservationSystemEntities(connectionStringVal)) { Func<MyEntityDataModelEDM.Payment, bool> predicate = (p => p.PaymentID == paymentID); payment = myObjectContext2.Payments.SingleOrDefault(predicate); } return payment; } public void SaveContextChanges(MyEntityDataModelEDM.Payment paymentEntity) { using (var myObjectContext = new MyEntityDataModelEDM.LibraryReservationSystemEntities(connectionStringVal)) { myObjectContext.SaveChanges(); } } } } Client MyRepository.MyPaymentRepository rep = new MyRepository.MyPaymentRepository(); MyEntityDataModelEDM.Payment p2= rep.GetPaymentByID(1); p2.PaymentType = "TeSSS"; rep.SaveContextChanges(p2);
0
11,542,355
07/18/2012 13:17:54
973,219
09/30/2011 13:59:39
28
0
sqlclient - Command Timeout for remote database server
I've an application developed in winforms(.net) and it is using Sql Server database. My client would be using the application locally (intranet) and some of my client would be using the same application from remote location (winform application in on region and database server far in another region). Now the problem is when they are using my application from remote location, sometimes i get command timeout. For now I've increased the commandtimeout in my code which is running fine. But I wanna know is it a best practice to increase command timeout in situations like this? Command timeout also includes the reading/writing of data in the network channel too no? (atleast this is what i've found on msdn) so if database is on far location, is it wise to increase command and connection timeout? Regards, TKL33
.net
sql-server
winforms
sqlclient
null
null
open
sqlclient - Command Timeout for remote database server === I've an application developed in winforms(.net) and it is using Sql Server database. My client would be using the application locally (intranet) and some of my client would be using the same application from remote location (winform application in on region and database server far in another region). Now the problem is when they are using my application from remote location, sometimes i get command timeout. For now I've increased the commandtimeout in my code which is running fine. But I wanna know is it a best practice to increase command timeout in situations like this? Command timeout also includes the reading/writing of data in the network channel too no? (atleast this is what i've found on msdn) so if database is on far location, is it wise to increase command and connection timeout? Regards, TKL33
0
11,542,356
07/18/2012 13:18:02
1,197,024
02/08/2012 11:20:27
30
1
Get a variable from another document
I am new to PHP. I'd like to get a variable that is in another document in order to insert a value into a table. So, I have this code: insert.php: $inputField = $_POST['inputField']; $inputField2 = $_POST['inputField2']; $Allowed_traffic = $_POST['Allowed_traffic']; $Frequency = $_POST['Frequency']; $sql="INSERT INTO users_fup (fup_id, user_id, ModemSn, start_date, end_date, allowed_traffic, realized_traffic, frequency, nextreset, whichdb) VALUES ('NULL','','', '".$inputField."', '".$inputField2."', '".$Allowed_traffic."', '', '".$Frequency."', '', '')"; I want to take ModemSn from another file which contains: $ffup = mysql_query("SELECT * FROM users_fup WHERE ModemSn = '".$row['ModemSn']."' AND start_date < '$oraoggi' AND end_date > '$oraoggi' "); . . echo "<td>".$row['ModemSn']."</td><td>".$percent_traffic."</td><td>linksetfup</td><td></td></tr>"; The files are not in the same folder.
php
sql
null
null
null
null
open
Get a variable from another document === I am new to PHP. I'd like to get a variable that is in another document in order to insert a value into a table. So, I have this code: insert.php: $inputField = $_POST['inputField']; $inputField2 = $_POST['inputField2']; $Allowed_traffic = $_POST['Allowed_traffic']; $Frequency = $_POST['Frequency']; $sql="INSERT INTO users_fup (fup_id, user_id, ModemSn, start_date, end_date, allowed_traffic, realized_traffic, frequency, nextreset, whichdb) VALUES ('NULL','','', '".$inputField."', '".$inputField2."', '".$Allowed_traffic."', '', '".$Frequency."', '', '')"; I want to take ModemSn from another file which contains: $ffup = mysql_query("SELECT * FROM users_fup WHERE ModemSn = '".$row['ModemSn']."' AND start_date < '$oraoggi' AND end_date > '$oraoggi' "); . . echo "<td>".$row['ModemSn']."</td><td>".$percent_traffic."</td><td>linksetfup</td><td></td></tr>"; The files are not in the same folder.
0
11,542,414
07/18/2012 13:21:24
1,509,103
07/07/2012 18:13:10
20
0
Self created JToggleButton: change icons
I have written a class that extends JToggleButton. Everything works fine, except that I can't change the icons of the button. Here is my code of the class: package be.blauweregen.lichtsturing; import javax.swing.*; import java.awt.*; class MyToggleButton extends JToggleButton { private static final long serialVersionUID = 1L; String s; public MyToggleButton(String str) { super(str); s = str; } public MyToggleButton(String str, Boolean sel) { super(str, sel); s = str; } public void paintComponent(Graphics g) { super.paintComponent(g); if (this.isSelected() && this.isEnabled()) { // manueel en aan int w = getWidth(); int h = getHeight(); g.setColor(Color.green); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.BOLD, 11)); } else if ( this.isSelected() && !this.isEnabled()) { // automatisch en aan int w = getWidth(); int h = getHeight(); g.setColor(Color.green); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.PLAIN, 11)); } else if (!this.isSelected() && this.isEnabled()) { // manueel en uit int w = getWidth(); int h = getHeight(); g.setColor(Color.red); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.BOLD, 11)); } else if (!this.isSelected() && !this.isEnabled()) { // automatisch en uit int w = getWidth(); int h = getHeight(); g.setColor(Color.red); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.PLAIN, 11)); } } } I use the code in this way in my program: btnGangSanitair = new MyToggleButton("Gang sanitair"); btnGangSanitair.setSelectedIcon(new ImageIcon("Z:\\Development\\Java\\BlauweRegen\\famfamfam_silk_icons_v013\\icons\\application_edit.png")); btnGangSanitair.setIcon(new ImageIcon(Client.class.getResource("/be.blauweregen.icons/arrow_refresh.png"))); What am I doing wrong? The icons don't appear in the program.
java
icons
jtogglebutton
null
null
null
open
Self created JToggleButton: change icons === I have written a class that extends JToggleButton. Everything works fine, except that I can't change the icons of the button. Here is my code of the class: package be.blauweregen.lichtsturing; import javax.swing.*; import java.awt.*; class MyToggleButton extends JToggleButton { private static final long serialVersionUID = 1L; String s; public MyToggleButton(String str) { super(str); s = str; } public MyToggleButton(String str, Boolean sel) { super(str, sel); s = str; } public void paintComponent(Graphics g) { super.paintComponent(g); if (this.isSelected() && this.isEnabled()) { // manueel en aan int w = getWidth(); int h = getHeight(); g.setColor(Color.green); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.BOLD, 11)); } else if ( this.isSelected() && !this.isEnabled()) { // automatisch en aan int w = getWidth(); int h = getHeight(); g.setColor(Color.green); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.PLAIN, 11)); } else if (!this.isSelected() && this.isEnabled()) { // manueel en uit int w = getWidth(); int h = getHeight(); g.setColor(Color.red); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.BOLD, 11)); } else if (!this.isSelected() && !this.isEnabled()) { // automatisch en uit int w = getWidth(); int h = getHeight(); g.setColor(Color.red); // selected color g.fillRect(0, 0, w, h); g.setColor(Color.black); // selected foreground color g.drawString(s, (w - g.getFontMetrics().stringWidth(s)) / 2 + 1, (h + g.getFontMetrics().getAscent()) / 2 - 1); setFont(new Font("Tahoma", Font.PLAIN, 11)); } } } I use the code in this way in my program: btnGangSanitair = new MyToggleButton("Gang sanitair"); btnGangSanitair.setSelectedIcon(new ImageIcon("Z:\\Development\\Java\\BlauweRegen\\famfamfam_silk_icons_v013\\icons\\application_edit.png")); btnGangSanitair.setIcon(new ImageIcon(Client.class.getResource("/be.blauweregen.icons/arrow_refresh.png"))); What am I doing wrong? The icons don't appear in the program.
0
11,542,415
07/18/2012 13:21:33
1,376,228
05/05/2012 03:11:56
1
1
3D visualize depth information in OpenGL
I have a depth data stored in a text file, then I load it into a matrix z. After create the mesh grid, I want to visualize the depth data as a 3D image. My work is the same with the function "surf" in Matlab. Here is my code: load file and create grid FILE * pFile; long lSize; char * fBuffer; size_t result; char* Token = (char*)calloc(8,sizeof(char)); pFile = fopen("td.txt","r"); if(pFile == NULL){ std::cerr<< "File Open Failed...\n"; exit(-1); } // obtain file size: fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile); // allocate memory to contain the whole file: fBuffer = (char*) malloc (sizeof(char)*lSize); if (fBuffer == NULL) {std::cerr<< "Memory error \n"; exit (2);} result = fread (fBuffer, 1, lSize, pFile); //if (result != lSize) {std::cerr<< "Reading error \n"; exit (3);} float oct; bool bk_for=false; Token = (char*)strtok(fBuffer," \n"); for(i=0; i< HEIGHT; i++){ for(j=0; j< WIDTH; j++){ //mesh grid from -1 to 1 x[i][j] = 2.0*((float) j + 0.5)/WIDTH - 1.0; y[i][j] = 2.0*((float) i + 0.5)/HEIGHT - 1.0; oct = atof(Token); z[i][j] = oct; std::cout<<z[i][j]<<" "; Token = (char*)strtok( NULL," \n" ); if( Token == NULL){ bk_for=true; break; } } if(bk_for == true) break; std::cout<< "\n"; } and to show the image int i,j; GLfloat nx,ny,nz; // Clears the screen and depth buffer. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glBegin(GL_QUADS); for (i = 0; i < (HEIGHT-1); i++) { for (j = 0; j < (WIDTH-1); j++) { normal(x[i][j],y[i][j],z[i][j], x[i+1][j],y[i+1][j],z[i+1][j], x[i][j+1],y[i][j+1],z[i][j+1], &nx,&ny,&nz); glNormal3f(nx,ny,nz); glVertex3f(x[i][j],y[i][j],z[i][j]); glVertex3f(x[i+1][j],y[i+1][j],z[i+1][j]); glVertex3f(x[i+1][j+1],y[i+1][j+1],z[i+1][j+1]); glVertex3f(x[i][j+1],y[i][j+1],z[i][j+1]); } } glEnd(); glutSwapBuffers(); glutPostRedisplay(); glFlush(); But I still cannot get the result I want. Could anyone help me to overcome it? Thank you very much!
opengl
3d
null
null
null
07/19/2012 13:38:49
not a real question
3D visualize depth information in OpenGL === I have a depth data stored in a text file, then I load it into a matrix z. After create the mesh grid, I want to visualize the depth data as a 3D image. My work is the same with the function "surf" in Matlab. Here is my code: load file and create grid FILE * pFile; long lSize; char * fBuffer; size_t result; char* Token = (char*)calloc(8,sizeof(char)); pFile = fopen("td.txt","r"); if(pFile == NULL){ std::cerr<< "File Open Failed...\n"; exit(-1); } // obtain file size: fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile); // allocate memory to contain the whole file: fBuffer = (char*) malloc (sizeof(char)*lSize); if (fBuffer == NULL) {std::cerr<< "Memory error \n"; exit (2);} result = fread (fBuffer, 1, lSize, pFile); //if (result != lSize) {std::cerr<< "Reading error \n"; exit (3);} float oct; bool bk_for=false; Token = (char*)strtok(fBuffer," \n"); for(i=0; i< HEIGHT; i++){ for(j=0; j< WIDTH; j++){ //mesh grid from -1 to 1 x[i][j] = 2.0*((float) j + 0.5)/WIDTH - 1.0; y[i][j] = 2.0*((float) i + 0.5)/HEIGHT - 1.0; oct = atof(Token); z[i][j] = oct; std::cout<<z[i][j]<<" "; Token = (char*)strtok( NULL," \n" ); if( Token == NULL){ bk_for=true; break; } } if(bk_for == true) break; std::cout<< "\n"; } and to show the image int i,j; GLfloat nx,ny,nz; // Clears the screen and depth buffer. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glBegin(GL_QUADS); for (i = 0; i < (HEIGHT-1); i++) { for (j = 0; j < (WIDTH-1); j++) { normal(x[i][j],y[i][j],z[i][j], x[i+1][j],y[i+1][j],z[i+1][j], x[i][j+1],y[i][j+1],z[i][j+1], &nx,&ny,&nz); glNormal3f(nx,ny,nz); glVertex3f(x[i][j],y[i][j],z[i][j]); glVertex3f(x[i+1][j],y[i+1][j],z[i+1][j]); glVertex3f(x[i+1][j+1],y[i+1][j+1],z[i+1][j+1]); glVertex3f(x[i][j+1],y[i][j+1],z[i][j+1]); } } glEnd(); glutSwapBuffers(); glutPostRedisplay(); glFlush(); But I still cannot get the result I want. Could anyone help me to overcome it? Thank you very much!
1
11,411,033
07/10/2012 10:09:34
1,342,109
04/18/2012 17:36:37
68
0
Sending a message to mail after completing spider running in scrapy python
**pipeline.py code** class Examplepipeline(object): def __init__(self): dispatcher.connect(self.spider_opened, signal=signals.spider_opened) dispatcher.connect(self.spider_closed, signal=signals.spider_closed) def spider_opened(self, spider): log.msg("opened spider %s at time %s" % (spider.name,datetime.now().strftime('%H-%M-%S'))) def process_item(self, item, spider): log.msg("Processsing item " + item['title'], level=log.DEBUG) def spider_closed(self, spider): log.msg("closed spider %s at %s" % (spider.name,datetime.now().strftime('%H-%M-%S'))) In the above spider code , it will display the starting time and ending time of the spider, but now after the completion of the spider, i want to recieve a mail that "Scraping has been completed" from scrapy. Is it possible to do this. If possible can we write that code in spider_closed method, can anyone please share some example code on how to do this. Thanks in advacne..........
python
email
scrapy
null
null
null
open
Sending a message to mail after completing spider running in scrapy python === **pipeline.py code** class Examplepipeline(object): def __init__(self): dispatcher.connect(self.spider_opened, signal=signals.spider_opened) dispatcher.connect(self.spider_closed, signal=signals.spider_closed) def spider_opened(self, spider): log.msg("opened spider %s at time %s" % (spider.name,datetime.now().strftime('%H-%M-%S'))) def process_item(self, item, spider): log.msg("Processsing item " + item['title'], level=log.DEBUG) def spider_closed(self, spider): log.msg("closed spider %s at %s" % (spider.name,datetime.now().strftime('%H-%M-%S'))) In the above spider code , it will display the starting time and ending time of the spider, but now after the completion of the spider, i want to recieve a mail that "Scraping has been completed" from scrapy. Is it possible to do this. If possible can we write that code in spider_closed method, can anyone please share some example code on how to do this. Thanks in advacne..........
0
11,411,034
07/10/2012 10:09:39
1,097,148
12/14/2011 05:41:21
388
33
Why UITableView calls UIScrollView's delegate methods?
I have an application, in which I have a `UITableView` inside a `UIView`, which is again inside a `UIScrollView`, so the hierarchy becomes like this: `UIScrollView` -> `UIView` -> `UITableView` The data inside my `UITableView` is filled properly. Now, my problem is that, When I scroll my `UITableView`, the `UIScrollView's` delegate method `scrollViewDidEndDecelerating:` and `scrollViewDidEndDragging::` gets called. I don't want this behavior, what should I do to stop this behavior? Thank in advance!!!
iphone
objective-c
ios
uitableview
null
null
open
Why UITableView calls UIScrollView's delegate methods? === I have an application, in which I have a `UITableView` inside a `UIView`, which is again inside a `UIScrollView`, so the hierarchy becomes like this: `UIScrollView` -> `UIView` -> `UITableView` The data inside my `UITableView` is filled properly. Now, my problem is that, When I scroll my `UITableView`, the `UIScrollView's` delegate method `scrollViewDidEndDecelerating:` and `scrollViewDidEndDragging::` gets called. I don't want this behavior, what should I do to stop this behavior? Thank in advance!!!
0
11,411,067
07/10/2012 10:11:05
50,173
12/30/2008 13:49:05
4,153
242
What does PRINT command do differently under the hood that notepad doesn't?
I need to send content to printer in C# .NET the same way as `PRINT` command does. I have Godex thermal printer with [QLabel][1] software bundled. Now it has the option to save the label as a command that you can pass to printer with command prompt `PRINT` command. The file looks like this: ^Q80,3 ^W100 ^H10 ^P1 ^S3 ^AD ^C1 ^R2 ~Q+0 ^O0 ^D0 ^E35 ~R200 ^L Dy2-me-dd Th:m:s AH,0,0,1,1,0,0,X AH,744,0,1,1,0,0,X AH,746,560,1,1,0,0,X AH,0,550,1,1,0,0,X AG,160,208,1,1,0,0, AA,234,283,1,1,0,0,Haloo E That works when i do something like this: net use LPT2 \\localhost\godexUsbPrinter /yes print /D:LPT2 label.cmd And it prints my label out nicely. Now, if i open this in notepad and print, it just prints me this text. I wonder what does `PRINT` command do under the hood and how can i program my C# based program to replicate the behaviour? Because when i implement printing logic, it just prints me the plain text as notepad does. I know i could call a `PRINT` command with Process.Start from C#, but i need to replace some placeholder value in the label template all the time. I could create a temporary file on the disk and print that, but i would prefer to avoid such a scenario. [1]: http://www.godexintl.com/product_content.aspx?id=9&cid=4
c#
.net
printing
null
null
null
open
What does PRINT command do differently under the hood that notepad doesn't? === I need to send content to printer in C# .NET the same way as `PRINT` command does. I have Godex thermal printer with [QLabel][1] software bundled. Now it has the option to save the label as a command that you can pass to printer with command prompt `PRINT` command. The file looks like this: ^Q80,3 ^W100 ^H10 ^P1 ^S3 ^AD ^C1 ^R2 ~Q+0 ^O0 ^D0 ^E35 ~R200 ^L Dy2-me-dd Th:m:s AH,0,0,1,1,0,0,X AH,744,0,1,1,0,0,X AH,746,560,1,1,0,0,X AH,0,550,1,1,0,0,X AG,160,208,1,1,0,0, AA,234,283,1,1,0,0,Haloo E That works when i do something like this: net use LPT2 \\localhost\godexUsbPrinter /yes print /D:LPT2 label.cmd And it prints my label out nicely. Now, if i open this in notepad and print, it just prints me this text. I wonder what does `PRINT` command do under the hood and how can i program my C# based program to replicate the behaviour? Because when i implement printing logic, it just prints me the plain text as notepad does. I know i could call a `PRINT` command with Process.Start from C#, but i need to replace some placeholder value in the label template all the time. I could create a temporary file on the disk and print that, but i would prefer to avoid such a scenario. [1]: http://www.godexintl.com/product_content.aspx?id=9&cid=4
0
11,411,074
07/10/2012 10:11:39
1,514,396
07/10/2012 09:55:49
1
0
Facebook is not displaying the email id info in the auth dialog box
I have integrated Facebook with my web application. When the Facebook authorization dialog is displayed to tht user, it displays only basic info details. There is no email id displayed. It is used to display the email id also earlier. It stopped to display the email id. What I am missing? Has FB done any changes in the auth dialog?
facebook
permissions
user
authorization
null
null
open
Facebook is not displaying the email id info in the auth dialog box === I have integrated Facebook with my web application. When the Facebook authorization dialog is displayed to tht user, it displays only basic info details. There is no email id displayed. It is used to display the email id also earlier. It stopped to display the email id. What I am missing? Has FB done any changes in the auth dialog?
0
11,411,076
07/10/2012 10:11:43
1,094,797
12/13/2011 00:32:20
6
0
Sound Cloud Error
Here is my redirect.php, i always get 'HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. ' php code: ///////////////////////////////// <br/>require_once 'Services/Soundcloud.php'; // create client object with app credentials <br/> $client = new Services_Soundcloud( 'xxxxxxxxxxxxxxxxxxxxxxx');<br/> $client->setAccessToken($_GET['code']);<br/> // make an authenticated call <br/> $current_user = json_decode($client->get('me'));<br/> print $current_user->username;<br/> /////////////////// any idea, thanks
php
audio
cloud
null
null
null
open
Sound Cloud Error === Here is my redirect.php, i always get 'HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. ' php code: ///////////////////////////////// <br/>require_once 'Services/Soundcloud.php'; // create client object with app credentials <br/> $client = new Services_Soundcloud( 'xxxxxxxxxxxxxxxxxxxxxxx');<br/> $client->setAccessToken($_GET['code']);<br/> // make an authenticated call <br/> $current_user = json_decode($client->get('me'));<br/> print $current_user->username;<br/> /////////////////// any idea, thanks
0
11,411,077
07/10/2012 10:11:45
1,506,533
07/06/2012 11:05:10
28
0
How to change color of cell from calendar?
I want to highlight selected date and current date.How can i do it?I have used NSDAteComponents for current date.What should be condition to set current date color. I have grid of button.
iphone
null
null
null
null
null
open
How to change color of cell from calendar? === I want to highlight selected date and current date.How can i do it?I have used NSDAteComponents for current date.What should be condition to set current date color. I have grid of button.
0
11,410,998
07/10/2012 10:07:53
1,459,420
06/15/2012 17:45:15
36
2
how to change Label content(In XAML file) to Lower to upper and Upper to case in wpf
<Storyboard x:Key="ShiftAltClickValue2Animate"> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ContentControl.Content)" Storyboard.TargetName="lbl_AWithDiaeresis"> <DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="Ä"/> <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="ä"/> </ObjectAnimationUsingKeyFrames> </Storyboard> I created one Storyboard in wpf.Then apply the same stoaryboard to many controls in **code behind**.So i have to change lablel content **upper to lower case and lower to upper case** in Freame by Frame. With above code is possible for one control and not possible in many control. what should i do for that.
c#
wpf
storyboard
null
null
null
open
how to change Label content(In XAML file) to Lower to upper and Upper to case in wpf === <Storyboard x:Key="ShiftAltClickValue2Animate"> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ContentControl.Content)" Storyboard.TargetName="lbl_AWithDiaeresis"> <DiscreteObjectKeyFrame KeyTime="0:0:0.2" Value="Ä"/> <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="ä"/> </ObjectAnimationUsingKeyFrames> </Storyboard> I created one Storyboard in wpf.Then apply the same stoaryboard to many controls in **code behind**.So i have to change lablel content **upper to lower case and lower to upper case** in Freame by Frame. With above code is possible for one control and not possible in many control. what should i do for that.
0
11,410,896
07/10/2012 10:02:21
534,790
12/08/2010 09:34:26
1,048
50
Python: How json dumps None to empty string
I want Python's `None` to be encoded in json as empty string how? Below is the default behavior of `json.dumps`. >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' Should I overwrite the json encoder method or is there any other way? Thanks!
python
json
null
null
null
null
open
Python: How json dumps None to empty string === I want Python's `None` to be encoded in json as empty string how? Below is the default behavior of `json.dumps`. >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' Should I overwrite the json encoder method or is there any other way? Thanks!
0
11,411,042
07/10/2012 10:09:59
1,022,141
10/31/2011 14:30:38
4,168
271
DB2 unique constraint, unique indexes and performance
I have a table that requires two rows to be unique. They are likely to be joined regularly so I probably need an index on these rows. I checked the Infocenter on the [Unique constraint](http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.dbobj.doc/doc/c0020151.html) and on the [Unique Index](http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.sql.ref.doc%2Fdoc%2Fr0000919.html). I'm wondering about the difference and the performance impact. Both seem to create an index. The unique index allows one null value. The constraint seems to be allows for one column only while the index covers multiple columns if needed. Are there other important differences? Do these indexes improve query performance or are they just enforcing uniqueness? Should I add an additional index for performance reasons or will be the unique index be good enough? Unfortunately I don't have enough test data yet for trying it out yet.
sql
index
db2
unique
unique-constraint
null
open
DB2 unique constraint, unique indexes and performance === I have a table that requires two rows to be unique. They are likely to be joined regularly so I probably need an index on these rows. I checked the Infocenter on the [Unique constraint](http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.dbobj.doc/doc/c0020151.html) and on the [Unique Index](http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.sql.ref.doc%2Fdoc%2Fr0000919.html). I'm wondering about the difference and the performance impact. Both seem to create an index. The unique index allows one null value. The constraint seems to be allows for one column only while the index covers multiple columns if needed. Are there other important differences? Do these indexes improve query performance or are they just enforcing uniqueness? Should I add an additional index for performance reasons or will be the unique index be good enough? Unfortunately I don't have enough test data yet for trying it out yet.
0
11,430,516
07/11/2012 10:20:33
1,517,415
07/11/2012 10:14:25
1
0
Assign Xsl Value from querystring
How can i assign value from querystring. <xsl:param name="EntityName"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param> <xsl:param name="FilterRk"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param> First code is working but second one is not working What can i do for this situtation?
c#
asp.net
visual-studio-2010
xslt
null
null
open
Assign Xsl Value from querystring === How can i assign value from querystring. <xsl:param name="EntityName"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param> <xsl:param name="FilterRk"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param> First code is working but second one is not working What can i do for this situtation?
0
11,430,517
07/11/2012 10:20:34
645,924
11/27/2010 20:01:40
712
3
signalR overhead
I have a client which updates its position on the server by periodically (each 4 seconds) sending it's new location. I also have a client which tracks the previous mobile, by periodically pollen the server (each 5 seconds) and get the latest location. Should this communication be carried over SignalR (for sending the latest location) or by using a timer? I say this as SignalR has some overhead which generates larger request sizes which can be very costly. Thank you, RYan
timer
signalr
null
null
null
null
open
signalR overhead === I have a client which updates its position on the server by periodically (each 4 seconds) sending it's new location. I also have a client which tracks the previous mobile, by periodically pollen the server (each 5 seconds) and get the latest location. Should this communication be carried over SignalR (for sending the latest location) or by using a timer? I say this as SignalR has some overhead which generates larger request sizes which can be very costly. Thank you, RYan
0
11,430,527
07/11/2012 10:21:07
273,657
02/15/2010 16:39:46
2,368
31
Spring WS web service. Adding an attachment to the response using SAAJ - No adapter for endpoint
I am really struggling getting Spring-WS to return a response with attachments. I have managed to get an MTOM version to work but this has some pre-requisites on the client as i believe that the client has to be MTOM enabled as well (please correct me if this is not correct). What i am trying to do now is to use the standard SOAP with attachment implementation using SAAJ and Spring-WS. To do this i implemented an endpoint that just attaches an image from the local filesystem to the response. @Endpoint public class TestEndPoint { private SaajSoapMessageFactory saajMessageFactory; @PayloadRoot(namespace="http://ws.mypackage.com", localPart="downloadMessageRequestSaaj") @ResponsePayload public JAXBElement<DownloadResponseSaajType> invoke(@RequestPayload DownloadMessageRequestSaaj req, MessageContext context ) throws Exception { DownloadResponseSaajType response = new DownloadResponseSaajType(); DownloadResponseSaajType.PayLoad payload = new DownloadResponseSaajType.PayLoad(); DataHandler handler = new javax.activation.DataHandler(new FileDataSource("c:\\temp\\maven-feather.png")); SaajSoapMessage message = saajMessageFactory.createWebServiceMessage(); message.addAttachment("picture", handler); context.setResponse(message); payload.setMessagePayLoad(handler); return objectFactory.createDownloadMessageResponseSaaj(response); } public void setSaajMessageFactory(SaajSoapMessageFactory saajMessageFactory){ this.saajMessageFactory = saajMessageFactory; } public SaajSoapMessageFactory getSaajMessageFactory(){ return saajMessageFactory; } } The Saaj properties are depency injected as shown below: <context:annotation-config/> <context:component-scan base-package="com.mypackage"/> <sws:annotation-driven/> <bean id="soapMessageFactory" class="javax.xml.soap.MessageFactory" factory-method="newInstance" /> <bean id="saajMessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> <constructor-arg ref="soapMessageFactory" /> </bean> <bean id="myService" class="com.mypackage.TestEndPoint"> <property name="saajMessageFactory" ref="saajMessageFactory" /> </bean> When i try to call the above service i get the following error: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring xml:lang="en">No adapter for endpoint [public javax.xml.bind.JAXBElement&lt;com.mypackage.ws.DownloadResponseSaajType> com.mypackage.TestEndPoint.invoke(com.mypackage.ws.DownloadMessageRequestSaaj,org.springframework.ws.context.MessageContext) throws java.lang.Exception]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
java
web-services
spring
soap
spring-ws
null
open
Spring WS web service. Adding an attachment to the response using SAAJ - No adapter for endpoint === I am really struggling getting Spring-WS to return a response with attachments. I have managed to get an MTOM version to work but this has some pre-requisites on the client as i believe that the client has to be MTOM enabled as well (please correct me if this is not correct). What i am trying to do now is to use the standard SOAP with attachment implementation using SAAJ and Spring-WS. To do this i implemented an endpoint that just attaches an image from the local filesystem to the response. @Endpoint public class TestEndPoint { private SaajSoapMessageFactory saajMessageFactory; @PayloadRoot(namespace="http://ws.mypackage.com", localPart="downloadMessageRequestSaaj") @ResponsePayload public JAXBElement<DownloadResponseSaajType> invoke(@RequestPayload DownloadMessageRequestSaaj req, MessageContext context ) throws Exception { DownloadResponseSaajType response = new DownloadResponseSaajType(); DownloadResponseSaajType.PayLoad payload = new DownloadResponseSaajType.PayLoad(); DataHandler handler = new javax.activation.DataHandler(new FileDataSource("c:\\temp\\maven-feather.png")); SaajSoapMessage message = saajMessageFactory.createWebServiceMessage(); message.addAttachment("picture", handler); context.setResponse(message); payload.setMessagePayLoad(handler); return objectFactory.createDownloadMessageResponseSaaj(response); } public void setSaajMessageFactory(SaajSoapMessageFactory saajMessageFactory){ this.saajMessageFactory = saajMessageFactory; } public SaajSoapMessageFactory getSaajMessageFactory(){ return saajMessageFactory; } } The Saaj properties are depency injected as shown below: <context:annotation-config/> <context:component-scan base-package="com.mypackage"/> <sws:annotation-driven/> <bean id="soapMessageFactory" class="javax.xml.soap.MessageFactory" factory-method="newInstance" /> <bean id="saajMessageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> <constructor-arg ref="soapMessageFactory" /> </bean> <bean id="myService" class="com.mypackage.TestEndPoint"> <property name="saajMessageFactory" ref="saajMessageFactory" /> </bean> When i try to call the above service i get the following error: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring xml:lang="en">No adapter for endpoint [public javax.xml.bind.JAXBElement&lt;com.mypackage.ws.DownloadResponseSaajType> com.mypackage.TestEndPoint.invoke(com.mypackage.ws.DownloadMessageRequestSaaj,org.springframework.ws.context.MessageContext) throws java.lang.Exception]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
0
11,430,528
07/11/2012 10:21:11
1,082,625
12/06/2011 01:08:43
9
0
504 for chat a application in cloudfoundry
I am trying to develop a chat application in java and have deployed a sample application that uses RabitMq and Comet. I have been able to send and receive messages from the bounded RabitMQ service. The problem occurs when i try to pool the queue for messages when there are no pending messages to deliver. Instead of waiting for a new message and keep the connection open, i am getting 504 error code. This i believe is due to the cloudfoundry condition that the request has to be responded within 30 sec. As i want to keep the connection open until i have a message to deliver to the client, Is there any way i can overcome this.
chat
cloudfoundry
null
null
null
null
open
504 for chat a application in cloudfoundry === I am trying to develop a chat application in java and have deployed a sample application that uses RabitMq and Comet. I have been able to send and receive messages from the bounded RabitMQ service. The problem occurs when i try to pool the queue for messages when there are no pending messages to deliver. Instead of waiting for a new message and keep the connection open, i am getting 504 error code. This i believe is due to the cloudfoundry condition that the request has to be responded within 30 sec. As i want to keep the connection open until i have a message to deliver to the client, Is there any way i can overcome this.
0
11,430,532
07/11/2012 10:21:21
1,268,630
03/14/2012 09:42:10
6
1
Flex DataGrid recycling Renderer
I have a trouble displapying a list in a datagrid with an itemRenderer. My itemrenderer is Hbox containing an image in a comlum. The data My dataprovider dataList changes every time when I click on a button. The problem is that it works ONLY the first time(dispalying the good lists). After that, even when the dataprovider list is empty, it make the icon appears in the dataGrid colum. Here's my mxml code: and here's my ImageRenderer: <mx:AdvancedDataGridColumn dataField="currentDecroType" resizable="true" itemRenderer="be.rtbf.radio.cockpit.rds.view.component.ImageRenderer" headerText="Niveau décro" width="80"/> Here is my ItemRenderer : public class ImageRenderer extends HBox { private var _currentDecroType : String; private var _lastDecro : String; private var _data : Object; private var imageReference:Image = null; public static const NATIONAL : String = "National"; public static const REGIONAL : String = "Regional"; public static const LOCAL : String = "Local"; public function ImageRenderer() { super(); setStyle("horizontalAlign", "center"); setStyle("verticalAlign", "center"); } override public function get data():Object { return _data; } override public function set data(value: Object) : void { super.data = value; _data = value; if(_data && _data.hasOwnProperty("currentDecroType")) { var radioRDs : RadioRds = RadioRds(_data); if(radioRDs.currentDecroType && imageReference==null) { setIcon(radioRDs.currentDecroType); } } else if(_data && _data.hasOwnProperty("lastDecro")) { var encoder : Encoder = Encoder(_data); if(encoder.lastDecro && imageReference==null) { setIcon(encoder.lastDecro); } } } public function setIcon(decro : String) { if(decro.length !=0) { var img:Image = new Image(); switch(decro) { case NATIONAL : img.source = IconAssets.DECRO_NATIONAL; img.toolTip = ImageRenderer.NATIONAL; break; case REGIONAL : img.source = IconAssets.DECRO_REGIONAL; img.toolTip = ImageRenderer.REGIONAL; break; case LOCAL : img.source = IconAssets.DECRO_LOCAL; img.toolTip = ImageRenderer.LOCAL; break; } if(img) { img.maxHeight = 24; img.maxWidth = 24; imageReference = img; addChild(img); } } } } }
image
datagrid
itemrenderer
recycling
hbox
null
open
Flex DataGrid recycling Renderer === I have a trouble displapying a list in a datagrid with an itemRenderer. My itemrenderer is Hbox containing an image in a comlum. The data My dataprovider dataList changes every time when I click on a button. The problem is that it works ONLY the first time(dispalying the good lists). After that, even when the dataprovider list is empty, it make the icon appears in the dataGrid colum. Here's my mxml code: and here's my ImageRenderer: <mx:AdvancedDataGridColumn dataField="currentDecroType" resizable="true" itemRenderer="be.rtbf.radio.cockpit.rds.view.component.ImageRenderer" headerText="Niveau décro" width="80"/> Here is my ItemRenderer : public class ImageRenderer extends HBox { private var _currentDecroType : String; private var _lastDecro : String; private var _data : Object; private var imageReference:Image = null; public static const NATIONAL : String = "National"; public static const REGIONAL : String = "Regional"; public static const LOCAL : String = "Local"; public function ImageRenderer() { super(); setStyle("horizontalAlign", "center"); setStyle("verticalAlign", "center"); } override public function get data():Object { return _data; } override public function set data(value: Object) : void { super.data = value; _data = value; if(_data && _data.hasOwnProperty("currentDecroType")) { var radioRDs : RadioRds = RadioRds(_data); if(radioRDs.currentDecroType && imageReference==null) { setIcon(radioRDs.currentDecroType); } } else if(_data && _data.hasOwnProperty("lastDecro")) { var encoder : Encoder = Encoder(_data); if(encoder.lastDecro && imageReference==null) { setIcon(encoder.lastDecro); } } } public function setIcon(decro : String) { if(decro.length !=0) { var img:Image = new Image(); switch(decro) { case NATIONAL : img.source = IconAssets.DECRO_NATIONAL; img.toolTip = ImageRenderer.NATIONAL; break; case REGIONAL : img.source = IconAssets.DECRO_REGIONAL; img.toolTip = ImageRenderer.REGIONAL; break; case LOCAL : img.source = IconAssets.DECRO_LOCAL; img.toolTip = ImageRenderer.LOCAL; break; } if(img) { img.maxHeight = 24; img.maxWidth = 24; imageReference = img; addChild(img); } } } } }
0
11,430,533
07/11/2012 10:21:22
1,407,363
05/21/2012 08:10:10
7
3
Grid View content click and selection
I have made a GridView and enabled the selection property to it. Now select comes next to every row in the gridview. I want to remove the select text/tag and selection should be done on the click on the content. How can i do this. :)
asp.net
null
null
null
null
null
open
Grid View content click and selection === I have made a GridView and enabled the selection property to it. Now select comes next to every row in the gridview. I want to remove the select text/tag and selection should be done on the click on the content. How can i do this. :)
0
11,430,522
07/11/2012 10:20:55
1,254,683
03/07/2012 12:37:39
86
3
Printscreen of artoolkit video frame
i am doing a little app with artoolkit and i want to create a screenshot function so the user can save the video frame with the vrml objects he draw in the video frame, its possible to do that? I am coding in C using Xcode in Mac OS X
c
xcode
osx
artoolkit
null
null
open
Printscreen of artoolkit video frame === i am doing a little app with artoolkit and i want to create a screenshot function so the user can save the video frame with the vrml objects he draw in the video frame, its possible to do that? I am coding in C using Xcode in Mac OS X
0
11,430,534
07/11/2012 10:21:35
1,909
08/19/2008 14:04:34
1,581
33
Escaping strings in JTemplate
I have a JTemplate string that looks like this <a class="add" href="#" onclick="javascript:myfunction('{$T.Properties.Title}')" > This code breaks when my parameter $T.Properties.Title is a string which contains a single quote character in it. I could use a double quote character while passing my parameter value, but my code will then break for double quotes. How do I escape the input string so that my code works for strings that have both single and double quotes in them?
javascript
jquery
jtemplate
null
null
null
open
Escaping strings in JTemplate === I have a JTemplate string that looks like this <a class="add" href="#" onclick="javascript:myfunction('{$T.Properties.Title}')" > This code breaks when my parameter $T.Properties.Title is a string which contains a single quote character in it. I could use a double quote character while passing my parameter value, but my code will then break for double quotes. How do I escape the input string so that my code works for strings that have both single and double quotes in them?
0
11,430,537
07/11/2012 10:21:41
1,517,207
07/11/2012 08:58:15
1
0
ruby on rails - edit params in model
I'm a beginner at Ruby on Rails and I'm having some problems with my model. I'm working on an existing Tool and have to add some functionality. The rails version is pretty old, Rails 2.3.14. Send with the browserdata is a file. My idea is that all the information which are send by the browser could also be in the file with the subscribers. The information are in the first line of the file. These example Parameters are send by the browser. {"authenticity_token"=>"sometoken/replaced", "migration"=>{"name"=>"asdfasdfeeeeeeeee", "pre_check_at(1i)"=>"2012", "pre_check_at(2i)"=>"7", "pre_check_at(3i)"=>"11", "pre_check_at(4i)"=>"09", "pre_check_at(5i)"=>"19", "post_check_at(1i)"=>"2012", "post_check_at(2i)"=>"7", "post_check_at(3i)"=>"11", "post_check_at(4i)"=>"09", "post_check_at(5i)"=>"19", "email"=>"[email protected]", "subscribers"=>#<File:/tmp/RackMultipart20120711-23850-hs8tkc-0>}, "commit"=>"Create"} Controller def create @migration = Migration.new(params[:migration]) @migration.user = User.find(session[:user_id]) if @migration.save flash[:notice] = 'Migration was successfully created.' redirect_to(@migration) else render :action => "new" end end Model def subscribers= collection_or_file return if collection_or_file.nil? if collection_or_file.is_a? Array return super else first_line = true collection_or_file.each_line do |line| next if line.blank? if first_line == true if line =~ #regex #some code first_line = false else #if regex 1 notmatches email, pre_check_at_1, pre_check_at_2, pre_check_at_3, pre_check_at_4, pre_check_at_5, post_check_at_1, post_check_at_2,post_check_at_3, post_check_at_4, post_check_at_5, name = line.split(',') ### I want to write email into :email first_line = false end else # some code end end end end end How can I write the content of **email** into :email ? I don't get it. What are these :name actually? Normal local variables? Can I edit them? Can I work with them? If you need any further information, write a comment :-) Thanks a lot // I'm not a native english speaker, so there will probably be some grammar mistakes.
ruby-on-rails
parameters
model
edit
params
null
open
ruby on rails - edit params in model === I'm a beginner at Ruby on Rails and I'm having some problems with my model. I'm working on an existing Tool and have to add some functionality. The rails version is pretty old, Rails 2.3.14. Send with the browserdata is a file. My idea is that all the information which are send by the browser could also be in the file with the subscribers. The information are in the first line of the file. These example Parameters are send by the browser. {"authenticity_token"=>"sometoken/replaced", "migration"=>{"name"=>"asdfasdfeeeeeeeee", "pre_check_at(1i)"=>"2012", "pre_check_at(2i)"=>"7", "pre_check_at(3i)"=>"11", "pre_check_at(4i)"=>"09", "pre_check_at(5i)"=>"19", "post_check_at(1i)"=>"2012", "post_check_at(2i)"=>"7", "post_check_at(3i)"=>"11", "post_check_at(4i)"=>"09", "post_check_at(5i)"=>"19", "email"=>"[email protected]", "subscribers"=>#<File:/tmp/RackMultipart20120711-23850-hs8tkc-0>}, "commit"=>"Create"} Controller def create @migration = Migration.new(params[:migration]) @migration.user = User.find(session[:user_id]) if @migration.save flash[:notice] = 'Migration was successfully created.' redirect_to(@migration) else render :action => "new" end end Model def subscribers= collection_or_file return if collection_or_file.nil? if collection_or_file.is_a? Array return super else first_line = true collection_or_file.each_line do |line| next if line.blank? if first_line == true if line =~ #regex #some code first_line = false else #if regex 1 notmatches email, pre_check_at_1, pre_check_at_2, pre_check_at_3, pre_check_at_4, pre_check_at_5, post_check_at_1, post_check_at_2,post_check_at_3, post_check_at_4, post_check_at_5, name = line.split(',') ### I want to write email into :email first_line = false end else # some code end end end end end How can I write the content of **email** into :email ? I don't get it. What are these :name actually? Normal local variables? Can I edit them? Can I work with them? If you need any further information, write a comment :-) Thanks a lot // I'm not a native english speaker, so there will probably be some grammar mistakes.
0
11,651,051
07/25/2012 13:38:46
1,199,519
02/09/2012 11:32:17
153
2
send mouse click to winamp
I'm trying to learn mouse/keyboard emulation using win api. I found out that it is possible to emulate button click using sendmessage() function. Well, I get coordinates of "play" button (it is (60;100)) and trying to push this button using the following code: int x = 60; int y = 100; int lParam = ((x << 16) | (y & 0xffff)); int parentWindow = FindWindow("BaseWindow_RootWnd", "Main Window");//get main winamp window MessageBox.Show(parentWindow.ToString());//failed if 0 SendMessage(parentWindow, WM_LBUTTONDOWN, IntPtr.Zero, new IntPtr(lParam));//send left mouse button down SendMessage(parentWindow, WM_LBUTTONUP, IntPtr.Zero, new IntPtr(lParam));//send left mouse button up But this code has no effect on the winamp. Can anybody point me on the mistakes i made? Any help is greatly appreciated! p.s. It's not applicable for me to move mouse to the winamp play button, than do a click, than move it back. Also for winamp it is impossible to get button's handle. With button handle SendMessage() works fairly well, but with coordinates it doesn't at all.
c#
winapi
winamp
null
null
null
open
send mouse click to winamp === I'm trying to learn mouse/keyboard emulation using win api. I found out that it is possible to emulate button click using sendmessage() function. Well, I get coordinates of "play" button (it is (60;100)) and trying to push this button using the following code: int x = 60; int y = 100; int lParam = ((x << 16) | (y & 0xffff)); int parentWindow = FindWindow("BaseWindow_RootWnd", "Main Window");//get main winamp window MessageBox.Show(parentWindow.ToString());//failed if 0 SendMessage(parentWindow, WM_LBUTTONDOWN, IntPtr.Zero, new IntPtr(lParam));//send left mouse button down SendMessage(parentWindow, WM_LBUTTONUP, IntPtr.Zero, new IntPtr(lParam));//send left mouse button up But this code has no effect on the winamp. Can anybody point me on the mistakes i made? Any help is greatly appreciated! p.s. It's not applicable for me to move mouse to the winamp play button, than do a click, than move it back. Also for winamp it is impossible to get button's handle. With button handle SendMessage() works fairly well, but with coordinates it doesn't at all.
0
11,650,989
07/25/2012 13:35:35
1,551,739
07/25/2012 13:17:20
1
0
dataGridView CurrentCellChanged event don't let me select more than one row
I have a dataGridView on my form. I set CurrentCellChanged event for it, MultiSelect properties is true but now I can't select more than one row! Please help me. thank you! I want to be able to select more than 1 row.
c#
winforms
events
datagridview
multi-select
null
open
dataGridView CurrentCellChanged event don't let me select more than one row === I have a dataGridView on my form. I set CurrentCellChanged event for it, MultiSelect properties is true but now I can't select more than one row! Please help me. thank you! I want to be able to select more than 1 row.
0
11,651,056
07/25/2012 13:39:01
1,174,488
01/27/2012 22:11:57
23
2
mysql & php ReturnTop 100 Scores
How can i write a MYSQL(in php file) FOR loop or WHILE loop to iterate through a tables id? Or should I use PHP to make a series of calls back and forth?
php
mysql
for-loop
while-loops
null
07/25/2012 13:44:17
not a real question
mysql & php ReturnTop 100 Scores === How can i write a MYSQL(in php file) FOR loop or WHILE loop to iterate through a tables id? Or should I use PHP to make a series of calls back and forth?
1
11,651,063
07/25/2012 13:39:12
1,543,701
07/22/2012 08:18:23
1
0
logging in to a website using Httpwebrequest
I'm new to programming (C#) and I started writing a bot for a MMORPG to learn communicating with websites programmatically and stuff... I found many questions about this topic in here and there. At last with a helping hand,I could find something and complete it, which unfortunately ain't working :( The mothods: public static CookieCollection GetCookie(HttpWebRequest request) { if (request.CookieContainer == null) { return new CookieContainer().GetCookies(request.RequestUri); } else { return request.CookieContainer.GetCookies(request.RequestUri); } } public static CookieContainer GetCookie(HttpWebResponse response) { CookieContainer cookiecontainer = new CookieContainer(); cookiecontainer.Add(response.Cookies); return cookiecontainer; } public static void SetCookie(HttpWebRequest request, CookieContainer cookie) { request.CookieContainer = cookie; } public static void SetCookie(HttpWebResponse response, CookieCollection cookie) { response.Cookies = cookie; } public static HttpWebResponse PostData(string uri,string request,CookieContainer cookie) { HttpWebRequest httprequest; byte[] requestbytes; Stream requeststream; HttpWebResponse httpresponse; httprequest = (HttpWebRequest)HttpWebRequest.Create(uri); if (cookie == null) {httprequest.CookieContainer=new CookieContainer();} else {httprequest.CookieContainer=cookie;} httprequest.Method = "POST"; httprequest.ContentType = "application/x-www-form-urlencoded"; httprequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19"; requestbytes = ASCIIEncoding.ASCII.GetBytes(request); httprequest.ContentLength = requestbytes.Length; requeststream=httprequest.GetRequestStream(); requeststream.Write(requestbytes,0,requestbytes.Length); requeststream.Close(); httpresponse=(HttpWebResponse)httprequest.GetResponse(); if (!(httpresponse.Cookies.Count>0)) { SetCookie(httpresponse, GetCookie(httprequest)); } return httpresponse; } public static HttpWebResponse GetData(string uri, CookieContainer cookie) { HttpWebRequest httprequest; HttpWebResponse httpresponse; httprequest = (HttpWebRequest)HttpWebRequest.Create(uri); if (cookie == null) { httprequest.CookieContainer = new CookieContainer(); } else { httprequest.CookieContainer = cookie; } httprequest.Method = "GET"; httprequest.ContentType = "application/x-www-form-urlencoded"; httprequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19"; httpresponse = (HttpWebResponse)httprequest.GetResponse(); if (!(httpresponse.Cookies.Count > 0)) { SetCookie(httpresponse, GetCookie(httprequest)); } return httpresponse; } the Main: string uri = "http://s2.kingsera.org"; string userName = "someUserName"; string passWord = "somePassWord"; string postData = "signinUsername=" + userName + "&signinPassword=" + passWord + "&signinRemember=remember"; CookieContainer cookie = new CookieContainer(); HttpWebResponse response = PostData(uri, postData, cookie); CookieContainer c = GetCookie(response); It seems the login page is doing something to make it more complicated! http://s2.kingsera.org Every single comment/suggestion will be appreciated. Thanks in advance.
c#
login
httpwebrequest
null
null
null
open
logging in to a website using Httpwebrequest === I'm new to programming (C#) and I started writing a bot for a MMORPG to learn communicating with websites programmatically and stuff... I found many questions about this topic in here and there. At last with a helping hand,I could find something and complete it, which unfortunately ain't working :( The mothods: public static CookieCollection GetCookie(HttpWebRequest request) { if (request.CookieContainer == null) { return new CookieContainer().GetCookies(request.RequestUri); } else { return request.CookieContainer.GetCookies(request.RequestUri); } } public static CookieContainer GetCookie(HttpWebResponse response) { CookieContainer cookiecontainer = new CookieContainer(); cookiecontainer.Add(response.Cookies); return cookiecontainer; } public static void SetCookie(HttpWebRequest request, CookieContainer cookie) { request.CookieContainer = cookie; } public static void SetCookie(HttpWebResponse response, CookieCollection cookie) { response.Cookies = cookie; } public static HttpWebResponse PostData(string uri,string request,CookieContainer cookie) { HttpWebRequest httprequest; byte[] requestbytes; Stream requeststream; HttpWebResponse httpresponse; httprequest = (HttpWebRequest)HttpWebRequest.Create(uri); if (cookie == null) {httprequest.CookieContainer=new CookieContainer();} else {httprequest.CookieContainer=cookie;} httprequest.Method = "POST"; httprequest.ContentType = "application/x-www-form-urlencoded"; httprequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19"; requestbytes = ASCIIEncoding.ASCII.GetBytes(request); httprequest.ContentLength = requestbytes.Length; requeststream=httprequest.GetRequestStream(); requeststream.Write(requestbytes,0,requestbytes.Length); requeststream.Close(); httpresponse=(HttpWebResponse)httprequest.GetResponse(); if (!(httpresponse.Cookies.Count>0)) { SetCookie(httpresponse, GetCookie(httprequest)); } return httpresponse; } public static HttpWebResponse GetData(string uri, CookieContainer cookie) { HttpWebRequest httprequest; HttpWebResponse httpresponse; httprequest = (HttpWebRequest)HttpWebRequest.Create(uri); if (cookie == null) { httprequest.CookieContainer = new CookieContainer(); } else { httprequest.CookieContainer = cookie; } httprequest.Method = "GET"; httprequest.ContentType = "application/x-www-form-urlencoded"; httprequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19"; httpresponse = (HttpWebResponse)httprequest.GetResponse(); if (!(httpresponse.Cookies.Count > 0)) { SetCookie(httpresponse, GetCookie(httprequest)); } return httpresponse; } the Main: string uri = "http://s2.kingsera.org"; string userName = "someUserName"; string passWord = "somePassWord"; string postData = "signinUsername=" + userName + "&signinPassword=" + passWord + "&signinRemember=remember"; CookieContainer cookie = new CookieContainer(); HttpWebResponse response = PostData(uri, postData, cookie); CookieContainer c = GetCookie(response); It seems the login page is doing something to make it more complicated! http://s2.kingsera.org Every single comment/suggestion will be appreciated. Thanks in advance.
0
11,650,183
07/25/2012 12:53:54
1,420,663
05/27/2012 22:14:10
1
0
classifying pages and second authentication level pages in LifeRay
I want to know if i can classify pages in the LifeRay CMS, so when i'm creating the page i can have a dropdown menu choosing (Public or Classified) **if it's Public :** That means that all users on the system can view this page. **If it's Classified:** It should ask then for second authentication level then if the second authentication level is correct then direct them to the requested page but when the process is finished or cancelled, it should end the second authentication level session and once i'm trying to access the same classified page or another classified page it should ask me again. Can it be done directly from the LifeRay system or i need to do programming inside it?.
authentication
content-management-system
system
liferay
categories
null
open
classifying pages and second authentication level pages in LifeRay === I want to know if i can classify pages in the LifeRay CMS, so when i'm creating the page i can have a dropdown menu choosing (Public or Classified) **if it's Public :** That means that all users on the system can view this page. **If it's Classified:** It should ask then for second authentication level then if the second authentication level is correct then direct them to the requested page but when the process is finished or cancelled, it should end the second authentication level session and once i'm trying to access the same classified page or another classified page it should ask me again. Can it be done directly from the LifeRay system or i need to do programming inside it?.
0
11,651,074
07/25/2012 13:39:44
1,319,424
04/07/2012 18:05:50
38
1
isolating a sub-string in a string before a symbol in SQL Server 2008
i am trying to extract a substring(everything before a hyphen, in this case) from a string as shown below: Net Operating Loss - 2007 Capital Loss - 1991 Foreign Tax Credit - 1997 and want the year and name(substring before hyphen) separately, using SQL server Management studio 2008. Any advice? or idea how i can achieve this?
sql-server-2008
null
null
null
null
null
open
isolating a sub-string in a string before a symbol in SQL Server 2008 === i am trying to extract a substring(everything before a hyphen, in this case) from a string as shown below: Net Operating Loss - 2007 Capital Loss - 1991 Foreign Tax Credit - 1997 and want the year and name(substring before hyphen) separately, using SQL server Management studio 2008. Any advice? or idea how i can achieve this?
0
11,651,076
07/25/2012 13:39:47
1,551,769
07/25/2012 13:28:21
1
0
Retrieving data in the last row of google spreadsheet
I am using a combination of google forms and spreadsheet to track our inventory. Employees will scan a QR code that will take them to a google form to fill out where the tool is going. That data is fed to a google spreadsheet. I want to create an aggregate spreadsheet to see where all the tool are. With google forms the information is posted on successive rows in the spreadsheet. Is there a function that will look for data in the last row as it will constantly change?
forms
google
spreadsheet
null
null
null
open
Retrieving data in the last row of google spreadsheet === I am using a combination of google forms and spreadsheet to track our inventory. Employees will scan a QR code that will take them to a google form to fill out where the tool is going. That data is fed to a google spreadsheet. I want to create an aggregate spreadsheet to see where all the tool are. With google forms the information is posted on successive rows in the spreadsheet. Is there a function that will look for data in the last row as it will constantly change?
0
11,651,079
07/25/2012 13:39:54
16,732
09/17/2008 20:15:51
893
14
Salesforce - How can I run testMethods with specific profile permissions?
We have a piece of code that is meant to run from the Public Site's user. Currently, the testMethods run as the standard test user, and the code works fine. However, the funcionality fails on the site, requesting user authentication before running the code (which shouldn't, since the user won't have Salesforce credentials). Is there a way that we can make the testMethods run as the site's guest user, or a similar profile? Take in mind that we cannot know the profile's name beforehand, and that the profile might not even exist when the tests are run.
unit-testing
salesforce
null
null
null
null
open
Salesforce - How can I run testMethods with specific profile permissions? === We have a piece of code that is meant to run from the Public Site's user. Currently, the testMethods run as the standard test user, and the code works fine. However, the funcionality fails on the site, requesting user authentication before running the code (which shouldn't, since the user won't have Salesforce credentials). Is there a way that we can make the testMethods run as the site's guest user, or a similar profile? Take in mind that we cannot know the profile's name beforehand, and that the profile might not even exist when the tests are run.
0
11,651,080
07/25/2012 13:39:57
1,551,754
07/25/2012 13:23:22
1
0
Searching a 2d Array (Java) for an element
I have created a 2d array, i need to search within that array for the state abbreviation if found then i need to print the row that it was found on. i did create a separate method for this. 1. private static void ticketpayout(String state) { 2. // search array for state 3. //2d array with all state info 4. String[][] tax = { {"AZ", "5%", "Annually", "$2,823,333", "After 30 Years", "$84,699,990", "Cash", "$57,050,000"}, {"AR", "7%", "Annually", "$2,742,667", "After 30 Years", "$82,280,010", "Cash", "$55,420,000"}, {"CO", "4%", "Annually", "$2,863,667", "After 30 Years", "$85,910,010", "Cash", "$57,865,000"}, {"CT", "6.7%", "Annually", "$2,754,767", "After 30 Years", "$82,643,010", "Cash", "$55,664,500"}, {"DE", "0%", "Annually", "$3,025,000", "After 30 Years", "$90,750,000", "Cash", "$61,125,000"}, {"FL", "0%", "Annually", "$3,025,000", "After 30 Years", "$90,750,000", "Cash", "$61,125,000"}, {"GA", "6%", "Annually", "$2,783,000", "After 30 Years", "$83,490,000", "Cash", "$56,235,000"}, {"ID", "7.8% ", "Annually", "$2,710,400", "After 30 Years", "$81,312,000", "Cash", "$54,768,000"}, {"IL", "5%", "Annually", "$2,823,333", "After 30 Years", "$84,699,990", "Cash", "$57,050,000"}, }; }
java
2d-array
null
null
null
07/26/2012 13:22:06
not a real question
Searching a 2d Array (Java) for an element === I have created a 2d array, i need to search within that array for the state abbreviation if found then i need to print the row that it was found on. i did create a separate method for this. 1. private static void ticketpayout(String state) { 2. // search array for state 3. //2d array with all state info 4. String[][] tax = { {"AZ", "5%", "Annually", "$2,823,333", "After 30 Years", "$84,699,990", "Cash", "$57,050,000"}, {"AR", "7%", "Annually", "$2,742,667", "After 30 Years", "$82,280,010", "Cash", "$55,420,000"}, {"CO", "4%", "Annually", "$2,863,667", "After 30 Years", "$85,910,010", "Cash", "$57,865,000"}, {"CT", "6.7%", "Annually", "$2,754,767", "After 30 Years", "$82,643,010", "Cash", "$55,664,500"}, {"DE", "0%", "Annually", "$3,025,000", "After 30 Years", "$90,750,000", "Cash", "$61,125,000"}, {"FL", "0%", "Annually", "$3,025,000", "After 30 Years", "$90,750,000", "Cash", "$61,125,000"}, {"GA", "6%", "Annually", "$2,783,000", "After 30 Years", "$83,490,000", "Cash", "$56,235,000"}, {"ID", "7.8% ", "Annually", "$2,710,400", "After 30 Years", "$81,312,000", "Cash", "$54,768,000"}, {"IL", "5%", "Annually", "$2,823,333", "After 30 Years", "$84,699,990", "Cash", "$57,050,000"}, }; }
1
11,650,852
07/25/2012 13:29:48
1,265,782
03/13/2012 06:27:16
179
0
making phone call in android
Making a Call through android device via phone and the code does not seems to work I am call this funtion private void call() { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("9766425971")); startActivity(callIntent); } catch (ActivityNotFoundException activityException) { Log.e("dialing-example", "Call failed", activityException); } } also i have given the permission <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission> What am i doing wrong any one can guide me?
android
null
null
null
null
null
open
making phone call in android === Making a Call through android device via phone and the code does not seems to work I am call this funtion private void call() { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("9766425971")); startActivity(callIntent); } catch (ActivityNotFoundException activityException) { Log.e("dialing-example", "Call failed", activityException); } } also i have given the permission <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission> What am i doing wrong any one can guide me?
0
11,650,857
07/25/2012 13:29:57
1,152,439
01/16/2012 18:17:46
5
1
How to show wordpress page between 10am to 5pm?
I'm creating a car booking website for my cousin and i have created it using wordpress, he wan't the booking page to be available between 10am to 5pm only. Otherwise the page must show booking hour ends. Please give me idea for this.
wordpress
datetime
custom-wordpress-pages
null
null
null
open
How to show wordpress page between 10am to 5pm? === I'm creating a car booking website for my cousin and i have created it using wordpress, he wan't the booking page to be available between 10am to 5pm only. Otherwise the page must show booking hour ends. Please give me idea for this.
0
11,660,660
07/26/2012 00:24:31
130,639
06/29/2009 19:48:43
99
5
Disable parent droppable box while dragging from parent
http://jsfiddle.net/xSQBw/ demonstrates my problem. Notice that when you drag a box out of its parent and bring it back into the parent, then parent will accept the element. I need for the parent's droppable'ness to be disabled while the child is being dragged. Then I need the droppable'ness to be re-enabled after the child is dropped. I tried using the start: and stop: methods for droppable, however, getting the correct element to disable/re-enable was tricky, kludgy, and didn't work anyway. Here's an example of what I am attempting with the droppable handler: $('<fieldset />', { id: login, level: self.levelValue, class: 'member ' + employeeClass, }).appendTo('#columnWrapDiv') .droppable( { hoverClass: 'hovered', drop: function(event,ui) { /* removed */}); And my draggable: $('.class') .draggable( { containment: '#ttkanbanDiv', cursor: 'crosshairs', revert: true, opacity: 0.4, start: function(ui) { var id = $($($(ui).attr('srcElement')) .parents() .find('.ui-droppable')[0]).attr('id'); $('#' + id).removeClass('ui-droppable'); }, stop: function(ui) { $($($(ui).attr('srcElement')) .parents() .find('.ui-droppable')[0]) .addClass('ui-droppable'); }, zindex: 'auto', });
jquery-ui
google-chrome-extension
jquery-ui-draggable
jquery-ui-droppable
null
null
open
Disable parent droppable box while dragging from parent === http://jsfiddle.net/xSQBw/ demonstrates my problem. Notice that when you drag a box out of its parent and bring it back into the parent, then parent will accept the element. I need for the parent's droppable'ness to be disabled while the child is being dragged. Then I need the droppable'ness to be re-enabled after the child is dropped. I tried using the start: and stop: methods for droppable, however, getting the correct element to disable/re-enable was tricky, kludgy, and didn't work anyway. Here's an example of what I am attempting with the droppable handler: $('<fieldset />', { id: login, level: self.levelValue, class: 'member ' + employeeClass, }).appendTo('#columnWrapDiv') .droppable( { hoverClass: 'hovered', drop: function(event,ui) { /* removed */}); And my draggable: $('.class') .draggable( { containment: '#ttkanbanDiv', cursor: 'crosshairs', revert: true, opacity: 0.4, start: function(ui) { var id = $($($(ui).attr('srcElement')) .parents() .find('.ui-droppable')[0]).attr('id'); $('#' + id).removeClass('ui-droppable'); }, stop: function(ui) { $($($(ui).attr('srcElement')) .parents() .find('.ui-droppable')[0]) .addClass('ui-droppable'); }, zindex: 'auto', });
0
11,660,664
07/26/2012 00:24:50
1,553,144
07/26/2012 00:15:44
1
0
Is there an alternate to "omake -P" (server mode)?
The omake build system has the awesome feature called "server mode", invoked with the command line switch "omake -P". This will cause omake to monitor the file system for any file changes -- when there is a file change it will launch the appropriate build action. Unfortunately omake does not seem to be actively maintained anymore and the -P feature has severe problems on Ubuntu 12.04. (I can discuss these in some detail if anyone cares). Does anyone know of a build system like make/omake that has a feature similar to omake -P?
make
build-automation
omake
null
null
null
open
Is there an alternate to "omake -P" (server mode)? === The omake build system has the awesome feature called "server mode", invoked with the command line switch "omake -P". This will cause omake to monitor the file system for any file changes -- when there is a file change it will launch the appropriate build action. Unfortunately omake does not seem to be actively maintained anymore and the -P feature has severe problems on Ubuntu 12.04. (I can discuss these in some detail if anyone cares). Does anyone know of a build system like make/omake that has a feature similar to omake -P?
0
11,660,666
07/26/2012 00:24:57
828,308
07/04/2011 14:37:50
42
1
OAuth Google API for Java unable to impersonate user
I would like to impersonate a user and add files to the users Google Drive on their behalf from a server process. I've setup a service account and can successfully access the Drive as the service account adding and listing files, etc. using the following code: /** Global instance of the HTTP transport. */ private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport(); /** Global instance of the JSON factory. */ private static final JsonFactory JSON_FACTORY = new JacksonFactory(); public static void main(String[] args) { try { GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId("[email protected]") .setServiceAccountScopes(DriveScopes.DRIVE) .setServiceAccountPrivateKeyFromP12File(new File("c:/junk/key.p12")) .build(); Drive drive = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).build(); drive.files().list().execute(); } catch (Exception e) { e.printStackTrace(); } This works, however only returns files that are associated to what I assume is associated with the service accounts drive (?). According to the JavaDoc, GoogleCredential can also be used to impersonate a user by adding the service account users email address as follows: GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId("[email protected]") .setServiceAccountScopes(DriveScopes.DRIVE) .setServiceAccountPrivateKeyFromP12File(new File("c:/junk/key.p12")) .setServiceAccountUser("[email protected]") //<-- impersonate user a .build(); However, when executing this code, the following exception is thrown: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "access_denied" } at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:103) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:303) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:323) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:340) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:508) at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:260) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:796) at com.google.api.client.googleapis.json.GoogleJsonResponseException.execute(GoogleJsonResponseException.java:198) at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:237) at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:207) at com.google.api.services.drive.Drive$Files$List.execute(Drive.java:1071) Am I missing a step or configuration setting? Thanks, David
java
oauth-2.0
google-drive-sdk
google-api-java-client
null
null
open
OAuth Google API for Java unable to impersonate user === I would like to impersonate a user and add files to the users Google Drive on their behalf from a server process. I've setup a service account and can successfully access the Drive as the service account adding and listing files, etc. using the following code: /** Global instance of the HTTP transport. */ private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport(); /** Global instance of the JSON factory. */ private static final JsonFactory JSON_FACTORY = new JacksonFactory(); public static void main(String[] args) { try { GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId("[email protected]") .setServiceAccountScopes(DriveScopes.DRIVE) .setServiceAccountPrivateKeyFromP12File(new File("c:/junk/key.p12")) .build(); Drive drive = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).build(); drive.files().list().execute(); } catch (Exception e) { e.printStackTrace(); } This works, however only returns files that are associated to what I assume is associated with the service accounts drive (?). According to the JavaDoc, GoogleCredential can also be used to impersonate a user by adding the service account users email address as follows: GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId("[email protected]") .setServiceAccountScopes(DriveScopes.DRIVE) .setServiceAccountPrivateKeyFromP12File(new File("c:/junk/key.p12")) .setServiceAccountUser("[email protected]") //<-- impersonate user a .build(); However, when executing this code, the following exception is thrown: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "access_denied" } at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:103) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:303) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:323) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:340) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:508) at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:260) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:796) at com.google.api.client.googleapis.json.GoogleJsonResponseException.execute(GoogleJsonResponseException.java:198) at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:237) at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:207) at com.google.api.services.drive.Drive$Files$List.execute(Drive.java:1071) Am I missing a step or configuration setting? Thanks, David
0
11,660,672
07/26/2012 00:25:26
1,128,106
01/03/2012 15:08:16
270
18
How can i resize a rotated control with aspect ratio based on the current position X and Y?
Currently I have used the following code, it works fine, but does not respect the aspect ratio: private double angle; private Point transformOrigin; private ContentControl designerItem; public ResizeThumb() { DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted); DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDelta); } private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as ContentControl; if (this.designerItem != null) { this.transformOrigin = this.designerItem.RenderTransformOrigin; RotateTransform rotateTransform = this.designerItem.RenderTransform as RotateTransform; if (rotateTransform != null) this.angle = rotateTransform.Angle * Math.PI / 180.0; else this.angle = 0; } } private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) { if (this.designerItem != null) { double deltaVertical, deltaHorizontal; switch (VerticalAlignment) { case System.Windows.VerticalAlignment.Bottom: deltaVertical = Math.Min(-e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle)))); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) - deltaVertical * this.transformOrigin.Y * Math.Sin(-this.angle)); this.designerItem.Height -= deltaVertical; break; case System.Windows.VerticalAlignment.Top: deltaVertical = Math.Min(e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaVertical * Math.Cos(-this.angle) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle)))); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaVertical * Math.Sin(-this.angle) - (this.transformOrigin.Y * deltaVertical * Math.Sin(-this.angle))); this.designerItem.Height -= deltaVertical; break; default: break; } switch (HorizontalAlignment) { case System.Windows.HorizontalAlignment.Left: deltaHorizontal = Math.Min(e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaHorizontal * Math.Sin(this.angle) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle)); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaHorizontal * Math.Cos(this.angle) + (this.transformOrigin.X * deltaHorizontal * (1 - Math.Cos(this.angle)))); this.designerItem.Width -= deltaHorizontal; break; case System.Windows.HorizontalAlignment.Right: deltaHorizontal = Math.Min(-e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle)); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + (deltaHorizontal * this.transformOrigin.X * (1 - Math.Cos(this.angle)))); this.designerItem.Width -= deltaHorizontal; break; default: break; } } } } and its visual (xaml): <Grid> <s:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 -4 0 0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/> <s:ResizeThumb Width="3" Cursor="SizeWE" Margin="-4 0 0 0" VerticalAlignment="Stretch" HorizontalAlignment="Left"/> <s:ResizeThumb Width="3" Cursor="SizeWE" Margin="0 0 -4 0" VerticalAlignment="Stretch" HorizontalAlignment="Right"/> <s:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 0 0 -4" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-6 -6 0 0" VerticalAlignment="Top" HorizontalAlignment="Left"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -6 -6 0" VerticalAlignment="Top" HorizontalAlignment="Right"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-6 0 0 -6" VerticalAlignment="Bottom" HorizontalAlignment="Left"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -6 -6" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> <!-- ... --> </Grid> As I said it works very well, especially if the control is rotated, the x and y position of the component works exactly as expected, no matter how much it is rotated. Full Source Code: http://www.codeproject.com/Articles/22952/WPF-Diagram-Designer-Part-1 How can I resize keeping aspect ratio and having no problem with the X and Y position? Tried in many ways, it is easy to get the new size while maintaining the aspect ratio. But I can not make it work properly because the component can be rotated and X and Y position is a mess. I do not know how to adjust and correct the new X and Y keeping the ratio
c#
wpf
control
transform
visual
null
open
How can i resize a rotated control with aspect ratio based on the current position X and Y? === Currently I have used the following code, it works fine, but does not respect the aspect ratio: private double angle; private Point transformOrigin; private ContentControl designerItem; public ResizeThumb() { DragStarted += new DragStartedEventHandler(this.ResizeThumb_DragStarted); DragDelta += new DragDeltaEventHandler(this.ResizeThumb_DragDelta); } private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as ContentControl; if (this.designerItem != null) { this.transformOrigin = this.designerItem.RenderTransformOrigin; RotateTransform rotateTransform = this.designerItem.RenderTransform as RotateTransform; if (rotateTransform != null) this.angle = rotateTransform.Angle * Math.PI / 180.0; else this.angle = 0; } } private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) { if (this.designerItem != null) { double deltaVertical, deltaHorizontal; switch (VerticalAlignment) { case System.Windows.VerticalAlignment.Bottom: deltaVertical = Math.Min(-e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle)))); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) - deltaVertical * this.transformOrigin.Y * Math.Sin(-this.angle)); this.designerItem.Height -= deltaVertical; break; case System.Windows.VerticalAlignment.Top: deltaVertical = Math.Min(e.VerticalChange, this.designerItem.ActualHeight - this.designerItem.MinHeight); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaVertical * Math.Cos(-this.angle) + (this.transformOrigin.Y * deltaVertical * (1 - Math.Cos(-this.angle)))); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaVertical * Math.Sin(-this.angle) - (this.transformOrigin.Y * deltaVertical * Math.Sin(-this.angle))); this.designerItem.Height -= deltaVertical; break; default: break; } switch (HorizontalAlignment) { case System.Windows.HorizontalAlignment.Left: deltaHorizontal = Math.Min(e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + deltaHorizontal * Math.Sin(this.angle) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle)); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + deltaHorizontal * Math.Cos(this.angle) + (this.transformOrigin.X * deltaHorizontal * (1 - Math.Cos(this.angle)))); this.designerItem.Width -= deltaHorizontal; break; case System.Windows.HorizontalAlignment.Right: deltaHorizontal = Math.Min(-e.HorizontalChange, this.designerItem.ActualWidth - this.designerItem.MinWidth); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) - this.transformOrigin.X * deltaHorizontal * Math.Sin(this.angle)); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + (deltaHorizontal * this.transformOrigin.X * (1 - Math.Cos(this.angle)))); this.designerItem.Width -= deltaHorizontal; break; default: break; } } } } and its visual (xaml): <Grid> <s:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 -4 0 0" VerticalAlignment="Top" HorizontalAlignment="Stretch"/> <s:ResizeThumb Width="3" Cursor="SizeWE" Margin="-4 0 0 0" VerticalAlignment="Stretch" HorizontalAlignment="Left"/> <s:ResizeThumb Width="3" Cursor="SizeWE" Margin="0 0 -4 0" VerticalAlignment="Stretch" HorizontalAlignment="Right"/> <s:ResizeThumb Height="3" Cursor="SizeNS" Margin="0 0 0 -4" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="-6 -6 0 0" VerticalAlignment="Top" HorizontalAlignment="Left"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="0 -6 -6 0" VerticalAlignment="Top" HorizontalAlignment="Right"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNESW" Margin="-6 0 0 -6" VerticalAlignment="Bottom" HorizontalAlignment="Left"/> <s:ResizeThumb Width="7" Height="7" Cursor="SizeNWSE" Margin="0 0 -6 -6" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> <!-- ... --> </Grid> As I said it works very well, especially if the control is rotated, the x and y position of the component works exactly as expected, no matter how much it is rotated. Full Source Code: http://www.codeproject.com/Articles/22952/WPF-Diagram-Designer-Part-1 How can I resize keeping aspect ratio and having no problem with the X and Y position? Tried in many ways, it is easy to get the new size while maintaining the aspect ratio. But I can not make it work properly because the component can be rotated and X and Y position is a mess. I do not know how to adjust and correct the new X and Y keeping the ratio
0
11,660,675
07/26/2012 00:25:49
1,475,898
06/22/2012 20:39:25
1
0
ReferenceError: $ is not defined
I have this weird behaviour of a page. The page loads, but after a second or two it turn blank. In FireFox console, i get this error: **ReferenceError: $ is not defined @https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js:4**. In chrome I don't get any error, but the page still turns blank, and it happens only in this particular page. The page uses jquery and jquery ui and I am trying to put some content in tabs. The jquery script is included before any other javascript in the page. The page is the following : http://www.upnext.eu/tv-schedule.html Or you can view the source code here http://pastebin.com/R8f7xNHd. The page is 100% HTML 5 valid and this happens only on this page. Does anyone have any idea what could be wrong ? Thanks!
jquery
jquery-ui
undefined
blank
null
null
open
ReferenceError: $ is not defined === I have this weird behaviour of a page. The page loads, but after a second or two it turn blank. In FireFox console, i get this error: **ReferenceError: $ is not defined @https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js:4**. In chrome I don't get any error, but the page still turns blank, and it happens only in this particular page. The page uses jquery and jquery ui and I am trying to put some content in tabs. The jquery script is included before any other javascript in the page. The page is the following : http://www.upnext.eu/tv-schedule.html Or you can view the source code here http://pastebin.com/R8f7xNHd. The page is 100% HTML 5 valid and this happens only on this page. Does anyone have any idea what could be wrong ? Thanks!
0
11,660,677
07/26/2012 00:26:07
62,162
02/03/2009 22:20:18
413
22
Dynamically enabling and disabling a button inside a table is not working
I am using a RichFaces table (with a subtable) backed by a list bean. Each row in the table has a "header row" with an ID number, a description, and a Collapse/Expand button. If the row is expanded then the subtable appears, which is a list of (initially empty) checkbox items. If any of the checkboxes are selected, then that row can no longer be collapsed so the expand/collapse button needs to be disabled. The problem is that the expand/collapse button does not become disabled. I changed it from "disabled" to "rendered" to check that the backing value was updating correctly and that worked fine. I then used hard-coded row IDs and put a copy of the button outside of the table and it disabled correctly. So to me it appears that the problem is with the table not re-rendering properly for disabling elements (the re-render works fine for hiding elements though). My workaround is to add a duplicate Collapse/Expand button which is always disabled, and then use the rendered flag to show the appropriate button. That seems like a bit of a hack though. Here is the XHTML: <a4j:outputPanel layout="block" id="idGoodsAndServicesSearchResultsPanel"> <rich:dataTable id="results" rowClasses=",even" value="#{goodsAndServiceSearch.results}" rendered="#{not empty goodsAndServiceSearch.results}" var="gands" styleClass="icm-table"> <rich:column id="classIdColumn" width="5%"> <f:facet name="header"> <h:outputText value="#{cust:getPropertyValueString('gands.search.results.table.class')}" /> </f:facet> <h:outputLink id="#{gands.classId}ExampleLink" value="#{facesContext.externalContext.requestContextPath}/gands-class-description.xhtml" target="_blank"> <h:outputText value="#{gands.classId}" /> <f:param name="gandsDescription" value="#{gands.description}" /> </h:outputLink> </rich:column> <rich:column id="elementsColumn" width="75%"> <f:facet name="header"> <h:outputText value="#{cust:getPropertyValueString('gands.search.results.table.gands')}" /> </f:facet> <h:outputText styleClass="table-subheading" value="#{cust:truncate(gands.description, 150)}" /> </rich:column> <rich:column id="actionColumn" width="15%"> <f:facet name="header"> <h:outputText value="#{cust:getPropertyValueString('gands.search.results.table.action')}" /> </f:facet> <cust:button disabled="#{goodsAndServiceSearch.classSelected[gands.classId]}" id="expandClass#{gands.classId}" immediate="true" alt="${cust:getPropertyValueString(goodsAndServiceSearch.expanded[gands.classId] ? 'gands.search.results.table.action.hide' : 'gands.search.results.table.action.show')}" title="${cust:getPropertyValueString(goodsAndServiceSearch.expanded[gands.classId] ? 'gands.search.results.table.action.hide' : 'gands.search.results.table.action.show')}" value="${cust:getPropertyValueString(goodsAndServiceSearch.expanded[gands.classId] ? 'gands.search.results.table.action.hide' : 'gands.search.results.table.action.show')}" styleClass="icm-iconbutton icm-previewbutton" bean="#{goodsAndServiceSearch}" action="showOrHide" reRender="idGoodsAndServicesSearchResultsPanel"> <f:setPropertyActionListener target="#{goodsAndServiceSearch.expanded[gands.classId]}" value="#{not goodsAndServiceSearch.expanded[gands.classId]}" /> </cust:button> </rich:column> <rich:subTable id="#{gands.classId}ElementList" value="#{gands.classElements}" rendered="#{goodsAndServiceSearch.expanded[gands.classId]}" var="element"> <rich:column /> <rich:column> <cust:checkbox id="#{element.id}SelectBox" value="#{element.selected}" label=" #{element.elementName}" styleClass="inline" labelStyleClass="inline" bean="#{goodsAndServiceSearch}" listener="toggleClassItemSelected"> <a4j:support event="onclick" reRender="idGoodsAndServicesSearchResultsPanel" onsubmit="Richfaces.showModalPanel('idWaitScreen')" oncomplete="Richfaces.hideModalPanel('idWaitScreen')" ajaxSingle="true" /> </cust:checkbox> </rich:column> <rich:column /> </rich:subTable> </rich:dataTable> </a4j:outputPanel> Here is the backing bean (cut-down version): public class GoodsAndServicesSearchBean extends BaseJSFBean { private String searchTerm; private List<GoodsAndServicesClass> results; private Map<Long, Boolean> expanded; private Map<Long, Boolean> classSelected; public String search() throws SystemException { clear(); BusinessController businessController = ServiceLocator.getInstance().lookup(BusinessController.class); results = businessController.searchGoodsAndServices(searchTerm); expanded = new HashMap<Long, Boolean>(); classSelected = new HashMap<Long, Boolean>(); for (GoodsAndServicesClass gands : results) { elementCount += gands.getClassElements().size(); expanded.put(gands.getClassId(), Boolean.TRUE); classSelected.put(gands.getClassId(), Boolean.FALSE); } return ""; } public String clear() { results = null; expanded = null; return ""; } public String showOrHide() { return ""; } public String showAll() { for (Entry<Long, Boolean> entry : expanded.entrySet()) { entry.setValue(Boolean.TRUE); } return ""; } public String hideAll() { for (GoodsAndServicesClass gands : results) { expanded.put(gands.getClassId(), classHasSelectedItem(gands)); } return ""; } public List<GoodsAndServicesClass> getSelectedClasses() { List<GoodsAndServicesClass> selected = new ArrayList<GoodsAndServicesClass>(); if (results != null) { for (GoodsAndServicesClass gands : results) { if (gands.isSelected()) { selected.add(gands); } } } return selected; } public String clearSelectedItems() { if (results != null) { for (GoodsAndServicesClass gands : results) { gands.setSelected(false); for (GoodsAndServicesItem element : gands.getClassElements()) { element.setSelected(false); } } } return ""; } public void toggleClassItemSelected(final ValueChangeEvent event) { for (GoodsAndServicesClass gands : results) { classSelected.put(gands.getClassId(), classHasSelectedItem(gands)); } } private boolean classHasSelectedItem(GoodsAndServicesClass gands) { boolean foundSelectedItem = false; for (GoodsAndServicesItem item : gands.getClassElements()) { if (item.isSelected()) { foundSelectedItem = true; break; } } return foundSelectedItem; } }
jsf
table
richfaces
null
null
null
open
Dynamically enabling and disabling a button inside a table is not working === I am using a RichFaces table (with a subtable) backed by a list bean. Each row in the table has a "header row" with an ID number, a description, and a Collapse/Expand button. If the row is expanded then the subtable appears, which is a list of (initially empty) checkbox items. If any of the checkboxes are selected, then that row can no longer be collapsed so the expand/collapse button needs to be disabled. The problem is that the expand/collapse button does not become disabled. I changed it from "disabled" to "rendered" to check that the backing value was updating correctly and that worked fine. I then used hard-coded row IDs and put a copy of the button outside of the table and it disabled correctly. So to me it appears that the problem is with the table not re-rendering properly for disabling elements (the re-render works fine for hiding elements though). My workaround is to add a duplicate Collapse/Expand button which is always disabled, and then use the rendered flag to show the appropriate button. That seems like a bit of a hack though. Here is the XHTML: <a4j:outputPanel layout="block" id="idGoodsAndServicesSearchResultsPanel"> <rich:dataTable id="results" rowClasses=",even" value="#{goodsAndServiceSearch.results}" rendered="#{not empty goodsAndServiceSearch.results}" var="gands" styleClass="icm-table"> <rich:column id="classIdColumn" width="5%"> <f:facet name="header"> <h:outputText value="#{cust:getPropertyValueString('gands.search.results.table.class')}" /> </f:facet> <h:outputLink id="#{gands.classId}ExampleLink" value="#{facesContext.externalContext.requestContextPath}/gands-class-description.xhtml" target="_blank"> <h:outputText value="#{gands.classId}" /> <f:param name="gandsDescription" value="#{gands.description}" /> </h:outputLink> </rich:column> <rich:column id="elementsColumn" width="75%"> <f:facet name="header"> <h:outputText value="#{cust:getPropertyValueString('gands.search.results.table.gands')}" /> </f:facet> <h:outputText styleClass="table-subheading" value="#{cust:truncate(gands.description, 150)}" /> </rich:column> <rich:column id="actionColumn" width="15%"> <f:facet name="header"> <h:outputText value="#{cust:getPropertyValueString('gands.search.results.table.action')}" /> </f:facet> <cust:button disabled="#{goodsAndServiceSearch.classSelected[gands.classId]}" id="expandClass#{gands.classId}" immediate="true" alt="${cust:getPropertyValueString(goodsAndServiceSearch.expanded[gands.classId] ? 'gands.search.results.table.action.hide' : 'gands.search.results.table.action.show')}" title="${cust:getPropertyValueString(goodsAndServiceSearch.expanded[gands.classId] ? 'gands.search.results.table.action.hide' : 'gands.search.results.table.action.show')}" value="${cust:getPropertyValueString(goodsAndServiceSearch.expanded[gands.classId] ? 'gands.search.results.table.action.hide' : 'gands.search.results.table.action.show')}" styleClass="icm-iconbutton icm-previewbutton" bean="#{goodsAndServiceSearch}" action="showOrHide" reRender="idGoodsAndServicesSearchResultsPanel"> <f:setPropertyActionListener target="#{goodsAndServiceSearch.expanded[gands.classId]}" value="#{not goodsAndServiceSearch.expanded[gands.classId]}" /> </cust:button> </rich:column> <rich:subTable id="#{gands.classId}ElementList" value="#{gands.classElements}" rendered="#{goodsAndServiceSearch.expanded[gands.classId]}" var="element"> <rich:column /> <rich:column> <cust:checkbox id="#{element.id}SelectBox" value="#{element.selected}" label=" #{element.elementName}" styleClass="inline" labelStyleClass="inline" bean="#{goodsAndServiceSearch}" listener="toggleClassItemSelected"> <a4j:support event="onclick" reRender="idGoodsAndServicesSearchResultsPanel" onsubmit="Richfaces.showModalPanel('idWaitScreen')" oncomplete="Richfaces.hideModalPanel('idWaitScreen')" ajaxSingle="true" /> </cust:checkbox> </rich:column> <rich:column /> </rich:subTable> </rich:dataTable> </a4j:outputPanel> Here is the backing bean (cut-down version): public class GoodsAndServicesSearchBean extends BaseJSFBean { private String searchTerm; private List<GoodsAndServicesClass> results; private Map<Long, Boolean> expanded; private Map<Long, Boolean> classSelected; public String search() throws SystemException { clear(); BusinessController businessController = ServiceLocator.getInstance().lookup(BusinessController.class); results = businessController.searchGoodsAndServices(searchTerm); expanded = new HashMap<Long, Boolean>(); classSelected = new HashMap<Long, Boolean>(); for (GoodsAndServicesClass gands : results) { elementCount += gands.getClassElements().size(); expanded.put(gands.getClassId(), Boolean.TRUE); classSelected.put(gands.getClassId(), Boolean.FALSE); } return ""; } public String clear() { results = null; expanded = null; return ""; } public String showOrHide() { return ""; } public String showAll() { for (Entry<Long, Boolean> entry : expanded.entrySet()) { entry.setValue(Boolean.TRUE); } return ""; } public String hideAll() { for (GoodsAndServicesClass gands : results) { expanded.put(gands.getClassId(), classHasSelectedItem(gands)); } return ""; } public List<GoodsAndServicesClass> getSelectedClasses() { List<GoodsAndServicesClass> selected = new ArrayList<GoodsAndServicesClass>(); if (results != null) { for (GoodsAndServicesClass gands : results) { if (gands.isSelected()) { selected.add(gands); } } } return selected; } public String clearSelectedItems() { if (results != null) { for (GoodsAndServicesClass gands : results) { gands.setSelected(false); for (GoodsAndServicesItem element : gands.getClassElements()) { element.setSelected(false); } } } return ""; } public void toggleClassItemSelected(final ValueChangeEvent event) { for (GoodsAndServicesClass gands : results) { classSelected.put(gands.getClassId(), classHasSelectedItem(gands)); } } private boolean classHasSelectedItem(GoodsAndServicesClass gands) { boolean foundSelectedItem = false; for (GoodsAndServicesItem item : gands.getClassElements()) { if (item.isSelected()) { foundSelectedItem = true; break; } } return foundSelectedItem; } }
0
11,660,681
07/26/2012 00:26:50
477,228
10/15/2010 17:23:17
1,057
19
DateTime.TryParseExact method for string comparison
Hey how can you do a string comparison match for a given date, `DateTime.TryParseExact` seems like the sensible option but I am not sure how to construct the arguement in the below method: public List<Dates> DateEqualToThisDate(string dateentered) { List<Dates> date = dates.Where(n => string.Equals(n.DateAdded, dateentered, StringComparison.CurrentCultureIgnoreCase) ).ToList(); return hiredate; }
c#
linq
null
null
null
null
open
DateTime.TryParseExact method for string comparison === Hey how can you do a string comparison match for a given date, `DateTime.TryParseExact` seems like the sensible option but I am not sure how to construct the arguement in the below method: public List<Dates> DateEqualToThisDate(string dateentered) { List<Dates> date = dates.Where(n => string.Equals(n.DateAdded, dateentered, StringComparison.CurrentCultureIgnoreCase) ).ToList(); return hiredate; }
0
11,660,638
07/26/2012 00:22:26
1,271,867
03/15/2012 15:07:25
1
5
Mystery URL decoding of certain characters - Android URI / Google App Engine
I am having a curious problem that perhaps someone has insight into. I encode a query string into a URL on Android using the following code: request = REQUEST_BASE + "?action=loadauthor&author=" + URLEncoder.encode(author, "UTF-8"); I then add a few other parameters to the string and create a URI like this: uri = new URI(request); At a certain point, I pull out the query string to make a checksum: uri.getRawQuery().getBytes(); On the Appengine server, I then retrieve the string and try to match the checksum: String query = req.getQueryString(); Then I send it on its way with: HttpGet get = new HttpGet(uri); Normally, this works fine. However, there are a few characters that seem to get unencoded on the way to the server. For example, action=loadauthor&author=Charles+Alexander+%28Ohiyesa%29+Eastman&timestamp=1343261225838&user=1479845600 shows up in the server logs (and in the GAE app) as: action=loadauthor&author=Charles+Alexander+(Ohiyesa)+Eastman&timestamp=1343261226837&user=1479845600 This only happens to a few characters (like parentheses). Other characters remain encoded all the way through. Does anyone have a thought about what I might be doing wrong? Any feedback is appreciated.
android
google-app-engine
url
url-encoding
url-decode
null
open
Mystery URL decoding of certain characters - Android URI / Google App Engine === I am having a curious problem that perhaps someone has insight into. I encode a query string into a URL on Android using the following code: request = REQUEST_BASE + "?action=loadauthor&author=" + URLEncoder.encode(author, "UTF-8"); I then add a few other parameters to the string and create a URI like this: uri = new URI(request); At a certain point, I pull out the query string to make a checksum: uri.getRawQuery().getBytes(); On the Appengine server, I then retrieve the string and try to match the checksum: String query = req.getQueryString(); Then I send it on its way with: HttpGet get = new HttpGet(uri); Normally, this works fine. However, there are a few characters that seem to get unencoded on the way to the server. For example, action=loadauthor&author=Charles+Alexander+%28Ohiyesa%29+Eastman&timestamp=1343261225838&user=1479845600 shows up in the server logs (and in the GAE app) as: action=loadauthor&author=Charles+Alexander+(Ohiyesa)+Eastman&timestamp=1343261226837&user=1479845600 This only happens to a few characters (like parentheses). Other characters remain encoded all the way through. Does anyone have a thought about what I might be doing wrong? Any feedback is appreciated.
0
11,571,918
07/20/2012 02:11:41
1,539,473
07/20/2012 01:14:20
1
0
Windows Script Host vs VS2010 setup project for Shortcuts
I use VS2010 C# on Win7 x64, I use the VS Installer to create the base setup projects which include programs menu shortcuts to add / drop the specific user desktop shortcuts. (Each user can only perform certain tasks). The arguments component of the shortcut defines which task is performed by the app. I use IWshRuntimeLibrary.WshShellClass to create the desktop shortcut .lnk files each with their own specific .Arguments sets (using code samples from stackoverflow and elsewhere). All works exactly as expected. I create a separate ...Icons.dll containing a native resources .res file for the shortcut icons (so the assembly info of the base exe remains intact). My problem is if I create a shortcut under the VS installer the Target property in disabled and the app Arguments and Path are hidden. If I create the same shortcut using the IWshRuntimeLibrary.WshShellClass in code the Target property of the shortcut is enabled and the Arguments and Path are visible. ["C:\Program Files\...\SteriTrack.exe" -View -GI –Test] Is there any way to achieve the same effect (Target property in disabled and the app Arguments and Path are hidden) using IWshRuntimeLibrary.WshShellClass (or other) in code. (Under the VS installer the Target property of all shortcuts are disabled and set to the installer project name - neat and secure). Any help would be most appreciated. Thanks.
visual-studio-2010
shortcut
null
null
null
null
open
Windows Script Host vs VS2010 setup project for Shortcuts === I use VS2010 C# on Win7 x64, I use the VS Installer to create the base setup projects which include programs menu shortcuts to add / drop the specific user desktop shortcuts. (Each user can only perform certain tasks). The arguments component of the shortcut defines which task is performed by the app. I use IWshRuntimeLibrary.WshShellClass to create the desktop shortcut .lnk files each with their own specific .Arguments sets (using code samples from stackoverflow and elsewhere). All works exactly as expected. I create a separate ...Icons.dll containing a native resources .res file for the shortcut icons (so the assembly info of the base exe remains intact). My problem is if I create a shortcut under the VS installer the Target property in disabled and the app Arguments and Path are hidden. If I create the same shortcut using the IWshRuntimeLibrary.WshShellClass in code the Target property of the shortcut is enabled and the Arguments and Path are visible. ["C:\Program Files\...\SteriTrack.exe" -View -GI –Test] Is there any way to achieve the same effect (Target property in disabled and the app Arguments and Path are hidden) using IWshRuntimeLibrary.WshShellClass (or other) in code. (Under the VS installer the Target property of all shortcuts are disabled and set to the installer project name - neat and secure). Any help would be most appreciated. Thanks.
0
11,571,922
07/20/2012 02:12:34
1,402,997
05/18/2012 09:26:39
10
0
Type 'iTextSharp.text.Table' is not defined
I want to know why Type 'iTextSharp.text.Table' is not defined. I already imported iTextSharp.text , iTextSharp.text.pdf, iTextSharp.text.html, iTextSharp.text.html.simpleparser. Dim gvTable As New **iTextSharp.text.Table**(columns, tableRows)
vb.net
null
null
null
null
null
open
Type 'iTextSharp.text.Table' is not defined === I want to know why Type 'iTextSharp.text.Table' is not defined. I already imported iTextSharp.text , iTextSharp.text.pdf, iTextSharp.text.html, iTextSharp.text.html.simpleparser. Dim gvTable As New **iTextSharp.text.Table**(columns, tableRows)
0
11,571,923
07/20/2012 02:12:35
621,428
02/17/2011 13:05:39
28
1
instanceof String not behaving as expected in Google Apps Script
I wanted to check whether a variable in an Apps Script was a String, but found that instanceof wasn't returning true when the variable was in fact a string. The following test: function test_instanceof() { var a = "a"; Logger.log('"a" is ' + ((a instanceof String) ? '' : 'not ') + 'a String'); var b = String("b"); Logger.log('String("b") is ' + ((b instanceof String) ? '' : 'not ') + 'a String'); } Logs these two messages: "a" is not a String String("b") is not a String The docs aren't clear on the subset of ECMAScript that is supported, though apparently instanceof is a valid operator and String is a valid type, judging from the fact that the code executed without an exception. What is the appropriate way to check the type of a variable?
google-apps-script
null
null
null
null
null
open
instanceof String not behaving as expected in Google Apps Script === I wanted to check whether a variable in an Apps Script was a String, but found that instanceof wasn't returning true when the variable was in fact a string. The following test: function test_instanceof() { var a = "a"; Logger.log('"a" is ' + ((a instanceof String) ? '' : 'not ') + 'a String'); var b = String("b"); Logger.log('String("b") is ' + ((b instanceof String) ? '' : 'not ') + 'a String'); } Logs these two messages: "a" is not a String String("b") is not a String The docs aren't clear on the subset of ECMAScript that is supported, though apparently instanceof is a valid operator and String is a valid type, judging from the fact that the code executed without an exception. What is the appropriate way to check the type of a variable?
0
11,571,926
07/20/2012 02:12:49
1,011,320
10/24/2011 16:56:21
13
1
Batch File: Fails to Echo Variable Inside Loop
I've hit rock bottom, I can't seem to get this work! setlocal EnableDelayedExpansion for %%g in (1,2,3) do ( set /a c=%%g+32 echo %c% ) pause But it says ECHO is on, I know this means that it has nothing to display, but how couldn't it have something to display? I tried changing many things (adding/removing setlocal for example) but it won't work. Any help is GREATLY appreciated!
for-loop
batch-file
null
null
null
null
open
Batch File: Fails to Echo Variable Inside Loop === I've hit rock bottom, I can't seem to get this work! setlocal EnableDelayedExpansion for %%g in (1,2,3) do ( set /a c=%%g+32 echo %c% ) pause But it says ECHO is on, I know this means that it has nothing to display, but how couldn't it have something to display? I tried changing many things (adding/removing setlocal for example) but it won't work. Any help is GREATLY appreciated!
0
11,571,928
07/20/2012 02:12:57
1,492,531
06/30/2012 04:03:44
13
8
How to Center TextViews in XML
How do you center TextViews in xml? Example: <TextView android:id="@+id/text_3" android:text="@string/text_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="25sp" android:textColor="#ffffff" />
android
xml
textview
center
null
null
open
How to Center TextViews in XML === How do you center TextViews in xml? Example: <TextView android:id="@+id/text_3" android:text="@string/text_3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="25sp" android:textColor="#ffffff" />
0
11,571,932
07/20/2012 02:13:11
603,007
02/04/2011 10:51:19
773
7
single sign on possible for already logged in user on intranet?
I have an asp.net intranet application where a user is logged into. I would like to authenticate this same user on another asp.net application which is public and in a diffrenent domain. Is it possible to somehow use his token securely that was created in for the intranet application ? So the user does not have to login again? what to use here, asp.net forms authentication? thanks
asp.net
web-security
single-sign-on
null
null
null
open
single sign on possible for already logged in user on intranet? === I have an asp.net intranet application where a user is logged into. I would like to authenticate this same user on another asp.net application which is public and in a diffrenent domain. Is it possible to somehow use his token securely that was created in for the intranet application ? So the user does not have to login again? what to use here, asp.net forms authentication? thanks
0
11,571,933
07/20/2012 02:13:12
1,394,953
05/15/2012 00:54:37
61
0
How can quickly add two bytes into a bytes array?
What is the best method to add two bytes into a existing bytes array? Should I use array.copy? Thnak you.
c#
.net
null
null
null
null
open
How can quickly add two bytes into a bytes array? === What is the best method to add two bytes into a existing bytes array? Should I use array.copy? Thnak you.
0
11,571,934
07/20/2012 02:13:23
1,462,722
06/18/2012 04:34:10
3
0
parse XML using Sax parse for android
how to parse xml using sax parser? i struggle to parse the author section part into array. i follow example from here http://ganeshtiwaridotcomdotnp.blogspot.com/2011/08/xml-parsing-using-saxparser-with.html <catalog> <book id="001" lang="ENG"> <isbn>23-34-42-3</isbn> <regDate>1990-05-24</regDate> <title>Operating Systems</title> <publisher country="USA">Pearson</publisher> <price>400</price> <authors> <author> <name>Ganesh Tiwari</name> <age>1</age> </author> </authors> </book> <book id="002"> <isbn>24-300-042-3</isbn> <regDate>1995-05-12</regDate> <title>Distributed Systems</title> <publisher country="Nepal">Ekata</publisher> <price>500</price> <authors> <author> <name>Mahesh Poudel</name> <age>2</age> </author> <author> <name>Bikram Adhikari</name> <age>3</age> </author> <author> <name>Ramesh Poudel</name> <age>4</age> </author> </authors> </book> </catalog>
android
null
null
null
null
null
open
parse XML using Sax parse for android === how to parse xml using sax parser? i struggle to parse the author section part into array. i follow example from here http://ganeshtiwaridotcomdotnp.blogspot.com/2011/08/xml-parsing-using-saxparser-with.html <catalog> <book id="001" lang="ENG"> <isbn>23-34-42-3</isbn> <regDate>1990-05-24</regDate> <title>Operating Systems</title> <publisher country="USA">Pearson</publisher> <price>400</price> <authors> <author> <name>Ganesh Tiwari</name> <age>1</age> </author> </authors> </book> <book id="002"> <isbn>24-300-042-3</isbn> <regDate>1995-05-12</regDate> <title>Distributed Systems</title> <publisher country="Nepal">Ekata</publisher> <price>500</price> <authors> <author> <name>Mahesh Poudel</name> <age>2</age> </author> <author> <name>Bikram Adhikari</name> <age>3</age> </author> <author> <name>Ramesh Poudel</name> <age>4</age> </author> </authors> </book> </catalog>
0
11,571,910
07/20/2012 02:10:39
1,203,304
02/11/2012 03:02:07
13
0
Clarification on Properties, "Synthesize", and "Dynamic" in Objective-C 2.0
If I define a property in Objective-C 2.0 as follows: @property (readwrite, assign) NSObject *theObject; I have to create getter & setter methods somehow. As far as I can tell, I have three options for this. - Manually code the implementations of `- (NSObject *)theObject` & `- (void)setTheObject:(NSObject *)object` - Use `@synthesize` to automatically generate _both_ methods, or - Use `@dynamic` to automatically generate any of the two methods that I don't choose to override. Am I understanding this correctly? Also, how does the use of different `@property` arguments affect the results of `@synthesize` & `@dynamic`? (For example, `nonatomic` & `weak`)
ios5
dynamic
properties
synthesize
null
null
open
Clarification on Properties, "Synthesize", and "Dynamic" in Objective-C 2.0 === If I define a property in Objective-C 2.0 as follows: @property (readwrite, assign) NSObject *theObject; I have to create getter & setter methods somehow. As far as I can tell, I have three options for this. - Manually code the implementations of `- (NSObject *)theObject` & `- (void)setTheObject:(NSObject *)object` - Use `@synthesize` to automatically generate _both_ methods, or - Use `@dynamic` to automatically generate any of the two methods that I don't choose to override. Am I understanding this correctly? Also, how does the use of different `@property` arguments affect the results of `@synthesize` & `@dynamic`? (For example, `nonatomic` & `weak`)
0
11,571,936
07/20/2012 02:13:41
369,854
06/17/2010 23:06:09
137
3
Screen casting with quicktime on lion
In Quicktime Player X, when you want to start a screen recording, you can either record the whole screen or drag to select a region. In the latter case, if you want a specific size (e.g., 1280x720), the best you can do is guess as you are dragging the mouse. Can I use AppleScript or something to tell Quicktime Player to select a specific region size? I'll be happy to drag it into its final location manually, but if I could at least automate the part of initially specifying the region size, I'd be happy. Is this possible? Where do I start looking for documentation? I'm also looking for any OPEN SOURCE solution. For pay is not welcome. Thanks.
apple
applescript
quicktime
screencasting
null
null
open
Screen casting with quicktime on lion === In Quicktime Player X, when you want to start a screen recording, you can either record the whole screen or drag to select a region. In the latter case, if you want a specific size (e.g., 1280x720), the best you can do is guess as you are dragging the mouse. Can I use AppleScript or something to tell Quicktime Player to select a specific region size? I'll be happy to drag it into its final location manually, but if I could at least automate the part of initially specifying the region size, I'd be happy. Is this possible? Where do I start looking for documentation? I'm also looking for any OPEN SOURCE solution. For pay is not welcome. Thanks.
0
11,571,937
07/20/2012 02:13:46
1,355,207
04/25/2012 03:53:08
34
1
Prevent float.Parse(string) result to epsilon number
i get the value from `textbox.Text` i have the variable `float _value;` that store the value from textbox _value = float.Parse(textBox.text); when i want to show up the _value, it will be in epsilon number. eg. textbox.Text = 100000000; `_value` will store with `1.0E+12` i do want to _value store the real number 10000000. thanks.
c#
winforms
float
null
null
null
open
Prevent float.Parse(string) result to epsilon number === i get the value from `textbox.Text` i have the variable `float _value;` that store the value from textbox _value = float.Parse(textBox.text); when i want to show up the _value, it will be in epsilon number. eg. textbox.Text = 100000000; `_value` will store with `1.0E+12` i do want to _value store the real number 10000000. thanks.
0
11,571,889
07/20/2012 02:07:38
1,534,289
07/18/2012 09:24:19
1
0
strange data remains
Does anyone heard or experienced about following phenomenon ? Using postgresql 9.0.5 on Windows = table structure = [parent] - [child] - [grandchild] I found out a record remained strangely on the [child] table. This record exists violating the restriction of foreign key. - these tables store transaction data of my application - all the above tables have numeric PRIMARY KEY - all these tables have FOREIGN KEY restriction (between parent and child, grandchild) - my application updates each record status along with the transaction progress - my app copies this record to archive tables (same structure, same restrictions) once the all status changed to "normal_end". - then, delete these records when it finished copy them to the archive tables. - the status of remained record on the [child] table was NOT "normal_end" but "processing". but the status of copied data (same ID) in archive table was "normal_end". - no error reported at pg_log I felt it very strange... I suspect that the deleted data might came back to active !? Can deleted data be active unexpected?
postgresql
null
null
null
null
null
open
strange data remains === Does anyone heard or experienced about following phenomenon ? Using postgresql 9.0.5 on Windows = table structure = [parent] - [child] - [grandchild] I found out a record remained strangely on the [child] table. This record exists violating the restriction of foreign key. - these tables store transaction data of my application - all the above tables have numeric PRIMARY KEY - all these tables have FOREIGN KEY restriction (between parent and child, grandchild) - my application updates each record status along with the transaction progress - my app copies this record to archive tables (same structure, same restrictions) once the all status changed to "normal_end". - then, delete these records when it finished copy them to the archive tables. - the status of remained record on the [child] table was NOT "normal_end" but "processing". but the status of copied data (same ID) in archive table was "normal_end". - no error reported at pg_log I felt it very strange... I suspect that the deleted data might came back to active !? Can deleted data be active unexpected?
0
11,693,297
07/27/2012 18:07:47
709,038
04/15/2011 01:55:23
112
5
What are the different NameID format used for?
In SAML metadata file there are several NameID format defined, for example: <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat> <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat> <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat> Can anybody explain what are these used for? What are the differences?
sso
saml
opensaml
null
null
null
open
What are the different NameID format used for? === In SAML metadata file there are several NameID format defined, for example: <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat> <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat> <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat> Can anybody explain what are these used for? What are the differences?
0
11,693,298
07/27/2012 18:07:48
1,555,256
07/26/2012 15:41:21
1
0
Won't write to plist array Xcode. This was the code used and it doesn't work, does anyone know why?
NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"HighScore.plist"]; NSMutableArray* plistDict = [[NSMutableArray alloc] initWithContentsOfFile:finalPath]; [plistDict addObject:[highScoreLabel text]]; NSArray *regArray = [NSMutableArray arrayWithArray:plistDict]; [regArray writeToFile:@"HighScore.plist" atomically: YES];
iphone
xcode
data
plist
storage
null
open
Won't write to plist array Xcode. This was the code used and it doesn't work, does anyone know why? === NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"HighScore.plist"]; NSMutableArray* plistDict = [[NSMutableArray alloc] initWithContentsOfFile:finalPath]; [plistDict addObject:[highScoreLabel text]]; NSArray *regArray = [NSMutableArray arrayWithArray:plistDict]; [regArray writeToFile:@"HighScore.plist" atomically: YES];
0
11,693,301
07/27/2012 18:07:56
379,235
06/29/2010 16:45:28
2,104
44
python regex: How can I have pattern searching for multiple pattern strings?
I have to search the following patterns in a file, (any match qualifies) pattern_strings = ['\xc2d', '\xa0', '\xe7', '\xc3\ufffdd', '\xc2\xa0', '\xc3\xa7', '\xa0\xa0', '\xc2', '\xe9'] pattern = [re.compile(x) for x in pattern_strings] and function using this def find_pattern(path): with open(path, 'r') as f: for line in f: found = pattern.search(line) if found: logging.info('found - ' + found) When I try using it find_pattern('myfile') I see `AttributeError: "'list' object has no attribute 'search'"` because patterns is `[<_sre.SRE_Pattern object at 0x107948378>, <_sre.SRE_Pattern object at 0x107b31c70>, <_sre.SRE_Pattern object at 0x107b31ce0>, <_sre.SRE_Pattern object at 0x107ac3cb0>, <_sre.SRE_Pattern object at 0x107b747b0>, <_sre.SRE_Pattern object at 0x107b74828>, <_sre.SRE_Pattern object at 0x107b748a0>, <_sre.SRE_Pattern object at 0x107b31d50>, <_sre.SRE_Pattern object at 0x107b31dc0>]` How can I have one pattern which looks for all strings in `pattern_strings`?
python
regex
null
null
null
null
open
python regex: How can I have pattern searching for multiple pattern strings? === I have to search the following patterns in a file, (any match qualifies) pattern_strings = ['\xc2d', '\xa0', '\xe7', '\xc3\ufffdd', '\xc2\xa0', '\xc3\xa7', '\xa0\xa0', '\xc2', '\xe9'] pattern = [re.compile(x) for x in pattern_strings] and function using this def find_pattern(path): with open(path, 'r') as f: for line in f: found = pattern.search(line) if found: logging.info('found - ' + found) When I try using it find_pattern('myfile') I see `AttributeError: "'list' object has no attribute 'search'"` because patterns is `[<_sre.SRE_Pattern object at 0x107948378>, <_sre.SRE_Pattern object at 0x107b31c70>, <_sre.SRE_Pattern object at 0x107b31ce0>, <_sre.SRE_Pattern object at 0x107ac3cb0>, <_sre.SRE_Pattern object at 0x107b747b0>, <_sre.SRE_Pattern object at 0x107b74828>, <_sre.SRE_Pattern object at 0x107b748a0>, <_sre.SRE_Pattern object at 0x107b31d50>, <_sre.SRE_Pattern object at 0x107b31dc0>]` How can I have one pattern which looks for all strings in `pattern_strings`?
0
11,693,315
07/27/2012 18:08:48
456,832
09/24/2010 02:03:57
678
48
Will Windows 8 Metro support managed c++/clr
I can't seem to find an answer to this question anywhere, but will metro support managed c++ ?? Right now in Visual Studios 2012 RC it does not. I have some frameworks written in c++/clr and wanted to port them to Metro. I know c++/cx is similar, but my c++/clr objects derive from ones written in C# and it would suck to have to rewrite that part of my system. If there are plans to support it when Windows 8 actually comes out, I can wait.
windows-8
microsoft-metro
visual-studio-2012
managed-c++
c++-cx
null
open
Will Windows 8 Metro support managed c++/clr === I can't seem to find an answer to this question anywhere, but will metro support managed c++ ?? Right now in Visual Studios 2012 RC it does not. I have some frameworks written in c++/clr and wanted to port them to Metro. I know c++/cx is similar, but my c++/clr objects derive from ones written in C# and it would suck to have to rewrite that part of my system. If there are plans to support it when Windows 8 actually comes out, I can wait.
0
11,693,318
07/27/2012 18:09:09
828,293
12/22/2010 17:28:44
1
0
How do I cut and replace xml data with simple XSLT?
I'm having trouble with writing a simple XSLT transform. Here is the XML data: <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <lst name="params"> </lst> </lst> <result name="response" numFound="2" start="0"> <doc> <str name="Race">Elf</str> <int name="TraderKey">128</int> <str name="TraderName">TraderLato</str> <int name="CharacterName">Maleysh</int> </doc> <doc> <str name="Race">Human</str> <int name="TraderKey">62</int> <str name="TraderName">TraderSam</str> <int name="Comments">Farl</int> </doc> </result> </response> I can't modify the format of the XML coming in, and there will be lots and lots of <doc> nodes. I need to be able to write an XSLT 1.0 transform that will copy all the original XML but replace TraderName for certain TraderKey values. On any <doc> node that contains a TraderKey of 128, change the TraderName to "Trader Lato Carum". Any <doc> that contains a TraderKey of 62, change the TraderName to "Trader Samson Vero". I've never written an XSLT before, and have limited experience with XML, so this is my attempt to write an XSLT transform: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="response/result/doc/int[@name='TraderKey'][. = '128']> <xsl:value-of select="../TraderName"/> <xsl:text>Trader Lato Carum</xsl:text> </xsl:template> <xsl:template match="response/result/doc/int[@name='TraderKey'][. = '62']> <xsl:value-of select="../TraderName"/> <xsl:text>Trader Samson Vero</xsl:text> </xsl:template> </xsl:stylesheet> It doesn't work at all and I've been hammering my head against a wall for the past hour. I don't think this should be a difficult problem, what am I doing wrong? Thanks zoombini
html
xml
xslt
null
null
null
open
How do I cut and replace xml data with simple XSLT? === I'm having trouble with writing a simple XSLT transform. Here is the XML data: <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <lst name="params"> </lst> </lst> <result name="response" numFound="2" start="0"> <doc> <str name="Race">Elf</str> <int name="TraderKey">128</int> <str name="TraderName">TraderLato</str> <int name="CharacterName">Maleysh</int> </doc> <doc> <str name="Race">Human</str> <int name="TraderKey">62</int> <str name="TraderName">TraderSam</str> <int name="Comments">Farl</int> </doc> </result> </response> I can't modify the format of the XML coming in, and there will be lots and lots of <doc> nodes. I need to be able to write an XSLT 1.0 transform that will copy all the original XML but replace TraderName for certain TraderKey values. On any <doc> node that contains a TraderKey of 128, change the TraderName to "Trader Lato Carum". Any <doc> that contains a TraderKey of 62, change the TraderName to "Trader Samson Vero". I've never written an XSLT before, and have limited experience with XML, so this is my attempt to write an XSLT transform: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="response/result/doc/int[@name='TraderKey'][. = '128']> <xsl:value-of select="../TraderName"/> <xsl:text>Trader Lato Carum</xsl:text> </xsl:template> <xsl:template match="response/result/doc/int[@name='TraderKey'][. = '62']> <xsl:value-of select="../TraderName"/> <xsl:text>Trader Samson Vero</xsl:text> </xsl:template> </xsl:stylesheet> It doesn't work at all and I've been hammering my head against a wall for the past hour. I don't think this should be a difficult problem, what am I doing wrong? Thanks zoombini
0
11,693,319
07/27/2012 18:09:13
434,218
08/29/2010 13:00:14
1,555
10
Click logic -- swap icons w/jQuery
I have two buttons that show/hide areas below. By default both buttons have the following icons: "ui-icon-triangle-1-e When a button is clicked I want to changed the icon of the clicked button to: "ui-icon-triangle-1-s, and show appropriate section below while hiding the other if it was open. I can't seem to be able to get the logic right, when I expand one section and then click another button. The areas swap properly, but the button icons do not update... Here's [DEMO][1]. Need more eyes to look and tell me what am I missing. $(".features").bind("click", function () { var that = this, pid = $(this).attr("id"), pidC = pid + "C", index = $(this).closest("td").index(); $(".features").find("span").removeClass("ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-e"); $(that).find("span").removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s"); // indicator OFF for all $(".ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-e"); $("#prT").find("td").removeClass("txtCCC"); $.each($("#prT").find("tr").children(), function () { if ($(that).index() != index) { $(that).addClass("txtCCC"); } }); if ($(".fList").hasClass("current")) { $(".fList:visible").slideUp().removeClass("current"); if ($(".fList:visible").attr("id") != pidC) { $("#" + pidC).slideDown(function(){ }).addClass("current"); } } else { $("#" + pidC).slideDown(function(){ $(".ui-icon-triangle-1-e", that).removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s"); }).addClass("current"); } }); [1]: http://usabilitest.com
jquery
null
null
null
null
null
open
Click logic -- swap icons w/jQuery === I have two buttons that show/hide areas below. By default both buttons have the following icons: "ui-icon-triangle-1-e When a button is clicked I want to changed the icon of the clicked button to: "ui-icon-triangle-1-s, and show appropriate section below while hiding the other if it was open. I can't seem to be able to get the logic right, when I expand one section and then click another button. The areas swap properly, but the button icons do not update... Here's [DEMO][1]. Need more eyes to look and tell me what am I missing. $(".features").bind("click", function () { var that = this, pid = $(this).attr("id"), pidC = pid + "C", index = $(this).closest("td").index(); $(".features").find("span").removeClass("ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-e"); $(that).find("span").removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s"); // indicator OFF for all $(".ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-s").addClass("ui-icon-triangle-1-e"); $("#prT").find("td").removeClass("txtCCC"); $.each($("#prT").find("tr").children(), function () { if ($(that).index() != index) { $(that).addClass("txtCCC"); } }); if ($(".fList").hasClass("current")) { $(".fList:visible").slideUp().removeClass("current"); if ($(".fList:visible").attr("id") != pidC) { $("#" + pidC).slideDown(function(){ }).addClass("current"); } } else { $("#" + pidC).slideDown(function(){ $(".ui-icon-triangle-1-e", that).removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-s"); }).addClass("current"); } }); [1]: http://usabilitest.com
0
11,472,602
07/13/2012 14:32:17
1,494,203
07/01/2012 11:33:11
3
0
Make hover div follow mouse & stop hover function for one div when another div is hovered
Please take a look at [this page][1]. In the "ΣΥΝΟΠΤΙΚΕΣ ΕΙΔΗΣΕΙΣ" block (scroll down, near the middle of the page), titles make article's photo & body to fade in on mouseenter and fade out on mouseleave. jQuery used: (function ($) { $(document).ready(function(){ $('.front_short_news_title_snippet_container').bind('mouseenter', function() { $(this).find('.front_short_news_snippet_container').fadeIn(); }); $('.front_short_news_title_snippet_container').bind('mouseleave', function() { $(this).find('.front_short_news_snippet_container').fadeOut(); }); }); }(jQuery)); What I additionally need: 1. When mouseenter + mouseleave multiple times on the same title, the fading div also appears for the same number of times. I would like to make this effect constant, let's say if mouseenter on a title, the floating div fades in and stays there as long as mouse is in the title's area. If mouse leaves, keep the floating div visible for 3 seconds and if mouse enters on that same title, keep the floating div visible, not fade out & fade in multiple times. 2. I need the fading div to follow user's mouse until mouse exits the title's container div. I'm also open to suggestions on jQuery plugins, not only custom jQuery code. Thanks a lot [1]: http://lesvosnews.net.orion-web.gr
jquery
drupal-7
hover
mouseenter
mouseleave
null
open
Make hover div follow mouse & stop hover function for one div when another div is hovered === Please take a look at [this page][1]. In the "ΣΥΝΟΠΤΙΚΕΣ ΕΙΔΗΣΕΙΣ" block (scroll down, near the middle of the page), titles make article's photo & body to fade in on mouseenter and fade out on mouseleave. jQuery used: (function ($) { $(document).ready(function(){ $('.front_short_news_title_snippet_container').bind('mouseenter', function() { $(this).find('.front_short_news_snippet_container').fadeIn(); }); $('.front_short_news_title_snippet_container').bind('mouseleave', function() { $(this).find('.front_short_news_snippet_container').fadeOut(); }); }); }(jQuery)); What I additionally need: 1. When mouseenter + mouseleave multiple times on the same title, the fading div also appears for the same number of times. I would like to make this effect constant, let's say if mouseenter on a title, the floating div fades in and stays there as long as mouse is in the title's area. If mouse leaves, keep the floating div visible for 3 seconds and if mouse enters on that same title, keep the floating div visible, not fade out & fade in multiple times. 2. I need the fading div to follow user's mouse until mouse exits the title's container div. I'm also open to suggestions on jQuery plugins, not only custom jQuery code. Thanks a lot [1]: http://lesvosnews.net.orion-web.gr
0
11,472,603
07/13/2012 14:32:21
1,147,364
01/13/2012 09:30:42
218
18
issue in Deleting Storyboard in wpf
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="QWERTY.animation" x:Name="Window" Title="animation" Width="640" Height="480"> <Window.Resources> <Storyboard x:Key="Animation"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.FontSize)" Storyboard.TargetName="btn_1"> <EasingDoubleKeyFrame KeyTime="0" Value="11"/> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="10.667"/> </DoubleAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.FontWeight)" Storyboard.TargetName="btn_1"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <FontWeight>Normal</FontWeight> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> <DiscreteObjectKeyFrame KeyTime="0:0:0.3"> <DiscreteObjectKeyFrame.Value> <FontWeight>Bold</FontWeight> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="btn_1"> <EasingColorKeyFrame KeyTime="0" Value="#FFEAF0ED"/> <EasingColorKeyFrame KeyTime="0:0:0.3" Value="#FF106285"/> </ColorAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Grid x:Name="LayoutRoot"> <Button x:Name="btn_2" Content="B" Height="55" Margin="236,98,0,0" VerticalAlignment="Top" Click="btn_2_Click" HorizontalAlignment="Left" Width="72" /> <Button x:Name="btn_1" Content="A" Height="55" Margin="115,98,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="72" Click="btn_1_Click"> <Button.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="White" Offset="0"/> <GradientStop Color="#FFEAF0ED" Offset="0.9"/> </LinearGradientBrush> </Button.Background> </Button> <Button Content="Remove" HorizontalAlignment="Left" Margin="173,179,0,217" Width="75" Click="Button_Click" /> </Grid> </Window> The design will be like below ![enter image description here][1] public partial class animation : Window { Storyboard SB; public animation() { this.InitializeComponent(); } public void Animate(string name) { SB = (Storyboard)(FindResource("Animation")); Storyboard.SetTargetName(SB.Children[0], name); Storyboard.SetTargetName(SB.Children[1], name); Storyboard.SetTargetName(SB.Children[2], name); SB.Begin(); } private void btn_1_Click(object sender, RoutedEventArgs e) { Button Btn_1 = (Button)sender; Animate(btn_1.Name); } private void btn_2_Click(object sender, RoutedEventArgs e) { Button Btn_2 = (Button)sender; Animate(Btn_2.Name); } private void Button_Click(object sender, RoutedEventArgs e) { SB.Remove(); } } It's output will be like below ![Output][2] The above result is after i clicked two buttons one by one.Then I clicked the remove button,only the **button B** animation is removed. But i want to remove **button A and button B animation** by clicking of remove button. [1]: http://i.stack.imgur.com/0XXJb.png [2]: http://i.stack.imgur.com/kwQ3C.png
c#
wpf
storyboard
null
null
null
open
issue in Deleting Storyboard in wpf === <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="QWERTY.animation" x:Name="Window" Title="animation" Width="640" Height="480"> <Window.Resources> <Storyboard x:Key="Animation"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.FontSize)" Storyboard.TargetName="btn_1"> <EasingDoubleKeyFrame KeyTime="0" Value="11"/> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="10.667"/> </DoubleAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.FontWeight)" Storyboard.TargetName="btn_1"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <FontWeight>Normal</FontWeight> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> <DiscreteObjectKeyFrame KeyTime="0:0:0.3"> <DiscreteObjectKeyFrame.Value> <FontWeight>Bold</FontWeight> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="btn_1"> <EasingColorKeyFrame KeyTime="0" Value="#FFEAF0ED"/> <EasingColorKeyFrame KeyTime="0:0:0.3" Value="#FF106285"/> </ColorAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Grid x:Name="LayoutRoot"> <Button x:Name="btn_2" Content="B" Height="55" Margin="236,98,0,0" VerticalAlignment="Top" Click="btn_2_Click" HorizontalAlignment="Left" Width="72" /> <Button x:Name="btn_1" Content="A" Height="55" Margin="115,98,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="72" Click="btn_1_Click"> <Button.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="White" Offset="0"/> <GradientStop Color="#FFEAF0ED" Offset="0.9"/> </LinearGradientBrush> </Button.Background> </Button> <Button Content="Remove" HorizontalAlignment="Left" Margin="173,179,0,217" Width="75" Click="Button_Click" /> </Grid> </Window> The design will be like below ![enter image description here][1] public partial class animation : Window { Storyboard SB; public animation() { this.InitializeComponent(); } public void Animate(string name) { SB = (Storyboard)(FindResource("Animation")); Storyboard.SetTargetName(SB.Children[0], name); Storyboard.SetTargetName(SB.Children[1], name); Storyboard.SetTargetName(SB.Children[2], name); SB.Begin(); } private void btn_1_Click(object sender, RoutedEventArgs e) { Button Btn_1 = (Button)sender; Animate(btn_1.Name); } private void btn_2_Click(object sender, RoutedEventArgs e) { Button Btn_2 = (Button)sender; Animate(Btn_2.Name); } private void Button_Click(object sender, RoutedEventArgs e) { SB.Remove(); } } It's output will be like below ![Output][2] The above result is after i clicked two buttons one by one.Then I clicked the remove button,only the **button B** animation is removed. But i want to remove **button A and button B animation** by clicking of remove button. [1]: http://i.stack.imgur.com/0XXJb.png [2]: http://i.stack.imgur.com/kwQ3C.png
0
11,472,606
07/13/2012 14:32:37
1,523,811
07/13/2012 14:19:26
1
0
how to add more fields in user personnal info in django admin page
i have a django project, just started so there is no apps in that. i have activated the admin in settings file and can access the django administration page. there is a column in django page to add users , while adding users i am getting only 3 fields under personnal info, but i need to store some more info about users, i googled about it and it was mentioned that i can use user profiles to accomplish this. I tried that solution but as i am a newbiew it may be possible that i am not doing it correctly, so please can some one explain me this in detail. my aim is- to add 3 more fields in user table- 1- role 2- contact number 3- other i need detail like which function i need to write and where to do this. i found this but where i need to write this steps i dint know. Need clear explanation http://blog.bripkens.de/2011/04/adding-custom-profiles-to-the-django-user-model/
django
django-admin
user-profile
null
null
null
open
how to add more fields in user personnal info in django admin page === i have a django project, just started so there is no apps in that. i have activated the admin in settings file and can access the django administration page. there is a column in django page to add users , while adding users i am getting only 3 fields under personnal info, but i need to store some more info about users, i googled about it and it was mentioned that i can use user profiles to accomplish this. I tried that solution but as i am a newbiew it may be possible that i am not doing it correctly, so please can some one explain me this in detail. my aim is- to add 3 more fields in user table- 1- role 2- contact number 3- other i need detail like which function i need to write and where to do this. i found this but where i need to write this steps i dint know. Need clear explanation http://blog.bripkens.de/2011/04/adding-custom-profiles-to-the-django-user-model/
0
11,472,608
07/13/2012 14:32:53
1,518,070
07/11/2012 14:22:46
29
0
JQuery - how do I make the cells in my table one set width and height?
Every time I run the program the cells in the table vary in size depending on what letter is in it. I have fiddled around with the CSS but no luck, can anyone help? var listOfWords = ["mat", "cat", "dog", "pit", "pot", "fog", "log", "pan", "can", "man", "pin", "gag", "sat", "pat", "tap", "sap", "tag", "gig", "gap", "nag", "sag", "gas", "pig", "dig", "got", "not", "top", "pop", "god", "mog", "cot", "cop", "cap", "cod", "kid", "kit", "get", "pet", "ten", "net", "pen", "peg", "met", "men", "mum", "run", "mug", "cup", "sun", "mud", "rim", "ram", "rat", "rip", "rag", "rug", "rot", "dad", "sad", "dim", "dip", "did", "mam", "map", "nip", "tin", "tan", "nap", "sit", "tip", "pip", "sip", "had", "him", "his", "hot", "hut", "hop", "hum", "hit", "hat", "has", "hug", "but", "big", "bet", "bad", "bad", "bed", "bud", "beg", "bug", "bun", "bus", "bat", "bit", "fit", "fin", "fun", "fig", "fan", "fat", "lap", "lot", "let", "leg", "lit"]; var shuffledWords = listOfWords.slice(0).sort(function () { return 0.5 - Math.random(); }).slice(0, 12); var tbl = document.createElement('table'); tbl.className='tablestyle'; var wordsPerRow = 2; for (var i = 0; i < shuffledWords.length; i += wordsPerRow) { var row = document.createElement('tr'); for (var j=i; j < i + wordsPerRow; ++ j) { var word = shuffledWords[j]; for (var k = 0; k < word.length; k++){ var cell = document.createElement('td'); cell.textContent = word[k]; // IF FIREFOX USE cell.textContent = word[j]; INSTEAD row.appendChild(cell); } } tbl.appendChild(row); } document.body.appendChild(tbl);
jquery
null
null
null
null
null
open
JQuery - how do I make the cells in my table one set width and height? === Every time I run the program the cells in the table vary in size depending on what letter is in it. I have fiddled around with the CSS but no luck, can anyone help? var listOfWords = ["mat", "cat", "dog", "pit", "pot", "fog", "log", "pan", "can", "man", "pin", "gag", "sat", "pat", "tap", "sap", "tag", "gig", "gap", "nag", "sag", "gas", "pig", "dig", "got", "not", "top", "pop", "god", "mog", "cot", "cop", "cap", "cod", "kid", "kit", "get", "pet", "ten", "net", "pen", "peg", "met", "men", "mum", "run", "mug", "cup", "sun", "mud", "rim", "ram", "rat", "rip", "rag", "rug", "rot", "dad", "sad", "dim", "dip", "did", "mam", "map", "nip", "tin", "tan", "nap", "sit", "tip", "pip", "sip", "had", "him", "his", "hot", "hut", "hop", "hum", "hit", "hat", "has", "hug", "but", "big", "bet", "bad", "bad", "bed", "bud", "beg", "bug", "bun", "bus", "bat", "bit", "fit", "fin", "fun", "fig", "fan", "fat", "lap", "lot", "let", "leg", "lit"]; var shuffledWords = listOfWords.slice(0).sort(function () { return 0.5 - Math.random(); }).slice(0, 12); var tbl = document.createElement('table'); tbl.className='tablestyle'; var wordsPerRow = 2; for (var i = 0; i < shuffledWords.length; i += wordsPerRow) { var row = document.createElement('tr'); for (var j=i; j < i + wordsPerRow; ++ j) { var word = shuffledWords[j]; for (var k = 0; k < word.length; k++){ var cell = document.createElement('td'); cell.textContent = word[k]; // IF FIREFOX USE cell.textContent = word[j]; INSTEAD row.appendChild(cell); } } tbl.appendChild(row); } document.body.appendChild(tbl);
0
11,472,609
07/13/2012 14:32:55
898,906
08/17/2011 15:04:27
18
1
WHERE can i get all iTunes Genres from a Mediatype?
I Found http://itunes.apple.com/us/rss/?cc=DE to get Top Hits from iTunes by Media. I can filter by selecting the Genre. Where can i get this genre IDs as xml or JSON?
xml
json
rss
itunes
null
null
open
WHERE can i get all iTunes Genres from a Mediatype? === I Found http://itunes.apple.com/us/rss/?cc=DE to get Top Hits from iTunes by Media. I can filter by selecting the Genre. Where can i get this genre IDs as xml or JSON?
0
11,472,611
07/13/2012 14:33:00
279,362
02/23/2010 10:47:04
1,197
27
How to (easily) update an ABPerson object with a vCard and keep its unique ID?
The AddressBook Framework offers a great method for initializing an ABPerson with a vCard, by using the `initWithVCardRepresentation:` method. What I want to do is *update* a contact with a certain vCard. I can't use `initWithVCardRepresentation:` because this will give me a new ABPerson object with a new uniqueId and I want to keep the uniqueId in between these changes. What's an easy way to go about doing something like this? Thanks!
objective-c
osx
abaddressbook
abperson
null
null
open
How to (easily) update an ABPerson object with a vCard and keep its unique ID? === The AddressBook Framework offers a great method for initializing an ABPerson with a vCard, by using the `initWithVCardRepresentation:` method. What I want to do is *update* a contact with a certain vCard. I can't use `initWithVCardRepresentation:` because this will give me a new ABPerson object with a new uniqueId and I want to keep the uniqueId in between these changes. What's an easy way to go about doing something like this? Thanks!
0
11,472,612
07/13/2012 14:33:04
685,979
03/31/2011 14:56:41
287
4
jQuery - how to call ajax when certain condition is met
I know you can use the function `setInterval` to call your ajax function at fixed time interval. What I'd like to achieve though is something like this: while (true) //but obviously this while loop will block other code. I'd like it non-blocking { //if certain condition is met, call my ajax function. } so basically the code should sit silently in the background, listening. if certain condition is meet, fire ajax call. Is is possible in jquery/javascript?
javascript
jquery
jquery-ajax
null
null
null
open
jQuery - how to call ajax when certain condition is met === I know you can use the function `setInterval` to call your ajax function at fixed time interval. What I'd like to achieve though is something like this: while (true) //but obviously this while loop will block other code. I'd like it non-blocking { //if certain condition is met, call my ajax function. } so basically the code should sit silently in the background, listening. if certain condition is meet, fire ajax call. Is is possible in jquery/javascript?
0
11,472,616
07/13/2012 14:33:25
141,311
07/20/2009 10:35:43
522
27
how to change displaytag sortproperty link
I am using display tag in my application. In that i need to sort the table contents based on the column header click. Column header has link navigation. Instead i need to submit the form while clicking on the table column header. How can we achieve it. As of now, my application craetes the table like this, <display:table id="data" name="lstEntities" sort="external" uid="row" htmlId="rowid" class="tborder" excludedParams="*" style="width:100%" pagesize="${pageCriteria.recordsPerPage}" partialList="true" size="${pageCriteria.totalRecords}" export="false" requestURI="prestigeBrandListMDA.action"> <display:column property="brandId" sortName="brand.brandId" sortable="true" titleKey="table.title.brandId" style="width:100px" /> <thead> <tr> <th class="sortable"> <a href="prestigeBrandListMDA.action?d-16544-p=1&amp;d-16544-o=2&amp;d-16544-n=1&amp;d-16544-s=brand.brandId">Sales Brand Id</a></th> instead i need the link like below <thead> <tr> <th class="sortable"> <a href="#" onclick="javascript:submitform(prestigeBrandListMDA.action?d-16544-p=1&amp;d-16544-o=2&amp;d-16544-n=1&amp;d-16544-s=brand.brandId)">Sales Brand Id</a></th>
java
displaytag
null
null
null
null
open
how to change displaytag sortproperty link === I am using display tag in my application. In that i need to sort the table contents based on the column header click. Column header has link navigation. Instead i need to submit the form while clicking on the table column header. How can we achieve it. As of now, my application craetes the table like this, <display:table id="data" name="lstEntities" sort="external" uid="row" htmlId="rowid" class="tborder" excludedParams="*" style="width:100%" pagesize="${pageCriteria.recordsPerPage}" partialList="true" size="${pageCriteria.totalRecords}" export="false" requestURI="prestigeBrandListMDA.action"> <display:column property="brandId" sortName="brand.brandId" sortable="true" titleKey="table.title.brandId" style="width:100px" /> <thead> <tr> <th class="sortable"> <a href="prestigeBrandListMDA.action?d-16544-p=1&amp;d-16544-o=2&amp;d-16544-n=1&amp;d-16544-s=brand.brandId">Sales Brand Id</a></th> instead i need the link like below <thead> <tr> <th class="sortable"> <a href="#" onclick="javascript:submitform(prestigeBrandListMDA.action?d-16544-p=1&amp;d-16544-o=2&amp;d-16544-n=1&amp;d-16544-s=brand.brandId)">Sales Brand Id</a></th>
0
11,471,006
07/13/2012 12:59:15
1,518,183
07/11/2012 14:55:27
6
0
How create tree view in PHP?
I have array of users and every user can have parents: array(6) { guest => NULL moderator => NULL member => array(1) [ //username 0 => "guest" (5) //parent ] user => array(1) [ 0 => "member" (6) ] admin => array(1) [ 0 => "moderator" (9) ] } And I want to make tree view from this data. The result should look like this: http://www.phorum.org/phorum5/file.php/62/3237/treeview_lightweight_admin_screenshot.jpg Is any way to make this in PHP? Thanks
php
treeview
null
null
null
null
open
How create tree view in PHP? === I have array of users and every user can have parents: array(6) { guest => NULL moderator => NULL member => array(1) [ //username 0 => "guest" (5) //parent ] user => array(1) [ 0 => "member" (6) ] admin => array(1) [ 0 => "moderator" (9) ] } And I want to make tree view from this data. The result should look like this: http://www.phorum.org/phorum5/file.php/62/3237/treeview_lightweight_admin_screenshot.jpg Is any way to make this in PHP? Thanks
0
11,471,008
07/13/2012 12:59:18
961,333
09/23/2011 14:10:12
215
18
location.hash and back history
**Is there a function that can be called to prevent the browser from recording a back history entry when changing the hash value?** I am writing a simple javascript gallery that changes the browser url without reloading the page as the user moves through each image. This is done by setting the location.hash to the unique ID of the image. window.location.hash = imageID; The problem is when the user hits the browser back button, they must move backwards through every image like it was a page load. If they rotated through 20 images using the gallery, they must click back 21 times to get back to the previous page. **How can I prevent a back history from being recorded with javascript?**
javascript
browser-cache
hashcode
null
null
null
open
location.hash and back history === **Is there a function that can be called to prevent the browser from recording a back history entry when changing the hash value?** I am writing a simple javascript gallery that changes the browser url without reloading the page as the user moves through each image. This is done by setting the location.hash to the unique ID of the image. window.location.hash = imageID; The problem is when the user hits the browser back button, they must move backwards through every image like it was a page load. If they rotated through 20 images using the gallery, they must click back 21 times to get back to the previous page. **How can I prevent a back history from being recorded with javascript?**
0
11,472,618
07/13/2012 14:33:36
1,523,790
07/13/2012 14:11:31
1
0
in ajax cascading with websevice dropdownlist the second dropdown shows method error 500
i have 2 dropdowns and the first drop works fine and shows data from database but the second drop down shows error 500. here is my code for webservice: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Configuration; using System.Data.SqlClient; using System.Collections.Specialized; using AjaxControlToolkit; using System.Data; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class CascadingDropdown : System.Web.Services.WebService { private static string strconnection = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); //private static string strconnection = ConfigurationManager.AppSettings["ConnectionString"].ToString(); SqlConnection concategory = new SqlConnection(strconnection); public CascadingDropdown() { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public CascadingDropDownNameValue[] BindCategoryDetails(string knownCategoryValues, string category) { concategory.Open(); SqlCommand cmdcategory = new SqlCommand("select * from Categories", concategory); //create list and add items in it by looping through dataset table List<CascadingDropDownNameValue> categorydetails = new List<CascadingDropDownNameValue>(); SqlDataReader drcategory= null ; drcategory=cmdcategory.ExecuteReader(); while(drcategory.Read()) { string CategoryID = drcategory ["categoryID"].ToString(); string CategoryName = drcategory ["categoryName"].ToString(); categorydetails.Add(new CascadingDropDownNameValue(CategoryName, CategoryID)); } concategory.Close(); return categorydetails.ToArray(); } /// <summary> /// WebMethod to Populate State Dropdown /// </summary> [WebMethod] public CascadingDropDownNameValue[] BindProductDetails(string knownCategoryValues, string category) { int categoryID; //This method will return a StringDictionary containing the name/value pairs of the currently selected values StringDictionary categorydetails = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); categoryID = Convert.ToInt32(categorydetails["Category"]); concategory.Open(); SqlCommand cmdproduct = new SqlCommand("select * from Products where categoryID=@categoryID", concategory); cmdproduct.Parameters.AddWithValue("@categoryID", categoryID); //create list and add items in it by looping through dataset table List<CascadingDropDownNameValue> productdetails = new List<CascadingDropDownNameValue>(); SqlDataReader drproduct= null ; drproduct=cmdproduct.ExecuteReader(); while(drproduct.Read()) { string ProductID = drproduct ["categoryID"].ToString(); string ProductName = drproduct ["categoryName"].ToString(); productdetails.Add(new CascadingDropDownNameValue(ProductName, ProductID)); } concategory.Close(); return productdetails.ToArray(); } } and aspx code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false"%> <%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <br /> <asp:DropDownList ID="ddlcategory" runat="server"></asp:DropDownList> <ajax:CascadingDropDown ID="ccdCategory" runat="server" Category="category" TargetControlID="ddlcategory" PromptText="Select Category" LoadingText="Loading Categories" ServiceMethod="BindCategoryDetails" ServicePath="CascadingDropdown.asmx"> </ajax:CascadingDropDown> <asp:DropDownList ID="ddlproduct" runat="server"> </asp:DropDownList> <ajax:CascadingDropDown ID="ccdProduct" runat="server" Category="product" TargetControlID="ddlproduct" PromptText="Select Product" LoadingText="Loading Products" ServiceMethod="BindProductDetails" ScriptPath="CascadingDropdown.asmx"> </ajax:CascadingDropDown> </form> </body> </html> if ther's anything else u need to know tell me. thanks.
c#
asp.net
cascadingdropdown
null
null
null
open
in ajax cascading with websevice dropdownlist the second dropdown shows method error 500 === i have 2 dropdowns and the first drop works fine and shows data from database but the second drop down shows error 500. here is my code for webservice: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Configuration; using System.Data.SqlClient; using System.Collections.Specialized; using AjaxControlToolkit; using System.Data; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class CascadingDropdown : System.Web.Services.WebService { private static string strconnection = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); //private static string strconnection = ConfigurationManager.AppSettings["ConnectionString"].ToString(); SqlConnection concategory = new SqlConnection(strconnection); public CascadingDropdown() { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public CascadingDropDownNameValue[] BindCategoryDetails(string knownCategoryValues, string category) { concategory.Open(); SqlCommand cmdcategory = new SqlCommand("select * from Categories", concategory); //create list and add items in it by looping through dataset table List<CascadingDropDownNameValue> categorydetails = new List<CascadingDropDownNameValue>(); SqlDataReader drcategory= null ; drcategory=cmdcategory.ExecuteReader(); while(drcategory.Read()) { string CategoryID = drcategory ["categoryID"].ToString(); string CategoryName = drcategory ["categoryName"].ToString(); categorydetails.Add(new CascadingDropDownNameValue(CategoryName, CategoryID)); } concategory.Close(); return categorydetails.ToArray(); } /// <summary> /// WebMethod to Populate State Dropdown /// </summary> [WebMethod] public CascadingDropDownNameValue[] BindProductDetails(string knownCategoryValues, string category) { int categoryID; //This method will return a StringDictionary containing the name/value pairs of the currently selected values StringDictionary categorydetails = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); categoryID = Convert.ToInt32(categorydetails["Category"]); concategory.Open(); SqlCommand cmdproduct = new SqlCommand("select * from Products where categoryID=@categoryID", concategory); cmdproduct.Parameters.AddWithValue("@categoryID", categoryID); //create list and add items in it by looping through dataset table List<CascadingDropDownNameValue> productdetails = new List<CascadingDropDownNameValue>(); SqlDataReader drproduct= null ; drproduct=cmdproduct.ExecuteReader(); while(drproduct.Read()) { string ProductID = drproduct ["categoryID"].ToString(); string ProductName = drproduct ["categoryName"].ToString(); productdetails.Add(new CascadingDropDownNameValue(ProductName, ProductID)); } concategory.Close(); return productdetails.ToArray(); } } and aspx code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false"%> <%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <br /> <asp:DropDownList ID="ddlcategory" runat="server"></asp:DropDownList> <ajax:CascadingDropDown ID="ccdCategory" runat="server" Category="category" TargetControlID="ddlcategory" PromptText="Select Category" LoadingText="Loading Categories" ServiceMethod="BindCategoryDetails" ServicePath="CascadingDropdown.asmx"> </ajax:CascadingDropDown> <asp:DropDownList ID="ddlproduct" runat="server"> </asp:DropDownList> <ajax:CascadingDropDown ID="ccdProduct" runat="server" Category="product" TargetControlID="ddlproduct" PromptText="Select Product" LoadingText="Loading Products" ServiceMethod="BindProductDetails" ScriptPath="CascadingDropdown.asmx"> </ajax:CascadingDropDown> </form> </body> </html> if ther's anything else u need to know tell me. thanks.
0
11,472,622
07/13/2012 14:33:47
1,251,746
03/06/2012 08:58:58
1
0
server settings for the function block system
I'm using the following command to export a databse echo system("mysqldump --user=$user --password=$password --host=$host $database > $bk",$res); I have two sites on two different servers, one of the command and the other is not ... about what goes where I practically creates the file, but it is empty how do I figure out where is the problem? and as I command ensures full database export? thanks
php
null
null
null
null
07/13/2012 15:04:56
not a real question
server settings for the function block system === I'm using the following command to export a databse echo system("mysqldump --user=$user --password=$password --host=$host $database > $bk",$res); I have two sites on two different servers, one of the command and the other is not ... about what goes where I practically creates the file, but it is empty how do I figure out where is the problem? and as I command ensures full database export? thanks
1
11,472,623
07/13/2012 14:33:48
541,686
12/14/2010 08:54:07
33,008
837
How to detect if two files are on the same physical disk?
I want to parallelize some disk I/O, but this will *hurt* performance badly if my files are on the same disk. Note that there may be various filter drivers in between the drivers and the actual disk -- e.g. two files might be on different virtual disks (VHDs), but on the same physical disk. How do I detect if two `HANDLE`s refer to files (or partitions, or whatever) on the same physical disk? If this is not possible -- what is the next-best/closest alternative?
winapi
file-io
disk
null
null
null
open
How to detect if two files are on the same physical disk? === I want to parallelize some disk I/O, but this will *hurt* performance badly if my files are on the same disk. Note that there may be various filter drivers in between the drivers and the actual disk -- e.g. two files might be on different virtual disks (VHDs), but on the same physical disk. How do I detect if two `HANDLE`s refer to files (or partitions, or whatever) on the same physical disk? If this is not possible -- what is the next-best/closest alternative?
0
11,628,449
07/24/2012 09:59:53
1,495,265
07/02/2012 06:21:14
13
0
"Error exited sync due to fetch errors android" while downloading Android Open Source Code
I'm trying to download the Android Open Source Code on my Linux system. I've executed the initial commands of mkdir, curl and repo init and then executed the repo sync command but after some time it showed "Error exited sync due to fetch errors android". Then I executed the repo sync command again but after some time it showed the following: Downloading packages/apps/Settings: 75% (56MB/74MB) Exception in thread Thread-150: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 505, in run self.__target(*self.__args, **self.__kwargs) File "/home/ingrid/.repo/repo/subcmds/sync.py", line 200, in _FetchHelper clone_bundle=not opt.no_clone_bundle) File "/home/ingrid/.repo/repo/project.py", line 968, in Sync_NetworkHalf and self._ApplyCloneBundle(initial=is_new, quiet=quiet): File "/home/ingrid/.repo/repo/project.py", line 1526, in _ApplyCloneBundle exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet) File "/home/ingrid/.repo/repo/project.py", line 1590, in _FetchBundle raise DownloadError('%s: %s ' % (req.get_host(), str(e))) DownloadError: android.googlesource.com: <urlopen error [Errno 104] Connection reset by peer> Could you please tell me why it is showing this? Thank you.
android
terminal
null
null
null
null
open
"Error exited sync due to fetch errors android" while downloading Android Open Source Code === I'm trying to download the Android Open Source Code on my Linux system. I've executed the initial commands of mkdir, curl and repo init and then executed the repo sync command but after some time it showed "Error exited sync due to fetch errors android". Then I executed the repo sync command again but after some time it showed the following: Downloading packages/apps/Settings: 75% (56MB/74MB) Exception in thread Thread-150: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 505, in run self.__target(*self.__args, **self.__kwargs) File "/home/ingrid/.repo/repo/subcmds/sync.py", line 200, in _FetchHelper clone_bundle=not opt.no_clone_bundle) File "/home/ingrid/.repo/repo/project.py", line 968, in Sync_NetworkHalf and self._ApplyCloneBundle(initial=is_new, quiet=quiet): File "/home/ingrid/.repo/repo/project.py", line 1526, in _ApplyCloneBundle exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet) File "/home/ingrid/.repo/repo/project.py", line 1590, in _FetchBundle raise DownloadError('%s: %s ' % (req.get_host(), str(e))) DownloadError: android.googlesource.com: <urlopen error [Errno 104] Connection reset by peer> Could you please tell me why it is showing this? Thank you.
0
11,628,454
07/24/2012 10:00:00
990,630
10/12/2011 02:37:50
1
0
Facebook application story impressions
Do you know if when using Facebook ads which sponsor the stories posted by the application, these impressions count in the Insights statistics under "Story Impressions"
facebook
application
impressions
null
null
null
open
Facebook application story impressions === Do you know if when using Facebook ads which sponsor the stories posted by the application, these impressions count in the Insights statistics under "Story Impressions"
0
11,628,460
07/24/2012 10:00:11
1,519,772
07/12/2012 05:45:50
1
0
getting most repeated value fromo sql table fields
i want to get most one repeated value in sql table column field below is my sql structure , i want to get most repeated value from Topic field Table name is Orange and field name with values is topic 1 2 1 3 1 2
php
sql
null
null
null
null
open
getting most repeated value fromo sql table fields === i want to get most one repeated value in sql table column field below is my sql structure , i want to get most repeated value from Topic field Table name is Orange and field name with values is topic 1 2 1 3 1 2
0
11,628,463
07/24/2012 10:00:34
1,192,353
09/30/2011 10:03:40
16
3
blinking footer in jquery mobile
while working in phonegap-jquery mobile i am using enter code here <div data-role="footer" class="nav-glyphish-example" data-position="fixed">`enter code here` but after pageload footer is blinking for a while.
jquery
jquery-mobile
phonegap
null
null
null
open
blinking footer in jquery mobile === while working in phonegap-jquery mobile i am using enter code here <div data-role="footer" class="nav-glyphish-example" data-position="fixed">`enter code here` but after pageload footer is blinking for a while.
0
11,628,465
07/24/2012 10:00:38
1,456,090
06/14/2012 11:31:13
8
0
Reading and writing a string through stream in java
What is the method for writing a stream in jsp and read that stream in servlet. kindly send me an idea for this.
java
jsp
null
null
null
07/25/2012 19:02:51
not a real question
Reading and writing a string through stream in java === What is the method for writing a stream in jsp and read that stream in servlet. kindly send me an idea for this.
1
11,628,469
07/24/2012 10:00:45
618,206
02/15/2011 16:46:41
834
29
Html.ValidationMessage: bug or feature?
I try to use the @Html.ValidationMessage() helper. If I only provide the modelName it only shows up if there is an error. If I provide an explicit validationMessage it will show up no matter what (even if the field is valid): @Html.ValidationMessage("elem_" + i, "This will show up no matter what!") This is contrary to the description. From the System.Web.Mvc.Html.ValidationExtensions.ValidationMessageHelper function (I ILSpied it): if (!string.IsNullOrEmpty(validationMessage)) { tagBuilder.SetInnerText(validationMessage); } else { if (modelError != null) { tagBuilder.SetInnerText(ValidationExtensions.GetUserErrorMessageOrDefault(htmlHelper.ViewContext.HttpContext, modelError, modelState)); } } As you can see if you provide a validationMessage it will show up. Is this a bug or is it intended. And how can I circumvent this?
asp.net-mvc-3
validation
null
null
null
null
open
Html.ValidationMessage: bug or feature? === I try to use the @Html.ValidationMessage() helper. If I only provide the modelName it only shows up if there is an error. If I provide an explicit validationMessage it will show up no matter what (even if the field is valid): @Html.ValidationMessage("elem_" + i, "This will show up no matter what!") This is contrary to the description. From the System.Web.Mvc.Html.ValidationExtensions.ValidationMessageHelper function (I ILSpied it): if (!string.IsNullOrEmpty(validationMessage)) { tagBuilder.SetInnerText(validationMessage); } else { if (modelError != null) { tagBuilder.SetInnerText(ValidationExtensions.GetUserErrorMessageOrDefault(htmlHelper.ViewContext.HttpContext, modelError, modelState)); } } As you can see if you provide a validationMessage it will show up. Is this a bug or is it intended. And how can I circumvent this?
0
11,628,470
07/24/2012 10:00:45
255,118
01/20/2010 17:48:58
362
2
Select last inserted records and grouping mysql
Im having a table with notes. Below is a small sample of data of my db. Id register_no name classification possibility 1 112 Ben Red 10% 2 112 Ben Red 10% 3 113 Mandy Red 20% 4 112 Ben Amber 30% 5 112 Ben Amber 10% 6 113 Mandy Amber 30% 7 113 Mandy Red 10% 8 112 Ben Red 50% What I want to do is select the last records or Ben and Mandy, which are id 7 and 8 I used the below query but I couldn’t achieve the results. SELECT FROM (`sales_log`) WHERE `name` = 'ben' GROUP BY ` register_no ` ORDER BY `id` desc Can someone please suggest how to retrieve those last records?
php
mysql
sql
null
null
null
open
Select last inserted records and grouping mysql === Im having a table with notes. Below is a small sample of data of my db. Id register_no name classification possibility 1 112 Ben Red 10% 2 112 Ben Red 10% 3 113 Mandy Red 20% 4 112 Ben Amber 30% 5 112 Ben Amber 10% 6 113 Mandy Amber 30% 7 113 Mandy Red 10% 8 112 Ben Red 50% What I want to do is select the last records or Ben and Mandy, which are id 7 and 8 I used the below query but I couldn’t achieve the results. SELECT FROM (`sales_log`) WHERE `name` = 'ben' GROUP BY ` register_no ` ORDER BY `id` desc Can someone please suggest how to retrieve those last records?
0
11,628,478
07/24/2012 10:01:02
1,418,751
05/26/2012 07:19:44
1
0
Spotify App API Bug Report : Player volume cannot be set to a value
I started playing with the Spotify App API of few weeks ago. I wanted to change the volume. This should be done by using the volume property of the Player class, as stated in the [documention](https://developer.spotify.com/technologies/apps/docs/beta/f19ff300f8.html): >volume Get or set the current volume level as a float between 0.0 and 1.0. Unfortunatly it turned out that this volume property can only be used to get the current volume, but not to set the volume. So I began searching the web to find some information. I found two related posts on stack overflow [1](http://stackoverflow.com/questions/10822979/change-volume-with-spotify-app-api) and [2](http://stackoverflow.com/questions/11230630/change-volume-in-a-spotify-app). So what do I ask the same question as two other people you may ask. Well, I've gone a little deeper into the Spotify API and found some useful information. I hope this post will help the Spotify developers. Also, stackoverflow seem to be the way to go to post bug report for Spotify. So let's jump into my Spotify App API investigation. All of this is done by using the Inspector. The volume property is defined in the Player class. The Player class is defined in the models module. So lets have a look to models, for this we open the file models.js ("Scripts" tab in the inspector, select "models.js" in the dropdown menu). We first find this (line 743) : * @property {number} volume Get or set the current volume level as a float between 0.0 and 1.0. So let's have a look to this volume property then (lines 889-892 in models.js): volume: { get: sp.trackPlayer.getVolume, set: sp.trackPlayer.setVolume }, Ok. So now we now that we can set the volume by using the setVolume method in trackPlayer. Let's go deeper and see what's inside trackPlayer. For this, type in the console: _getSpotifyModule("trackPlayer") It returns an object containing a lot of functions. Here is a little snapshot: _getSpotifyModule("trackPlayer") Object ... getShuffle: function getShuffle() { [native code] } getVolume: function getVolume() { [native code] } playTrackFromContext: function playTrackFromContext() { [native code] } ... setShuffle: function setShuffle() { [native code] } skipToNextTrack: function skipToNextTrack() { [native code] } ... Has you can see the function getVolume is defined. But the function setVolume is not. So here is my conclusion: as of now it is not possible to use Player.volume to set the volume because the setVolume function is not define in trackPlayer. I hope that my work will help the developers to solve this problem. --- In [1], IKenndac suggested that: > you're only allowed to change the volume if your app initiated the playback that's occurring But this turned out to be wrong, I made a little application to test it : https://gist.github.com/3152875 . You can also try to execute the following code in the console, and you will see that the volume does not change: var sp = getSpotifyApi(1); var models = sp.require('sp://import/scripts/api/models'); var views = sp.require('sp://import/scripts/api/views'); var player = models.player; player.volume; player.volume = 0.5; player.volume; --- [1] http://stackoverflow.com/questions/10822979/change-volume-with-spotify-app-api [2] http://stackoverflow.com/questions/11230630/change-volume-in-a-spotify-app
javascript
api
spotify
null
null
null
open
Spotify App API Bug Report : Player volume cannot be set to a value === I started playing with the Spotify App API of few weeks ago. I wanted to change the volume. This should be done by using the volume property of the Player class, as stated in the [documention](https://developer.spotify.com/technologies/apps/docs/beta/f19ff300f8.html): >volume Get or set the current volume level as a float between 0.0 and 1.0. Unfortunatly it turned out that this volume property can only be used to get the current volume, but not to set the volume. So I began searching the web to find some information. I found two related posts on stack overflow [1](http://stackoverflow.com/questions/10822979/change-volume-with-spotify-app-api) and [2](http://stackoverflow.com/questions/11230630/change-volume-in-a-spotify-app). So what do I ask the same question as two other people you may ask. Well, I've gone a little deeper into the Spotify API and found some useful information. I hope this post will help the Spotify developers. Also, stackoverflow seem to be the way to go to post bug report for Spotify. So let's jump into my Spotify App API investigation. All of this is done by using the Inspector. The volume property is defined in the Player class. The Player class is defined in the models module. So lets have a look to models, for this we open the file models.js ("Scripts" tab in the inspector, select "models.js" in the dropdown menu). We first find this (line 743) : * @property {number} volume Get or set the current volume level as a float between 0.0 and 1.0. So let's have a look to this volume property then (lines 889-892 in models.js): volume: { get: sp.trackPlayer.getVolume, set: sp.trackPlayer.setVolume }, Ok. So now we now that we can set the volume by using the setVolume method in trackPlayer. Let's go deeper and see what's inside trackPlayer. For this, type in the console: _getSpotifyModule("trackPlayer") It returns an object containing a lot of functions. Here is a little snapshot: _getSpotifyModule("trackPlayer") Object ... getShuffle: function getShuffle() { [native code] } getVolume: function getVolume() { [native code] } playTrackFromContext: function playTrackFromContext() { [native code] } ... setShuffle: function setShuffle() { [native code] } skipToNextTrack: function skipToNextTrack() { [native code] } ... Has you can see the function getVolume is defined. But the function setVolume is not. So here is my conclusion: as of now it is not possible to use Player.volume to set the volume because the setVolume function is not define in trackPlayer. I hope that my work will help the developers to solve this problem. --- In [1], IKenndac suggested that: > you're only allowed to change the volume if your app initiated the playback that's occurring But this turned out to be wrong, I made a little application to test it : https://gist.github.com/3152875 . You can also try to execute the following code in the console, and you will see that the volume does not change: var sp = getSpotifyApi(1); var models = sp.require('sp://import/scripts/api/models'); var views = sp.require('sp://import/scripts/api/views'); var player = models.player; player.volume; player.volume = 0.5; player.volume; --- [1] http://stackoverflow.com/questions/10822979/change-volume-with-spotify-app-api [2] http://stackoverflow.com/questions/11230630/change-volume-in-a-spotify-app
0
11,628,304
07/24/2012 09:50:30
1,235,267
02/27/2012 09:59:58
102
8
sharekit/sharekit not displaying link when sharing on facebook and twitter
I'm using sharekit/sharekit API to share via mail,twitter,facebook NSDictionary *table = [[NSDictionary alloc] initWithObjectsAndKeys:@"SHKTwitter", SHKLocalizedString(@"Twitter", nil), @"SHKFacebook", SHKLocalizedString(@"Facebook", nil), @"SHKMail", SHKLocalizedString(@"Email", nil),@"SHKTextMessage", SHKLocalizedString(@"Text", nil),nil]; Class SharersClass = NSClassFromString([table objectForKey:"Facebook"]); NSString *shareMsg = @"share message"; NSURL *shareUrl = [NSURL URLWithString:myURL]; SHKItem *item = [SHKItem text:shareMsg]; item.url = shareUrl; [SharersClass performSelector:@selector(shareItem:) withObject:item]; the sharing works but my problem is that the url is not displayed to the user in the facebook pop up however it's displayed on the user wall on facebook.com ... the same case happens with twitter ... but the links appears in mail and text sharing ... any idea what might be the problem ?
iphone
ios
sharekit
null
null
null
open
sharekit/sharekit not displaying link when sharing on facebook and twitter === I'm using sharekit/sharekit API to share via mail,twitter,facebook NSDictionary *table = [[NSDictionary alloc] initWithObjectsAndKeys:@"SHKTwitter", SHKLocalizedString(@"Twitter", nil), @"SHKFacebook", SHKLocalizedString(@"Facebook", nil), @"SHKMail", SHKLocalizedString(@"Email", nil),@"SHKTextMessage", SHKLocalizedString(@"Text", nil),nil]; Class SharersClass = NSClassFromString([table objectForKey:"Facebook"]); NSString *shareMsg = @"share message"; NSURL *shareUrl = [NSURL URLWithString:myURL]; SHKItem *item = [SHKItem text:shareMsg]; item.url = shareUrl; [SharersClass performSelector:@selector(shareItem:) withObject:item]; the sharing works but my problem is that the url is not displayed to the user in the facebook pop up however it's displayed on the user wall on facebook.com ... the same case happens with twitter ... but the links appears in mail and text sharing ... any idea what might be the problem ?
0
11,628,306
07/24/2012 09:50:39
1,107,433
12/20/2011 08:56:04
6
0
read a vector image with full quality and density then write it to pdf file with full quality without breaking pixel?
I have PDF, EPS, AI file which have density "300x300". I zoom it and it didn't break any pixel. I'm using RMagick require 'RMagick' include Magick img = Image.read("myFile.ai").first img.write("myNewFile.pdf") Then when I zoom myNewFile, it broke pixel. Any solution about this? Or Is there any library to deal with vector image file?
rmagick
null
null
null
null
null
open
read a vector image with full quality and density then write it to pdf file with full quality without breaking pixel? === I have PDF, EPS, AI file which have density "300x300". I zoom it and it didn't break any pixel. I'm using RMagick require 'RMagick' include Magick img = Image.read("myFile.ai").first img.write("myNewFile.pdf") Then when I zoom myNewFile, it broke pixel. Any solution about this? Or Is there any library to deal with vector image file?
0
11,350,884
07/05/2012 19:04:57
1,491,739
06/29/2012 17:02:53
6
0
Scala MD5 equivalent of this PHP line
This MD5 call has 2 arguments, the first string, and then the $transaction_key hash_hmac("md5", $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $transaction_key); How would I reproduce this in Scala? I can't find an MD5 function that takes 2 arguments.
scala
null
null
null
null
null
open
Scala MD5 equivalent of this PHP line === This MD5 call has 2 arguments, the first string, and then the $transaction_key hash_hmac("md5", $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $transaction_key); How would I reproduce this in Scala? I can't find an MD5 function that takes 2 arguments.
0
11,350,886
07/05/2012 19:05:01
871,705
07/31/2011 16:12:58
18
2
wordpress wpdb->update not working
I can't update with wpdb->update here is my code : $tweet = $_POST['tweet']; $id = $_POST['id']; $wpdb->update( $table_name, array('id' => $id , 'tweet' => $tweet ), array( 'id' => $id ),array("%s","%d"), array("%d") ); Nothing wrong i think , but i can't update thanks advanced
ajax
wordpress
update
wpdb
null
null
open
wordpress wpdb->update not working === I can't update with wpdb->update here is my code : $tweet = $_POST['tweet']; $id = $_POST['id']; $wpdb->update( $table_name, array('id' => $id , 'tweet' => $tweet ), array( 'id' => $id ),array("%s","%d"), array("%d") ); Nothing wrong i think , but i can't update thanks advanced
0
11,350,888
07/05/2012 19:05:09
976,042
10/03/2011 03:57:45
31
1
LINQ query to select object and count
I'm trying to do a query to generate packing slips, and need general order info, as well as how many items the order contains. Here's my basic query: var orders = (from cert in _orderRepository.GetAll() where !cert.PrintedPackSlip orderby cert.CardNumber //group cert by cert.CardNumber //into certGrp select cert); What I need to do is group by CardNumber and do a count of how many orders have that card number.
c#
linq
null
null
null
null
open
LINQ query to select object and count === I'm trying to do a query to generate packing slips, and need general order info, as well as how many items the order contains. Here's my basic query: var orders = (from cert in _orderRepository.GetAll() where !cert.PrintedPackSlip orderby cert.CardNumber //group cert by cert.CardNumber //into certGrp select cert); What I need to do is group by CardNumber and do a count of how many orders have that card number.
0
11,350,889
07/05/2012 19:05:10
566,616
01/07/2011 08:29:23
25
0
Error 500 when calling get_instance from a library in CodeIgniter
I'm trying to extend the CodeIgniter log library with a bit of additional information that I load from the "Session" library. This appears to be possible according to the information here: http://codeigniter.com/user_guide/general/creating_libraries.html So, I created a file in application/libraries called MY_Log.php with the following: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Log extends CI_Log { function __construct() { parent::__construct(); $CI =& get_instance(); $CI->load->library('session'); } } ?> The trouble is, whenever I call get_instance from within this file, I get a "500 Internal Server Error". I tried swapping out my codeigniter system directory with a fresh copy of the latest version (2.1.2), but I get the same error. What am I doing wrong? Thanks in advance.
php
codeigniter
http-status-code-500
null
null
null
open
Error 500 when calling get_instance from a library in CodeIgniter === I'm trying to extend the CodeIgniter log library with a bit of additional information that I load from the "Session" library. This appears to be possible according to the information here: http://codeigniter.com/user_guide/general/creating_libraries.html So, I created a file in application/libraries called MY_Log.php with the following: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Log extends CI_Log { function __construct() { parent::__construct(); $CI =& get_instance(); $CI->load->library('session'); } } ?> The trouble is, whenever I call get_instance from within this file, I get a "500 Internal Server Error". I tried swapping out my codeigniter system directory with a fresh copy of the latest version (2.1.2), but I get the same error. What am I doing wrong? Thanks in advance.
0
11,350,891
07/05/2012 19:05:38
108,000
05/15/2009 23:09:33
934
8
Cache issue & routing issue with Passenger 3.0.2
I have many rails applications on DreamHost VPS. They upgraded Passenger 3.0.2-1. over the last weekend. Since that, I have a few issues. - My cache dir is public/cache and it causes routing error. This is a known issue: http://code.google.com/p/phusion-passenger/issues/detail?id=563 . So I changed the dir to public. - While redirecting, rails gives an error (randomly about 1 out of 3 times). It says that /internal_error.html doesn't exist. But it does exist. I already complained to DreamHost. However, I'd like to solve it by myself right now. Do you have any idea how to fix them? Especially the 2nd issue? Thanks. Sam
ruby-on-rails
passenger
null
null
null
null
open
Cache issue & routing issue with Passenger 3.0.2 === I have many rails applications on DreamHost VPS. They upgraded Passenger 3.0.2-1. over the last weekend. Since that, I have a few issues. - My cache dir is public/cache and it causes routing error. This is a known issue: http://code.google.com/p/phusion-passenger/issues/detail?id=563 . So I changed the dir to public. - While redirecting, rails gives an error (randomly about 1 out of 3 times). It says that /internal_error.html doesn't exist. But it does exist. I already complained to DreamHost. However, I'd like to solve it by myself right now. Do you have any idea how to fix them? Especially the 2nd issue? Thanks. Sam
0
11,350,899
07/05/2012 19:06:00
785,214
06/05/2011 23:16:29
78
1
C++ references and references parameters
Please look at the code snippet below - I have declared 3 functions (i.e. 1 passing an int and the others passing reference to an int). After executing the program I found that the value of "count" variable after calling function (tripleByReference) has not been changed to reflect its triple (count is still equal to 5). However calling function (tripleByReferenceVoid) modifies the variable but this is due to the fact that changes occurred directly to the variable (count). I understand that with pass by reference, the caller gives the called function the ability to access the caller's data directly and modify it but that could not be achieved by passing the variable to function (tripleByReference) - Please help me to understand this. #include <iostream> using namespace std; /* function Prototypes */ int tripleByValue(int); int tripleByReference(int &); void tripleByReferenceVoid(int &); int main(void) { int count = 5; //call by value cout << "Value of count before passing by value is: " << count << endl; cout << "Passing " << count << " by value, output is: " << tripleByValue(count) << endl; cout << "Value of count after passing by value is: " << count << endl; //call by reference - using int tripleByReference cout << "\n\nValue of count before passing by reference is: " << count << endl; cout << "Passing " << count << " by reference, output is: " << tripleByReference(count) << endl; cout << "Value of count after passing by reference is: " << count << endl; //call by reference - using void tripleByReference tripleByReferenceVoid(count); cout << "\n\nValue of count after passing by reference is: " << count << endl; cout << endl; system("PAUSE"); return 0; }//end main int tripleByValue (int count) { int result = count * count * count; return result; }//end tirpleByValue function int tripleByReference(int &count) { int result = count * count * count; return result; //perform calcs }//end tripleByReference function void tripleByReferenceVoid(int &count) { count *= count * count; }//end tripleByReference function Thank you.
c++
null
null
null
null
null
open
C++ references and references parameters === Please look at the code snippet below - I have declared 3 functions (i.e. 1 passing an int and the others passing reference to an int). After executing the program I found that the value of "count" variable after calling function (tripleByReference) has not been changed to reflect its triple (count is still equal to 5). However calling function (tripleByReferenceVoid) modifies the variable but this is due to the fact that changes occurred directly to the variable (count). I understand that with pass by reference, the caller gives the called function the ability to access the caller's data directly and modify it but that could not be achieved by passing the variable to function (tripleByReference) - Please help me to understand this. #include <iostream> using namespace std; /* function Prototypes */ int tripleByValue(int); int tripleByReference(int &); void tripleByReferenceVoid(int &); int main(void) { int count = 5; //call by value cout << "Value of count before passing by value is: " << count << endl; cout << "Passing " << count << " by value, output is: " << tripleByValue(count) << endl; cout << "Value of count after passing by value is: " << count << endl; //call by reference - using int tripleByReference cout << "\n\nValue of count before passing by reference is: " << count << endl; cout << "Passing " << count << " by reference, output is: " << tripleByReference(count) << endl; cout << "Value of count after passing by reference is: " << count << endl; //call by reference - using void tripleByReference tripleByReferenceVoid(count); cout << "\n\nValue of count after passing by reference is: " << count << endl; cout << endl; system("PAUSE"); return 0; }//end main int tripleByValue (int count) { int result = count * count * count; return result; }//end tirpleByValue function int tripleByReference(int &count) { int result = count * count * count; return result; //perform calcs }//end tripleByReference function void tripleByReferenceVoid(int &count) { count *= count * count; }//end tripleByReference function Thank you.
0
11,350,900
07/05/2012 19:06:03
1,175,276
01/28/2012 14:18:41
247
4
JavaScript getElementsByTagName not working
I have a HTML page, with several links on it. I want to make all those links open in a different tab, so I tried using var foo = document.getElementsByTagName("a"); for(var i = 0; i < foo.length; i++) { foo[i].target = "_blank"; } But why is that not working (as far as I know, `getElementsByTagName()` returns an array, I might as well be wrong)?
javascript
html
hyperlink
null
null
null
open
JavaScript getElementsByTagName not working === I have a HTML page, with several links on it. I want to make all those links open in a different tab, so I tried using var foo = document.getElementsByTagName("a"); for(var i = 0; i < foo.length; i++) { foo[i].target = "_blank"; } But why is that not working (as far as I know, `getElementsByTagName()` returns an array, I might as well be wrong)?
0
11,350,903
07/05/2012 19:06:11
218,471
11/25/2009 10:20:05
1,362
20
How to make Lisp forget about previously exported symbols?
This is how I export symbols `:bar` and `:baz` from package `foo`: (in-package :cl-user) (defpackage foo (:use :cl) (:export :bar :baz)) (in-package :foo) When I remove `:baz` from the list of exported symbols SBCL complains and the compilation fails. warning: FOO also exports the following symbols: (FOO:BAZ) How can I make SBCL make forget about `:baz` without reloading SLIME?
lisp
slime
sbcl
null
null
null
open
How to make Lisp forget about previously exported symbols? === This is how I export symbols `:bar` and `:baz` from package `foo`: (in-package :cl-user) (defpackage foo (:use :cl) (:export :bar :baz)) (in-package :foo) When I remove `:baz` from the list of exported symbols SBCL complains and the compilation fails. warning: FOO also exports the following symbols: (FOO:BAZ) How can I make SBCL make forget about `:baz` without reloading SLIME?
0
11,350,904
07/05/2012 19:06:12
1,504,907
07/05/2012 18:40:54
1
0
MySQL Joining Multiple Tables
I have three tables: t1.estimate, t1.mid, t1.description, t1.status t2.mid, t2.mname, t2.mphone, t2.memail t3.estimate, t3.action I need to join these tables, but that issue that I am having is that t2 and t3 may contain no records to join to t1. Table t1 is the primary table that will have the filter applied. Table t2 will 99.9% of the time contain a match when join 'mid'. But table t3 is a table that only stores information and creates an estimate when a user enters it into the table. There can be 40,000 plus records in t1, but only 5,000 in t3. Here is my current code, but it's only displaying records that are in all three tables. I would like values to be shown from t1 even if there are no records to join on t2 and t3. SELECT DISTINCT t1.estimate, t1.mid, t2.mname, t1.description, t1.status,GROUP_CONCAT(t3.action) FROM t1 LEFT OUTER JOIN t2 ON t1.mid = t2.mid LEFT OUTER JOIN t3 ON t1.estimate = t3.estimate WHERE t1.status LIKE '0%'GROUP BY t3.estimate
mysql
query
table
join
null
null
open
MySQL Joining Multiple Tables === I have three tables: t1.estimate, t1.mid, t1.description, t1.status t2.mid, t2.mname, t2.mphone, t2.memail t3.estimate, t3.action I need to join these tables, but that issue that I am having is that t2 and t3 may contain no records to join to t1. Table t1 is the primary table that will have the filter applied. Table t2 will 99.9% of the time contain a match when join 'mid'. But table t3 is a table that only stores information and creates an estimate when a user enters it into the table. There can be 40,000 plus records in t1, but only 5,000 in t3. Here is my current code, but it's only displaying records that are in all three tables. I would like values to be shown from t1 even if there are no records to join on t2 and t3. SELECT DISTINCT t1.estimate, t1.mid, t2.mname, t1.description, t1.status,GROUP_CONCAT(t3.action) FROM t1 LEFT OUTER JOIN t2 ON t1.mid = t2.mid LEFT OUTER JOIN t3 ON t1.estimate = t3.estimate WHERE t1.status LIKE '0%'GROUP BY t3.estimate
0
11,350,753
07/05/2012 18:56:19
50,312
12/30/2008 21:31:53
1,271
34
running a function on a column twice
Lets suppose I have a DB. Lets call this database Utils. In `Utils` I have 2 functions. Okay lets say I am currently working in db `MyDatabase`. I need to calculate some fields in a table. This is how I currently do it: My select statement looks like the following SELECT *, column1= UTILS.dbo.Function1(ID) column2 =UTILS.dbo.Function1(Name column3 =UTILS.dbo.Function1(Address) INTO ##temp_table1 FROM MyDatabase.dbo.Customers SELECT *, column1= UTILS.dbo.Function2(ID) column2 =UTILS.dbo.Function2(Name column3 =UTILS.dbo.Function2(Address) INTO ##temp_table2 FROM MyDatabase.dbo.Customers The problem with this is that I don't just have 3 columns to be calcualted. I have about 100. So I really don't want to repeat the select statement twice because if a change comes along then I have to change it in two places which is error prone, makes my script very long and hard to read and other issues. My solution USE Utils; GO; DECLARE @strSQL VARCHAR(MAX) SET @strSQL = ' SELECT *, column1= UTILS.dbo.temp_function(ID) column2 =UTILS.dbo.temp_function(Name column3 =UTILS.dbo.temp_function(Address) ' exec sp_rename 'UTILS.dbo.Function1' ,'temp_function' exec (@strSQL + 'into temp_table1 FROM Customers') exec sp_rename 'temp_function' ,'UTILS.dbo.Function1' exec sp_rename 'UTILS.dbo.Function2' ,'temp_function' exec (@strSQL + 'into temp_table2 FROM Customers') exec sp_rename 'temp_function' ,'UTILS.dbo.Function2' But I dont like this solution since i Have to change databases to use `sp_rename`. It also gives me caution. And MSDN advises against it. What is a good way to overcome this problem?
tsql
null
null
null
null
null
open
running a function on a column twice === Lets suppose I have a DB. Lets call this database Utils. In `Utils` I have 2 functions. Okay lets say I am currently working in db `MyDatabase`. I need to calculate some fields in a table. This is how I currently do it: My select statement looks like the following SELECT *, column1= UTILS.dbo.Function1(ID) column2 =UTILS.dbo.Function1(Name column3 =UTILS.dbo.Function1(Address) INTO ##temp_table1 FROM MyDatabase.dbo.Customers SELECT *, column1= UTILS.dbo.Function2(ID) column2 =UTILS.dbo.Function2(Name column3 =UTILS.dbo.Function2(Address) INTO ##temp_table2 FROM MyDatabase.dbo.Customers The problem with this is that I don't just have 3 columns to be calcualted. I have about 100. So I really don't want to repeat the select statement twice because if a change comes along then I have to change it in two places which is error prone, makes my script very long and hard to read and other issues. My solution USE Utils; GO; DECLARE @strSQL VARCHAR(MAX) SET @strSQL = ' SELECT *, column1= UTILS.dbo.temp_function(ID) column2 =UTILS.dbo.temp_function(Name column3 =UTILS.dbo.temp_function(Address) ' exec sp_rename 'UTILS.dbo.Function1' ,'temp_function' exec (@strSQL + 'into temp_table1 FROM Customers') exec sp_rename 'temp_function' ,'UTILS.dbo.Function1' exec sp_rename 'UTILS.dbo.Function2' ,'temp_function' exec (@strSQL + 'into temp_table2 FROM Customers') exec sp_rename 'temp_function' ,'UTILS.dbo.Function2' But I dont like this solution since i Have to change databases to use `sp_rename`. It also gives me caution. And MSDN advises against it. What is a good way to overcome this problem?
0
11,411,085
07/10/2012 10:12:14
259,541
01/26/2010 20:14:02
7,496
157
Why is the mouseenter part of this hover executing, but not the mouseleave?
I am using [this syntax option][1] for jquery hover. Here is my code: $('mySelector') .hover( function(){ $(this).html('<img src="images/myImage2.png" height="23" width="24" />'); }, function(){ $(this).html('<img src="images/myImage1.png" height="23" width="24" />'); } ); The original text for the element referenced by mySelector is the mouseleave option - `$(this).html('<img src="images/myImage1.png" height="23" width="24" />');` The first handler, for mouseenter/mouseover, is working correctly. But the second handler, for mouseleave/mouseout (which should restore the original image), never executes. When I trace it in firebug, the mouseover event is triggered, but the second "function()" is not reached. [1]: http://api.jquery.com/hover/#example-1
jquery
hover
mouseevent
null
null
null
open
Why is the mouseenter part of this hover executing, but not the mouseleave? === I am using [this syntax option][1] for jquery hover. Here is my code: $('mySelector') .hover( function(){ $(this).html('<img src="images/myImage2.png" height="23" width="24" />'); }, function(){ $(this).html('<img src="images/myImage1.png" height="23" width="24" />'); } ); The original text for the element referenced by mySelector is the mouseleave option - `$(this).html('<img src="images/myImage1.png" height="23" width="24" />');` The first handler, for mouseenter/mouseover, is working correctly. But the second handler, for mouseleave/mouseout (which should restore the original image), never executes. When I trace it in firebug, the mouseover event is triggered, but the second "function()" is not reached. [1]: http://api.jquery.com/hover/#example-1
0
11,411,091
07/10/2012 10:12:28
1,147,909
01/13/2012 14:54:52
105
11
How To Serialize A .net Class To Disk
I'm trying to serialize an object cache to disk so it can be loaded the next time the program is loaded. One of the features of the class being saved is it contains references to other objects. For example: I have a list of an image class that stores remote url, local filepath, if it's been downloaded etc.... I then bind visibility to downloaded and the source to the local filepath. Other Objects have a reference to this image so when the image is downloaded it's updated once and all the bindings update across all items that are pointing at it. As a quick fix I implemented a binary formatter and all is working correctly. All my lists are serialized to disk and when I reload them all the references remain (I.E 1 image object is created and everything that uses it has a reference as opposed to deserialisation creating a new instance of Image everytime it appears) My question is what kind of Serialier I should be using to store to disk whilst not breaking my references? I've read that BinaryFormatter is a BAD choice for serializing to disk and expecting it to work across different releases. Although I've had no issues with it so far I don't want to run into problems a year down the road and force all my users so re-aquire all their cached metadata. I'm not 100% sure how all the different serializers work but I presume I may need to write some kind of convertor if I were to use XML. If it helps, all of my image objects have a GUID assigned to them so I have something unique about every object.
c#
.net
null
null
null
null
open
How To Serialize A .net Class To Disk === I'm trying to serialize an object cache to disk so it can be loaded the next time the program is loaded. One of the features of the class being saved is it contains references to other objects. For example: I have a list of an image class that stores remote url, local filepath, if it's been downloaded etc.... I then bind visibility to downloaded and the source to the local filepath. Other Objects have a reference to this image so when the image is downloaded it's updated once and all the bindings update across all items that are pointing at it. As a quick fix I implemented a binary formatter and all is working correctly. All my lists are serialized to disk and when I reload them all the references remain (I.E 1 image object is created and everything that uses it has a reference as opposed to deserialisation creating a new instance of Image everytime it appears) My question is what kind of Serialier I should be using to store to disk whilst not breaking my references? I've read that BinaryFormatter is a BAD choice for serializing to disk and expecting it to work across different releases. Although I've had no issues with it so far I don't want to run into problems a year down the road and force all my users so re-aquire all their cached metadata. I'm not 100% sure how all the different serializers work but I presume I may need to write some kind of convertor if I were to use XML. If it helps, all of my image objects have a GUID assigned to them so I have something unique about every object.
0
11,411,092
07/10/2012 10:12:35
259,913
01/27/2010 09:30:19
137
13
SharePoint Silverlight odd behaviour when displaying dates
I've been picking up odds and sods from a previous developer and have come accross something quite strange. I have a list with dates in it. This data is correct and the end user is confident of the data integrity. THe funny thing happens when you try to display the data in silverlight. Some dates seem to have -1 day so the 6th become the 5th etc etc. After looking at various articles it looks like it's something to do with daylight saving as some records have the date and 23:00:00 against them and others have the date and 00:00:00 We have toggling with daylight saving but with no luck. If anyone has any ideas they are very much welcome with open arms :) ! Cheers Truez
silverlight
sharepoint
sharepoint2010
null
null
null
open
SharePoint Silverlight odd behaviour when displaying dates === I've been picking up odds and sods from a previous developer and have come accross something quite strange. I have a list with dates in it. This data is correct and the end user is confident of the data integrity. THe funny thing happens when you try to display the data in silverlight. Some dates seem to have -1 day so the 6th become the 5th etc etc. After looking at various articles it looks like it's something to do with daylight saving as some records have the date and 23:00:00 against them and others have the date and 00:00:00 We have toggling with daylight saving but with no luck. If anyone has any ideas they are very much welcome with open arms :) ! Cheers Truez
0
11,411,095
07/10/2012 10:13:00
761,347
05/19/2011 15:22:32
180
14
$_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] not set correctly in Zend Studio
I set up unit testing in Zend Studio last week, and it was working fine.. until suddenly after some refactoring, I got an error that the following file was not found in ZendPHPUnit.php: /var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.2428213892936827201.php The file path is stored in $_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] in ZendPHPUnit.php I checked the folder and I found zend.phpunit.UserrMapperTest.php.6031927106542896607.php (the number is different) I was a little desperate so I made it work by forcing $_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] = '/var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.6031927106542896607.php'; Eventually, after I worked with a few other test cases, the problem fixed itself. Now, I refactored some code again, and the problem is back. None of my testcases work. Restarting the comp doesnt help, Project -> Clean doesnt help. I am on a mac running Snow Leopard. Any insights on what is causing this? Thanks!
zend-framework
phpunit
zend-studio
null
null
null
open
$_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] not set correctly in Zend Studio === I set up unit testing in Zend Studio last week, and it was working fine.. until suddenly after some refactoring, I got an error that the following file was not found in ZendPHPUnit.php: /var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.2428213892936827201.php The file path is stored in $_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] in ZendPHPUnit.php I checked the folder and I found zend.phpunit.UserrMapperTest.php.6031927106542896607.php (the number is different) I was a little desperate so I made it work by forcing $_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] = '/var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.6031927106542896607.php'; Eventually, after I worked with a few other test cases, the problem fixed itself. Now, I refactored some code again, and the problem is back. None of my testcases work. Restarting the comp doesnt help, Project -> Clean doesnt help. I am on a mac running Snow Leopard. Any insights on what is causing this? Thanks!
0