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,349,480
07/05/2012 17:30:53
921,177
08/31/2011 08:10:57
30
0
Apply several string transformations in scala
I want to perform several ordered and successive replaceAll(...,...) on a string in a functional way in scala. What's the most elegant solution ? Scalaz welcome ! ;)
scala
functional-programming
scalaz
null
null
null
open
Apply several string transformations in scala === I want to perform several ordered and successive replaceAll(...,...) on a string in a functional way in scala. What's the most elegant solution ? Scalaz welcome ! ;)
0
11,349,523
07/05/2012 17:33:57
1,504,737
07/05/2012 17:14:38
1
0
Ctrl-y behavior in gnuplot - not yanking in OS X
Typically, ctrl-y yanks previously killed text. This works very well in the terminal to cut and paste text. However, once I start gnuplot, using ctrl-y suspends the program. The odd thing is that this only happens in my OS X machine. On my Ubuntu 12.04, the ctrl-y inside the gnuplot has the expected behavior of yanking text. Any ideas ideas on why this is happening? And how can I make ctrl-y to have the expected behavior in a interactive gnuplot session?
gnuplot
null
null
null
null
null
open
Ctrl-y behavior in gnuplot - not yanking in OS X === Typically, ctrl-y yanks previously killed text. This works very well in the terminal to cut and paste text. However, once I start gnuplot, using ctrl-y suspends the program. The odd thing is that this only happens in my OS X machine. On my Ubuntu 12.04, the ctrl-y inside the gnuplot has the expected behavior of yanking text. Any ideas ideas on why this is happening? And how can I make ctrl-y to have the expected behavior in a interactive gnuplot session?
0
11,349,527
07/05/2012 17:34:05
1,457,957
06/15/2012 06:30:12
1
0
Change the size of the portlet conditionally
i want to change the size of the portlet when i click the button. Change to specific dimensions. Any ideas how to do it?
portlet
null
null
null
null
07/06/2012 10:51:16
not a real question
Change the size of the portlet conditionally === i want to change the size of the portlet when i click the button. Change to specific dimensions. Any ideas how to do it?
1
11,349,530
07/05/2012 17:34:09
1,344,642
04/19/2012 17:14:32
39
3
Magento override controller
I would like to do the above. Ive overridden many files in the past...block, model, helper....but this one eludes me. Can anyone see what im doing wrong here: Heres my folder structure: /Idigital/Idgeneral/etc/config.xml /Idigital/Idgeneral/controllers/Checkout/CartController.php Heres my config.xml: <global> <modules> <idigital_idgeneral> <version>0.1.0</version> </idigital_idgeneral> </modules> <blocks> <idgeneral><class>Idigital_Idgeneral_Block</class></idgeneral> </blocks> </global> <frontend> <routers> <checkout> <args> <modules> <Idigital_Idgeneral before="Mage_Checkout">Idgeneral_Checkout</Idigital_Idgeneral> </modules> </args> </checkout> </routers> <layout> <updates> <idgeneral> <file>idigital.xml</file> </idgeneral> </updates> </layout> </frontend> And heres the top of my controller file: require_once 'Mage/Checkout/controllers/CartController.php'; class Idigital_Idgeneral_Checkout_CartController extends Mage_Checkout_CartController { /** * Add product to shopping cart action */ public function addAction() { When i visit: /checkout/cart/add Im directed to the mage controller...not my local. (i have var_dump stmts in each..so i can see which is ran).
magento
controller
override
cart
null
null
open
Magento override controller === I would like to do the above. Ive overridden many files in the past...block, model, helper....but this one eludes me. Can anyone see what im doing wrong here: Heres my folder structure: /Idigital/Idgeneral/etc/config.xml /Idigital/Idgeneral/controllers/Checkout/CartController.php Heres my config.xml: <global> <modules> <idigital_idgeneral> <version>0.1.0</version> </idigital_idgeneral> </modules> <blocks> <idgeneral><class>Idigital_Idgeneral_Block</class></idgeneral> </blocks> </global> <frontend> <routers> <checkout> <args> <modules> <Idigital_Idgeneral before="Mage_Checkout">Idgeneral_Checkout</Idigital_Idgeneral> </modules> </args> </checkout> </routers> <layout> <updates> <idgeneral> <file>idigital.xml</file> </idgeneral> </updates> </layout> </frontend> And heres the top of my controller file: require_once 'Mage/Checkout/controllers/CartController.php'; class Idigital_Idgeneral_Checkout_CartController extends Mage_Checkout_CartController { /** * Add product to shopping cart action */ public function addAction() { When i visit: /checkout/cart/add Im directed to the mage controller...not my local. (i have var_dump stmts in each..so i can see which is ran).
0
11,348,925
07/05/2012 16:49:14
1,359,454
04/26/2012 18:28:49
24
2
Can i get age or date of birth of users using Twitter API?
I'm working on a research and I need to get the age/date of birth of any user using Twitter API. Is it possible to do that?
twitter
twitter-api
null
null
null
null
open
Can i get age or date of birth of users using Twitter API? === I'm working on a research and I need to get the age/date of birth of any user using Twitter API. Is it possible to do that?
0
11,349,539
07/05/2012 17:34:45
1,475,331
06/22/2012 15:54:30
33
1
WCF: Authentication Service or token-based security?
There's a **Dynamic CRM** instance on a server ("on-premises"). It will be used by **a few sites** that run on distant machines (another domain, another Active Directory). The communication between those sites and the CRM instance is done via a **CRM proxy**, a WCF service that sits near it (near CRM), handles requests, queries CRM etc. That WCF service is facing the Internet. Although secured communication channels aren't that necessary, authentication is. We cannot let random clients to use the services provided by the CRM proxy. So, Authentication Service (cookies?) / hand-coded token passing (as a parameter for each service operation) / [this solution - on stackoverflow][1]. [1]: http://stackoverflow.com/questions/1861868/token-based-authentication-in-wcf Thank you in advance! PS: hand-coded tokens would be "time-sensitive" and hashed a few times with some secret keys. Man-in-the-middle might not be such a big problem, as a token can be invalidated after a request.
c#
wcf
rest
dynamics-crm-2011
null
null
open
WCF: Authentication Service or token-based security? === There's a **Dynamic CRM** instance on a server ("on-premises"). It will be used by **a few sites** that run on distant machines (another domain, another Active Directory). The communication between those sites and the CRM instance is done via a **CRM proxy**, a WCF service that sits near it (near CRM), handles requests, queries CRM etc. That WCF service is facing the Internet. Although secured communication channels aren't that necessary, authentication is. We cannot let random clients to use the services provided by the CRM proxy. So, Authentication Service (cookies?) / hand-coded token passing (as a parameter for each service operation) / [this solution - on stackoverflow][1]. [1]: http://stackoverflow.com/questions/1861868/token-based-authentication-in-wcf Thank you in advance! PS: hand-coded tokens would be "time-sensitive" and hashed a few times with some secret keys. Man-in-the-middle might not be such a big problem, as a token can be invalidated after a request.
0
11,541,497
07/18/2012 12:34:59
1,117,675
12/27/2011 13:12:24
767
69
Whats the reason for "Deprecated encryption algorithm"?
Was having a look at sys.dm_os_performance_counters to find out what deprecated features is used on my SQL Server 2008 R2: SELECT [object_name], instance_name, cntr_value FROM sys.dm_os_performance_counters WHERE [object_name] LIKE '%:Deprecated Features%' And cntr_value > 0 Order By cntr_value desc **Found lots of "Deprecated encryption algorithm". Cant understand why..** In SQL Profiler i can catch "*Deprecated encryption algorithm rc4 will be removed in a future version of SQL Server[..]*", but cant really understand what T-SQL causes it. and cant find any place where is used RC4 algorithm (because of [this][1]). There is no Asymmetric keys. Symmetric keys use AES_256 algorithm, protected by certificate, certificate is protected by DMK. [1]: http://technet.microsoft.com/en-us/library/ms345262%28v=sql.105%29.aspx
sql-server
sql-server-2008
encryption
null
null
null
open
Whats the reason for "Deprecated encryption algorithm"? === Was having a look at sys.dm_os_performance_counters to find out what deprecated features is used on my SQL Server 2008 R2: SELECT [object_name], instance_name, cntr_value FROM sys.dm_os_performance_counters WHERE [object_name] LIKE '%:Deprecated Features%' And cntr_value > 0 Order By cntr_value desc **Found lots of "Deprecated encryption algorithm". Cant understand why..** In SQL Profiler i can catch "*Deprecated encryption algorithm rc4 will be removed in a future version of SQL Server[..]*", but cant really understand what T-SQL causes it. and cant find any place where is used RC4 algorithm (because of [this][1]). There is no Asymmetric keys. Symmetric keys use AES_256 algorithm, protected by certificate, certificate is protected by DMK. [1]: http://technet.microsoft.com/en-us/library/ms345262%28v=sql.105%29.aspx
0
11,541,231
07/18/2012 12:21:23
1,384,223
05/09/2012 09:41:42
72
3
Navigation drop down menu not showing using simple css and HTML
I have a drop down menu list made in css and plain HTMl. It works fine but it rolls under my image slider , and I can see on a part of the menu when i hover on any of my menu.
html
css
null
null
null
null
open
Navigation drop down menu not showing using simple css and HTML === I have a drop down menu list made in css and plain HTMl. It works fine but it rolls under my image slider , and I can see on a part of the menu when i hover on any of my menu.
0
11,541,503
07/18/2012 12:35:11
371,465
06/20/2010 09:55:18
95
2
Alternatives for $() / jquery()
I would like to use my own symbol instead of _$()_ or _jquery()_. Is it possible? I strongly feel **NO**.
jquery
null
null
null
null
null
open
Alternatives for $() / jquery() === I would like to use my own symbol instead of _$()_ or _jquery()_. Is it possible? I strongly feel **NO**.
0
11,541,510
07/18/2012 12:35:24
179,736
09/27/2009 11:27:55
10,075
60
Under heavy load of my Node.JS server, I'm getting ECONNRESET socket error?
So I have an API server and a Web server. The web server is basically a client that talks to the API server. They both use Node.js wit REST endpoints. When my web server hits the API server, sometimes I get {"err":{"code":"ECONNRESET"}} ...it's really random and sometimes I get it, sometimes in different places. It's really hard to figure out what's going on, because I get it at different places. How can I resolve this? I already increased "ulimit -n" to 99999. What can I do? It freezes everything and the server can't move on when this happens.
sockets
node.js
url
rest
tcp
null
open
Under heavy load of my Node.JS server, I'm getting ECONNRESET socket error? === So I have an API server and a Web server. The web server is basically a client that talks to the API server. They both use Node.js wit REST endpoints. When my web server hits the API server, sometimes I get {"err":{"code":"ECONNRESET"}} ...it's really random and sometimes I get it, sometimes in different places. It's really hard to figure out what's going on, because I get it at different places. How can I resolve this? I already increased "ulimit -n" to 99999. What can I do? It freezes everything and the server can't move on when this happens.
0
11,541,512
07/18/2012 12:35:32
1,417,814
05/25/2012 16:05:11
39
1
Bizarre readfile() issue
My script is the following: <?php header("Content-type:application/pdf"); // It will be called downloaded.pdf header("Content-Disposition:attachment;filename='test.pdf'"); // The PDF source is in original.pdf readfile("www.example.com/test.pdf"); ?> Now if I change readfile to say: // The PDF source is in original.pdf readfile("test.pdf"); It works fine, if however I specify and absolute URL, `readfile("www.example.com/test.pdf");` the PDF does not open up. The above only seems to work locally. Does anybody know why absolute url's are not working? Cheers
php
null
null
null
null
null
open
Bizarre readfile() issue === My script is the following: <?php header("Content-type:application/pdf"); // It will be called downloaded.pdf header("Content-Disposition:attachment;filename='test.pdf'"); // The PDF source is in original.pdf readfile("www.example.com/test.pdf"); ?> Now if I change readfile to say: // The PDF source is in original.pdf readfile("test.pdf"); It works fine, if however I specify and absolute URL, `readfile("www.example.com/test.pdf");` the PDF does not open up. The above only seems to work locally. Does anybody know why absolute url's are not working? Cheers
0
11,541,513
07/18/2012 12:35:35
861,832
07/25/2011 15:08:21
700
9
Multiple Autocomplete Widget
Can anybody suggest widgets that deal with multiple autocomplete selections, rather than just one?
javascript
jquery
null
null
null
null
open
Multiple Autocomplete Widget === Can anybody suggest widgets that deal with multiple autocomplete selections, rather than just one?
0
11,541,515
07/18/2012 12:35:41
546,476
12/17/2010 19:59:29
474
11
Marching Cubes (C++ to C#)
I am trying to implement marching cubes in C#, but I've come to a part where I don't understand the algorithm and I don't how to implement it. `int Polygonise(GRIDCELL grid, double isolevel, TRIANGLE *triangles)` The third argument I don't really understand. I know it's a pointer, but later on in the algo, when you set the triangles it appears as though the `triangles` variable is an array of the `TRIANGLE` struct: int ntriang = 0; for (int i=0; triTable[cubeindex,i]!=-1; i+=3) { triangles[ntriang].p[i ] = vertlist[triTable[cubeindex,i ]]; triangles[ntriang].p[i+1] = vertlist[triTable[cubeindex,i+1]]; triangles[ntriang].p[i+2] = vertlist[triTable[cubeindex,i+2]]; ntriang++; } Notice the `triangles[ntriang]`. That doesn't make sense because before we set `triangles` to `TRIANGLE *triangles`. I also don't understand why It's a pointer.
c++
pointers
marching-cubes
null
null
null
open
Marching Cubes (C++ to C#) === I am trying to implement marching cubes in C#, but I've come to a part where I don't understand the algorithm and I don't how to implement it. `int Polygonise(GRIDCELL grid, double isolevel, TRIANGLE *triangles)` The third argument I don't really understand. I know it's a pointer, but later on in the algo, when you set the triangles it appears as though the `triangles` variable is an array of the `TRIANGLE` struct: int ntriang = 0; for (int i=0; triTable[cubeindex,i]!=-1; i+=3) { triangles[ntriang].p[i ] = vertlist[triTable[cubeindex,i ]]; triangles[ntriang].p[i+1] = vertlist[triTable[cubeindex,i+1]]; triangles[ntriang].p[i+2] = vertlist[triTable[cubeindex,i+2]]; ntriang++; } Notice the `triangles[ntriang]`. That doesn't make sense because before we set `triangles` to `TRIANGLE *triangles`. I also don't understand why It's a pointer.
0
11,541,516
07/18/2012 12:35:46
1,404,861
05/19/2012 08:42:43
6
0
openssl 0.9.8.j possible bug
I am working on ssl client using openssl library 0.9.8j in C.I need to connect to a server and to verify server's certificate.First I do test this way: openssl s_client -connect 46.38.167.198:443 -CAfile /home/user/Desktop/sf_sharewin/tftp/verisign.pem It works fine on version 0.9.8g on my Linux machine.But when I use version 0.9.8j on my uCLinux device the same test the result is "error 20 unable to get local issuer certificate". I wrote some C code (under ucLinux and 0.9.8j version) and the function SSL_get_verify_result(ssl) return the same error 20. I am sure that PEM file is the correct one and the path is the correct one. Where could be the problem? Thanks!
openssl
null
null
null
null
null
open
openssl 0.9.8.j possible bug === I am working on ssl client using openssl library 0.9.8j in C.I need to connect to a server and to verify server's certificate.First I do test this way: openssl s_client -connect 46.38.167.198:443 -CAfile /home/user/Desktop/sf_sharewin/tftp/verisign.pem It works fine on version 0.9.8g on my Linux machine.But when I use version 0.9.8j on my uCLinux device the same test the result is "error 20 unable to get local issuer certificate". I wrote some C code (under ucLinux and 0.9.8j version) and the function SSL_get_verify_result(ssl) return the same error 20. I am sure that PEM file is the correct one and the path is the correct one. Where could be the problem? Thanks!
0
11,541,485
07/18/2012 12:34:33
766,920
05/24/2011 00:38:36
49
2
Rails - Making a plugin
I've made a comment system for my blog, and now I want to share with some friends. What do I have to do? I'm not familiar with plugins/engines/gems (in fact I don't even know the distinction between them). My comment system has: * Model (Comment.rb) * Partial (_comment.erb.html) * Some assets (comments.css, comments.js and 2 images) * Some relationships (belongs to Post, has many Votes) What I want is to offer some configurations, like using another model instead of Post. You can see the comment system [here](http://jmorais.com/blog/hello-world). (Yes, it's totally inspired in Reddit)
ruby-on-rails-3
null
null
null
null
null
open
Rails - Making a plugin === I've made a comment system for my blog, and now I want to share with some friends. What do I have to do? I'm not familiar with plugins/engines/gems (in fact I don't even know the distinction between them). My comment system has: * Model (Comment.rb) * Partial (_comment.erb.html) * Some assets (comments.css, comments.js and 2 images) * Some relationships (belongs to Post, has many Votes) What I want is to offer some configurations, like using another model instead of Post. You can see the comment system [here](http://jmorais.com/blog/hello-world). (Yes, it's totally inspired in Reddit)
0
11,541,486
07/18/2012 12:34:37
1,488,804
06/28/2012 14:06:30
30
0
Trouble with -n in sed command with Mac
I'm writing a script using sed to look for a string in one file - temp.txt (a version number) and take this string and update the version number in another file. Here is the relevant code snippet. >new=$(sed -n '/version: /p' temp.txt) sed -i .bk "s/version: [.0-9]*/version: $new/" file2.txt The problem I'm having is that the variable `new` doesn't take just the one line with the version number on it, but instead takes the whole file, file2.txt. This leads me to believe that the `-n` part of the command isn't working, as this should suppress the printing of all lines but those with the string `version` in them. I think this could be a problem with the version of sed I am using (on a mac). Alternatively I could be using the sed command wrong. Any help would be appreciated. I'd rather not update my version of sed, since this script will not just be running on my computer. So any workarounds would be ideal. Thanks
shell
sed
null
null
null
null
open
Trouble with -n in sed command with Mac === I'm writing a script using sed to look for a string in one file - temp.txt (a version number) and take this string and update the version number in another file. Here is the relevant code snippet. >new=$(sed -n '/version: /p' temp.txt) sed -i .bk "s/version: [.0-9]*/version: $new/" file2.txt The problem I'm having is that the variable `new` doesn't take just the one line with the version number on it, but instead takes the whole file, file2.txt. This leads me to believe that the `-n` part of the command isn't working, as this should suppress the printing of all lines but those with the string `version` in them. I think this could be a problem with the version of sed I am using (on a mac). Alternatively I could be using the sed command wrong. Any help would be appreciated. I'd rather not update my version of sed, since this script will not just be running on my computer. So any workarounds would be ideal. Thanks
0
11,541,519
07/18/2012 12:35:52
1,203,043
02/10/2012 22:00:27
278
4
sending integer value in c# over network
What is the way for sending integer values via client/server? I know how to send strings but how can I send an 32integer? I've looked for information in google but haven't find any helpfull information for it related to C#. Thank you.
c#
networking
tcp
client-server
null
null
open
sending integer value in c# over network === What is the way for sending integer values via client/server? I know how to send strings but how can I send an 32integer? I've looked for information in google but haven't find any helpfull information for it related to C#. Thank you.
0
11,541,520
07/18/2012 12:35:53
761,095
05/19/2011 13:01:12
165
18
Why am I getting the error on svn client "XML parse error at line 1 no element found" when accessing VisualSVN Server?
You may get the following error when using incorrect URL to access VisualSVN Server repository with a Subversion client, e.g. [TortoiseSVN][1]: XML parse error at line 1 no element found *What is the cause and how to get rid of the error?* [1]: http://tortoisesvn.net/
svn
url
visualsvn-server
null
null
null
open
Why am I getting the error on svn client "XML parse error at line 1 no element found" when accessing VisualSVN Server? === You may get the following error when using incorrect URL to access VisualSVN Server repository with a Subversion client, e.g. [TortoiseSVN][1]: XML parse error at line 1 no element found *What is the cause and how to get rid of the error?* [1]: http://tortoisesvn.net/
0
11,541,522
07/18/2012 12:35:56
1,129,317
01/04/2012 06:25:45
32
0
Jquery .click for one second
how to make the function work only after click button for one second? eg $("#button").click(function(){ $(".panel").addClass('flip'); I want `'flip'` only if the button is pressed for 1 second. if you click on it for less than a second it does not `'flip'` Please suggest.
jquery
time
click
null
null
null
open
Jquery .click for one second === how to make the function work only after click button for one second? eg $("#button").click(function(){ $(".panel").addClass('flip'); I want `'flip'` only if the button is pressed for 1 second. if you click on it for less than a second it does not `'flip'` Please suggest.
0
11,728,205
07/30/2012 19:24:35
1,536,707
07/19/2012 03:51:27
8
0
How to set UISwitch on overlay?
I've set a switch on my overlay, which appears every time my app launches the camera. The switch appears, which is fine. But how do I create the if conditions to command the switch to perform an action when on or off? //This is the overlay. - (UIView*)CommomOverlay { UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake (30,400,20,20)]; [mySwitch addTarget:self action:@selector(mySwitch) forControlEvents:UIControlEventAllTouchEvents]; [view addSubview:mySwitch]; return view; } So the switch appears on the overlay, but how do I command it do something when called? I've tried the following -(void)mySwitch { if ([mySwitch.on]){ execute this.. } } But the above doesn't work. I get an error saying "undeclared identifier, did you mean UISwitch?". So then I replace mySwitch.on with UISwitch.on, then it says " property on not found on object of type UISwitch". I just want to execute my if else method properly. I made the overlay, I made the switch code and it appears on the overly perfectly. But now I want it to do something with an if/else condition. How do I rectify this? What did I do wrong?
ios
uiswitch
null
null
null
null
open
How to set UISwitch on overlay? === I've set a switch on my overlay, which appears every time my app launches the camera. The switch appears, which is fine. But how do I create the if conditions to command the switch to perform an action when on or off? //This is the overlay. - (UIView*)CommomOverlay { UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake (30,400,20,20)]; [mySwitch addTarget:self action:@selector(mySwitch) forControlEvents:UIControlEventAllTouchEvents]; [view addSubview:mySwitch]; return view; } So the switch appears on the overlay, but how do I command it do something when called? I've tried the following -(void)mySwitch { if ([mySwitch.on]){ execute this.. } } But the above doesn't work. I get an error saying "undeclared identifier, did you mean UISwitch?". So then I replace mySwitch.on with UISwitch.on, then it says " property on not found on object of type UISwitch". I just want to execute my if else method properly. I made the overlay, I made the switch code and it appears on the overly perfectly. But now I want it to do something with an if/else condition. How do I rectify this? What did I do wrong?
0
11,728,209
07/30/2012 19:24:57
1,561,474
07/29/2012 20:11:54
11
0
How to get the name of color while having its RGB value in C#?
I am creating an application to find the most used color of an image, i am up to getting the RGB value of the color, but how to get the color name, help plz.
c#
null
null
null
null
null
open
How to get the name of color while having its RGB value in C#? === I am creating an application to find the most used color of an image, i am up to getting the RGB value of the color, but how to get the color name, help plz.
0
11,728,210
07/30/2012 19:25:03
1,469,021
06/20/2012 11:14:21
1
0
force facebook app to always use https
Is there any way to make the link to the app page use HTTPs - or another way to get the page to load facebook as a whole as https? At present the app page just loads a blank, it has to run off of https. I've also looked into if you can set the canvas URL to https to see if that would help - but facebook seems to set that for you.
facebook
application
https
null
null
null
open
force facebook app to always use https === Is there any way to make the link to the app page use HTTPs - or another way to get the page to load facebook as a whole as https? At present the app page just loads a blank, it has to run off of https. I've also looked into if you can set the canvas URL to https to see if that would help - but facebook seems to set that for you.
0
11,728,212
07/30/2012 19:25:13
222,888
12/02/2009 12:42:36
3
3
android - Programmatically refresh (draw, erase, and update) shapes on custom View in background asynchoronously wihtout blocking the UI
Below is the **CustomView** class extending the **View** class. It works good statically. I am clicking a button, it shows the targeted shelf, which I am headed to. Then I am clicking another button, it clears the targeted shelf and the map is back in its initial state. What needs to be done is, this baby has to clear the targeted shelf by itself using some async calls, after *xx* seconds. And in the same fashion, when I begin to show my position on the map with an "**X**", it has to refresh that "**X**" while I am walking. The **AsyncTask** doesn't seem to be the perfect solution for this. Do *you* have an idea on how the map should update itself? Thanks in advance. The **CustomView**: public class CustomView extends View { ShapeDrawable roomFrame, targetShelfFrame; ArrayList<ShapeDrawable> shelfFrames; //(...) @Override protected void onDraw(Canvas canvas){ super.onDraw(canvas); if(roomFrame != null) roomFrame.draw(canvas); for (ShapeDrawable shelfFrame : shelfFrames) shelfFrame.draw(canvas); if(targetShelfFrame != null) targetShelfFrame.draw(canvas); } public void setRoom(Room room){ roomFrame = new ShapeDrawable(new RectShape()); roomFrame.getPaint().setColor(0xff74AC23); roomFrame.getPaint().setStyle(Style.STROKE); roomFrame.setBounds(10, 10, room.getWidth(), room.getHeight()); invalidate(); } public void setShelves(ArrayList<Shelf> shelves){ shelfFrames = new ArrayList<ShapeDrawable>(); for(int i = 0; i<shelves.size(); i++){ ShapeDrawable shelfFrame = new ShapeDrawable(new RectShape()); shelfFrame.getPaint().setColor(0xff74AC23); shelfFrame.setBounds(shelves.get(i).getXPosition(), shelves.get(i).getYPosition(), shelves.get(i).getWidth(), shelves.get(i).getHeight()); shelfFrames.add(shelfFrame); } invalidate(); } public void setTargetShelf(Shelf shelf){ targetShelfFrame = new ShapeDrawable(new RectShape()); targetShelfFrame.getPaint().setColor(Color.RED); targetShelfFrame.setBounds((int)(shelf.getXPosition()), (int)(shelf.getYPosition()), (int)((shelf.getXPosition() + shelf.getWidth())), (int)((shelf.getYPosition() + shelf.getHeight()))); invalidate(); } public void clearTargetShelf(){ targetShelfFrame = null; invalidate(); } } How I call it: public void loadRoomPlan(Room room, ArrayList<Shelf> shelves){ CustomView exampleView = (CustomView)findViewById(R.id.roomplan); exampleView.setRoom(room); exampleView.setShelves(shelves); }
android
view
drawing
custom-view
null
null
open
android - Programmatically refresh (draw, erase, and update) shapes on custom View in background asynchoronously wihtout blocking the UI === Below is the **CustomView** class extending the **View** class. It works good statically. I am clicking a button, it shows the targeted shelf, which I am headed to. Then I am clicking another button, it clears the targeted shelf and the map is back in its initial state. What needs to be done is, this baby has to clear the targeted shelf by itself using some async calls, after *xx* seconds. And in the same fashion, when I begin to show my position on the map with an "**X**", it has to refresh that "**X**" while I am walking. The **AsyncTask** doesn't seem to be the perfect solution for this. Do *you* have an idea on how the map should update itself? Thanks in advance. The **CustomView**: public class CustomView extends View { ShapeDrawable roomFrame, targetShelfFrame; ArrayList<ShapeDrawable> shelfFrames; //(...) @Override protected void onDraw(Canvas canvas){ super.onDraw(canvas); if(roomFrame != null) roomFrame.draw(canvas); for (ShapeDrawable shelfFrame : shelfFrames) shelfFrame.draw(canvas); if(targetShelfFrame != null) targetShelfFrame.draw(canvas); } public void setRoom(Room room){ roomFrame = new ShapeDrawable(new RectShape()); roomFrame.getPaint().setColor(0xff74AC23); roomFrame.getPaint().setStyle(Style.STROKE); roomFrame.setBounds(10, 10, room.getWidth(), room.getHeight()); invalidate(); } public void setShelves(ArrayList<Shelf> shelves){ shelfFrames = new ArrayList<ShapeDrawable>(); for(int i = 0; i<shelves.size(); i++){ ShapeDrawable shelfFrame = new ShapeDrawable(new RectShape()); shelfFrame.getPaint().setColor(0xff74AC23); shelfFrame.setBounds(shelves.get(i).getXPosition(), shelves.get(i).getYPosition(), shelves.get(i).getWidth(), shelves.get(i).getHeight()); shelfFrames.add(shelfFrame); } invalidate(); } public void setTargetShelf(Shelf shelf){ targetShelfFrame = new ShapeDrawable(new RectShape()); targetShelfFrame.getPaint().setColor(Color.RED); targetShelfFrame.setBounds((int)(shelf.getXPosition()), (int)(shelf.getYPosition()), (int)((shelf.getXPosition() + shelf.getWidth())), (int)((shelf.getYPosition() + shelf.getHeight()))); invalidate(); } public void clearTargetShelf(){ targetShelfFrame = null; invalidate(); } } How I call it: public void loadRoomPlan(Room room, ArrayList<Shelf> shelves){ CustomView exampleView = (CustomView)findViewById(R.id.roomplan); exampleView.setRoom(room); exampleView.setShelves(shelves); }
0
11,728,213
07/30/2012 19:25:20
685,621
03/31/2011 11:28:42
32
0
C++: Objects allocated on heap
When we create an object using *new* it is allocated on the heap. But, what happens to the members of the class that we are instantiating? For example, class foo { Bar x; Bar *y; foo() { x = 10; y = new Bar(); } } Here, x is an object while y is an instance of Bar. Are they both allocated on the heap? So if an object of foo *F* is created locally inside a method, what will happen to *y* when F goes out of scope? Also, if *F* is created on the heap, when will we conclude that *F* is dangling (no one pointing to it)? Because, there may be no references to F but there may be references to *Y*.
c++
null
null
null
null
07/31/2012 01:28:34
not constructive
C++: Objects allocated on heap === When we create an object using *new* it is allocated on the heap. But, what happens to the members of the class that we are instantiating? For example, class foo { Bar x; Bar *y; foo() { x = 10; y = new Bar(); } } Here, x is an object while y is an instance of Bar. Are they both allocated on the heap? So if an object of foo *F* is created locally inside a method, what will happen to *y* when F goes out of scope? Also, if *F* is created on the heap, when will we conclude that *F* is dangling (no one pointing to it)? Because, there may be no references to F but there may be references to *Y*.
4
11,728,215
07/30/2012 19:25:29
1,560,215
07/28/2012 22:02:23
16
0
Generating Binomial Logit-Normal data with covariates
I am trying to generate 300 Binomial-Logit Normal datasets where the porbability of outcome is a function of covariates. I used the following code to generate the data. Now I need to add in the covariates. Should I be using the package lnLME? Any help is appreciated. set.seed(111) k<-20 n<-60 x<-NULL eta<-rnorm(k,-3.32,.860)# equating moments to BB(3,3) p<-exp(eta)/(1+exp(eta)) for(i in 1:k) x<-cbind(x,rbinom(300,n,p[i]))
r
null
null
null
null
null
open
Generating Binomial Logit-Normal data with covariates === I am trying to generate 300 Binomial-Logit Normal datasets where the porbability of outcome is a function of covariates. I used the following code to generate the data. Now I need to add in the covariates. Should I be using the package lnLME? Any help is appreciated. set.seed(111) k<-20 n<-60 x<-NULL eta<-rnorm(k,-3.32,.860)# equating moments to BB(3,3) p<-exp(eta)/(1+exp(eta)) for(i in 1:k) x<-cbind(x,rbinom(300,n,p[i]))
0
11,728,216
07/30/2012 19:25:32
428,705
08/23/2010 18:23:20
3,388
169
How to automate building of third party library using cmake
What I am looking for: Download library Extract It Apply custom patch Run configure Run build command What library I am trying to build are: - Openssl - Boost - Thrift - C-ares - Curl - Pcre - Nginx - ICU - JsonCPP I think I can do these things using external module: http://cmake.org/cmake/help/v2.8.8/cmake.html#module:ExternalProject But I have following question? 1. I have different type of build and with different directory. Is it going to build all these library for every different target? If yes it will be painful as all these library take one hour to build. Is there a way I can control it and it only build it once. As library remains same for all these targets. 2. On switching directory to different name. Cmake force everything to be rebuild-ed. Will it be same for external library. If yes? How to solve this problem. I don't want to rebuild the library if I am not changing them and want to use them while switching to different branches without building them.
cmake
null
null
null
null
null
open
How to automate building of third party library using cmake === What I am looking for: Download library Extract It Apply custom patch Run configure Run build command What library I am trying to build are: - Openssl - Boost - Thrift - C-ares - Curl - Pcre - Nginx - ICU - JsonCPP I think I can do these things using external module: http://cmake.org/cmake/help/v2.8.8/cmake.html#module:ExternalProject But I have following question? 1. I have different type of build and with different directory. Is it going to build all these library for every different target? If yes it will be painful as all these library take one hour to build. Is there a way I can control it and it only build it once. As library remains same for all these targets. 2. On switching directory to different name. Cmake force everything to be rebuild-ed. Will it be same for external library. If yes? How to solve this problem. I don't want to rebuild the library if I am not changing them and want to use them while switching to different branches without building them.
0
11,728,220
07/30/2012 19:25:52
1,204,130
02/11/2012 18:15:45
83
5
php doesn't execute query
I've two mysql tables, here is sql for them => CREATE TABLE IF NOT EXISTS artInfo( -- art meant article art_id int(3) NOT NULL AUTO_INCREMENT PRIMARY KEY, descName VARCHAR(120) CHARSET utf8 COLLATE 'utf8_unicode_ci', -- desc meant descent cat_id int(3) NOT NULL ); CREATE TABLE IF NOT EXISTS menu( menu_id int(3) NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50) CHARSET utf8 COLLATE 'utf8_unicode_ci' NOT NULL, for_sub_url VARCHAR(50) CHARSET utf8 COLLATE 'utf8_unicode_ci'); I'm making dynamic menu with its sub menu . SO I've the situation that want to execute such a query DELETE FROM artinfo WHERE descName=(SELECT for_sub_url FROM menu WHERE menu_id=" . $_POST['m_num'] . ") where **$_POST['m_num']** exists and is menu_id. I'm not writing php code too , because it works just fine and remarkable is that , this query executes when I am trying to execute it from mysql shell (of course using directly number of menu_id instead of $_POST['m_num']) Any ideas whats going on, how to execute it from php script ? thanks :) **UPDATE** here is php script if ($connection->query("DELETE FROM artinfo WHERE descName=(SELECT for_sub_url FROM menu WHERE menu_id=" . $_POST['main_menu_titles'] . ")") && $connection->query("DELETE FROM artinfo WHERE descName IS NULL AND cat_id=" . $_POST['main_menu_titles'] . "")){ $edit_res_fine = "DELETED"; }
php
mysql
execute
null
null
null
open
php doesn't execute query === I've two mysql tables, here is sql for them => CREATE TABLE IF NOT EXISTS artInfo( -- art meant article art_id int(3) NOT NULL AUTO_INCREMENT PRIMARY KEY, descName VARCHAR(120) CHARSET utf8 COLLATE 'utf8_unicode_ci', -- desc meant descent cat_id int(3) NOT NULL ); CREATE TABLE IF NOT EXISTS menu( menu_id int(3) NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50) CHARSET utf8 COLLATE 'utf8_unicode_ci' NOT NULL, for_sub_url VARCHAR(50) CHARSET utf8 COLLATE 'utf8_unicode_ci'); I'm making dynamic menu with its sub menu . SO I've the situation that want to execute such a query DELETE FROM artinfo WHERE descName=(SELECT for_sub_url FROM menu WHERE menu_id=" . $_POST['m_num'] . ") where **$_POST['m_num']** exists and is menu_id. I'm not writing php code too , because it works just fine and remarkable is that , this query executes when I am trying to execute it from mysql shell (of course using directly number of menu_id instead of $_POST['m_num']) Any ideas whats going on, how to execute it from php script ? thanks :) **UPDATE** here is php script if ($connection->query("DELETE FROM artinfo WHERE descName=(SELECT for_sub_url FROM menu WHERE menu_id=" . $_POST['main_menu_titles'] . ")") && $connection->query("DELETE FROM artinfo WHERE descName IS NULL AND cat_id=" . $_POST['main_menu_titles'] . "")){ $edit_res_fine = "DELETED"; }
0
11,728,223
07/30/2012 19:26:09
1,558,132
07/27/2012 15:45:29
1
0
Powershell Switch Statement to Set Multiple Variables
I am in the process of converting some old VB script to Powershell. I am trying to use a Switch statement to set multiple variables. Is this possible in Powershell? In VBS my code would look something like this: Select Case ENV Case "DEV" : SRCDRV = "\\Server1" _ : DESTDRV = "\\Server1\Folder1\" Case "TEST" : SRCDRV = "F:" _ : DESTDRV = "\\Server1\Folder2\" Case "PROD" : SRCDRV = "F:" _ : DESTDRV = "\\Server2\Folder2\" End Select I have tried something similar in PS, but it doesn't seem to set the variables. switch ($cENV) { DEV { $SRCDRV = "\\Server1" $DSTDRV = "\\Server2\Folder1\" break } TEST { $SRCDRV = "\\Server1" $DSTDRV = "\\Server2\Folder2\" break } PROD { $SRCDRV = "\\Server1" $DSTDRV = "\\Server2\Folder2\" break } } When I check the value of either DESTDRV or SRCDRV I get an error saying: The variable '$SRCDRV' cannot be retrieved because it has not been set. Any ideas on what I'm doing wrong?
powershell
null
null
null
null
null
open
Powershell Switch Statement to Set Multiple Variables === I am in the process of converting some old VB script to Powershell. I am trying to use a Switch statement to set multiple variables. Is this possible in Powershell? In VBS my code would look something like this: Select Case ENV Case "DEV" : SRCDRV = "\\Server1" _ : DESTDRV = "\\Server1\Folder1\" Case "TEST" : SRCDRV = "F:" _ : DESTDRV = "\\Server1\Folder2\" Case "PROD" : SRCDRV = "F:" _ : DESTDRV = "\\Server2\Folder2\" End Select I have tried something similar in PS, but it doesn't seem to set the variables. switch ($cENV) { DEV { $SRCDRV = "\\Server1" $DSTDRV = "\\Server2\Folder1\" break } TEST { $SRCDRV = "\\Server1" $DSTDRV = "\\Server2\Folder2\" break } PROD { $SRCDRV = "\\Server1" $DSTDRV = "\\Server2\Folder2\" break } } When I check the value of either DESTDRV or SRCDRV I get an error saying: The variable '$SRCDRV' cannot be retrieved because it has not been set. Any ideas on what I'm doing wrong?
0
11,326,868
07/04/2012 10:05:40
645,460
03/04/2011 21:38:53
3,365
144
Image scroller with jQuery that supports image pre-caching
A good example of what I need to implement can be seen at http://www.gojee.com There, different images of food are scrolled effectively, image to image with javascript, and the sript support next image precaching. Their JS is obfuscated and minimized, so I can't just "look" how they have implemented it. Can anyone point to a jQuery plugin that allows to "page" images with embedded pre-caching of a next image, but without a knowledge of an entire list like jQuery Tools "Scrollable" control?
javascript
jquery
scroll
image-gallery
null
null
open
Image scroller with jQuery that supports image pre-caching === A good example of what I need to implement can be seen at http://www.gojee.com There, different images of food are scrolled effectively, image to image with javascript, and the sript support next image precaching. Their JS is obfuscated and minimized, so I can't just "look" how they have implemented it. Can anyone point to a jQuery plugin that allows to "page" images with embedded pre-caching of a next image, but without a knowledge of an entire list like jQuery Tools "Scrollable" control?
0
11,327,461
07/04/2012 10:41:32
1,042,830
11/12/2011 05:18:50
163
18
How to prevent black rectangle in slide animation effect when close soft keyboard?
In my current activity, there is soft keyboard showing. And i press a button to open another activity and also close the soft keyboard in current activity. I applied slide animation for transit of activity. When another activity slide in and current activity slide out, i saw a black rectangle of soft keyboard in animation effect. How can i prevent this black rectangle appear? Thanks for your help.
android
null
null
null
null
null
open
How to prevent black rectangle in slide animation effect when close soft keyboard? === In my current activity, there is soft keyboard showing. And i press a button to open another activity and also close the soft keyboard in current activity. I applied slide animation for transit of activity. When another activity slide in and current activity slide out, i saw a black rectangle of soft keyboard in animation effect. How can i prevent this black rectangle appear? Thanks for your help.
0
11,327,440
07/04/2012 10:40:11
364,056
06/10/2010 23:04:34
1,056
12
WCF callbacks, proxy and thread-safety
Given a WCF duplex service (NetTcpBinding) that is configured to create a new service instance for each new client (see [pattern publish-subscribe][1]), you can get a specific instance of callback for each service instance. Since different instances are created, methods belonging to different callbacks can be invoked from different threads concurrently. - What happens if multiple threads try to invoke the same method on the same callback? - What happens if they try to invoke different methods but for the same callback? - Should we manage concurrent access to these methods from multiple threads? In both cases? Consider now the client side that communicates with the service: to make sure that the client can use the service, you must instantiate a new proxy, and in order to invoke the methods defined in the service, you must invoke the corresponding methods of the proxy. - What happens if multiple threads try to invoke the same method on the same proxy instance? - What happens if they try to invoke different methods but for the same proxy instance? - Should we manage concurrent access to these methods from multiple threads? In both cases? [1]: http://msdn.microsoft.com/en-us/library/ms752254.aspx
c#
.net
multithreading
wcf
thread-safety
null
open
WCF callbacks, proxy and thread-safety === Given a WCF duplex service (NetTcpBinding) that is configured to create a new service instance for each new client (see [pattern publish-subscribe][1]), you can get a specific instance of callback for each service instance. Since different instances are created, methods belonging to different callbacks can be invoked from different threads concurrently. - What happens if multiple threads try to invoke the same method on the same callback? - What happens if they try to invoke different methods but for the same callback? - Should we manage concurrent access to these methods from multiple threads? In both cases? Consider now the client side that communicates with the service: to make sure that the client can use the service, you must instantiate a new proxy, and in order to invoke the methods defined in the service, you must invoke the corresponding methods of the proxy. - What happens if multiple threads try to invoke the same method on the same proxy instance? - What happens if they try to invoke different methods but for the same proxy instance? - Should we manage concurrent access to these methods from multiple threads? In both cases? [1]: http://msdn.microsoft.com/en-us/library/ms752254.aspx
0
11,327,469
07/04/2012 10:41:54
1,501,118
07/04/2012 09:25:38
1
0
create and use screen like android 4.0.4 call screen
I want to reuse android 4.0.4 call screen. but I cant access some widget classes which they are using. Can any one suggest me. Thanks in advance.
android
android-layout
null
null
null
null
open
create and use screen like android 4.0.4 call screen === I want to reuse android 4.0.4 call screen. but I cant access some widget classes which they are using. Can any one suggest me. Thanks in advance.
0
11,327,472
07/04/2012 10:42:12
911,391
08/25/2011 07:03:00
5
0
"No more data to read from socket" Exception Tomcat DBCP
I am using tomcat's DBCP with Oracle 10g. After using the connections successfully, when some time passes, there are no more connections available. I receive this exception **No more data to read from socket** On next retry this exception occurs: **OALL8 is in an inconisitent state** On next retry this exception occurs: **Io exception: Software caused connection abort: socket write error** After that this exception occurs: **Closed Connection** My question is what is the reason of these exceptions? Are they due to some bug in DBCP or Oracle Database is causing the issue. I'm using Tomcat 6, jdk 1.7, Oracle 10.2
database
tomcat
oracle10g
connection-pooling
apache-commons-dbcp
null
open
"No more data to read from socket" Exception Tomcat DBCP === I am using tomcat's DBCP with Oracle 10g. After using the connections successfully, when some time passes, there are no more connections available. I receive this exception **No more data to read from socket** On next retry this exception occurs: **OALL8 is in an inconisitent state** On next retry this exception occurs: **Io exception: Software caused connection abort: socket write error** After that this exception occurs: **Closed Connection** My question is what is the reason of these exceptions? Are they due to some bug in DBCP or Oracle Database is causing the issue. I'm using Tomcat 6, jdk 1.7, Oracle 10.2
0
11,327,475
07/04/2012 10:42:14
387,185
07/08/2010 21:43:08
118
1
gdb how to inspect 2D array elements
I was happily debugging in GDB and then I hit a 2D array that might hold incorrect values. However I cant seem to be able to print an single element. p array2D[0][0] gives me > Cannot perform pointer math on incomplete types, try casting to a known type, or void *. I tried to google this but I can't find anything and I am not sure if I am missing something obvious.
c
linux
debugging
gdb
2d-array
null
open
gdb how to inspect 2D array elements === I was happily debugging in GDB and then I hit a 2D array that might hold incorrect values. However I cant seem to be able to print an single element. p array2D[0][0] gives me > Cannot perform pointer math on incomplete types, try casting to a known type, or void *. I tried to google this but I can't find anything and I am not sure if I am missing something obvious.
0
11,327,477
07/04/2012 10:42:17
347,172
05/21/2010 14:32:46
6,057
187
CA1004 and exception/error handling assistance
<a href="http://msdn.microsoft.com/en-us/library/ms182150">CA1004: Generic methods should provide type parameter</a> public static void IfNullAndNullsAreIllegalThenThrow<T>(object value) { if (value == null && !(default(T) == null)) throw new ArgumentException("Nulls are not allowed for this object."); } I found this method online, which is quite useful to be honest. But, it violates the CA1004 rule. I'm not sure if there is a better way to design the method and not violate the rules.
c#
design
generics
exception-handling
code-analysis
null
open
CA1004 and exception/error handling assistance === <a href="http://msdn.microsoft.com/en-us/library/ms182150">CA1004: Generic methods should provide type parameter</a> public static void IfNullAndNullsAreIllegalThenThrow<T>(object value) { if (value == null && !(default(T) == null)) throw new ArgumentException("Nulls are not allowed for this object."); } I found this method online, which is quite useful to be honest. But, it violates the CA1004 rule. I'm not sure if there is a better way to design the method and not violate the rules.
0
11,327,478
07/04/2012 10:42:18
1,241,241
02/29/2012 21:05:40
22
0
RegExp For Validate Link
i want to validate 7 frist alphabet of my input box my code is dosent work <input type="text" value="www.example.com" id="txt_url" onkeyup="if(!this.value.match(/^http\:\/\//) && (txt_url.lenght >= 7 )this.value='http://'+this.value" />
javascript
regex
null
null
null
null
open
RegExp For Validate Link === i want to validate 7 frist alphabet of my input box my code is dosent work <input type="text" value="www.example.com" id="txt_url" onkeyup="if(!this.value.match(/^http\:\/\//) && (txt_url.lenght >= 7 )this.value='http://'+this.value" />
0
11,327,484
07/04/2012 10:42:45
476,619
10/15/2010 07:42:49
478
14
How to set IsPublishedTo status on a Tridion Component?
After a Tridion CMS Database restore from another environment we cannot unpublish Components from the Broker. If we publish to the Broker then we can unpublish. We want to set the IsPublishedTo status to the publish targets available in the new envioronment. The TOM API has a SetPublishedTo method available for Pages and Component Templates but not Components. How can I set the PublishedStatus for the Components? Is it possible using UpdateXML or do we need to perform database black magic?
tridion
null
null
null
null
null
open
How to set IsPublishedTo status on a Tridion Component? === After a Tridion CMS Database restore from another environment we cannot unpublish Components from the Broker. If we publish to the Broker then we can unpublish. We want to set the IsPublishedTo status to the publish targets available in the new envioronment. The TOM API has a SetPublishedTo method available for Pages and Component Templates but not Components. How can I set the PublishedStatus for the Components? Is it possible using UpdateXML or do we need to perform database black magic?
0
11,327,494
07/04/2012 10:43:27
1,067,504
11/27/2011 01:59:30
76
4
PHP Socket Blocking
Basically, I'm using a **blocking** TCP socket along with `socket_accept()`. The problem I have, is that for obvious reasons since the I/O is blocking there can only be one connection to the socket at any one time that PHP is able to manipulate. I am fine with this, as this is the behaviour I am after. However, if a client is to open a connection to the my PHP server, if they are simply leaving the socket open and sending no data, the socket and daemon are rendered useless as the blocking I/O will not allow new requests. Is there a way to detect a client that is simply sending no data (like a no-transmission timeout) or something similar? I'd rather not use non-blocking I/O.
php
sockets
tcp
null
null
null
open
PHP Socket Blocking === Basically, I'm using a **blocking** TCP socket along with `socket_accept()`. The problem I have, is that for obvious reasons since the I/O is blocking there can only be one connection to the socket at any one time that PHP is able to manipulate. I am fine with this, as this is the behaviour I am after. However, if a client is to open a connection to the my PHP server, if they are simply leaving the socket open and sending no data, the socket and daemon are rendered useless as the blocking I/O will not allow new requests. Is there a way to detect a client that is simply sending no data (like a no-transmission timeout) or something similar? I'd rather not use non-blocking I/O.
0
11,327,496
07/04/2012 10:43:28
63,898
02/08/2009 15:47:03
2,569
3
Web architecture with c++ backend in Linux best way ?
I have php front end that render the GUI , from there I like to use c++ engine in the backend that gets the users request with data xml structures this c++ engine is responsible to process the data and store it in the DB or files and return the response to the user now , my front end is lighthttpd working great , in the back end I want to avoid to write the c/c++ daemon I like to use something that is well establish in the industry , which server shell I use to host my c++ back end code? also what is the best way to establish connection between php and back end server ? sockets? Php sockets ?
c++
architecture
web
null
null
null
open
Web architecture with c++ backend in Linux best way ? === I have php front end that render the GUI , from there I like to use c++ engine in the backend that gets the users request with data xml structures this c++ engine is responsible to process the data and store it in the DB or files and return the response to the user now , my front end is lighthttpd working great , in the back end I want to avoid to write the c/c++ daemon I like to use something that is well establish in the industry , which server shell I use to host my c++ back end code? also what is the best way to establish connection between php and back end server ? sockets? Php sockets ?
0
11,327,497
07/04/2012 10:43:30
1,414,612
05/24/2012 09:19:57
10
0
Getting Error is cs0162 unreachable code detected
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { } decimal ParseDecimal(string number) { if (number.Equals("0E+3", StringComparison.OrdinalIgnoreCase)) { return 0; } return decimal.Parse(number, System.Globalization.NumberStyles.Any); Console.WriteLine(number); } } }
console-application
null
null
null
null
null
open
Getting Error is cs0162 unreachable code detected === using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { } decimal ParseDecimal(string number) { if (number.Equals("0E+3", StringComparison.OrdinalIgnoreCase)) { return 0; } return decimal.Parse(number, System.Globalization.NumberStyles.Any); Console.WriteLine(number); } } }
0
11,298,245
07/02/2012 17:20:14
718,414
04/21/2011 06:39:22
3
0
qtableview text edit
<br/> I'm writing a program with PyQt. I use QTableView to display data.<br/> The problem is when I trigger the edit(for example press F2) of a cell, the text in the cell is all selected(highlighted) by default. It's not convenience because I want to modify the text but not rewrite them all.<br/> So I want to know if there is any function to change the behavior?<br/> <br/> Thank you
qt
pyqt
qtableview
null
null
null
open
qtableview text edit === <br/> I'm writing a program with PyQt. I use QTableView to display data.<br/> The problem is when I trigger the edit(for example press F2) of a cell, the text in the cell is all selected(highlighted) by default. It's not convenience because I want to modify the text but not rewrite them all.<br/> So I want to know if there is any function to change the behavior?<br/> <br/> Thank you
0
11,298,247
07/02/2012 17:20:23
413,127
04/23/2010 20:54:46
10,246
486
What is an alternative to this XML layout (Lint Warning)
Alright here it is, this layout will give you 3 images that are all of equal width, that width being as wide as the longest text on the 3 textviews. The 3 text views are centered on the background with equals space on the left and right. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:gravity="center" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/button_grey" android:drawableLeft="@drawable/some_img_one" android:text="view 1"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/button_grey" android:drawableLeft="@drawable/some_img" android:text="view 2"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/button_grey" android:drawableLeft="@drawable/some_img" android:text="view 3 longer text"/> </LinearLayout> </LinearLayout> Like so: ![Preview][1] **The problem is Lint is giving a warning that the inner LinearLayout is useless.** (Which it isn't because it's what makes the inner textviews become all the same width. ![Lint error][2] Can anyone produce the same layout but without the lint warning? [1]: http://i.stack.imgur.com/mxRfF.png [2]: http://i.stack.imgur.com/ZB41B.png
android
xml
android-layout
lint
null
null
open
What is an alternative to this XML layout (Lint Warning) === Alright here it is, this layout will give you 3 images that are all of equal width, that width being as wide as the longest text on the 3 textviews. The 3 text views are centered on the background with equals space on the left and right. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:gravity="center" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/button_grey" android:drawableLeft="@drawable/some_img_one" android:text="view 1"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/button_grey" android:drawableLeft="@drawable/some_img" android:text="view 2"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/button_grey" android:drawableLeft="@drawable/some_img" android:text="view 3 longer text"/> </LinearLayout> </LinearLayout> Like so: ![Preview][1] **The problem is Lint is giving a warning that the inner LinearLayout is useless.** (Which it isn't because it's what makes the inner textviews become all the same width. ![Lint error][2] Can anyone produce the same layout but without the lint warning? [1]: http://i.stack.imgur.com/mxRfF.png [2]: http://i.stack.imgur.com/ZB41B.png
0
11,298,251
07/02/2012 17:20:57
1,496,707
07/02/2012 17:14:14
1
0
Swap array values with php
Look, I have an array like that: ` array( 0 => 'contact', 1 => 'home', 2 => 'projects' ); ` and I need to swap the 'contact' with 'home', so the array would be like that: ` array( 0 => 'home', 1 => 'contact', 2 => 'projects' ); ` how can I do this with PHP? And sorry for my bad English, it's because I'm Brazilian :)
php
arrays
null
null
null
null
open
Swap array values with php === Look, I have an array like that: ` array( 0 => 'contact', 1 => 'home', 2 => 'projects' ); ` and I need to swap the 'contact' with 'home', so the array would be like that: ` array( 0 => 'home', 1 => 'contact', 2 => 'projects' ); ` how can I do this with PHP? And sorry for my bad English, it's because I'm Brazilian :)
0
11,295,037
07/02/2012 13:49:29
1,038,814
11/10/2011 01:00:47
439
1
assign states to list item and retrieve what states they are in - jquery
I have a sortable list using jqueryUI. I want each of these lists to have 4 different states. So I've assigned each list item a toggle function. How can I get what states each items are at if say, I were to submit this information via a form? Is this possible at all? Any help will be much appreciated. Thanks $(".sortedli").toggle(function(){ //state 1 $(this).css("background-color","white");}, function(){ //state 2 $(this).css("background-color","green");}, function(){ //state 3 $(this).css("background-color","red");}, function(){ //state 4 $(this).css("background-color","yellow");} ); <ul id="coll-selected-list" class="droptrue ui-sortable"> <li class="sortedli" style="">blah</li> <li class="sortedli" style="">blah</li> <li class="sortedli" style="">blah</li> </ul>
jquery
jquery-ui
toggle
null
null
null
open
assign states to list item and retrieve what states they are in - jquery === I have a sortable list using jqueryUI. I want each of these lists to have 4 different states. So I've assigned each list item a toggle function. How can I get what states each items are at if say, I were to submit this information via a form? Is this possible at all? Any help will be much appreciated. Thanks $(".sortedli").toggle(function(){ //state 1 $(this).css("background-color","white");}, function(){ //state 2 $(this).css("background-color","green");}, function(){ //state 3 $(this).css("background-color","red");}, function(){ //state 4 $(this).css("background-color","yellow");} ); <ul id="coll-selected-list" class="droptrue ui-sortable"> <li class="sortedli" style="">blah</li> <li class="sortedli" style="">blah</li> <li class="sortedli" style="">blah</li> </ul>
0
11,295,038
07/02/2012 13:49:31
220,899
11/29/2009 16:48:06
356
17
CSS not working in IE7
This CSS works in IE8 and newer (and in Chrome), but not in IE7. Specifically, the tooltip just doesn't appear when I hover over the div. What do I need to change for IE7 (and IE6)? .headertooltip, .headertooltip:visited { color: #0077AA; float: left; height: 40px; text-decoration: none; width: 20px; } .headertooltip div { background-color: black; color: #fff; left: 50px; padding: 5px 10px 5px 40px; position: absolute; text-decoration: none; top: 82px; visibility: hidden; width: 900px; z-index: 10; } .headertooltip:hover div { position: absolute; visibility: visible; }
css
internet-explorer-7
null
null
null
null
open
CSS not working in IE7 === This CSS works in IE8 and newer (and in Chrome), but not in IE7. Specifically, the tooltip just doesn't appear when I hover over the div. What do I need to change for IE7 (and IE6)? .headertooltip, .headertooltip:visited { color: #0077AA; float: left; height: 40px; text-decoration: none; width: 20px; } .headertooltip div { background-color: black; color: #fff; left: 50px; padding: 5px 10px 5px 40px; position: absolute; text-decoration: none; top: 82px; visibility: hidden; width: 900px; z-index: 10; } .headertooltip:hover div { position: absolute; visibility: visible; }
0
11,298,258
06/30/2012 14:26:18
1,496,294
07/02/2012 14:21:33
1
0
Creating a precision matrix for Gaussian markov random field
I am currently trying to create a precision matrix for a Gaussian markov random field. Lets say I have random variables in a spatial grid of 6x6. Then I will have a precision matrix of 36x36. Now suppose that I have a neighbor hood of 3x3, then my precision matrix will be Q= nnbs[1] -1 0 0 0 0 -1.......0 -1 nnbs[2] -1 0 0 0 0 ......0 0 -1 nnbs[3] -1 0 0 0 ......0 ................................................... ................................................... and so on. Can anyone suggest me how can I code this precision matrix. I mean if I change the window size/neighborhood size to 5x5, then I will have a new precision matrix. How can I code this?
normal-distribution
null
null
null
null
null
open
Creating a precision matrix for Gaussian markov random field === I am currently trying to create a precision matrix for a Gaussian markov random field. Lets say I have random variables in a spatial grid of 6x6. Then I will have a precision matrix of 36x36. Now suppose that I have a neighbor hood of 3x3, then my precision matrix will be Q= nnbs[1] -1 0 0 0 0 -1.......0 -1 nnbs[2] -1 0 0 0 0 ......0 0 -1 nnbs[3] -1 0 0 0 ......0 ................................................... ................................................... and so on. Can anyone suggest me how can I code this precision matrix. I mean if I change the window size/neighborhood size to 5x5, then I will have a new precision matrix. How can I code this?
0
11,298,260
07/02/2012 17:21:46
1,006,789
10/21/2011 09:18:45
114
0
Parse javascript generated content using Java
http://support.xbox.com/en-us/contact-us uses javascript to create some lists. I want to be able to parse these lists for their text. So for the above page I want to return the following: Billing and Subscriptions Xbox 360 Xbox LIVE Kinect Apps Games I was trying to use JSoup for a while before noticing it was generated using javascript. I have no idea how to go about parsing a page for its javascript generated content. Where do I begin?
java
javascript
parsing
null
null
null
open
Parse javascript generated content using Java === http://support.xbox.com/en-us/contact-us uses javascript to create some lists. I want to be able to parse these lists for their text. So for the above page I want to return the following: Billing and Subscriptions Xbox 360 Xbox LIVE Kinect Apps Games I was trying to use JSoup for a while before noticing it was generated using javascript. I have no idea how to go about parsing a page for its javascript generated content. Where do I begin?
0
11,298,261
07/02/2012 17:21:46
793,468
06/10/2011 22:29:53
464
3
data not displaying on form on ajax success
I am trying a simple task of displaying student name in a textbox based on StudentId entered. I am able to display the student name as an alert from jQuery - AJAX call but not in the text box, what am I missing here? Controller: [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)] public ActionResult DisplayStudentName(string id) { StudentDataContext db = new StudentDataContext(); var StudentName = (from p in db.vwStudents.Where(a => a.StudentNumber == id) group p by p.StudentName into g select g.Key).FirstOrDefault(); return Json(new { Name = StudentName }); } jQuery: $(function () { $('#submitButton').click(function () { var link = '/StudentForm/DisplayStudentName'; $.ajax({ type: 'POST', url: link, data: { id: $('#id').val() }, dataType: 'json', success: function (result) { $("#StudentName").val(result.Name); alert(result.Name); }, error: function (result) { alert("Failed") } }); }); }); View: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Student Form </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div id="Data" style="text-align: left; height: 202px;"> Student Number:<input type="text" name="id" id="id"/><br /> Student Name:<input type="text" name="StudentName" id="StudentName"/><br /> <br /> <div id="Div1"> <button id="submitButton" name="submitButton" style="width:140px;">Display Short Name</button> </div> </div> </asp:Content> Again, I am able to display Student Name in the Alert window, but not in the text box, Am I missing something? Thanks in advance
c#
asp.net-mvc
jquery-ajax
null
null
null
open
data not displaying on form on ajax success === I am trying a simple task of displaying student name in a textbox based on StudentId entered. I am able to display the student name as an alert from jQuery - AJAX call but not in the text box, what am I missing here? Controller: [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)] public ActionResult DisplayStudentName(string id) { StudentDataContext db = new StudentDataContext(); var StudentName = (from p in db.vwStudents.Where(a => a.StudentNumber == id) group p by p.StudentName into g select g.Key).FirstOrDefault(); return Json(new { Name = StudentName }); } jQuery: $(function () { $('#submitButton').click(function () { var link = '/StudentForm/DisplayStudentName'; $.ajax({ type: 'POST', url: link, data: { id: $('#id').val() }, dataType: 'json', success: function (result) { $("#StudentName").val(result.Name); alert(result.Name); }, error: function (result) { alert("Failed") } }); }); }); View: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Student Form </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div id="Data" style="text-align: left; height: 202px;"> Student Number:<input type="text" name="id" id="id"/><br /> Student Name:<input type="text" name="StudentName" id="StudentName"/><br /> <br /> <div id="Div1"> <button id="submitButton" name="submitButton" style="width:140px;">Display Short Name</button> </div> </div> </asp:Content> Again, I am able to display Student Name in the Alert window, but not in the text box, Am I missing something? Thanks in advance
0
11,298,262
07/02/2012 17:21:47
1,464,355
06/18/2012 17:18:11
47
1
Extracting particular fields in a single file traversal
I have a requirement. I am in the process of writing awk scripts and my input file is `TIME FIELD : SOME FIELDS SOME FIELDS Some fields Some fields RID ..` The occurrence of RID is random and it varies from one record to another record and, so the problem is I will not be able to use NR and $1 concept as there is no guarantee that RID would occur in this particular line I need to extract both the time field and RID. I can do that in two file traversal but any idea of how to do it in a single file traversal using awk. Thank you
shell
awk
null
null
null
null
open
Extracting particular fields in a single file traversal === I have a requirement. I am in the process of writing awk scripts and my input file is `TIME FIELD : SOME FIELDS SOME FIELDS Some fields Some fields RID ..` The occurrence of RID is random and it varies from one record to another record and, so the problem is I will not be able to use NR and $1 concept as there is no guarantee that RID would occur in this particular line I need to extract both the time field and RID. I can do that in two file traversal but any idea of how to do it in a single file traversal using awk. Thank you
0
11,298,266
07/02/2012 17:22:15
1,071,887
11/29/2011 17:55:40
48
5
Write text on image in objective-c iPhone, Font size of simulator different from on iPhone itself
I'm having something really weird going, I'm adding caption to an image and everything works fine on simulator but on the device itself the font is really small... I have a problem when using this code : -(UIImage*) drawTextOnPic:(NSString*) bottomText inImage:(UIImage*) image { UIFont *font = [UIFont boldSystemFontOfSize:CAPTION_FONT_SIZE]; UIGraphicsBeginImageContext(image.size); [image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)]; CGRect = CGRectMake(10.0f,10.0f,image.size.width-20.0f, image.size.height); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetShadow(context, CGSizeMake(2.5f, 2.5f), 5.0f); [[UIColor whiteColor] set]; [bottomText drawInRect:CGRectIntegral(rect) withFont:font lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentCenter]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } Does someone know why it works only on simulator as I expected? BTW, I'm using the SDK for iOS6, Can it be something there?
objective-c
ios
ios5
uiimage
null
null
open
Write text on image in objective-c iPhone, Font size of simulator different from on iPhone itself === I'm having something really weird going, I'm adding caption to an image and everything works fine on simulator but on the device itself the font is really small... I have a problem when using this code : -(UIImage*) drawTextOnPic:(NSString*) bottomText inImage:(UIImage*) image { UIFont *font = [UIFont boldSystemFontOfSize:CAPTION_FONT_SIZE]; UIGraphicsBeginImageContext(image.size); [image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)]; CGRect = CGRectMake(10.0f,10.0f,image.size.width-20.0f, image.size.height); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetShadow(context, CGSizeMake(2.5f, 2.5f), 5.0f); [[UIColor whiteColor] set]; [bottomText drawInRect:CGRectIntegral(rect) withFont:font lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentCenter]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } Does someone know why it works only on simulator as I expected? BTW, I'm using the SDK for iOS6, Can it be something there?
0
11,298,255
07/02/2012 17:21:28
1,056,328
11/20/2011 12:06:17
149
0
How to get from array of objects with property "name" array of strings (with names corresponding to each object)?
How having an array of objects with property "name" get array of strings (with names corresponding to each object)?
c#
.net-3.5
null
null
null
07/03/2012 02:26:38
not a real question
How to get from array of objects with property "name" array of strings (with names corresponding to each object)? === How having an array of objects with property "name" get array of strings (with names corresponding to each object)?
1
11,387,000
07/08/2012 21:50:48
458,960
09/26/2010 21:45:36
2,121
32
How to call CSS animation manually with Javascript?
I'm using a UIWebView with CSS animations, which animates the main body when it loads from alpha 0 to 1: NSString *HTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "@-webkit-keyframes fadeIn {from {opacity: 0;-webkit-transition: opacity;}to {opacity: 1;}} \n" "body {\n" "-webkit-animation-name:fadeIn;\n" "-webkit-animation-duration: 1.5s;\n" ... My question is, how would I call this animation manually using Javascript so that at any time, if I call the JS, the view animates from 0 to 1 (rather than just animating on load)? Or is this not possible with CSS? Basically I want to do this: [mainWebView stringByEvaluatingJavaScriptFromString:@"/*animate*/"];
javascript
css
uiwebview
null
null
null
open
How to call CSS animation manually with Javascript? === I'm using a UIWebView with CSS animations, which animates the main body when it loads from alpha 0 to 1: NSString *HTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "@-webkit-keyframes fadeIn {from {opacity: 0;-webkit-transition: opacity;}to {opacity: 1;}} \n" "body {\n" "-webkit-animation-name:fadeIn;\n" "-webkit-animation-duration: 1.5s;\n" ... My question is, how would I call this animation manually using Javascript so that at any time, if I call the JS, the view animates from 0 to 1 (rather than just animating on load)? Or is this not possible with CSS? Basically I want to do this: [mainWebView stringByEvaluatingJavaScriptFromString:@"/*animate*/"];
0
11,387,001
07/08/2012 21:51:05
170,431
09/08/2009 20:46:16
1,844
71
How can I get specific tracebacks for inherited templates in Jinja2 with App Enigne?
Whenever there is an error in an inherited Jinja2 template in my App Engine project, I get a traceback that specifies only the line that caused the inheritance, not the line that caused the error. For example, I created a dummy project with two templates, `page.html` and `base.html`. `page.html` inherits from `base.html` and `base.html` has the line designed to cause an error. Rather than reporting the error in `base.html`, App Engine/Jinja will give me this traceback: Traceback (most recent call last): File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1536, in __call__ rv = self.handle_exception(request, response, e) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1530, in __call__ rv = self.router.dispatch(request, response) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1102, in __call__ return handler.dispatch() File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 570, in dispatch return method(*args, **kwargs) File "/home/kkinder/Projects/JinjaTestProject/main.py", line 11, in get self.response.out.write(self.jinja2.render_template('page.html')) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2_extras/jinja2.py", line 158, in render_template return self.environment.get_template(_filename).render(**context) File "/home/kkinder/Software/google_appengine/lib/jinja2/jinja2/environment.py", line 894, in render return self.environment.handle_exception(exc_info, True) File "templates/page.html", line 1, in top-level template code {% extends 'base.html' %} UndefinedError: 'doesnotexist' is undefined main.py: import webapp2 from webapp2_extras import jinja2 class MainHandler(webapp2.RequestHandler): @webapp2.cached_property def jinja2(self): return jinja2.get_jinja2(app=self.app) def get(self): self.response.out.write(self.jinja2.render_template('page.html')) app = webapp2.WSGIApplication([('/', MainHandler)], debug=True) page.html: {% extends 'base.html' %} {% block content %} Stuff {% endblock %} base.html: <!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" xml:lang="en" lang="en"> <head> </head> <body> <h1>{{ doesnotexist.foo }}</h1> {% block content %}{% endblock %} </body> </html>
python
google-app-engine
jinja2
null
null
null
open
How can I get specific tracebacks for inherited templates in Jinja2 with App Enigne? === Whenever there is an error in an inherited Jinja2 template in my App Engine project, I get a traceback that specifies only the line that caused the inheritance, not the line that caused the error. For example, I created a dummy project with two templates, `page.html` and `base.html`. `page.html` inherits from `base.html` and `base.html` has the line designed to cause an error. Rather than reporting the error in `base.html`, App Engine/Jinja will give me this traceback: Traceback (most recent call last): File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1536, in __call__ rv = self.handle_exception(request, response, e) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1530, in __call__ rv = self.router.dispatch(request, response) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 1102, in __call__ return handler.dispatch() File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2.py", line 570, in dispatch return method(*args, **kwargs) File "/home/kkinder/Projects/JinjaTestProject/main.py", line 11, in get self.response.out.write(self.jinja2.render_template('page.html')) File "/home/kkinder/Software/google_appengine/lib/webapp2/webapp2_extras/jinja2.py", line 158, in render_template return self.environment.get_template(_filename).render(**context) File "/home/kkinder/Software/google_appengine/lib/jinja2/jinja2/environment.py", line 894, in render return self.environment.handle_exception(exc_info, True) File "templates/page.html", line 1, in top-level template code {% extends 'base.html' %} UndefinedError: 'doesnotexist' is undefined main.py: import webapp2 from webapp2_extras import jinja2 class MainHandler(webapp2.RequestHandler): @webapp2.cached_property def jinja2(self): return jinja2.get_jinja2(app=self.app) def get(self): self.response.out.write(self.jinja2.render_template('page.html')) app = webapp2.WSGIApplication([('/', MainHandler)], debug=True) page.html: {% extends 'base.html' %} {% block content %} Stuff {% endblock %} base.html: <!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" xml:lang="en" lang="en"> <head> </head> <body> <h1>{{ doesnotexist.foo }}</h1> {% block content %}{% endblock %} </body> </html>
0
11,386,992
07/08/2012 21:48:56
1,510,590
07/08/2012 21:20:26
1
0
Migration fails with Error: NoMethodError: undefined method `Migration'
I'm trying to get set up with Sequel in Ruby. I went to http://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html and created my first migration. Then I got Postgres.app running as my server and did a createdb Qsario. The problem comes when I try to use my migration to create the database fields: $sequel -E -m . postgres://localhost/Qsario I, [2012-07-08T13:53:49.659795 #6258] INFO -- : (0.000374s) SET standard_conforming_strings = ON I, [2012-07-08T13:53:49.660113 #6258] INFO -- : (0.000153s) SET client_min_messages = 'WARNING' I, [2012-07-08T13:53:49.660359 #6258] INFO -- : (0.000163s) SET DateStyle = 'ISO' I, [2012-07-08T13:53:49.664679 #6258] INFO -- : (0.000952s) SELECT NULL FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.665179 #6258] INFO -- : (0.000214s) SELECT * FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.665544 #6258] INFO -- : (0.000166s) SELECT 1 AS "one" FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.666100 #6258] INFO -- : (0.000325s) SELECT COUNT(*) AS "count" FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.666461 #6258] INFO -- : (0.000179s) SELECT "version" FROM "schema_info" LIMIT 1 Error: NoMethodError: undefined method `Migration' for Sequel:Module/Users/me/Projects/Qsario/db/migrate/001_create_user_and_file_tables.rb:3:in `<top (required)>' Here's what 001_create_user_and_file_tables.rb looks like: Sequel.Migration do no_transaction change do create_table(:users) do primary_key :id String :username, :unique=>true String :email, :unique=>true String :password_hash String :password_salt DateTime :joined_at, :null => false FalseClass :banned, default=>false String :role, default=>"user" end create_table(:files) do primary_key :id foreign_key :user_id, :users String :filename, :null => false DateTime :uploaded_at, :null => false end create_table(:users_files) do primary_key :id foreign_key :user_id, :users foreign_key :file_id, :files end end end Note that there is no Rakefile or anything like that yet because I'm still trying to get things set up. I am not using Rails. So that .rb file is the only thing in the directory.
ruby
migration
sequel
nomethoderror
null
null
open
Migration fails with Error: NoMethodError: undefined method `Migration' === I'm trying to get set up with Sequel in Ruby. I went to http://sequel.rubyforge.org/rdoc/files/doc/migration_rdoc.html and created my first migration. Then I got Postgres.app running as my server and did a createdb Qsario. The problem comes when I try to use my migration to create the database fields: $sequel -E -m . postgres://localhost/Qsario I, [2012-07-08T13:53:49.659795 #6258] INFO -- : (0.000374s) SET standard_conforming_strings = ON I, [2012-07-08T13:53:49.660113 #6258] INFO -- : (0.000153s) SET client_min_messages = 'WARNING' I, [2012-07-08T13:53:49.660359 #6258] INFO -- : (0.000163s) SET DateStyle = 'ISO' I, [2012-07-08T13:53:49.664679 #6258] INFO -- : (0.000952s) SELECT NULL FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.665179 #6258] INFO -- : (0.000214s) SELECT * FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.665544 #6258] INFO -- : (0.000166s) SELECT 1 AS "one" FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.666100 #6258] INFO -- : (0.000325s) SELECT COUNT(*) AS "count" FROM "schema_info" LIMIT 1 I, [2012-07-08T13:53:49.666461 #6258] INFO -- : (0.000179s) SELECT "version" FROM "schema_info" LIMIT 1 Error: NoMethodError: undefined method `Migration' for Sequel:Module/Users/me/Projects/Qsario/db/migrate/001_create_user_and_file_tables.rb:3:in `<top (required)>' Here's what 001_create_user_and_file_tables.rb looks like: Sequel.Migration do no_transaction change do create_table(:users) do primary_key :id String :username, :unique=>true String :email, :unique=>true String :password_hash String :password_salt DateTime :joined_at, :null => false FalseClass :banned, default=>false String :role, default=>"user" end create_table(:files) do primary_key :id foreign_key :user_id, :users String :filename, :null => false DateTime :uploaded_at, :null => false end create_table(:users_files) do primary_key :id foreign_key :user_id, :users foreign_key :file_id, :files end end end Note that there is no Rakefile or anything like that yet because I'm still trying to get things set up. I am not using Rails. So that .rb file is the only thing in the directory.
0
11,387,007
07/08/2012 21:51:30
663,148
03/16/2011 19:31:05
823
5
Join two similar tables
This is Table1 data. BUYER_ID | ITEM_ID | CREATED_TIME -------------+--------------------+------------------------ 1015826235 220003038067 2001-11-03 19:40:21 1015826235 300003861266 2001-11-08 18:19:59 1015826235 140002997245 2003-08-22 09:23:17 1015826235 200002448035 2001-11-11 22:21:11 1015826235 *260003553381* *2005-05-27 07:09:56* 1015826235 *260003553382* *2002-02-02 19:40:39* 2012926235 *260003553383* *2002-06-01 06:58:47* If you compare the `Table1` data with the below `Table2` data, then the last three lines are missing in Table2 data after comparison from Table1 data for particular USER_ID with BUYER_ID. USER_ID | PRODUCT_ID | TIMESTAMPS ------------+------------------+------------- 1015826235 220003038067 1004841621 1015826235 300003861266 1005268799 1015826235 140002997245 1061569397 1015826235 200002448035 1005542471 So I need to show either of the two result like this for the above example after JOINING Table1 with Table2- BUYER_ID | ITEM_ID | CREATED_TIME | USER_ID | PRODUCT_ID | TIMESTAMPS -----------+-------------------+-------------------------+-----------------+----------------------+------------------ 1015826235 260003553381 2005-05-27 07:09:56 1015826235 NULL NULL 1015826235 260003553382 2002-02-02 19:40:39 1015826235 NULL NULL 2012926235 260003553383 2002-06-01 06:58:47 2012926235 NULL NULL **OR** BUYER_ID | ITEM_ID | CREATED_TIME | PRODUCT_ID | TIMESTAMPS -----------+-------------------+-------------------------+----------------+-------------- 1015826235 260003553381 2005-05-27 07:09:56 NULL NULL 1015826235 260003553382 2002-02-02 19:40:39 NULL NULL 2012926235 260003553383 2002-06-01 06:58:47 NULL NULL Any suggestion will be appreciated.
sql
join
group-by
null
null
null
open
Join two similar tables === This is Table1 data. BUYER_ID | ITEM_ID | CREATED_TIME -------------+--------------------+------------------------ 1015826235 220003038067 2001-11-03 19:40:21 1015826235 300003861266 2001-11-08 18:19:59 1015826235 140002997245 2003-08-22 09:23:17 1015826235 200002448035 2001-11-11 22:21:11 1015826235 *260003553381* *2005-05-27 07:09:56* 1015826235 *260003553382* *2002-02-02 19:40:39* 2012926235 *260003553383* *2002-06-01 06:58:47* If you compare the `Table1` data with the below `Table2` data, then the last three lines are missing in Table2 data after comparison from Table1 data for particular USER_ID with BUYER_ID. USER_ID | PRODUCT_ID | TIMESTAMPS ------------+------------------+------------- 1015826235 220003038067 1004841621 1015826235 300003861266 1005268799 1015826235 140002997245 1061569397 1015826235 200002448035 1005542471 So I need to show either of the two result like this for the above example after JOINING Table1 with Table2- BUYER_ID | ITEM_ID | CREATED_TIME | USER_ID | PRODUCT_ID | TIMESTAMPS -----------+-------------------+-------------------------+-----------------+----------------------+------------------ 1015826235 260003553381 2005-05-27 07:09:56 1015826235 NULL NULL 1015826235 260003553382 2002-02-02 19:40:39 1015826235 NULL NULL 2012926235 260003553383 2002-06-01 06:58:47 2012926235 NULL NULL **OR** BUYER_ID | ITEM_ID | CREATED_TIME | PRODUCT_ID | TIMESTAMPS -----------+-------------------+-------------------------+----------------+-------------- 1015826235 260003553381 2005-05-27 07:09:56 NULL NULL 1015826235 260003553382 2002-02-02 19:40:39 NULL NULL 2012926235 260003553383 2002-06-01 06:58:47 NULL NULL Any suggestion will be appreciated.
0
11,387,009
07/08/2012 21:51:38
1,500,652
07/04/2012 06:02:39
1
0
Visual Basic for Application (Excel 2002): How to use WIC api or Bitmap class?
I have no experience with VBA and I need to get this done. I appreciate any help. My goal is to read EXIF metadata of a jpg picture. There are some tutorials on the internet, but I have some difficulties with them. 1) I found this code on a msdn man page, its about the use of GDI+ library and functions of a Bitmap class.. 'Create an Image object. Dim image As Bitmap = New Bitmap("c:\FakePhoto.jpg") 'Get the PropertyItems property from image. Dim propItems As PropertyItem() = image.PropertyItems 'Set up the display. Dim font As New Font("Arial", 12) Dim blackBrush As New SolidBrush(Color.Black) Dim X As Integer = 0 Dim Y As Integer = 0 'For each PropertyItem in the array, display the ID, type, and length. Dim count As Integer = 0 Dim propItem As PropertyItem For Each propItem In propItems e.Graphics.DrawString( _ "Property Item " & count.ToString(), _ font, _ blackBrush, _ X, Y) Y += font.Height e.Graphics.DrawString( _ " iD: 0x" & propItem.Id.ToString("x"), _ font, _ blackBrush, _ X, Y) Y += font.Height e.Graphics.DrawString( _ " type: " & propItem.Type.ToString(), _ font, _ blackBrush, _ X, Y) Y += font.Height e.Graphics.DrawString( _ " length: " & propItem.Len.ToString() & " bytes", _ font, _ blackBrush, _ X, Y) Y += font.Height count += 1 Next propItem 'Convert the value of the second property to a string, and display it. Dim encoding As New System.Text.ASCIIEncoding() Dim manufacturer As String = encoding.GetString(propItems(1).Value) e.Graphics.DrawString( _ "The equipment make is " & manufacturer & ".", _ font, _ blackBrush, _ X, Y) But is this possible to use in VBA? I added System_Drawing resource, it knew Bitmap class, but I couldnt use PropertyItem() for example.. what am I doing wrong please? 2) Second tutorial I found was about Windows Imaging Component (its not VB, but I couldnt get it work in C# also). First code on that page is: IWICImagingFactory *pFactory = NULL; IWICBitmapDecoder *pDecoder = NULL; IWICBitmapFrameDecode *pFrameDecode = NULL; IWICMetadataQueryReader *pQueryReader = NULL; IWICMetadataQueryReader *pEmbedReader = NULL; PROPVARIANT value; // Initialize COM CoInitialize(NULL); // Initialize PROPVARIANT PropVariantInit(&value); //Create the COM imaging factory HRESULT hr = CoCreateInstance( CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (LPVOID*)&pFactory); // Create the decoder if (SUCCEEDED(hr)) { hr = pFactory->CreateDecoderFromFilename( L"test.jpg", NULL, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &pDecoder); } // Get a single frame from the image if (SUCCEEDED(hr)) { hr = pDecoder->GetFrame( 0, //JPEG has only one frame. &pFrameDecode); } and I just dont know what reference to add (i tried windowscodecs.dll - wrong move) or what Declaration to add to get the VBA module to know this *IWICImagingFactory* (for example), can you help me? Thanks a lot. I know its probably lame question, but i wasnt able to find an answer (at least if you told me where to find answers it would be great :)
excel
vba
metadata
jpg
basic
null
open
Visual Basic for Application (Excel 2002): How to use WIC api or Bitmap class? === I have no experience with VBA and I need to get this done. I appreciate any help. My goal is to read EXIF metadata of a jpg picture. There are some tutorials on the internet, but I have some difficulties with them. 1) I found this code on a msdn man page, its about the use of GDI+ library and functions of a Bitmap class.. 'Create an Image object. Dim image As Bitmap = New Bitmap("c:\FakePhoto.jpg") 'Get the PropertyItems property from image. Dim propItems As PropertyItem() = image.PropertyItems 'Set up the display. Dim font As New Font("Arial", 12) Dim blackBrush As New SolidBrush(Color.Black) Dim X As Integer = 0 Dim Y As Integer = 0 'For each PropertyItem in the array, display the ID, type, and length. Dim count As Integer = 0 Dim propItem As PropertyItem For Each propItem In propItems e.Graphics.DrawString( _ "Property Item " & count.ToString(), _ font, _ blackBrush, _ X, Y) Y += font.Height e.Graphics.DrawString( _ " iD: 0x" & propItem.Id.ToString("x"), _ font, _ blackBrush, _ X, Y) Y += font.Height e.Graphics.DrawString( _ " type: " & propItem.Type.ToString(), _ font, _ blackBrush, _ X, Y) Y += font.Height e.Graphics.DrawString( _ " length: " & propItem.Len.ToString() & " bytes", _ font, _ blackBrush, _ X, Y) Y += font.Height count += 1 Next propItem 'Convert the value of the second property to a string, and display it. Dim encoding As New System.Text.ASCIIEncoding() Dim manufacturer As String = encoding.GetString(propItems(1).Value) e.Graphics.DrawString( _ "The equipment make is " & manufacturer & ".", _ font, _ blackBrush, _ X, Y) But is this possible to use in VBA? I added System_Drawing resource, it knew Bitmap class, but I couldnt use PropertyItem() for example.. what am I doing wrong please? 2) Second tutorial I found was about Windows Imaging Component (its not VB, but I couldnt get it work in C# also). First code on that page is: IWICImagingFactory *pFactory = NULL; IWICBitmapDecoder *pDecoder = NULL; IWICBitmapFrameDecode *pFrameDecode = NULL; IWICMetadataQueryReader *pQueryReader = NULL; IWICMetadataQueryReader *pEmbedReader = NULL; PROPVARIANT value; // Initialize COM CoInitialize(NULL); // Initialize PROPVARIANT PropVariantInit(&value); //Create the COM imaging factory HRESULT hr = CoCreateInstance( CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (LPVOID*)&pFactory); // Create the decoder if (SUCCEEDED(hr)) { hr = pFactory->CreateDecoderFromFilename( L"test.jpg", NULL, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &pDecoder); } // Get a single frame from the image if (SUCCEEDED(hr)) { hr = pDecoder->GetFrame( 0, //JPEG has only one frame. &pFrameDecode); } and I just dont know what reference to add (i tried windowscodecs.dll - wrong move) or what Declaration to add to get the VBA module to know this *IWICImagingFactory* (for example), can you help me? Thanks a lot. I know its probably lame question, but i wasnt able to find an answer (at least if you told me where to find answers it would be great :)
0
11,387,012
07/08/2012 21:52:42
1,358,752
04/26/2012 13:03:59
1
0
Should I create custom jdbcrealm or not?
first sorry for my poor english ^_^ I have N databases with similar structures and I access it with EJB module in GlassFish 3.1.1. Some of my EJB methods are secured (@RolesAllowed...). I want simply test theses methods with remote call by an application client with JNDI. I can access remote interface of my bean with InitialContext(). But now I'm a litle bit lost because I don't know how to call these secured methods with correct Identity to match secured role of the method. Should I create new realm or only JAAS module ? I'm in doubt... Actual Glassfish jdbcRealm doesn't match my case because I want user to provide username, password AND database name to get identity but jdbcRealm is mono-database... For now, I have created one JAAS test module in my EJB module and created one method to launch authentication process. Authentication seems to finish well and I had one Principal to my Subject on commit method : @Override public boolean commit() throws LoginException { if(succeeded){ subject.getPrincipals().add(new OlivierPrincipal(name)); } return succeeded; } name variable equals "name" String and I have created glassfish-ejb-jar.xml in which I wrote : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd"> <glassfish-ejb-jar> <security-role-mapping> <role-name>admin</role-name> <principal-name>name</principal-name> </security-role-mapping> <enterprise-beans></enterprise-beans> </glassfish-ejb-jar> Basically, in my application client module I do : Context c = new InitialContext(); OlivierBeanRemote ejb = (OlivierBeanRemote)c.lookup("java:global/oli_ear/oli_ejb/OlivierBean!com.olivier.OlivierBeanRemote"); ejb.testLogin(); // test login with JAAS module stored on my EJB module ejb.test(); // secured method with @RolesAllowed("admin") I have some security error because my method call isn't done with admin role. How can I realize authentication with EJB module and application client module please ? Thanks a lot
java
jaas
jdbcrealm
null
null
null
open
Should I create custom jdbcrealm or not? === first sorry for my poor english ^_^ I have N databases with similar structures and I access it with EJB module in GlassFish 3.1.1. Some of my EJB methods are secured (@RolesAllowed...). I want simply test theses methods with remote call by an application client with JNDI. I can access remote interface of my bean with InitialContext(). But now I'm a litle bit lost because I don't know how to call these secured methods with correct Identity to match secured role of the method. Should I create new realm or only JAAS module ? I'm in doubt... Actual Glassfish jdbcRealm doesn't match my case because I want user to provide username, password AND database name to get identity but jdbcRealm is mono-database... For now, I have created one JAAS test module in my EJB module and created one method to launch authentication process. Authentication seems to finish well and I had one Principal to my Subject on commit method : @Override public boolean commit() throws LoginException { if(succeeded){ subject.getPrincipals().add(new OlivierPrincipal(name)); } return succeeded; } name variable equals "name" String and I have created glassfish-ejb-jar.xml in which I wrote : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd"> <glassfish-ejb-jar> <security-role-mapping> <role-name>admin</role-name> <principal-name>name</principal-name> </security-role-mapping> <enterprise-beans></enterprise-beans> </glassfish-ejb-jar> Basically, in my application client module I do : Context c = new InitialContext(); OlivierBeanRemote ejb = (OlivierBeanRemote)c.lookup("java:global/oli_ear/oli_ejb/OlivierBean!com.olivier.OlivierBeanRemote"); ejb.testLogin(); // test login with JAAS module stored on my EJB module ejb.test(); // secured method with @RolesAllowed("admin") I have some security error because my method call isn't done with admin role. How can I realize authentication with EJB module and application client module please ? Thanks a lot
0
11,226,710
06/27/2012 12:56:06
1,474,868
06/22/2012 12:54:00
11
0
How to place cursor to certain EditText box?
My XML contains Five `EditText` box and One Button. My cursor is now pointed to the First `EditText` box. How can I click a button to place the cursor automaticly to Third `EditText` box. Thank you!
android
null
null
null
null
null
open
How to place cursor to certain EditText box? === My XML contains Five `EditText` box and One Button. My cursor is now pointed to the First `EditText` box. How can I click a button to place the cursor automaticly to Third `EditText` box. Thank you!
0
11,226,711
06/27/2012 12:56:06
1,174,719
01/28/2012 02:33:28
625
3
How to display a complex UIViewController inside another UIView Controller?
Ok, so here's the situation. I currently have a view controller called `MainViewController` which has a UITableView with many different cells. When I click on a cell, I want that cell to expand (grow in height) and show some "additional information". The problem is, this additional information is very complex and can contain UILabels, other UITableViews, UIWebViews and UIImageViews. Furthermore, this "additional data" requires quite a bit of computation in order to determine what exactly to display (i.e. what the UILabels say, how large the UIImageViews are). Therefore, because of the complexity of this "additional information", I'm at a loss as to how to design my program. The "additional information" requires a lot of code, thus I don't want to just throw that code into the `MainViewController.` Additionally, it would be nice if there was some way to use Interface Builder to design these "additional information" views graphically rather than programatically. Currently I have each set of additional information as its own separate UIViewController (thus allowing me to have separate classes for the data and allowing me to use interface builder) and I just segue to a new screen when a cell is selected. However, I don't want to segue to a new screen; I want all of the data that this UIView controller is showing to be shown in `MainViewController`. What's the best way to do this? In summary, I currently have one UIViewController segueing to another UIViewController; however, I want the second UIViewController's content to be show in the first. If possible I would like to use some sort of Interface Builder and to separate out the logic for this second UIViewController into another class. Details: ~ I'm developing for iOS 5 only and I'm using ARC. ~ I've never developed for iOS 4 or below before and I have never used nib files before but I would be willing to learn if required. Simple sample code would be helpful. ~ Thanks!
iphone
objective-c
ios
xcode
uiviewcontroller
null
open
How to display a complex UIViewController inside another UIView Controller? === Ok, so here's the situation. I currently have a view controller called `MainViewController` which has a UITableView with many different cells. When I click on a cell, I want that cell to expand (grow in height) and show some "additional information". The problem is, this additional information is very complex and can contain UILabels, other UITableViews, UIWebViews and UIImageViews. Furthermore, this "additional data" requires quite a bit of computation in order to determine what exactly to display (i.e. what the UILabels say, how large the UIImageViews are). Therefore, because of the complexity of this "additional information", I'm at a loss as to how to design my program. The "additional information" requires a lot of code, thus I don't want to just throw that code into the `MainViewController.` Additionally, it would be nice if there was some way to use Interface Builder to design these "additional information" views graphically rather than programatically. Currently I have each set of additional information as its own separate UIViewController (thus allowing me to have separate classes for the data and allowing me to use interface builder) and I just segue to a new screen when a cell is selected. However, I don't want to segue to a new screen; I want all of the data that this UIView controller is showing to be shown in `MainViewController`. What's the best way to do this? In summary, I currently have one UIViewController segueing to another UIViewController; however, I want the second UIViewController's content to be show in the first. If possible I would like to use some sort of Interface Builder and to separate out the logic for this second UIViewController into another class. Details: ~ I'm developing for iOS 5 only and I'm using ARC. ~ I've never developed for iOS 4 or below before and I have never used nib files before but I would be willing to learn if required. Simple sample code would be helpful. ~ Thanks!
0
11,226,712
06/27/2012 12:56:06
857,994
07/22/2011 13:21:38
6,669
229
EndPoint: Syntax in C# - what is this?
I'm reviewing some code on the project I recently joined, and in a **C# Win Forms Application** for **.NET 3.5** I found this: public void foo() { //Normal code for function foo. //This is at the end and it is left-indented just as I put it here. EndPoint: { } } When I click "*EndPoint/Go To Definition"* it says *"Cannot Navigate to Endpoint"* but the project as a whole is pretty small and compiles/runs without error, so it's not a missing reference or anything. **What is EndPoint and what is this syntax with the name : {}?**
c#
.net
windows
winforms
.net-3.5
null
open
EndPoint: Syntax in C# - what is this? === I'm reviewing some code on the project I recently joined, and in a **C# Win Forms Application** for **.NET 3.5** I found this: public void foo() { //Normal code for function foo. //This is at the end and it is left-indented just as I put it here. EndPoint: { } } When I click "*EndPoint/Go To Definition"* it says *"Cannot Navigate to Endpoint"* but the project as a whole is pretty small and compiles/runs without error, so it's not a missing reference or anything. **What is EndPoint and what is this syntax with the name : {}?**
0
11,226,644
06/27/2012 12:52:22
1,041,118
11/11/2011 05:43:15
154
36
update positive to negative value in mysql
i have payment table fields ![enter image description here][1] [1]: http://i.stack.imgur.com/LWhtN.png update reason and amount & total field are change negative UPDATE payment SET reason = 'refund' WHERE WHERE uid =5 AND date = '2012-05-01' AND accid =2 update single query is it possible?
mysql
update
null
null
null
null
open
update positive to negative value in mysql === i have payment table fields ![enter image description here][1] [1]: http://i.stack.imgur.com/LWhtN.png update reason and amount & total field are change negative UPDATE payment SET reason = 'refund' WHERE WHERE uid =5 AND date = '2012-05-01' AND accid =2 update single query is it possible?
0
11,226,645
06/27/2012 12:52:30
1,041,333
11/11/2011 08:37:29
11
0
How do I make a Date Time Picker only select value by datepicker not by manual
here is my code that select from date value by user i want to select date value by datepicker only not manual entry <td style="width:25%;"> <s:datetimepicker id="fromDate" key="fromDate" name='fromDate' label="Format(dd/MM/yyyy)" displayFormat="dd/MM/yyyy" theme="simple"/> </td>
java
jsp
null
null
null
null
open
How do I make a Date Time Picker only select value by datepicker not by manual === here is my code that select from date value by user i want to select date value by datepicker only not manual entry <td style="width:25%;"> <s:datetimepicker id="fromDate" key="fromDate" name='fromDate' label="Format(dd/MM/yyyy)" displayFormat="dd/MM/yyyy" theme="simple"/> </td>
0
11,226,715
06/27/2012 12:56:14
1,407,889
05/21/2012 12:43:31
1
0
contact notes are not transferred when exporting/importing via the built-in vCard representation methods
Using the ABPersonCreateVCardRepresentationWithPeople method for export, and the ABPersonCreatePeopleInSourceWithVCardRepresentation for import, I have successfully transfered contact data between devices. However, the data in the contact's "notes" field isn't transfered. Here's my export function: +(NSData*)exportContactsToVcard:(NSArray*)contacts { NSMutableArray *people = [NSMutableArray arrayWithCapacity:contacts.count]; ABAddressBookRef ab = ABAddressBookCreate(); for (Contact *contact in contacts) { ABRecordRef person = ABAddressBookGetPersonWithRecordID(ab,contact.contactId); [people addObject:(__bridge id)person]; } NSData *vCard = (__bridge NSData*)ABPersonCreateVCardRepresentationWithPeople((__bridge CFArrayRef) people); return vCard; } and part of my import function: +(NSArray*)importContactsFromVcardData:(NSData*)vcardData { NSMutableArray *addedContactIds = [NSMutableArray array]; ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef defaultSource = ABAddressBookCopyDefaultSource(addressBook); NSArray *createdPeople = (__bridge_transfer NSArray*)ABPersonCreatePeopleInSourceWithVCardRepresentation(defaultSource,(__bridge CFDataRef)vcardData); CFErrorRef error = NULL; for (id person in createdPeople) { error = NULL; ABRecordRef personRecord = (__bridge ABRecordRef)person; NSString *notes = (__bridge NSString *)ABRecordCopyValue(personRecord, kABPersonNoteProperty); In the last line, notes is always nil, even if the contact had notes before it was exported. All the other standard contact fields seem to be in place. For example, if I replace the last line with: NSString *firstName = (__bridge NSString *)ABRecordCopyValue(personRecord, kABPersonFirstNameProperty); the firstName string will hold the contact's first name. Any idea how I can work around this, and get the contact notes? Thanks.
iphone
objective-c
abaddressbook
vcard
null
null
open
contact notes are not transferred when exporting/importing via the built-in vCard representation methods === Using the ABPersonCreateVCardRepresentationWithPeople method for export, and the ABPersonCreatePeopleInSourceWithVCardRepresentation for import, I have successfully transfered contact data between devices. However, the data in the contact's "notes" field isn't transfered. Here's my export function: +(NSData*)exportContactsToVcard:(NSArray*)contacts { NSMutableArray *people = [NSMutableArray arrayWithCapacity:contacts.count]; ABAddressBookRef ab = ABAddressBookCreate(); for (Contact *contact in contacts) { ABRecordRef person = ABAddressBookGetPersonWithRecordID(ab,contact.contactId); [people addObject:(__bridge id)person]; } NSData *vCard = (__bridge NSData*)ABPersonCreateVCardRepresentationWithPeople((__bridge CFArrayRef) people); return vCard; } and part of my import function: +(NSArray*)importContactsFromVcardData:(NSData*)vcardData { NSMutableArray *addedContactIds = [NSMutableArray array]; ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef defaultSource = ABAddressBookCopyDefaultSource(addressBook); NSArray *createdPeople = (__bridge_transfer NSArray*)ABPersonCreatePeopleInSourceWithVCardRepresentation(defaultSource,(__bridge CFDataRef)vcardData); CFErrorRef error = NULL; for (id person in createdPeople) { error = NULL; ABRecordRef personRecord = (__bridge ABRecordRef)person; NSString *notes = (__bridge NSString *)ABRecordCopyValue(personRecord, kABPersonNoteProperty); In the last line, notes is always nil, even if the contact had notes before it was exported. All the other standard contact fields seem to be in place. For example, if I replace the last line with: NSString *firstName = (__bridge NSString *)ABRecordCopyValue(personRecord, kABPersonFirstNameProperty); the firstName string will hold the contact's first name. Any idea how I can work around this, and get the contact notes? Thanks.
0
11,226,719
06/27/2012 12:56:36
258,009
01/24/2010 22:05:16
2,002
141
C++ / Boost shared resource class for managing resource lifecycle like shared_ptr
Does Boost, or anything else, contain a container will act like a shared pointer but allow me to control what happens to the shared 'resource' at the end of it's life? I want to encapsulate an object that can be handed around but, when no longer needed can be closed in a context defined way. For example, I might want to create and pass around a file handle knowing that when it goes out of scope, the file will be closed automatically, but I don't want to delete the handle. I could implement it myself, but would rather not get into that if the framework already exists - someone has no doubt done it better. I can't use `boost::shared_ptr`, at least not in it's normal form, as the resource should not be deleted at end of life.
c++
boost
shared-ptr
null
null
null
open
C++ / Boost shared resource class for managing resource lifecycle like shared_ptr === Does Boost, or anything else, contain a container will act like a shared pointer but allow me to control what happens to the shared 'resource' at the end of it's life? I want to encapsulate an object that can be handed around but, when no longer needed can be closed in a context defined way. For example, I might want to create and pass around a file handle knowing that when it goes out of scope, the file will be closed automatically, but I don't want to delete the handle. I could implement it myself, but would rather not get into that if the framework already exists - someone has no doubt done it better. I can't use `boost::shared_ptr`, at least not in it's normal form, as the resource should not be deleted at end of life.
0
11,226,725
06/27/2012 12:56:43
1,328,316
04/12/2012 06:21:44
1
0
FileNotFound Exception while passing inputStream to XmlParser
I am begginer to android development. I am using SAX parser for xml parser. I couldn't find the reason for this exeption. I tried getAsset() method. but it didn't worked. xmlParser code ::: public class XMLParser { public static Country parseCountry(InputStream is) { try { Country country= new Country(null, null, null); XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); XMLHandler xmlHandler = new XMLHandler(); xmlReader.setContentHandler(xmlHandler); xmlReader.parse(new InputSource(new FileInputStream(http://64.85.165.53/dharatest/xmlarray.xml)); country = xmlHandler.getParsedCountryData(); } catch(ParserConfigurationException pce) { Log.e("SAX XML", "sax parse error", pce); } catch(SAXException se) { Log.e("SAX XML", "sax error", se); } catch(IOException ioe) { Log.e("SAX XML", "sax parse io error", ioe); } return country; } }
android
inputstream
saxparser
filenotfoundexception
null
null
open
FileNotFound Exception while passing inputStream to XmlParser === I am begginer to android development. I am using SAX parser for xml parser. I couldn't find the reason for this exeption. I tried getAsset() method. but it didn't worked. xmlParser code ::: public class XMLParser { public static Country parseCountry(InputStream is) { try { Country country= new Country(null, null, null); XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); XMLHandler xmlHandler = new XMLHandler(); xmlReader.setContentHandler(xmlHandler); xmlReader.parse(new InputSource(new FileInputStream(http://64.85.165.53/dharatest/xmlarray.xml)); country = xmlHandler.getParsedCountryData(); } catch(ParserConfigurationException pce) { Log.e("SAX XML", "sax parse error", pce); } catch(SAXException se) { Log.e("SAX XML", "sax error", se); } catch(IOException ioe) { Log.e("SAX XML", "sax parse io error", ioe); } return country; } }
0
11,226,730
06/27/2012 12:57:07
733,287
05/01/2011 13:00:26
2,409
194
how to get element's inner HTML with dynamically typed text , jQuery
i am using jquery . i want to get a div's html . i am trying to do it by var form_html = jQuery('#search_form_wrapper').html(); it is working perfectly . when i alert HTML i get <div class="add-taggin-component"> <input class="data-label-input" value="" name="search_phrase" id="input-auto-suggest" tabindex="123456" type="text"> <!-- a id="btn-auto-suggest" tabindex="123456" class="data-label-add lbl-coal12"> Products </a> <label class="lbl-bottom lbl-grey11">Add a Country, State or City</label--> <div class="data-label-add lbl-coal12"> <span id="select-open1"> Products </span><span class="search-down-arrow"></span> </div> <select title="Search in" class="search-select" id="searchDropdownBox1" name="type"> <option value="products" selected="selected">Products</option> <option value="services">Services</option> <option value="people">People</option> <option value="places">Places</option> </select> </div> here i havean input <input class="data-label-input" value="" name="search_phrase" id="input-auto-suggest" tabindex="123456" type="text"> *i typed "kanishka" in that input field and then alert the HTML . but it has not updates with value "kanishka" i want to get my HTML like <input class="data-label-input" value="kanishka" name="search_phrase" id="input-auto-suggest" tabindex="123456" type="text"> i want the value of input to be updated to value="kanishka" instead of value="" how to achieve this , please help..................
javascript
jquery
ajax
null
null
null
open
how to get element's inner HTML with dynamically typed text , jQuery === i am using jquery . i want to get a div's html . i am trying to do it by var form_html = jQuery('#search_form_wrapper').html(); it is working perfectly . when i alert HTML i get <div class="add-taggin-component"> <input class="data-label-input" value="" name="search_phrase" id="input-auto-suggest" tabindex="123456" type="text"> <!-- a id="btn-auto-suggest" tabindex="123456" class="data-label-add lbl-coal12"> Products </a> <label class="lbl-bottom lbl-grey11">Add a Country, State or City</label--> <div class="data-label-add lbl-coal12"> <span id="select-open1"> Products </span><span class="search-down-arrow"></span> </div> <select title="Search in" class="search-select" id="searchDropdownBox1" name="type"> <option value="products" selected="selected">Products</option> <option value="services">Services</option> <option value="people">People</option> <option value="places">Places</option> </select> </div> here i havean input <input class="data-label-input" value="" name="search_phrase" id="input-auto-suggest" tabindex="123456" type="text"> *i typed "kanishka" in that input field and then alert the HTML . but it has not updates with value "kanishka" i want to get my HTML like <input class="data-label-input" value="kanishka" name="search_phrase" id="input-auto-suggest" tabindex="123456" type="text"> i want the value of input to be updated to value="kanishka" instead of value="" how to achieve this , please help..................
0
11,349,544
07/05/2012 17:35:12
370,927
06/19/2010 08:47:28
244
19
Ruby - Optimize the comparison of two arrays with duplicates
I have the following arrays: A = "cheddar".split(//) # ["c", "h", "e", "d", "d", "a", "r"] B = "cheddaar".split(//) # ["c", "h", "e", "d", "d", "a", "a", "r"] The A array is a subset of the B array. If the A array had another "d" element, it wouldn't be a subset. I want to compare and find if one is a subset of the other even if they have duplicates. The A - B or the A & B doesn't capture the duplicates it just compares them and find them matched. So I wrote the following which it captures the duplicates: B.each do |letter| A.delete_at(A.index(letter)) rescue "" end p A.empty? Is this the best way or can it be optimized?
ruby-on-rails
ruby
jruby
null
null
null
open
Ruby - Optimize the comparison of two arrays with duplicates === I have the following arrays: A = "cheddar".split(//) # ["c", "h", "e", "d", "d", "a", "r"] B = "cheddaar".split(//) # ["c", "h", "e", "d", "d", "a", "a", "r"] The A array is a subset of the B array. If the A array had another "d" element, it wouldn't be a subset. I want to compare and find if one is a subset of the other even if they have duplicates. The A - B or the A & B doesn't capture the duplicates it just compares them and find them matched. So I wrote the following which it captures the duplicates: B.each do |letter| A.delete_at(A.index(letter)) rescue "" end p A.empty? Is this the best way or can it be optimized?
0
11,349,555
07/05/2012 17:35:39
30,946
10/23/2008 19:56:12
5,651
179
is there a way to search a set of diffs for a particular string for a file?
I'd like to search the diffs of one file (ideally a set of files) for a specified set of revisions (or all). I'm looking for a diff report that is text searchable. I've got this: `hg diff -r 0:47131 .\TheFile.cs | grep 'theSearch' -Context 50 ` OK, that works well enough, but deciding how much context to include is an issue as well as finding the first and last revision. I can automate this better but it seems like it'll be a bit of work. I'm wondering if there's a tool out there that will do this better. Maybe a diff report web page for the hg server?
mercurial
null
null
null
null
null
open
is there a way to search a set of diffs for a particular string for a file? === I'd like to search the diffs of one file (ideally a set of files) for a specified set of revisions (or all). I'm looking for a diff report that is text searchable. I've got this: `hg diff -r 0:47131 .\TheFile.cs | grep 'theSearch' -Context 50 ` OK, that works well enough, but deciding how much context to include is an issue as well as finding the first and last revision. I can automate this better but it seems like it'll be a bit of work. I'm wondering if there's a tool out there that will do this better. Maybe a diff report web page for the hg server?
0
11,349,557
07/05/2012 17:35:46
957,225
09/21/2011 14:52:28
655
2
UIInterfaceOrientation of UIViewController
I tried checking the UIInterfaceOrientation of the current presented view controller and for some reason it always returns landscape. UIInterfaceOrientation currentOrientation = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation]; if (currentOrientation == UIInterfaceOrientationPortrait){ self.scrollView_.colMargin = 50; } else { self.scrollView_.colMargin = 130; } Any idea why?
iphone
objective-c
ios
ipad
null
null
open
UIInterfaceOrientation of UIViewController === I tried checking the UIInterfaceOrientation of the current presented view controller and for some reason it always returns landscape. UIInterfaceOrientation currentOrientation = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation]; if (currentOrientation == UIInterfaceOrientationPortrait){ self.scrollView_.colMargin = 50; } else { self.scrollView_.colMargin = 130; } Any idea why?
0
11,349,560
07/05/2012 17:36:07
1,492,787
06/30/2012 09:05:51
10
0
How to sum only the positive/negative values of the properties of objects in an array in Ruby
I understand that I can sum the properties of objects in an array in Ruby using the inject method. For example, I could sum the cash of all agents in an array using the following: sum_of_cash = agents.inject(0) { |sum, e| sum + e.cash } However, how can I sum only the positive or negative values of the properties, i.e. only the positive or negative cash balances, for example? One way I can think of is doing a loop over the array and summing only if the value is positive using an if function but I'm looking for a cleaner method, if possible. Thanks!
ruby
arrays
sum
inject
null
null
open
How to sum only the positive/negative values of the properties of objects in an array in Ruby === I understand that I can sum the properties of objects in an array in Ruby using the inject method. For example, I could sum the cash of all agents in an array using the following: sum_of_cash = agents.inject(0) { |sum, e| sum + e.cash } However, how can I sum only the positive or negative values of the properties, i.e. only the positive or negative cash balances, for example? One way I can think of is doing a loop over the array and summing only if the value is positive using an if function but I'm looking for a cleaner method, if possible. Thanks!
0
11,349,561
07/05/2012 17:36:08
1,484,513
06/27/2012 04:16:06
11
1
many-to-many-to-many accessor using DBIx::Class
Using DBIx::Class, I am trying to create a many-to-many accessor (or even just a has-many relationship) that spans two link tables. The three data tables in question are **Users**, **Roles** and **Pages**, with the two link tables **UserRoles** and **RolePages**. These tables are related thus: - a **User** has many **UserRoles** - a **Role** has many **UserRoles** - a **Role** has many **RolePages** - a **Page** has many **RolePages** The Catalyst helper script created these relationships and accessors for me: package MyApp::Schema::Result::User; __PACKAGE__->has_many( "user_roles", "MyApp::Schema::Result::UserRole", { "foreign.username" => "self.username" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many("roles", "user_roles", "role"); package MyApp::Schema::Result::Role; __PACKAGE__->has_many( "role_pages", "MyApp::Schema::Result::RolePage", { "foreign.role" => "self.role" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->has_many( "user_roles", "MyApp::Schema::Result::UserRole", { "foreign.role" => "self.role" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many("page_names", "role_pages", "page_name") __PACKAGE__->many_to_many("usernames", "user_roles", "username"); package MyApp::Schema::Result::Page; __PACKAGE__->has_many( "role_pages", "MyApp::Schema::Result::RolePage", { "foreign.page_name" => "self.page_name" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many("roles", "role_pages", "role"); package MyApp::Schema::Result::UserRole; __PACKAGE__->belongs_to( "role", "MyApp::Schema::Result::Role", { role => "role" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); __PACKAGE__->belongs_to( "username", "MyApp::Schema::Result::User", { username => "username" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); package MyApp::Schema::Result::RolePage; __PACKAGE__->belongs_to( "page_name", "MyApp::Schema::Result::Page", { page_name => "page_name" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); __PACKAGE__->belongs_to( "role", "MyApp::Schema::Result::Role", { role => "role" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); My end goal is to have a clean way to get a list of the pages that should be displayed for the current user. I.e.: foreach my $page ($c->user->pages) { # do something with $page } I did have this method in the MyApp::Schema::Result::User class: sub pages { my ($self) = @_; return $self->result_source->schema->resultset('RolePage')->search( { 'username.username' => $self->username, }, { join => [ { role => {user_roles => 'username'}, }, 'page_name', ], } ); } which worked until I added a class to extend MyApp::Schema::Result::RolePage. That class starts off like this: package MyApp::Schema::ResultSet::RolePage; use Moose; use namespace::autoclean; extends qw/MyApp::Schema::ResultSetX::DisplayTable/; has '+name' => ( default => 'RolePage' ); I've used this technique throughout my app, to create various result sets, and have only run into trouble with it now. I get this error: > Caught exception in Lifeway::Controller::Root->auto "Single parameters to new() must be a HASH ref which is caused by my `MyApp::Schema::Result::User->pages()` method. So, to avoid this error, I thought I'd try to create a many-to-many accessor (or even just a has-many relationship) from **Users** to **Pages**. Is is possible to create such an accessor/relationship that spans two link tables? If so, how? I can't find an example in the docs, and have run out of ideas myself. Failing that, any ideas on why I'm getting that error with my pages() method?
perl
many-to-many
catalyst
dbix-class
null
null
open
many-to-many-to-many accessor using DBIx::Class === Using DBIx::Class, I am trying to create a many-to-many accessor (or even just a has-many relationship) that spans two link tables. The three data tables in question are **Users**, **Roles** and **Pages**, with the two link tables **UserRoles** and **RolePages**. These tables are related thus: - a **User** has many **UserRoles** - a **Role** has many **UserRoles** - a **Role** has many **RolePages** - a **Page** has many **RolePages** The Catalyst helper script created these relationships and accessors for me: package MyApp::Schema::Result::User; __PACKAGE__->has_many( "user_roles", "MyApp::Schema::Result::UserRole", { "foreign.username" => "self.username" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many("roles", "user_roles", "role"); package MyApp::Schema::Result::Role; __PACKAGE__->has_many( "role_pages", "MyApp::Schema::Result::RolePage", { "foreign.role" => "self.role" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->has_many( "user_roles", "MyApp::Schema::Result::UserRole", { "foreign.role" => "self.role" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many("page_names", "role_pages", "page_name") __PACKAGE__->many_to_many("usernames", "user_roles", "username"); package MyApp::Schema::Result::Page; __PACKAGE__->has_many( "role_pages", "MyApp::Schema::Result::RolePage", { "foreign.page_name" => "self.page_name" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many("roles", "role_pages", "role"); package MyApp::Schema::Result::UserRole; __PACKAGE__->belongs_to( "role", "MyApp::Schema::Result::Role", { role => "role" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); __PACKAGE__->belongs_to( "username", "MyApp::Schema::Result::User", { username => "username" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); package MyApp::Schema::Result::RolePage; __PACKAGE__->belongs_to( "page_name", "MyApp::Schema::Result::Page", { page_name => "page_name" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); __PACKAGE__->belongs_to( "role", "MyApp::Schema::Result::Role", { role => "role" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); My end goal is to have a clean way to get a list of the pages that should be displayed for the current user. I.e.: foreach my $page ($c->user->pages) { # do something with $page } I did have this method in the MyApp::Schema::Result::User class: sub pages { my ($self) = @_; return $self->result_source->schema->resultset('RolePage')->search( { 'username.username' => $self->username, }, { join => [ { role => {user_roles => 'username'}, }, 'page_name', ], } ); } which worked until I added a class to extend MyApp::Schema::Result::RolePage. That class starts off like this: package MyApp::Schema::ResultSet::RolePage; use Moose; use namespace::autoclean; extends qw/MyApp::Schema::ResultSetX::DisplayTable/; has '+name' => ( default => 'RolePage' ); I've used this technique throughout my app, to create various result sets, and have only run into trouble with it now. I get this error: > Caught exception in Lifeway::Controller::Root->auto "Single parameters to new() must be a HASH ref which is caused by my `MyApp::Schema::Result::User->pages()` method. So, to avoid this error, I thought I'd try to create a many-to-many accessor (or even just a has-many relationship) from **Users** to **Pages**. Is is possible to create such an accessor/relationship that spans two link tables? If so, how? I can't find an example in the docs, and have run out of ideas myself. Failing that, any ideas on why I'm getting that error with my pages() method?
0
11,349,563
07/05/2012 17:36:16
804,564
06/18/2011 13:47:41
33
4
CodeCollab GUI issues
I am trying to upload code to Code Collaborator via the GUI. When I enter the server url, username and password and select ClearCase as the SCM, I get the following error: Error: rational cm api for clearcase remote client not found. Has anyone encountered this before? What have you done to solve this?
clearcase
code-collaborator
null
null
null
null
open
CodeCollab GUI issues === I am trying to upload code to Code Collaborator via the GUI. When I enter the server url, username and password and select ClearCase as the SCM, I get the following error: Error: rational cm api for clearcase remote client not found. Has anyone encountered this before? What have you done to solve this?
0
11,349,568
07/05/2012 17:36:33
884,625
08/08/2011 18:38:35
92
2
Dertermine holidays in Oracle
Is there a default function in Oracle that allows you to pass the date as the parameter, and it returns whether it is a US holiday or not? something like IS_HOLIDAY(:DATEINPUT) I need to do this **without** a stored procedure. In my select statement, what I'd like to do is filter out data based on holday, in my where clause. Please help.
sql
oracle
date
null
null
null
open
Dertermine holidays in Oracle === Is there a default function in Oracle that allows you to pass the date as the parameter, and it returns whether it is a US holiday or not? something like IS_HOLIDAY(:DATEINPUT) I need to do this **without** a stored procedure. In my select statement, what I'd like to do is filter out data based on holday, in my where clause. Please help.
0
11,349,569
07/05/2012 17:36:37
598,591
02/01/2011 15:01:23
795
62
How to make a fluid/liquid Air application?
What I need is take advantage of the all area of the screen, independent of user's screen proportions. By default, Air apps scales proportionately from the inside out. This would be great if we hadn't so different screens sizes and proportions in Android. Angry Birds is a good example of what I call of fluid layout, it always scales/zooms the three layers(front, game and background layer) accordinly. My app is mostly a inteface based game, the user must see some info and click on some buttons. I think I could base my scale primarily in the user screen's width, and use a scroll if needed. The problem is how do that.
actionscript-3
air
resolution
mobile-application
null
null
open
How to make a fluid/liquid Air application? === What I need is take advantage of the all area of the screen, independent of user's screen proportions. By default, Air apps scales proportionately from the inside out. This would be great if we hadn't so different screens sizes and proportions in Android. Angry Birds is a good example of what I call of fluid layout, it always scales/zooms the three layers(front, game and background layer) accordinly. My app is mostly a inteface based game, the user must see some info and click on some buttons. I think I could base my scale primarily in the user screen's width, and use a scroll if needed. The problem is how do that.
0
11,349,571
07/05/2012 17:36:39
1,125,699
01/02/2012 04:41:39
169
11
ORA-00937: Not a single-group group function - Query error
**Error: ORA-00937: Not a single-group group function** Query: select count(*) todas, sum(case when i.prioridade = 1 then 1 else 0 end) urgente, sum(case when i.prioridade = 2 then 1 else 0 end) alta, sum(case when i.prioridade = 3 then 1 else 0 end) normal, sum(case when i.prioridade = 4 then 1 else 0 end) baixa, (select count(*) from GMITEMOS i inner join GMCTLSLA c on c.os = i.cd_numero_os and c.item = i.item where i.situacao in ('A', 'I', 'P') and c.ordem = 99999 ) naoAvaliados, sum(case when i.situacao = 'P' then 1 else 0 end) pendentes, sum(case when i.situacao = 'A' or i.situacao = 'I' then 1 else 0 end) iniciados from GMITEMOS i where i.situacao in ('A', 'I', 'P') and exists (select 1 from GMCTLSLA c where c.os = i.cd_numero_os and c.item = i.item) The error is ocurring here: (select count(*) from GMITEMOS i inner join GMCTLSLA c on c.os = i.cd_numero_os and c.item = i.item where i.situacao in ('A', 'I', 'P') and c.ordem = 99999 ) naoAvaliados Can someone tell why is it happening?
database
oracle
query
null
null
null
open
ORA-00937: Not a single-group group function - Query error === **Error: ORA-00937: Not a single-group group function** Query: select count(*) todas, sum(case when i.prioridade = 1 then 1 else 0 end) urgente, sum(case when i.prioridade = 2 then 1 else 0 end) alta, sum(case when i.prioridade = 3 then 1 else 0 end) normal, sum(case when i.prioridade = 4 then 1 else 0 end) baixa, (select count(*) from GMITEMOS i inner join GMCTLSLA c on c.os = i.cd_numero_os and c.item = i.item where i.situacao in ('A', 'I', 'P') and c.ordem = 99999 ) naoAvaliados, sum(case when i.situacao = 'P' then 1 else 0 end) pendentes, sum(case when i.situacao = 'A' or i.situacao = 'I' then 1 else 0 end) iniciados from GMITEMOS i where i.situacao in ('A', 'I', 'P') and exists (select 1 from GMCTLSLA c where c.os = i.cd_numero_os and c.item = i.item) The error is ocurring here: (select count(*) from GMITEMOS i inner join GMCTLSLA c on c.os = i.cd_numero_os and c.item = i.item where i.situacao in ('A', 'I', 'P') and c.ordem = 99999 ) naoAvaliados Can someone tell why is it happening?
0
11,349,582
07/05/2012 17:37:16
165,694
08/30/2009 19:53:00
627
7
Cannot see employee class object properties in asp.net
I have an Employee class object that I am calling from my "Login.aspx" page's btnContinue_Click event. I am not able to see any of the properties in the intellisense. What am I doing wrong in the code below? Here is my code: **employee.cls** public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public string DateOfBirth { get; set; } public string EMailAddress { get; set; } public string PhoneNumber { get; set; } public string CorpID { get; set; } public string SignOn { get; set; } public string Password { get; set; } } **Login.aspx.cs** protected void btnEmployeeLogin_Click(object sender, EventArgs e) { try { if (LogInValidated()) { Employee oEmp = new Employee(); //oEmp. } } catch (Exception ex) { Response.Write(ex.ToString()); } }
c#
asp.net
oop
null
null
null
open
Cannot see employee class object properties in asp.net === I have an Employee class object that I am calling from my "Login.aspx" page's btnContinue_Click event. I am not able to see any of the properties in the intellisense. What am I doing wrong in the code below? Here is my code: **employee.cls** public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public string DateOfBirth { get; set; } public string EMailAddress { get; set; } public string PhoneNumber { get; set; } public string CorpID { get; set; } public string SignOn { get; set; } public string Password { get; set; } } **Login.aspx.cs** protected void btnEmployeeLogin_Click(object sender, EventArgs e) { try { if (LogInValidated()) { Employee oEmp = new Employee(); //oEmp. } } catch (Exception ex) { Response.Write(ex.ToString()); } }
0
11,349,585
07/05/2012 17:37:20
1,470,127
06/20/2012 18:15:54
6
0
Run .Net application on XP,Vista,Windows7 ... 32 and 64 bit
I got an application from a client. The application has 2 setup files one for 32 bit OS and other for 64 bit windows OS. I want to combine them and i want to make 1 exe that runs on all the windows OS and on 32 and 64 bit. What i need to do ? Regards, Behroz
winforms
null
null
null
null
null
open
Run .Net application on XP,Vista,Windows7 ... 32 and 64 bit === I got an application from a client. The application has 2 setup files one for 32 bit OS and other for 64 bit windows OS. I want to combine them and i want to make 1 exe that runs on all the windows OS and on 32 and 64 bit. What i need to do ? Regards, Behroz
0
11,259,258
06/29/2012 09:26:13
1,270,187
03/14/2012 21:30:31
393
15
Python time always time at beginning of script?
Code I have written involves getting the time waiting for 10 minutes and then getting the time again, but in both cases `datetime.time(datetime.now())` returns the same time and in both cases the time is NOT the time when I ran the part to check the time, its the time that the entire script began to execute (e.g. if the script starts at 7:05 and at 7:06 i check the time it will tell me its 7:05 etc)
datetime
python-2.5
null
null
null
null
open
Python time always time at beginning of script? === Code I have written involves getting the time waiting for 10 minutes and then getting the time again, but in both cases `datetime.time(datetime.now())` returns the same time and in both cases the time is NOT the time when I ran the part to check the time, its the time that the entire script began to execute (e.g. if the script starts at 7:05 and at 7:06 i check the time it will tell me its 7:05 etc)
0
11,259,261
06/29/2012 09:26:18
1,435,226
06/04/2012 13:08:22
23
2
REGEX FOR SPANISH LANGUAGE FOR VALIDATION OF FILE CONTENT. RELATED TO ESAPI
I am working on the fixes of the code audit report of my project on the security issues. I am using ESAPI for the validation and escaping and for other purposes on the xss vulnerability and leakage of .toString issues been reported. I have done with all except one of them in which I need to have a Regex expression to validate the contents of a string/File may have any type of spanish characters and english characters. The code is below. boolean isValidContent = ESAPI.validator().isValidInput(file.toString(),content, "ContentRejex",1000000, false); response.getWriter().write(ValidContent); Can anyone tell me how to define this regex expression (ContentRegex)? Also I have got a suggestion to use LOCALE in getting the expression. But I dont no how? Please give me a clue. Also can I use \n, \t in the Regex expression.
regex
validation
xss
locale
esapi
null
open
REGEX FOR SPANISH LANGUAGE FOR VALIDATION OF FILE CONTENT. RELATED TO ESAPI === I am working on the fixes of the code audit report of my project on the security issues. I am using ESAPI for the validation and escaping and for other purposes on the xss vulnerability and leakage of .toString issues been reported. I have done with all except one of them in which I need to have a Regex expression to validate the contents of a string/File may have any type of spanish characters and english characters. The code is below. boolean isValidContent = ESAPI.validator().isValidInput(file.toString(),content, "ContentRejex",1000000, false); response.getWriter().write(ValidContent); Can anyone tell me how to define this regex expression (ContentRegex)? Also I have got a suggestion to use LOCALE in getting the expression. But I dont no how? Please give me a clue. Also can I use \n, \t in the Regex expression.
0
11,262,240
06/29/2012 12:58:25
203,239
11/05/2009 07:33:07
85
1
InkCanvas: How to erase by Stroke on right mouse click
I have an InkCanvas that works in the InkCanvasEditingMode.Ink. But I want to erase the entire stroke when the user presses the right button. Help me with an advise, please?
erase
stroke
inkcanvas
right-mouse-button
null
null
open
InkCanvas: How to erase by Stroke on right mouse click === I have an InkCanvas that works in the InkCanvasEditingMode.Ink. But I want to erase the entire stroke when the user presses the right button. Help me with an advise, please?
0
11,262,244
06/29/2012 12:58:35
1,486,868
06/27/2012 20:38:43
1
0
JQtouch: Scroll to anchor in list with link
I allready have used to much time, figuring out (googling) how to make a butten, scroll down to a specific < li > in a edgetoedge list. I use JQtouch with Zepto and PhoneGap (Cordova) . Here's my very simple example, where im trying to use html anchors. It'll not work: <div id="ListPage"> <div> <a href="#b">jump to b</a> </div> <div class="scroll"> <ul> <li><a name="a" />Some text</li> . . 50 times li.... :) . . <li><a name="b" />Some text</li> . . 50 times li.... :) . . </ul> </div> </div> I cant use ID's cause JQtouch use the id and a for page transistions.. what to do...
list
phonegap
scroll
anchor
jqtouch
null
open
JQtouch: Scroll to anchor in list with link === I allready have used to much time, figuring out (googling) how to make a butten, scroll down to a specific < li > in a edgetoedge list. I use JQtouch with Zepto and PhoneGap (Cordova) . Here's my very simple example, where im trying to use html anchors. It'll not work: <div id="ListPage"> <div> <a href="#b">jump to b</a> </div> <div class="scroll"> <ul> <li><a name="a" />Some text</li> . . 50 times li.... :) . . <li><a name="b" />Some text</li> . . 50 times li.... :) . . </ul> </div> </div> I cant use ID's cause JQtouch use the id and a for page transistions.. what to do...
0
11,262,245
06/29/2012 12:58:36
1,232,720
02/25/2012 15:59:33
6
0
Change the class of and object. (Other aproachs?)
I have had serveral situations when i would like to do that. This could be an example: Considere a possible implementation for the chess game. We define the abstract class 'Piece' and classes inheriting from it: 'bishop' 'peon' 'tower' 'horse' 'queen' etc We may have our peon about to reach the end of the board, and it may be required for a method called onto that peon object to change the class of that object to 'Queen', 'horse' or whatever. So my question is, is there any way to do that in C++ or Java? if not, in any other language? Also, are there other aproachs for this situations in general?
java
c++
class
runtime
inherit
null
open
Change the class of and object. (Other aproachs?) === I have had serveral situations when i would like to do that. This could be an example: Considere a possible implementation for the chess game. We define the abstract class 'Piece' and classes inheriting from it: 'bishop' 'peon' 'tower' 'horse' 'queen' etc We may have our peon about to reach the end of the board, and it may be required for a method called onto that peon object to change the class of that object to 'Queen', 'horse' or whatever. So my question is, is there any way to do that in C++ or Java? if not, in any other language? Also, are there other aproachs for this situations in general?
0
11,262,256
06/29/2012 12:59:01
596,881
01/31/2011 13:03:01
62
0
How do I get displayed string from one table view in another table view?
I passed string from controllerA (second item in tab bar) to controllerB (first item in tab bar), added that string to array and want to display it. I called reloadData but table view is still empty. What I have to do to get my string displayed in controllerB? (this two controllers are connected to two different navigation controllers and I don't want to use seque).
objective-c
null
null
null
null
null
open
How do I get displayed string from one table view in another table view? === I passed string from controllerA (second item in tab bar) to controllerB (first item in tab bar), added that string to array and want to display it. I called reloadData but table view is still empty. What I have to do to get my string displayed in controllerB? (this two controllers are connected to two different navigation controllers and I don't want to use seque).
0
11,262,087
06/29/2012 12:48:44
1,472,847
06/21/2012 17:18:52
3
2
Creating links on another page using a PHP form?
I have a form. Someone types something into the form and that link gets put into a button, I was wondering if there was a way I could possibly have my form so that you can paste the URL and submit the name of the button to? I have a set number of buttons ready on the other side waiting to be filled via POST, but what I'm wondering is weather I can use a for to 'generate' buttons? It's just a hyperlink with a class attached.
php
forms
null
null
null
null
open
Creating links on another page using a PHP form? === I have a form. Someone types something into the form and that link gets put into a button, I was wondering if there was a way I could possibly have my form so that you can paste the URL and submit the name of the button to? I have a set number of buttons ready on the other side waiting to be filled via POST, but what I'm wondering is weather I can use a for to 'generate' buttons? It's just a hyperlink with a class attached.
0
11,262,260
06/29/2012 12:59:17
1,491,156
06/29/2012 12:28:31
1
0
finding free blocks of time in mysql and php
i have a table in mysql like this +------------+------------+------------+------------+ | date | user_id | start_hour | end_hour | +------------+------------+------------+------------+ | 2010-12-15 | 20 | 08:00:00 | 08:15:00 | | 2010-12-15 | 20 | 14:00:00 | 14:30:00 | | 2010-12-15 | 20 | 17:00:00 | 17:45:00 | +------------+------------+------------+------------+ and i try to extrac the time range of between the time of users i found the next great code: http://www.artfulsoftware.com/infotree/queries.php#577 but i can't make that work on hours i have the next query $sql="SELECT a.end_hour AS 'Available From', Min(b.start_hour) AS 'To' FROM ( SELECT 0 as date, '08:00:00' as start_hour,'08:00:00' as end_hour UNION SELECT date, start_hour, end_hour FROM appointment ) AS a JOIN ( SELECT date, start_hour, end_hour FROM appointment UNION SELECT 0, '21:00:00' as start_hour, '22:00:00' as end_hour ) AS b ON a.date=b.date AND a.user_id=b.user_id AND a.end_hour < b.start_hour WHERE a.date='$date' AND a.user_id='$user_id' GROUP BY a.end_hour HAVING a.end_hour < Min(b.start_hour); "; i need create a range since 08:00 to 21:00 whit the free blocks between the appointments thanks in advance and sorry by my bad english.
php
mysql
time
appointment
null
null
open
finding free blocks of time in mysql and php === i have a table in mysql like this +------------+------------+------------+------------+ | date | user_id | start_hour | end_hour | +------------+------------+------------+------------+ | 2010-12-15 | 20 | 08:00:00 | 08:15:00 | | 2010-12-15 | 20 | 14:00:00 | 14:30:00 | | 2010-12-15 | 20 | 17:00:00 | 17:45:00 | +------------+------------+------------+------------+ and i try to extrac the time range of between the time of users i found the next great code: http://www.artfulsoftware.com/infotree/queries.php#577 but i can't make that work on hours i have the next query $sql="SELECT a.end_hour AS 'Available From', Min(b.start_hour) AS 'To' FROM ( SELECT 0 as date, '08:00:00' as start_hour,'08:00:00' as end_hour UNION SELECT date, start_hour, end_hour FROM appointment ) AS a JOIN ( SELECT date, start_hour, end_hour FROM appointment UNION SELECT 0, '21:00:00' as start_hour, '22:00:00' as end_hour ) AS b ON a.date=b.date AND a.user_id=b.user_id AND a.end_hour < b.start_hour WHERE a.date='$date' AND a.user_id='$user_id' GROUP BY a.end_hour HAVING a.end_hour < Min(b.start_hour); "; i need create a range since 08:00 to 21:00 whit the free blocks between the appointments thanks in advance and sorry by my bad english.
0
11,713,492
07/29/2012 22:21:23
1,359,182
04/26/2012 16:12:55
89
1
jQuery UI Datepicker not working
[Here][1] is the code from my project where I am using a datepicker. The jQuery menubar works but the datepicker doesnt. What am I missing? Also, how do I get the menubar center aligned? [1]: http://jsfiddle.net/Wwqpq/
javascript
css
jquery-ui
null
null
null
open
jQuery UI Datepicker not working === [Here][1] is the code from my project where I am using a datepicker. The jQuery menubar works but the datepicker doesnt. What am I missing? Also, how do I get the menubar center aligned? [1]: http://jsfiddle.net/Wwqpq/
0
11,710,991
07/29/2012 16:42:40
187,048
10/09/2009 09:32:12
340
14
facebook logout error
i am trying to use the facebook login for the site https://www.mysite.com on www.mysite.com/login.php i print a facebook login button using Javascript SDK. login works correctly. in the logged pages i print a logout button using: require_once 'oauth2/facebook/facebook.php'; require 'admin/inc/facebook.inc.php'; //contains setting as secret sky, app id, etc $facebook = new Facebook(array( 'appId' => $fb_app_id, 'secret' => $fb_secret_key )); $fb_user=null; $fb_user = $facebook->getUser(); if ($fb_user) { $fb_user_profile=$facebook->destroySession(); $params = array( 'next' => 'https://www.mysite.com/logout.php' ); echo="<a href=\"".$facebook->getLogoutUrl($params))."\" >"."logout"."</a>"; } else echo="<a href=\"/logout.php\" >"."logout"."</a>"; but when i press logout it redirects just to www.facebook.com/home.php i tried to use <a onclick="FB.logout()" href="logout.php">Logout</a> but it didn't work.
php
facebook
oauth-2.0
null
null
null
open
facebook logout error === i am trying to use the facebook login for the site https://www.mysite.com on www.mysite.com/login.php i print a facebook login button using Javascript SDK. login works correctly. in the logged pages i print a logout button using: require_once 'oauth2/facebook/facebook.php'; require 'admin/inc/facebook.inc.php'; //contains setting as secret sky, app id, etc $facebook = new Facebook(array( 'appId' => $fb_app_id, 'secret' => $fb_secret_key )); $fb_user=null; $fb_user = $facebook->getUser(); if ($fb_user) { $fb_user_profile=$facebook->destroySession(); $params = array( 'next' => 'https://www.mysite.com/logout.php' ); echo="<a href=\"".$facebook->getLogoutUrl($params))."\" >"."logout"."</a>"; } else echo="<a href=\"/logout.php\" >"."logout"."</a>"; but when i press logout it redirects just to www.facebook.com/home.php i tried to use <a onclick="FB.logout()" href="logout.php">Logout</a> but it didn't work.
0
11,710,992
07/29/2012 16:42:42
1,561,206
07/29/2012 16:20:01
1
0
Broken Menu Styling After Adding New Javascript
I have dropdown menus that look like this: http://imgur.com/pzBjF However, I want a div element to stick the top of a page at a certain scroll range, so I added this code: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[ $(window).scroll(function(e){ $el = $('.fixedElement'); if ($(this).scrollTop() > 1437 && $el.css('position') != 'fixed'){ $('.fixedElement').css({'position': 'fixed', 'top': '0px'}); } if ($(this).scrollTop() < 1437 && $el.css('position') != 'absolute'){ $('.fixedElement').css({'position': 'absolute', 'top': '1437px'}); } }); // ]]> </script> .fixedElement is defined in my CSS file, and then referenced with <div class="fixedElement" Now, my dropdown menus look like this: http://imgur.com/1BZkR When I comment out the new javascript, the menus go back to normal. Any ideas on how to make my new javascript work with my dropdown menus? Thanks!
javascript
drop-down-menu
null
null
null
null
open
Broken Menu Styling After Adding New Javascript === I have dropdown menus that look like this: http://imgur.com/pzBjF However, I want a div element to stick the top of a page at a certain scroll range, so I added this code: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[ $(window).scroll(function(e){ $el = $('.fixedElement'); if ($(this).scrollTop() > 1437 && $el.css('position') != 'fixed'){ $('.fixedElement').css({'position': 'fixed', 'top': '0px'}); } if ($(this).scrollTop() < 1437 && $el.css('position') != 'absolute'){ $('.fixedElement').css({'position': 'absolute', 'top': '1437px'}); } }); // ]]> </script> .fixedElement is defined in my CSS file, and then referenced with <div class="fixedElement" Now, my dropdown menus look like this: http://imgur.com/1BZkR When I comment out the new javascript, the menus go back to normal. Any ideas on how to make my new javascript work with my dropdown menus? Thanks!
0
11,713,526
07/29/2012 22:26:28
1,525,984
07/14/2012 18:44:24
27
1
customize table view highlight
I have a table view that I am customizing, but when I select it, it only selects half... Look: ![without highlight][1] ![highlighted][2] Without highlights: [1]: http://i.stack.imgur.com/hQbim.png Highlighted: [2]: http://i.stack.imgur.com/0OOdJ.png My codes from the class that controls the tableview: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ // create the parent view that will hold header Label UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10,0,300,60)]; // create image object UIImage *myImage = [UIImage imageNamed:@"trolley.png"];; // create the label objects UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; headerLabel.backgroundColor = [UIColor clearColor]; headerLabel.font = [UIFont boldSystemFontOfSize:15]; headerLabel.frame = CGRectMake(70,22,200,20); headerLabel.text = @"Object"; headerLabel.textColor = [UIColor darkGrayColor]; UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectZero]; detailLabel.backgroundColor = [UIColor clearColor]; detailLabel.textColor = [UIColor redColor]; detailLabel.text = @"Quantity"; detailLabel.font = [UIFont systemFontOfSize:15]; detailLabel.frame = CGRectMake(230,20,230,25); // create the imageView with the image in it UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage]; imageView.frame = CGRectMake(10,10,50,50); [customView addSubview:imageView]; [customView addSubview:headerLabel]; [customView addSubview:detailLabel]; return customView; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [lista count]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath { return 60; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } // Configure the cell... return cell; } I hope you can understand me!
objective-c
xcode
cocoa-touch
uitableview
uitableviewcell
null
open
customize table view highlight === I have a table view that I am customizing, but when I select it, it only selects half... Look: ![without highlight][1] ![highlighted][2] Without highlights: [1]: http://i.stack.imgur.com/hQbim.png Highlighted: [2]: http://i.stack.imgur.com/0OOdJ.png My codes from the class that controls the tableview: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ // create the parent view that will hold header Label UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10,0,300,60)]; // create image object UIImage *myImage = [UIImage imageNamed:@"trolley.png"];; // create the label objects UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; headerLabel.backgroundColor = [UIColor clearColor]; headerLabel.font = [UIFont boldSystemFontOfSize:15]; headerLabel.frame = CGRectMake(70,22,200,20); headerLabel.text = @"Object"; headerLabel.textColor = [UIColor darkGrayColor]; UILabel *detailLabel = [[UILabel alloc] initWithFrame:CGRectZero]; detailLabel.backgroundColor = [UIColor clearColor]; detailLabel.textColor = [UIColor redColor]; detailLabel.text = @"Quantity"; detailLabel.font = [UIFont systemFontOfSize:15]; detailLabel.frame = CGRectMake(230,20,230,25); // create the imageView with the image in it UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage]; imageView.frame = CGRectMake(10,10,50,50); [customView addSubview:imageView]; [customView addSubview:headerLabel]; [customView addSubview:detailLabel]; return customView; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [lista count]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath { return 60; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } // Configure the cell... return cell; } I hope you can understand me!
0
11,713,527
07/29/2012 22:26:29
938,822
09/11/2011 03:48:53
689
28
How can I define a variable inside a function to be called by an event
I'm not sure of how ask this how can I set a function variable so can I call outside of the context, like this example function testSet(elmA,elmB){ elmA.onclick=function(){ elmB.value="ok"; } } testSet(document.getElementById('a'),document.getElementById('b')); this doesn't work because when the onclick event is called it is called probably from 'window' and elmB is undefined. How can I get this working without flooding the global-scope like `window.elmB=elmB;` I'm having this issue, with events and callbacks.
javascript
oop
variable-scope
static-variables
null
null
open
How can I define a variable inside a function to be called by an event === I'm not sure of how ask this how can I set a function variable so can I call outside of the context, like this example function testSet(elmA,elmB){ elmA.onclick=function(){ elmB.value="ok"; } } testSet(document.getElementById('a'),document.getElementById('b')); this doesn't work because when the onclick event is called it is called probably from 'window' and elmB is undefined. How can I get this working without flooding the global-scope like `window.elmB=elmB;` I'm having this issue, with events and callbacks.
0
11,713,528
07/29/2012 22:26:30
1,561,605
07/29/2012 22:19:54
1
0
(new to this) Trying to make a batch menu which activates other batches
I'm having alot of trouble with this batch because my directory that I put always says that it does not find it. Do I have to short my directory to activate my batches on the menu? C:\Users\Saul\Documents\Word\Notepad\Batch\Directories\B.Pictures\comic.bat
batch-file
null
null
null
null
null
open
(new to this) Trying to make a batch menu which activates other batches === I'm having alot of trouble with this batch because my directory that I put always says that it does not find it. Do I have to short my directory to activate my batches on the menu? C:\Users\Saul\Documents\Word\Notepad\Batch\Directories\B.Pictures\comic.bat
0
11,713,535
07/29/2012 22:27:44
146,234
07/28/2009 08:23:26
97
5
Unable to Check Out Bundles for TextMate using SVN
I was following the instructions on this page to check out all bundles for TextMate using SVN: http://wiki.macromates.com/Main/SubversionCheckout When I issued this command: svn co http://svn.textmate.org/trunk ./ Encountered the following error message: svn: Can't create directory '.svn': Permission denied What would be the appropriate credentials as they weren't specified on the wiki page? Would appreciate it if someone could offer me some assistance.
textmate
textmatebundles
null
null
null
null
open
Unable to Check Out Bundles for TextMate using SVN === I was following the instructions on this page to check out all bundles for TextMate using SVN: http://wiki.macromates.com/Main/SubversionCheckout When I issued this command: svn co http://svn.textmate.org/trunk ./ Encountered the following error message: svn: Can't create directory '.svn': Permission denied What would be the appropriate credentials as they weren't specified on the wiki page? Would appreciate it if someone could offer me some assistance.
0
11,430,200
07/11/2012 10:03:57
691,642
04/04/2011 18:45:08
136
5
Serialize DOM tree from htmlcxx
I'm using [`htmlcxx`][1], a non-validating HTML parser for C++, which uses [`tree.h`][2] internally for the document structure. Serializing the tree to an HTML string should be relatively forward, normally, since the tree nodes store information about offsets and lengths from the original HTML document, to be able to reproduce the exact same string, byte by byte. However, when one has manipulated the tree with `append_child` and `erase` and so forth, that information quickly becomes useless since the original document, obviously, doesn't contain anything regarding new nodes. How would one go about reconstructing the HTML from this tree? The tree contains `HTML::Node`s and they contain information about one DOM node (tag, text, comment). The tree class has [several iterators available][3] for traversing the tree. [1]: http://htmlcxx.sourceforge.net/ [2]: http://tree.phi-sci.com/documentation.html [3]: http://tree.phi-sci.com/doxygen/html/annotated.html
c++
tree
null
null
null
null
open
Serialize DOM tree from htmlcxx === I'm using [`htmlcxx`][1], a non-validating HTML parser for C++, which uses [`tree.h`][2] internally for the document structure. Serializing the tree to an HTML string should be relatively forward, normally, since the tree nodes store information about offsets and lengths from the original HTML document, to be able to reproduce the exact same string, byte by byte. However, when one has manipulated the tree with `append_child` and `erase` and so forth, that information quickly becomes useless since the original document, obviously, doesn't contain anything regarding new nodes. How would one go about reconstructing the HTML from this tree? The tree contains `HTML::Node`s and they contain information about one DOM node (tag, text, comment). The tree class has [several iterators available][3] for traversing the tree. [1]: http://htmlcxx.sourceforge.net/ [2]: http://tree.phi-sci.com/documentation.html [3]: http://tree.phi-sci.com/doxygen/html/annotated.html
0
11,430,203
07/11/2012 10:04:13
142,746
07/22/2009 11:18:06
385
6
Storing an audio file in a UIDocument
I have a little app that works with iCloud. It stores audio files into the cloud. I noticed that loading the audio files from a second device doesn't work immediately. So I implemented - (BOOL)downloadFileIfNotAvailable:(NSURL*)file That helped but still it works sluggish. I wanted to speed up the downloading process on other iCloud devices by wrapping the audio file in a UIDocument. Is this even possible? I could store the file contents in a NSData, but is there a point (seeing as how AVAudioPlayer wants a URL)? Is there another way for me to speed up the synchronization? Thanks
ios
avaudioplayer
icloud
uidocument
null
null
open
Storing an audio file in a UIDocument === I have a little app that works with iCloud. It stores audio files into the cloud. I noticed that loading the audio files from a second device doesn't work immediately. So I implemented - (BOOL)downloadFileIfNotAvailable:(NSURL*)file That helped but still it works sluggish. I wanted to speed up the downloading process on other iCloud devices by wrapping the audio file in a UIDocument. Is this even possible? I could store the file contents in a NSData, but is there a point (seeing as how AVAudioPlayer wants a URL)? Is there another way for me to speed up the synchronization? Thanks
0
11,430,204
07/11/2012 10:04:18
1,040,245
11/10/2011 17:20:49
323
19
Restore mysqldump file without writing to general_log
It's basically what the subject says. I've read about disabling binary log when restoring a DB dump, but I can't find how to do this with general log (all the INSERT statements end up there and they take a lot of space). Is it possible to disable this kind of logging just for the restore operation?
mysql
mysqldump
diskspace
null
null
null
open
Restore mysqldump file without writing to general_log === It's basically what the subject says. I've read about disabling binary log when restoring a DB dump, but I can't find how to do this with general log (all the INSERT statements end up there and they take a lot of space). Is it possible to disable this kind of logging just for the restore operation?
0
11,429,981
07/11/2012 09:51:41
851,029
07/19/2011 00:17:42
440
15
The type SortExpression.SortDirection is not visible - Full Text Search in Google App Engine
I have followed the example in Google App Engine [documentation][1]: SortOptions sortOption = SortOptions.newBuilder() .addSortExpression(SortExpression.newBuilder() .setExpression("birthDate") .setLimit(1000) .setDirection(SortExpression.SortDirection.DESCENDING) .setDefaultValueNumeric(0)) .build(); But there's an error: `The type SortExpression.SortDirection is not visible` Im using Eclipse IDE. What's the cause of the error? [1]: https://developers.google.com/appengine/docs/java/search/overview#Passing_Queries_in_a_Query_Object
google-app-engine
full-text-search
null
null
null
null
open
The type SortExpression.SortDirection is not visible - Full Text Search in Google App Engine === I have followed the example in Google App Engine [documentation][1]: SortOptions sortOption = SortOptions.newBuilder() .addSortExpression(SortExpression.newBuilder() .setExpression("birthDate") .setLimit(1000) .setDirection(SortExpression.SortDirection.DESCENDING) .setDefaultValueNumeric(0)) .build(); But there's an error: `The type SortExpression.SortDirection is not visible` Im using Eclipse IDE. What's the cause of the error? [1]: https://developers.google.com/appengine/docs/java/search/overview#Passing_Queries_in_a_Query_Object
0
11,430,209
07/11/2012 10:04:33
710,818
02/10/2010 09:50:08
2,146
16
Does oracle classes12 driver single threaded?
I use java spring application with 2 beans that use the same class. Difference only in url to Oracle database. One oracle server on my local computer, another on remote. So there are 2 threads each connected to different Oracle host. But I found that when I e.g. kill session on my local - to receive error message on client part about it, should wait untill finished execution of query on remote. Does it specific of Oracle classes12 driver? Or may be I should check code that I use?
java
multithreading
oracle
jdbc
driver
null
open
Does oracle classes12 driver single threaded? === I use java spring application with 2 beans that use the same class. Difference only in url to Oracle database. One oracle server on my local computer, another on remote. So there are 2 threads each connected to different Oracle host. But I found that when I e.g. kill session on my local - to receive error message on client part about it, should wait untill finished execution of query on remote. Does it specific of Oracle classes12 driver? Or may be I should check code that I use?
0
11,429,901
07/11/2012 09:46:48
956,575
09/21/2011 09:31:01
250
1
Azure CloudOperationResponse<CloudQueueMessage> response issue
I am trying to pop message from the queue. ( Windows Phone 7 ) But unfortunately getting such error inside `CloudOperationResponse<CloudQueueMessage> response` object: ` Value for one of the query parameters specified in the request URI is invalid. RequestId:75c52c29-a325-44a4-9cc4-3203fb99fb47 Time:2012-07-11T09:43:56.6042490Z` ![enter image description here][1] Any one has any ideas why it happens? Thank you in advance! public StorageInitializer() { var resolver = new CloudStorageClientResolverAccountAndKey( new StorageCredentialsAccountAndKey("ACCNAME", "KEY"), new Uri("http://ACCNAME.blob.core.windows.net"), new Uri("http://ACCNAME.queue.core.windows.net"), new Uri("http://ACCNAME.table.core.windows.net"), Deployment.Current.Dispatcher); CloudStorageContext.Current.Resolver = resolver; } public void FetchMsg() { CloudQueueClient queueClient = CloudStorageContext.Current.Resolver.CreateCloudQueueClient() as CloudQueueClient; var queue = queueClient.GetQueueReference("queueout"); queue.GetMessage(TimeSpan.FromSeconds(1), OnMessageReturned); } private void OnMessageReturned(CloudOperationResponse<CloudQueueMessage> response) { string str = response.Response.AsString; } [1]: http://i.stack.imgur.com/EdFWI.png
windows-phone-7
azure
windows-phone-7.1
null
null
null
open
Azure CloudOperationResponse<CloudQueueMessage> response issue === I am trying to pop message from the queue. ( Windows Phone 7 ) But unfortunately getting such error inside `CloudOperationResponse<CloudQueueMessage> response` object: ` Value for one of the query parameters specified in the request URI is invalid. RequestId:75c52c29-a325-44a4-9cc4-3203fb99fb47 Time:2012-07-11T09:43:56.6042490Z` ![enter image description here][1] Any one has any ideas why it happens? Thank you in advance! public StorageInitializer() { var resolver = new CloudStorageClientResolverAccountAndKey( new StorageCredentialsAccountAndKey("ACCNAME", "KEY"), new Uri("http://ACCNAME.blob.core.windows.net"), new Uri("http://ACCNAME.queue.core.windows.net"), new Uri("http://ACCNAME.table.core.windows.net"), Deployment.Current.Dispatcher); CloudStorageContext.Current.Resolver = resolver; } public void FetchMsg() { CloudQueueClient queueClient = CloudStorageContext.Current.Resolver.CreateCloudQueueClient() as CloudQueueClient; var queue = queueClient.GetQueueReference("queueout"); queue.GetMessage(TimeSpan.FromSeconds(1), OnMessageReturned); } private void OnMessageReturned(CloudOperationResponse<CloudQueueMessage> response) { string str = response.Response.AsString; } [1]: http://i.stack.imgur.com/EdFWI.png
0
11,429,902
07/11/2012 09:46:49
965,020
09/26/2011 12:12:40
112
1
Android ExpandableListView bug
I have the folowing listener and I overrite method onGroupExpand: list.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { long groupId = adapter.getGroupId(groupPosition); Toast.makeText(getBaseContext(), "Group = " + adapter.getGroupId(groupPosition), Toast.LENGTH_SHORT).show(); Log.d(TAG, "Group expanded"); View v = adapter.getGroupView((int) groupId, true, null, list); TextView txt = (TextView)v.findViewById(R.id.expandable_first_layer); Log.d(TAG, "txt: " + txt.getText()); txt.setText("Tru-ru-ru"); Log.d(TAG, "txt: " + txt.getText()); } }); I see the proper text when I invoke txt.getText() first time. Then I'm changing the text, and after second txt.getText() in my LogCat I see new text. But the point is that my ExpandableListView doesn't change it's text in that particular item. The same with setting background color in onGroupExpand. Has anybody encountered with this bug?
android
null
null
null
null
null
open
Android ExpandableListView bug === I have the folowing listener and I overrite method onGroupExpand: list.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { long groupId = adapter.getGroupId(groupPosition); Toast.makeText(getBaseContext(), "Group = " + adapter.getGroupId(groupPosition), Toast.LENGTH_SHORT).show(); Log.d(TAG, "Group expanded"); View v = adapter.getGroupView((int) groupId, true, null, list); TextView txt = (TextView)v.findViewById(R.id.expandable_first_layer); Log.d(TAG, "txt: " + txt.getText()); txt.setText("Tru-ru-ru"); Log.d(TAG, "txt: " + txt.getText()); } }); I see the proper text when I invoke txt.getText() first time. Then I'm changing the text, and after second txt.getText() in my LogCat I see new text. But the point is that my ExpandableListView doesn't change it's text in that particular item. The same with setting background color in onGroupExpand. Has anybody encountered with this bug?
0
11,430,216
07/11/2012 10:04:50
1,501,457
07/04/2012 11:44:57
17
0
How to redirect to index page when user is not logged using Servlet?
how to redirect to a login page if the user is not logged in using servlet. I have a login page user logs in using that and goes to home page,after navigating the user clicks on logout and just hits on back button in browser now the page goes to previously visited page, how to redirect the user to login page when using servlet? thanks for the help and continued support
java
session
servlets
null
null
null
open
How to redirect to index page when user is not logged using Servlet? === how to redirect to a login page if the user is not logged in using servlet. I have a login page user logs in using that and goes to home page,after navigating the user clicks on logout and just hits on back button in browser now the page goes to previously visited page, how to redirect the user to login page when using servlet? thanks for the help and continued support
0