question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,218,298
6,218,393
add file in folders with PHP
I have more than 100 folders with subfolders... example: a/b/c/d/e f/g/h m/n k/l/o/p/s/z/x/.... I want to added a blank file (index.html) to each folder (and each subfolder). Could I do that with PHP? And How?
Might be easier with a shell script: exec(' for DIR in $(find. -type d); do touch "$DIR/index.html"; done '); With PHP more effort: function scandir_tree($dir) { $r = array("$dir"); foreach (scandir($dir) as $fn) { if (is_dir("$dir/$fn") && ($fn[0]!= ".")) { $r = array_merge($r, scandir_tree("$dir/$fn")); } } return $r...
add file in folders with PHP I have more than 100 folders with subfolders... example: a/b/c/d/e f/g/h m/n k/l/o/p/s/z/x/.... I want to added a blank file (index.html) to each folder (and each subfolder). Could I do that with PHP? And How?
TITLE: add file in folders with PHP QUESTION: I have more than 100 folders with subfolders... example: a/b/c/d/e f/g/h m/n k/l/o/p/s/z/x/.... I want to added a blank file (index.html) to each folder (and each subfolder). Could I do that with PHP? And How? ANSWER: Might be easier with a shell script: exec(' for DIR in...
[ "php" ]
3
3
956
4
0
2011-06-02T17:56:14.480000
2011-06-02T18:03:41.953000
6,218,302
6,218,420
Why won't this project run NetBeans, but it does in Eclipse
I have built a small program for school that runs perfectly when i run it through eclipse, but if I run the same code in NetBeans I get this error: java.lang.NoClassDefFoundError: myrunnable/Main Caused by: java.lang.ClassNotFoundException: myrunnable.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at ja...
I have not used netbeans but from what I can see from your exception looks to me JRE may not be in the classpath. Have you checked that? For example when you create a project in eclipse it will automatically add JRE to the classpath. OR may be you need to explicitly compile/build before you can run. In eclipse it is au...
Why won't this project run NetBeans, but it does in Eclipse I have built a small program for school that runs perfectly when i run it through eclipse, but if I run the same code in NetBeans I get this error: java.lang.NoClassDefFoundError: myrunnable/Main Caused by: java.lang.ClassNotFoundException: myrunnable.Main at ...
TITLE: Why won't this project run NetBeans, but it does in Eclipse QUESTION: I have built a small program for school that runs perfectly when i run it through eclipse, but if I run the same code in NetBeans I get this error: java.lang.NoClassDefFoundError: myrunnable/Main Caused by: java.lang.ClassNotFoundException: m...
[ "java" ]
0
1
1,164
2
0
2011-06-02T17:56:31.770000
2011-06-02T18:05:24.797000
6,218,306
6,218,436
Does it make sense to deploy more instance of Tomcat on a VM?
Similar question to, "Does it make sense to have multiple tomcat instances on the same server?" but in this case the Tomcats are running on a VM. I know the answer probably is "it depends," but I'd like to explore the issue. When does it make sense? What are the VM specific considerations? Reasons I've heard: 1) JVMs a...
If you have the option, a different VM would be prefered. You still get all the resource utilization benefits you mentioned of multiple JVMs. You ALSO get the redundancy of not having a single point of failure; your VM crashing will not bring down every node in a cluster. If you HAVE to use one VM, the things to consid...
Does it make sense to deploy more instance of Tomcat on a VM? Similar question to, "Does it make sense to have multiple tomcat instances on the same server?" but in this case the Tomcats are running on a VM. I know the answer probably is "it depends," but I'd like to explore the issue. When does it make sense? What are...
TITLE: Does it make sense to deploy more instance of Tomcat on a VM? QUESTION: Similar question to, "Does it make sense to have multiple tomcat instances on the same server?" but in this case the Tomcats are running on a VM. I know the answer probably is "it depends," but I'd like to explore the issue. When does it ma...
[ "java", "tomcat", "jvm", "tomcat6", "vmware" ]
0
2
2,235
1
0
2011-06-02T17:56:36.167000
2011-06-02T18:06:35.330000
6,218,313
6,218,359
JavaScript Redirection
Here is the code I have, $name is a PHP variable which has the name of which directory I'm trying to redirect to. Needless to say, it isn't working. What's wrong with it? I don't know a lot about javascript so I probably did something stupid Thanks
If your mixing PHP with JavaScript, it's always advisable to check the output being sent to the browser: right click on your website and click view source! JavaScript doesn't care whether the content being sent to it is static HTML, from a Database or generated by PHP. If its in the output, it'll parse it. If you'd hav...
JavaScript Redirection Here is the code I have, $name is a PHP variable which has the name of which directory I'm trying to redirect to. Needless to say, it isn't working. What's wrong with it? I don't know a lot about javascript so I probably did something stupid Thanks
TITLE: JavaScript Redirection QUESTION: Here is the code I have, $name is a PHP variable which has the name of which directory I'm trying to redirect to. Needless to say, it isn't working. What's wrong with it? I don't know a lot about javascript so I probably did something stupid Thanks ANSWER: If your mixing PHP wi...
[ "php", "javascript", "redirect" ]
1
6
987
7
0
2011-06-02T17:57:06.943000
2011-06-02T18:00:59.560000
6,218,318
6,218,586
php eval function does not like colons
I am using eval to create an associative array from php built in xml parser (not a fan of how the array is setup). The particular XML I am using is a response from First Data and the tags and attributes both have colons which the eval function seems to really dislike. I have tried escaping the colons but eval is mad ab...
It comes from JS, but it applies here: eval is evil, there's no reason you can't doing this directly instead of through eval. On the other hand it sounds like the features of SimpleXML in php would be a better choice for you see simplexml_load_string.
php eval function does not like colons I am using eval to create an associative array from php built in xml parser (not a fan of how the array is setup). The particular XML I am using is a response from First Data and the tags and attributes both have colons which the eval function seems to really dislike. I have tried...
TITLE: php eval function does not like colons QUESTION: I am using eval to create an associative array from php built in xml parser (not a fan of how the array is setup). The particular XML I am using is a response from First Data and the tags and attributes both have colons which the eval function seems to really dis...
[ "php", "eval" ]
0
0
261
2
0
2011-06-02T17:57:33.310000
2011-06-02T18:18:41.047000
6,218,320
6,218,410
Is there a way to get the order of attributes/fields in an instance?
For the purposes of a generic-style TableModel it would be nice to be able to get the attributes of an object. It is apparently possible to get the field names and values using reflection. However, is there a way to get these according to the order of declaration? If not, do you know of a workaround that could be used ...
Create out own annotation: @interface Order { int value(); } and then annotate your fields @Order(1) String field1; @Order(2) String field2;... Then you can use reflection Field[] flds = MyClass.getFields(); flds[0].getAnnotation(Order.class) etc...
Is there a way to get the order of attributes/fields in an instance? For the purposes of a generic-style TableModel it would be nice to be able to get the attributes of an object. It is apparently possible to get the field names and values using reflection. However, is there a way to get these according to the order of...
TITLE: Is there a way to get the order of attributes/fields in an instance? QUESTION: For the purposes of a generic-style TableModel it would be nice to be able to get the attributes of an object. It is apparently possible to get the field names and values using reflection. However, is there a way to get these accordi...
[ "java", "attributes", "field" ]
0
1
99
2
0
2011-06-02T17:57:36.577000
2011-06-02T18:04:41.970000
6,218,325
6,218,445
How do you check if a directory exists on Windows in C?
Question In a Windows C application I want to validate a parameter passed into a function to ensure that the specified path exists.* How do you check if a directory exists on Windows in C? *I understand that you can get into race conditions where between the time you check for the existance and the time you use the pat...
Do something like this: BOOL DirectoryExists(LPCTSTR szPath) { DWORD dwAttrib = GetFileAttributes(szPath); return (dwAttrib!= INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); } The GetFileAttributes () method is included in Kernel32.dll.
How do you check if a directory exists on Windows in C? Question In a Windows C application I want to validate a parameter passed into a function to ensure that the specified path exists.* How do you check if a directory exists on Windows in C? *I understand that you can get into race conditions where between the time ...
TITLE: How do you check if a directory exists on Windows in C? QUESTION: Question In a Windows C application I want to validate a parameter passed into a function to ensure that the specified path exists.* How do you check if a directory exists on Windows in C? *I understand that you can get into race conditions where...
[ "c", "windows", "winapi" ]
77
104
78,543
5
0
2011-06-02T17:57:52.977000
2011-06-02T18:07:36.090000
6,218,328
6,224,146
Base Classes "Entity" and "ValueObject" in Domain-Driven Design
Do you always create these two abstract base classes as the basis of any new project in DDD? I've read that Entity should have two things. First, an identity property, probably of a generic type. Second, an Equals() method that determines whether it's the same as another Entity. Anything else? Any other natural methods...
I like to have a common abstract ancestor for all my Domain objects but that is a matter of preference and overall infrastructure requirements. After that, yes I have abstract classes for Entity and Value objects. Don't forget that also overriding Equals for Value objects to return equality based on equal property stat...
Base Classes "Entity" and "ValueObject" in Domain-Driven Design Do you always create these two abstract base classes as the basis of any new project in DDD? I've read that Entity should have two things. First, an identity property, probably of a generic type. Second, an Equals() method that determines whether it's the ...
TITLE: Base Classes "Entity" and "ValueObject" in Domain-Driven Design QUESTION: Do you always create these two abstract base classes as the basis of any new project in DDD? I've read that Entity should have two things. First, an identity property, probably of a generic type. Second, an Equals() method that determines...
[ "class", "domain-driven-design", "radix" ]
7
4
1,803
3
0
2011-06-02T17:58:38.857000
2011-06-03T07:20:33.743000
6,218,332
6,218,387
jQuery: how to fade in permanent website elements only once?
The website I'm building has a few elements that are the same on every page, such as a logo, a menu, a copyright notice, and so on. I want to fade them in once the visitor loads any of the website's pages, and never replay the fade-in effect for any other pages the visitor may arrive to. I know making the site AJAXy wo...
You could set a uniquie cookie value for each element that loads and check it on every page to determine whether to fade-in or not. http://plugins.jquery.com/files/jquery.cookie.js.txt var loaded = $.cookie('loaded'); loaded = (typeof(loaded) == 'string')? loaded.split('|'): []; if($.inArray('unique_key', loaded) == -1...
jQuery: how to fade in permanent website elements only once? The website I'm building has a few elements that are the same on every page, such as a logo, a menu, a copyright notice, and so on. I want to fade them in once the visitor loads any of the website's pages, and never replay the fade-in effect for any other pag...
TITLE: jQuery: how to fade in permanent website elements only once? QUESTION: The website I'm building has a few elements that are the same on every page, such as a logo, a menu, a copyright notice, and so on. I want to fade them in once the visitor loads any of the website's pages, and never replay the fade-in effect...
[ "jquery", "animation", "conditional-statements" ]
3
1
965
4
0
2011-06-02T17:59:01.173000
2011-06-02T18:03:15.127000
6,218,347
6,218,388
Run a function inside of a string
How to run a function inside of a string like the shown below in php: echo "This page is under construction Current Date: date('l jS \of F Y')"; I've used double-quoted string statement but the function didn't run at all and this is what I got on my screen after running the script: This page is under construction Curre...
PHP does not support functions being embedded in string values. The manual has a great page on string and parsing. You can embed variables however or concatenate strings with the function output.
Run a function inside of a string How to run a function inside of a string like the shown below in php: echo "This page is under construction Current Date: date('l jS \of F Y')"; I've used double-quoted string statement but the function didn't run at all and this is what I got on my screen after running the script: Thi...
TITLE: Run a function inside of a string QUESTION: How to run a function inside of a string like the shown below in php: echo "This page is under construction Current Date: date('l jS \of F Y')"; I've used double-quoted string statement but the function didn't run at all and this is what I got on my screen after runni...
[ "php", "function" ]
1
1
326
4
0
2011-06-02T18:00:08.123000
2011-06-02T18:03:26.523000
6,218,358
6,219,143
How do I set R_LIBS_SITE on Ubuntu so that .libPaths() is set properly for all users at startup?
I am setting up a cluster where all nodes have access to /nfs/software, so a good place to install.packages() would be under /nfs/software/R. How do I set R_LIBS_SITE so that this is automatically part of all users' R environment? I tried prepending to the path given for R_LIBS_SITE in /etc/R/Renviron but help(Startup)...
Make sure you have owner and/or group write permissions for the directory you want to write into. The file /etc/R/Renviron.site is the preferred choice for local overrides to /etc/R/Renviron. Another way is to simply... impose the directory when installing packages. I tend to do that on the (bash rather than R) shell v...
How do I set R_LIBS_SITE on Ubuntu so that .libPaths() is set properly for all users at startup? I am setting up a cluster where all nodes have access to /nfs/software, so a good place to install.packages() would be under /nfs/software/R. How do I set R_LIBS_SITE so that this is automatically part of all users' R envir...
TITLE: How do I set R_LIBS_SITE on Ubuntu so that .libPaths() is set properly for all users at startup? QUESTION: I am setting up a cluster where all nodes have access to /nfs/software, so a good place to install.packages() would be under /nfs/software/R. How do I set R_LIBS_SITE so that this is automatically part of ...
[ "r", "package" ]
2
2
4,383
2
0
2011-06-02T18:00:56.523000
2011-06-02T19:06:19.593000
6,218,364
6,218,756
how to change names of all directories / files containing a specific string on linux
I have a directory where I want to change all of the directory names and files under it to a different name. For example my directory structure is./mydir_ABC/./mydir_ABC/myfile_ABC.txt./mydir_ABC/otherdir_ABC/ and I want to make it for example./mydir_DEF/./mydir_DEF/myfile_DEF.txt./mydir_DEF/otherdir_DEF/ I am using fi...
Look up the rename(1) command. There are some different variations on it, but they all support some sort of renaming based on regular expressions of some sort. The version I use (based on code from the first edition of the Perl 'Camel Book') would be used as: rename 's%ABC%DEF%g'... Or, for your example: find. -print0 ...
how to change names of all directories / files containing a specific string on linux I have a directory where I want to change all of the directory names and files under it to a different name. For example my directory structure is./mydir_ABC/./mydir_ABC/myfile_ABC.txt./mydir_ABC/otherdir_ABC/ and I want to make it for...
TITLE: how to change names of all directories / files containing a specific string on linux QUESTION: I have a directory where I want to change all of the directory names and files under it to a different name. For example my directory structure is./mydir_ABC/./mydir_ABC/myfile_ABC.txt./mydir_ABC/otherdir_ABC/ and I w...
[ "linux", "shell", "unix", "pipe" ]
1
2
2,803
3
0
2011-06-02T18:01:15.687000
2011-06-02T18:31:59.160000
6,218,382
6,218,727
UIView rotates while scaling using CGAffineTransformMakeScale
Im using CGAffineTransformMakeScale to scale a UIView from 0.1 to 1.0. The problem is that the view is also rotating while the scaling is being animated. So it ends with a scale of 1.0 AND 90º of rotation. [self presentModalViewController:slideTwoViewController animated: NO]; [slideTwoViewController.view setTransform:C...
My bet, is the view already have a transform set and you are overwriting it with the new transform and it is animating the difference. Try using the following function instead: CGAffineTransformScale(<#CGAffineTransform t#>, <#CGFloat sx#>, <#CGFloat sy#>) With this function, you pass the original transform slideTwoVie...
UIView rotates while scaling using CGAffineTransformMakeScale Im using CGAffineTransformMakeScale to scale a UIView from 0.1 to 1.0. The problem is that the view is also rotating while the scaling is being animated. So it ends with a scale of 1.0 AND 90º of rotation. [self presentModalViewController:slideTwoViewControl...
TITLE: UIView rotates while scaling using CGAffineTransformMakeScale QUESTION: Im using CGAffineTransformMakeScale to scale a UIView from 0.1 to 1.0. The problem is that the view is also rotating while the scaling is being animated. So it ends with a scale of 1.0 AND 90º of rotation. [self presentModalViewController:s...
[ "iphone", "objective-c", "ipad", "ios4" ]
1
3
2,196
2
0
2011-06-02T18:02:48.113000
2011-06-02T18:29:39.330000
6,218,385
6,218,739
Chrome loading IE only stylesheet
A stylesheet being loaded inside an IE conditional tag is being loaded in Google Chrome version 11.0.696.65. The IE only rules are throwing off our layout in Chrome. I've checked the code character for character and it looks fine to me. Is anyone else experiencing this? Is this a Chrome bug or some misguided feature? E...
Chrome is fine. We have a custom theme switcher built which was erroneously loading a different copy of the site.ie.css from a theme's folder.
Chrome loading IE only stylesheet A stylesheet being loaded inside an IE conditional tag is being loaded in Google Chrome version 11.0.696.65. The IE only rules are throwing off our layout in Chrome. I've checked the code character for character and it looks fine to me. Is anyone else experiencing this? Is this a Chrom...
TITLE: Chrome loading IE only stylesheet QUESTION: A stylesheet being loaded inside an IE conditional tag is being loaded in Google Chrome version 11.0.696.65. The IE only rules are throwing off our layout in Chrome. I've checked the code character for character and it looks fine to me. Is anyone else experiencing thi...
[ "google-chrome", "stylesheet" ]
3
0
654
3
0
2011-06-02T18:03:09.653000
2011-06-02T18:30:56.223000
6,218,386
6,218,505
Using narrow string manipulation functions on wide data
I'm parsing an XML file which can contain localized strings in different languages (at the moment its just english and spanish, but in the future it could be any language), the API for the XML parser returns all data within the XML via a char* which is UTF8 encoded. Some manipulation of the data is required after its b...
UTF-8 is not "wide". UTF-8 is multibyte encoding, where Unicode character can take 1 to 4 bytes. UTF-8 won't have zero terminators inside valid character. Make sure you are not confused on what your parser is giving you. It could be UTF-16 or UCS2 or their 4-byte equivalents placed in wide character strings, in which c...
Using narrow string manipulation functions on wide data I'm parsing an XML file which can contain localized strings in different languages (at the moment its just english and spanish, but in the future it could be any language), the API for the XML parser returns all data within the XML via a char* which is UTF8 encode...
TITLE: Using narrow string manipulation functions on wide data QUESTION: I'm parsing an XML file which can contain localized strings in different languages (at the moment its just english and spanish, but in the future it could be any language), the API for the XML parser returns all data within the XML via a char* wh...
[ "c", "utf-8", "internationalization", "widestring" ]
1
3
248
2
0
2011-06-02T18:03:11.470000
2011-06-02T18:12:51.810000
6,218,389
6,218,495
Windows 7 IIS 7.0 - setting an application to run under localhost
If i create a web application inside Visual Studio called MyWebApp, how can I make sure it can be accessed at the following address: http://localhost/MyWebApp NO PORTS required thanks VS 2010 IIS 7.0 Windows 7
Http is by default run on port tcp/80. writing http://address.com/ is the same as http://address.com:80/ If IIS is configured to use the default port of 80, then you do not need to specify anything.
Windows 7 IIS 7.0 - setting an application to run under localhost If i create a web application inside Visual Studio called MyWebApp, how can I make sure it can be accessed at the following address: http://localhost/MyWebApp NO PORTS required thanks VS 2010 IIS 7.0 Windows 7
TITLE: Windows 7 IIS 7.0 - setting an application to run under localhost QUESTION: If i create a web application inside Visual Studio called MyWebApp, how can I make sure it can be accessed at the following address: http://localhost/MyWebApp NO PORTS required thanks VS 2010 IIS 7.0 Windows 7 ANSWER: Http is by defaul...
[ "visual-studio-2010", "windows-7", "iis-7", "vs-web-application-project" ]
1
0
1,064
2
0
2011-06-02T18:03:34.970000
2011-06-02T18:11:56.183000
6,218,394
6,218,512
How to get parameters name of method in MethodInterceptor?
I would like to retrieve the parameters's name of a method on MethodInterceptor class. public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); Class declaringClass = method.getDeclaringClass(); Logger logger = LoggerFactory.getLogger(declaringClass); //here some trea...
You can not. Java does not keep the param names in runtime, therefore, the interceptors (or reflection api) do not have way to get that. One way to solve this is to wrap your params in one class, and have field with names that correspond to your param names.
How to get parameters name of method in MethodInterceptor? I would like to retrieve the parameters's name of a method on MethodInterceptor class. public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); Class declaringClass = method.getDeclaringClass(); Logger logger ...
TITLE: How to get parameters name of method in MethodInterceptor? QUESTION: I would like to retrieve the parameters's name of a method on MethodInterceptor class. public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); Class declaringClass = method.getDeclaringClass...
[ "java", "aop" ]
1
2
3,168
2
0
2011-06-02T18:03:45.963000
2011-06-02T18:13:06.757000
6,218,401
6,218,525
How to count sessions in asp.net server application
There is a way to manage how many sessions an asp.net running aplication have? I want to exhibit it in a page, maybe with some other important information, if available. And, how can I do it?
In global.asax, do the following: Handle the Application.Start event adding the following: Application["LiveSessionsCount"] = 0; Handle the Session.Start event adding the following: Application["LiveSessionsCount"] = ((int) Application["LiveSessionsCount"]) + 1; Handle the Session.End event adding the following: Applic...
How to count sessions in asp.net server application There is a way to manage how many sessions an asp.net running aplication have? I want to exhibit it in a page, maybe with some other important information, if available. And, how can I do it?
TITLE: How to count sessions in asp.net server application QUESTION: There is a way to manage how many sessions an asp.net running aplication have? I want to exhibit it in a page, maybe with some other important information, if available. And, how can I do it? ANSWER: In global.asax, do the following: Handle the Appl...
[ "asp.net" ]
7
18
17,280
2
0
2011-06-02T18:04:13.667000
2011-06-02T18:13:46.273000
6,218,402
6,218,414
how can I check if a Gyroscope is present on device?
Just wondering can I check if the device (iPhone, iPad, iPod i.e. iOS devices) has a Gyroscope?
- (BOOL) isGyroscopeAvailable { #ifdef __IPHONE_4_0 CMMotionManager *motionManager = [[CMMotionManager alloc] init]; BOOL gyroAvailable = motionManager.gyroAvailable; [motionManager release]; return gyroAvailable; #else return NO; #endif } See also my this blog entry to know you can check for different capabilities in...
how can I check if a Gyroscope is present on device? Just wondering can I check if the device (iPhone, iPad, iPod i.e. iOS devices) has a Gyroscope?
TITLE: how can I check if a Gyroscope is present on device? QUESTION: Just wondering can I check if the device (iPhone, iPad, iPod i.e. iOS devices) has a Gyroscope? ANSWER: - (BOOL) isGyroscopeAvailable { #ifdef __IPHONE_4_0 CMMotionManager *motionManager = [[CMMotionManager alloc] init]; BOOL gyroAvailable = motion...
[ "iphone", "ios", "gyroscope" ]
6
13
3,061
3
0
2011-06-02T18:04:14.643000
2011-06-02T18:04:46.517000
6,218,417
6,218,527
Dependency Injection of a service usage inside the global.asax
I'm using Ninject to do dependency injection. I have a userService in which I need to access from the global.asax file. How do I dependency inject this? private IUserService userService;//<--this protected void Application_PostAuthenticateRequest(Object sender, EventArgs e) { HttpCookie authCookie = Request.Cookies[For...
Instead of injection try to resolve in your method... protected void Application_PostAuthenticateRequest(Object sender, EventArgs e) { var userService = DependencyResolver.Current.GetService ();... } Don't forget to set dependency resolver to Ninject's implementation before use, for example in your NinjectMVC3 (WebActi...
Dependency Injection of a service usage inside the global.asax I'm using Ninject to do dependency injection. I have a userService in which I need to access from the global.asax file. How do I dependency inject this? private IUserService userService;//<--this protected void Application_PostAuthenticateRequest(Object sen...
TITLE: Dependency Injection of a service usage inside the global.asax QUESTION: I'm using Ninject to do dependency injection. I have a userService in which I need to access from the global.asax file. How do I dependency inject this? private IUserService userService;//<--this protected void Application_PostAuthenticate...
[ "asp.net-mvc", "asp.net-mvc-3", "ninject" ]
2
3
1,506
1
0
2011-06-02T18:05:07.240000
2011-06-02T18:14:01.143000
6,218,421
6,218,594
Explaining to someone why type casting isn't done automatically at compile time
Recently, while I was writing a brief introduction to C for Fortran programmers, one of said Fortran programmers asked me about type casting. To him, it did not really make sense that in C you have to explicitly cast variables instead of having the compiler do it for you automatically. I actually had a bit of hard time...
C does not need casts. Conversions are mostly done automatically at compile time. This works and is idiomatic C #include int main(void) { double x; int i; x = 42; /* automatically convert `int` to `double` */ i = x; /* automatically convert `double` to `int` */ printf("%f\n", i * 1.0); /* automatically convert `int` t...
Explaining to someone why type casting isn't done automatically at compile time Recently, while I was writing a brief introduction to C for Fortran programmers, one of said Fortran programmers asked me about type casting. To him, it did not really make sense that in C you have to explicitly cast variables instead of ha...
TITLE: Explaining to someone why type casting isn't done automatically at compile time QUESTION: Recently, while I was writing a brief introduction to C for Fortran programmers, one of said Fortran programmers asked me about type casting. To him, it did not really make sense that in C you have to explicitly cast varia...
[ "c", "fortran" ]
2
5
301
2
0
2011-06-02T18:05:28.573000
2011-06-02T18:19:24.743000
6,218,431
6,218,458
How do I parse the last 6 digits of a string using regex in Java?
I would like to know how to parse the last 6 digits from a Java string. So: String input1 = "b400" // the regex should return b400 String input2 = "101010" // the regex should return 101010 String input3 = "12345678" // the regex should return 345678
No regex needed. input.substring(Math.max(0, input.length() - 6)); If it has to be a regex for API reasons, Pattern.compile(".{0,6}\\Z", Pattern.DOTALL) If you need to match the last 6 codepoints (incl. supplementary codepoints), then you can replace. with (?:[\\ud800-\\udbff][\\udc00-\\udfff]|.){0,6}
How do I parse the last 6 digits of a string using regex in Java? I would like to know how to parse the last 6 digits from a Java string. So: String input1 = "b400" // the regex should return b400 String input2 = "101010" // the regex should return 101010 String input3 = "12345678" // the regex should return 345678
TITLE: How do I parse the last 6 digits of a string using regex in Java? QUESTION: I would like to know how to parse the last 6 digits from a Java string. So: String input1 = "b400" // the regex should return b400 String input2 = "101010" // the regex should return 101010 String input3 = "12345678" // the regex should...
[ "java", "regex" ]
0
4
1,807
2
0
2011-06-02T18:06:06.977000
2011-06-02T18:08:44.947000
6,218,434
6,218,526
How to add configurations to Xcode?
There are no other way, I search a lot. In XCode 3 this is easy, but now.. In the screen above, I have the Build Configuration, so I can chose if I want: Debug Release This 2 kind of config, have their own config in "Build Settings" tabs (in targets config). To create I third one, the Distribution, reading here, it sho...
Have a look at the project settings. There is a + button that you can use to add to configurations here.
How to add configurations to Xcode? There are no other way, I search a lot. In XCode 3 this is easy, but now.. In the screen above, I have the Build Configuration, so I can chose if I want: Debug Release This 2 kind of config, have their own config in "Build Settings" tabs (in targets config). To create I third one, th...
TITLE: How to add configurations to Xcode? QUESTION: There are no other way, I search a lot. In XCode 3 this is easy, but now.. In the screen above, I have the Build Configuration, so I can chose if I want: Debug Release This 2 kind of config, have their own config in "Build Settings" tabs (in targets config). To crea...
[ "xcode", "configuration" ]
54
114
26,383
3
0
2011-06-02T18:06:29.023000
2011-06-02T18:13:47.630000
6,218,437
6,220,245
How to alter country dropdown in location module?
I have been researching a way to limit the available countries in the drop-down that comes with the contrib locations module. I think hook_form_alter is the way to handle just showing certain countries, but starting a hook_form_alter snippet from hand is not something that I have the ability to achieve. After much goog...
You are correct, hook_form_alter() is a good start. If you are looking to alter a content type form, one method I have used is to create a really small and simple custom module implementing hook_form_alter(). Details/instructions on creating this module can be found below. As an example, I am calling this module 'custo...
How to alter country dropdown in location module? I have been researching a way to limit the available countries in the drop-down that comes with the contrib locations module. I think hook_form_alter is the way to handle just showing certain countries, but starting a hook_form_alter snippet from hand is not something t...
TITLE: How to alter country dropdown in location module? QUESTION: I have been researching a way to limit the available countries in the drop-down that comes with the contrib locations module. I think hook_form_alter is the way to handle just showing certain countries, but starting a hook_form_alter snippet from hand ...
[ "drupal", "location", "hook-form-alter" ]
1
0
2,485
2
0
2011-06-02T18:06:46.437000
2011-06-02T20:51:29.787000
6,218,442
6,218,546
MySQL won't insert certain field
This code won't work. I've had everything echoed and it displays fine on the webpage, as in, all the data is collected fine. What isn't working is inserting it into the MySQL table. This same query, without the archive insertion, works fine. But for some reason MySQL doesn't want to insert my archive copy. The archive ...
I'm uncertain why it's not giving you an error, because it should be! You're taking the entire contents of an unknown URL and attempting to insert it into a table column. You should be escaping it first... $archive = mysql_real_escape_string(strip_tags(file_get_contents($url)), $link); Basically, this will escape quote...
MySQL won't insert certain field This code won't work. I've had everything echoed and it displays fine on the webpage, as in, all the data is collected fine. What isn't working is inserting it into the MySQL table. This same query, without the archive insertion, works fine. But for some reason MySQL doesn't want to ins...
TITLE: MySQL won't insert certain field QUESTION: This code won't work. I've had everything echoed and it displays fine on the webpage, as in, all the data is collected fine. What isn't working is inserting it into the MySQL table. This same query, without the archive insertion, works fine. But for some reason MySQL d...
[ "php", "mysql" ]
0
0
202
2
0
2011-06-02T18:07:13.467000
2011-06-02T18:15:18.913000
6,218,456
6,218,545
Problem with Workflow Designer
When I open a xamlx file the designer shows this: I am having trouble fixing this. Here's the xaml: Any suggestions?
Look at the end of Line 0, you'll find Type="Exempt". The exception, rightfully, notifies you that Type is not a property or dependency property on WorkflowService.
Problem with Workflow Designer When I open a xamlx file the designer shows this: I am having trouble fixing this. Here's the xaml: Any suggestions?
TITLE: Problem with Workflow Designer QUESTION: When I open a xamlx file the designer shows this: I am having trouble fixing this. Here's the xaml: Any suggestions? ANSWER: Look at the end of Line 0, you'll find Type="Exempt". The exception, rightfully, notifies you that Type is not a property or dependency property ...
[ ".net", "xaml", "workflow", "workflow-foundation" ]
0
0
125
1
0
2011-06-02T18:08:35.853000
2011-06-02T18:15:06.073000
6,218,457
6,218,540
Finding the number of words in each row
Let's say that I want to find the number of words in each row of a data frame. So in the following example, I want to find that the first value in column one has 3 words, the second value has 4 words, and so on. I assume this is a task for one of the apply functions, but i'm having little luck figuring this out. dat = ...
The code below should do it, assuming all the words are separated by spaces. sapply(strsplit(as.character(dat$one), " "), length) # [1] 3 4 3 1
Finding the number of words in each row Let's say that I want to find the number of words in each row of a data frame. So in the following example, I want to find that the first value in column one has 3 words, the second value has 4 words, and so on. I assume this is a task for one of the apply functions, but i'm havi...
TITLE: Finding the number of words in each row QUESTION: Let's say that I want to find the number of words in each row of a data frame. So in the following example, I want to find that the first value in column one has 3 words, the second value has 4 words, and so on. I assume this is a task for one of the apply funct...
[ "string", "r", "apply" ]
3
6
127
2
0
2011-06-02T18:08:41.703000
2011-06-02T18:14:52.640000
6,218,481
6,218,639
How to use a Scala Secure Trait in PlayFramework?
I'm trying to build a web application in Scala using Play Framework. When using Play Framework in Java I can use the Secure module to do authentication for pages that require logins. This is a common problem in many web applications, and I would like to use a general solution for my web application. I have tried to fol...
You must use keyword def before defining an method. @Before def checkSecurity = { should fix this.
How to use a Scala Secure Trait in PlayFramework? I'm trying to build a web application in Scala using Play Framework. When using Play Framework in Java I can use the Secure module to do authentication for pages that require logins. This is a common problem in many web applications, and I would like to use a general so...
TITLE: How to use a Scala Secure Trait in PlayFramework? QUESTION: I'm trying to build a web application in Scala using Play Framework. When using Play Framework in Java I can use the Secure module to do authentication for pages that require logins. This is a common problem in many web applications, and I would like t...
[ "authentication", "scala", "controller", "playframework", "traits" ]
5
6
3,673
2
0
2011-06-02T18:11:04.527000
2011-06-02T18:23:15.663000
6,218,486
6,218,556
TeamCity says to use "Build Parameters" instead of "/property:" in an MSBuild step. What does that mean?
I have a TeamCity server setup to do my CI builds. I'm building and testing a C# solution and running some custom MSBuild tasks. One of these tasks is printing a warning in my build output... MSBuild command line parameters contains "/property:" or "/p:" parameters. Please use Build Parameteres instead. I don't underst...
You have to add Build Parameters under Properties and environment variables in the configuration ` So in the command line parameters in the Build Step for MSBUild, remove any property that is specified as /p: and add each of those to the Build Parameters ( screenshot above) and give the values
TeamCity says to use "Build Parameters" instead of "/property:" in an MSBuild step. What does that mean? I have a TeamCity server setup to do my CI builds. I'm building and testing a C# solution and running some custom MSBuild tasks. One of these tasks is printing a warning in my build output... MSBuild command line pa...
TITLE: TeamCity says to use "Build Parameters" instead of "/property:" in an MSBuild step. What does that mean? QUESTION: I have a TeamCity server setup to do my CI builds. I'm building and testing a C# solution and running some custom MSBuild tasks. One of these tasks is printing a warning in my build output... MSBui...
[ "msbuild", "teamcity" ]
80
58
39,154
2
0
2011-06-02T18:11:19.397000
2011-06-02T18:16:23.407000
6,218,500
6,219,571
Validation not working after leaving list grid field in smartgwt
I'm trying to get changes made to a cell in a ListGrid to validate against other cells in the ListGrid. The Item being added needs to have a unique name from the items in the item container, as well as any other items being added. I have the ListGridField.validateOnChange set to true. My validator looks like this: Cust...
The ListGrid is managing two pieces of data: the original record loaded from the server, and the changes to that record which have not been saved. The latter are called "editValues". To access a copy of the Record with editValues applied (as though they had already been saved) call getEditedRecord(rowNum). More backgro...
Validation not working after leaving list grid field in smartgwt I'm trying to get changes made to a cell in a ListGrid to validate against other cells in the ListGrid. The Item being added needs to have a unique name from the items in the item container, as well as any other items being added. I have the ListGridField...
TITLE: Validation not working after leaving list grid field in smartgwt QUESTION: I'm trying to get changes made to a cell in a ListGrid to validate against other cells in the ListGrid. The Item being added needs to have a unique name from the items in the item container, as well as any other items being added. I have...
[ "gwt", "smartgwt" ]
0
1
4,095
1
0
2011-06-02T18:12:25.650000
2011-06-02T19:47:05.950000
6,218,502
6,218,544
Where are cookie files stored? - PHP Wamp
Am using WAMP server for PHP development. I have created a cookie in my php but can't locate the cookie file being created. The php.ini reads session.save_path=C:/wamp/tmp and none of the files have been created today. The code is: I get "Cookie is set" message but checking C:/wamp/tmp does not see any cookie file crea...
Cookies are stored individually depending on a browser. they store them in their own folders. what you are setting in your php.ini is the session path. which is the path for saving sessions $_SESSION not cookies $_COOKIES.
Where are cookie files stored? - PHP Wamp Am using WAMP server for PHP development. I have created a cookie in my php but can't locate the cookie file being created. The php.ini reads session.save_path=C:/wamp/tmp and none of the files have been created today. The code is: I get "Cookie is set" message but checking C:/...
TITLE: Where are cookie files stored? - PHP Wamp QUESTION: Am using WAMP server for PHP development. I have created a cookie in my php but can't locate the cookie file being created. The php.ini reads session.save_path=C:/wamp/tmp and none of the files have been created today. The code is: I get "Cookie is set" messag...
[ "php", "cookies" ]
1
7
13,908
3
0
2011-06-02T18:12:29.710000
2011-06-02T18:15:05.230000
6,218,507
6,218,614
Simple indirection approach for linking to images
I have a web site which hosts images are shared and linked directly. I've read somewhere that this is a bad idea. How could I apply simple indirection approach while perhaps keeping existing links up for a while until they disappear off Facebook?
Old answer below. Example for making links that you can't direct link to: $expire = 60 * 5; // 5 minutes; $time = $_SERVER['REQUEST_TIME'] + $expire; $image_id = $image_id; $secretpassword = "secretpassword"; function generate_link($image_id, $time, $secretpassword) { $hash = md5($secretpassword. $time. $image_id); re...
Simple indirection approach for linking to images I have a web site which hosts images are shared and linked directly. I've read somewhere that this is a bad idea. How could I apply simple indirection approach while perhaps keeping existing links up for a while until they disappear off Facebook?
TITLE: Simple indirection approach for linking to images QUESTION: I have a web site which hosts images are shared and linked directly. I've read somewhere that this is a bad idea. How could I apply simple indirection approach while perhaps keeping existing links up for a while until they disappear off Facebook? ANSW...
[ "php", "image", "indirection" ]
1
2
87
1
0
2011-06-02T18:12:57.090000
2011-06-02T18:21:34.853000
6,218,514
6,224,202
Positioning tabs in TabContainer
I'm working with ajaxtoolkit:TabContainer. I need to add two tabs (which i can do) but i need one of the tab headers in the far left and the other in the far right. I've been playing with CSS ( float:left; etc; ) but i can't separate them! They always show themselves glued together one after the other. Is it possible t...
You may use this style (doesn't works in IE below 9th version):.ajax__tab_header:nth-child(2) { float: right!important; } Or you can apply style via javascript (right below the ScriptManager): Where the TabPanel2 is ID of TabPanel which you need to move right.
Positioning tabs in TabContainer I'm working with ajaxtoolkit:TabContainer. I need to add two tabs (which i can do) but i need one of the tab headers in the far left and the other in the far right. I've been playing with CSS ( float:left; etc; ) but i can't separate them! They always show themselves glued together one ...
TITLE: Positioning tabs in TabContainer QUESTION: I'm working with ajaxtoolkit:TabContainer. I need to add two tabs (which i can do) but i need one of the tab headers in the far left and the other in the far right. I've been playing with CSS ( float:left; etc; ) but i can't separate them! They always show themselves g...
[ "c#", "asp.net", "internet-explorer-8", "tabcontainer" ]
2
1
1,069
2
0
2011-06-02T18:13:12.340000
2011-06-03T07:26:02.473000
6,218,521
6,219,624
Drupal Password set
I have to reset my password direct through database for that I used query UPDATE users SET pass = md5('NEWPASSWORD') WHERE name = 'admin' but still I am not able to login. Can you please tell me where I am going wrong?
With drupal 7, password are no more encrypted through md5. There are several way to reset a password in drupal7. Using drush: drush upwd admin --password="newpassword" Without drush, if you have a cli access to the server: cd php scripts/password-hash.sh 'myPassword' Now copy the resultant hash and paste it into the qu...
Drupal Password set I have to reset my password direct through database for that I used query UPDATE users SET pass = md5('NEWPASSWORD') WHERE name = 'admin' but still I am not able to login. Can you please tell me where I am going wrong?
TITLE: Drupal Password set QUESTION: I have to reset my password direct through database for that I used query UPDATE users SET pass = md5('NEWPASSWORD') WHERE name = 'admin' but still I am not able to login. Can you please tell me where I am going wrong? ANSWER: With drupal 7, password are no more encrypted through ...
[ "drupal-7" ]
0
2
273
2
0
2011-06-02T18:13:33.043000
2011-06-02T19:51:40.090000
6,218,533
6,218,865
google chart with extjs3.3.1 not give output
there are problem with GVisualizationPanel.js file do the change in line no 23 tbl.addColumn(convert[f.type.type], c.label || c, id); after that its working with extjs 3.3.1
google chart with extjs3.3.1 not give output
TITLE: google chart with extjs3.3.1 not give output ANSWER: there are problem with GVisualizationPanel.js file do the change in line no 23 tbl.addColumn(convert[f.type.type], c.label || c, id); after that its working with extjs 3.3.1
[ "google-chrome", "extjs", "google-maps-api-3" ]
0
0
477
1
0
2011-06-02T18:14:31.487000
2011-06-02T18:41:33.733000
6,218,535
6,218,627
Ruby : Find a Date in a array of strings
I am searching through an array of strings looking for a Date: Is the method I'm using a good way to do it? OR... is there a better alternative. Perhaps a more "beautiful" way to do it? query = {'Hvaða','mánaðardagur','er','í','dag?','Það','er','02.06.2011','hví','spyrðu?'} def has_date(query) date = nil query.each do...
Note that in Ruby we use square brackets [] for array literals (curly braces {} are for Hash literals). Here is a solution that will find all dates in the array and return them as strings (thanks @steenslag): require 'date' arr = ['Hvaða', 'er', '02.06.2011', 'hví', '2011-01-01', '???'] dates = arr.select { |x| Date.pa...
Ruby : Find a Date in a array of strings I am searching through an array of strings looking for a Date: Is the method I'm using a good way to do it? OR... is there a better alternative. Perhaps a more "beautiful" way to do it? query = {'Hvaða','mánaðardagur','er','í','dag?','Það','er','02.06.2011','hví','spyrðu?'} def...
TITLE: Ruby : Find a Date in a array of strings QUESTION: I am searching through an array of strings looking for a Date: Is the method I'm using a good way to do it? OR... is there a better alternative. Perhaps a more "beautiful" way to do it? query = {'Hvaða','mánaðardagur','er','í','dag?','Það','er','02.06.2011','hv...
[ "ruby", "date" ]
1
7
1,247
4
0
2011-06-02T18:14:45.663000
2011-06-02T18:22:43.543000
6,218,536
6,218,575
Jquery not working inside UserControl
i'm facing a problem tryin to execute a simples jquery inside my userControl. This jquery doesn't has anything with the pages that is goin to load my UC. the code looks like it: i tryied to debug using firebug but not even the breakpoint is reach.. by some reason i think that the browser is just ignoring my script. it'...
you need to write just below lines because ready function get fire automatically when page get loaded with all controls
Jquery not working inside UserControl i'm facing a problem tryin to execute a simples jquery inside my userControl. This jquery doesn't has anything with the pages that is goin to load my UC. the code looks like it: i tryied to debug using firebug but not even the breakpoint is reach.. by some reason i think that the b...
TITLE: Jquery not working inside UserControl QUESTION: i'm facing a problem tryin to execute a simples jquery inside my userControl. This jquery doesn't has anything with the pages that is goin to load my UC. the code looks like it: i tryied to debug using firebug but not even the breakpoint is reach.. by some reason ...
[ "c#", "jquery", "user-controls" ]
2
0
1,526
2
0
2011-06-02T18:14:45.763000
2011-06-02T18:17:55.900000
6,218,550
6,218,590
Silverlight 4 Memory Leaks All Fixed?
I can't seem to find anything definitive via Google or searching here. I know there was a service release for SL4 that supposedly fixed the inline DataTemplate memory leak issue, but I see references after the release data that report memory leak issues. I can't seem to find an official statement from anyone from Micro...
A good source for monitoring any bug submissions is Microsoft Connect.
Silverlight 4 Memory Leaks All Fixed? I can't seem to find anything definitive via Google or searching here. I know there was a service release for SL4 that supposedly fixed the inline DataTemplate memory leak issue, but I see references after the release data that report memory leak issues. I can't seem to find an off...
TITLE: Silverlight 4 Memory Leaks All Fixed? QUESTION: I can't seem to find anything definitive via Google or searching here. I know there was a service release for SL4 that supposedly fixed the inline DataTemplate memory leak issue, but I see references after the release data that report memory leak issues. I can't s...
[ "silverlight", "silverlight-4.0", "memory-leaks" ]
0
2
352
1
0
2011-06-02T18:15:50.877000
2011-06-02T18:19:09.753000
6,218,554
6,219,047
Get the name of a parent resource when working with a nested resource
I have a comment controller that uses a form partial to add comments. Now this controller is nested under any parent resource that needs to have comments. resource:post do resource:comments end resource:poll resource:comments end If I want to have a form partial that automatically configured for the proper resource how...
You can solve this problem by passing a local variable to the comments partial using the locals hash: In your nested resource, lets say, post's view: <%= render 'comments/form',:locals => {:resource => @post} %> Your comments form: <%= form_for [resource, @comment] do |f| %> <%= f.label:title %> <%= f.text_field:title ...
Get the name of a parent resource when working with a nested resource I have a comment controller that uses a form partial to add comments. Now this controller is nested under any parent resource that needs to have comments. resource:post do resource:comments end resource:poll resource:comments end If I want to have a ...
TITLE: Get the name of a parent resource when working with a nested resource QUESTION: I have a comment controller that uses a form partial to add comments. Now this controller is nested under any parent resource that needs to have comments. resource:post do resource:comments end resource:poll resource:comments end If...
[ "ruby-on-rails", "metaprogramming" ]
0
1
436
1
0
2011-06-02T18:16:05.557000
2011-06-02T18:57:52.247000
6,218,555
6,218,696
How would I structure this database?
Apologies for another question on a similar topic, but I'm inexperienced at this level of database development. I have a project in which users join projects, a page where content is loaded dynamically from a MySQL database. I've been exploring foreign keys and the like to deal with the many-to-many aspects of having s...
This might be what you are looking for Project id proejectName startDate endDate title description [... basically all project specific content] ProjectParticipant userId projectId User id username email [... basically all user specific content] ProjectParticipant is a many-to-many table, linking the user to the proje...
How would I structure this database? Apologies for another question on a similar topic, but I'm inexperienced at this level of database development. I have a project in which users join projects, a page where content is loaded dynamically from a MySQL database. I've been exploring foreign keys and the like to deal with...
TITLE: How would I structure this database? QUESTION: Apologies for another question on a similar topic, but I'm inexperienced at this level of database development. I have a project in which users join projects, a page where content is loaded dynamically from a MySQL database. I've been exploring foreign keys and the...
[ "php", "mysql" ]
0
2
67
1
0
2011-06-02T18:16:16.803000
2011-06-02T18:27:37.767000
6,218,559
6,218,698
Javascript, go async and return to exactly the same place
My input is javascript code that I can pre-process.. at some specific point in the middle of some function there is a token that I need to replace with some async request(e.g. async AJAX request). On runtime: When the async request is back (the callback is being executed) I need to return to exactly the same place(with...
There are several projects that attempt to rewrite code written in a synchronous pattern into async code using continuations. E.g. you might want to take a look at: https://github.com/Sage/streamlinejs Some patterns (loops, try/catches) likely present more challenges than simple linear flow, but I'm pretty sure it's a ...
Javascript, go async and return to exactly the same place My input is javascript code that I can pre-process.. at some specific point in the middle of some function there is a token that I need to replace with some async request(e.g. async AJAX request). On runtime: When the async request is back (the callback is being...
TITLE: Javascript, go async and return to exactly the same place QUESTION: My input is javascript code that I can pre-process.. at some specific point in the middle of some function there is a token that I need to replace with some async request(e.g. async AJAX request). On runtime: When the async request is back (the...
[ "javascript", "node.js", "interpreter" ]
2
3
332
4
0
2011-06-02T18:16:35.697000
2011-06-02T18:27:38.940000
6,218,561
6,218,733
Many processes executed by one thread
Is something like the following possible in C on Linux platform: I have a thread say A reading system calls(intercepting system calls) made by application processes. For each process A creates a thread, which performs the required system call and then sleeps till A wakes it up with another system call which was made by...
If you are looking for some kind of threadpool implementation and are not strictly limited to C I would recommend threadpool (which is almost Boost). Its easy to use and quite lean. The only logic you now need is the catching of the system event and then spawn a new task thread that will execute the call. The threadpoo...
Many processes executed by one thread Is something like the following possible in C on Linux platform: I have a thread say A reading system calls(intercepting system calls) made by application processes. For each process A creates a thread, which performs the required system call and then sleeps till A wakes it up with...
TITLE: Many processes executed by one thread QUESTION: Is something like the following possible in C on Linux platform: I have a thread say A reading system calls(intercepting system calls) made by application processes. For each process A creates a thread, which performs the required system call and then sleeps till ...
[ "c", "linux", "pthreads" ]
1
0
124
1
0
2011-06-02T18:16:40.970000
2011-06-02T18:30:25.817000
6,218,581
6,220,339
Good documentation for rspec-rails Request Specs (or Integration Tests)
I'm looking for any documentation or reference on how to do request specs (which I've also seen called 'integration tests') with rspec and rails. The page here shows a snippet in the readme for "request specs" which is the sort of testing I'd like to do (full stack testing). describe "widgets resource" do describe "GET...
have_selector is part of Webrat: http://rubydoc.info/github/brynary/webrat/master/Webrat/Matchers Capybara provides a larger range of matchers: http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers
Good documentation for rspec-rails Request Specs (or Integration Tests) I'm looking for any documentation or reference on how to do request specs (which I've also seen called 'integration tests') with rspec and rails. The page here shows a snippet in the readme for "request specs" which is the sort of testing I'd like ...
TITLE: Good documentation for rspec-rails Request Specs (or Integration Tests) QUESTION: I'm looking for any documentation or reference on how to do request specs (which I've also seen called 'integration tests') with rspec and rails. The page here shows a snippet in the readme for "request specs" which is the sort of...
[ "rspec", "rspec-rails" ]
0
2
820
1
0
2011-06-02T18:18:29.737000
2011-06-02T21:01:17.150000
6,218,591
6,218,721
c++ std::vector std::sort infinite loop
I ran across an issue whenever I was trying to sort a vector of objects that was resulting in an infinite loop. I am using a custom compare function that I passed in to the sort function. I was able to fix the issue by returning false when two objects were equal instead of true but I don't fully understand the solution...
The correct answer, as others have pointed out, is to learn what a "strict weak ordering" is. In particular, if comp(x,y) is true, then comp(y,x) has to be false. (Note that this implies that comp(x,x) is false.) That is all you need to know to correct your problem. The sort algorithm makes no promises at all if your c...
c++ std::vector std::sort infinite loop I ran across an issue whenever I was trying to sort a vector of objects that was resulting in an infinite loop. I am using a custom compare function that I passed in to the sort function. I was able to fix the issue by returning false when two objects were equal instead of true b...
TITLE: c++ std::vector std::sort infinite loop QUESTION: I ran across an issue whenever I was trying to sort a vector of objects that was resulting in an infinite loop. I am using a custom compare function that I passed in to the sort function. I was able to fix the issue by returning false when two objects were equal...
[ "c++", "sorting", "stdvector" ]
4
6
2,821
6
0
2011-06-02T18:19:16.650000
2011-06-02T18:29:07.073000
6,218,606
6,218,846
Why is my PayPal IPN script failing?
I'm developing a lightweight e-commerce solution that uses PayPal as the payment gateway. However, my IPN callback is constantly returning an INVALID response. I even tried using the sample PHP script provided by PayPal: // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST a...
what is encoding of your html/php page? (charset=windows-1252)?
Why is my PayPal IPN script failing? I'm developing a lightweight e-commerce solution that uses PayPal as the payment gateway. However, my IPN callback is constantly returning an INVALID response. I even tried using the sample PHP script provided by PayPal: // read the post from PayPal system and add 'cmd' $req = 'cmd=...
TITLE: Why is my PayPal IPN script failing? QUESTION: I'm developing a lightweight e-commerce solution that uses PayPal as the payment gateway. However, my IPN callback is constantly returning an INVALID response. I even tried using the sample PHP script provided by PayPal: // read the post from PayPal system and add ...
[ "php", "paypal", "paypal-ipn", "paypal-sandbox" ]
1
1
2,731
1
0
2011-06-02T18:20:42.217000
2011-06-02T18:39:57.757000
6,218,608
6,218,681
Do PHP sessions get lost when directing to a payment gateway?
If i was to store some order details in a session whilst the customer is redirected to a payment gateway, would they be lost by the time the custom returns back from the gateway? My plan is: website take order -> store order in session -> website goes to paypal -> payment made -> returns using paypal autoreturn to conf...
That depends on how long it takes them to come back to your site. I don't know what the default expire time is for sessions but you can assume it to be anywhere from a few minutes to a few hours. If you want to assure the user gets to see whatever he needs to, you will need the payment gateway to redirect the user to a...
Do PHP sessions get lost when directing to a payment gateway? If i was to store some order details in a session whilst the customer is redirected to a payment gateway, would they be lost by the time the custom returns back from the gateway? My plan is: website take order -> store order in session -> website goes to pay...
TITLE: Do PHP sessions get lost when directing to a payment gateway? QUESTION: If i was to store some order details in a session whilst the customer is redirected to a payment gateway, would they be lost by the time the custom returns back from the gateway? My plan is: website take order -> store order in session -> w...
[ "php" ]
1
3
8,862
7
0
2011-06-02T18:20:51.250000
2011-06-02T18:26:13.213000
6,218,616
6,220,884
Not able to set multiple markers on the Google maps using Google map javascript api v3
i want to place multiple markers on the map but I'm getting a map with no markers set.
You need to change all your lines that look like this: places.push(google.maps.LatLng(40.756,-73.986)); To look like this: places.push(new google.maps.LatLng(40.756,-73.986)); Here's your code above with these modifications. It's working for me. Try it:
Not able to set multiple markers on the Google maps using Google map javascript api v3 i want to place multiple markers on the map but I'm getting a map with no markers set.
TITLE: Not able to set multiple markers on the Google maps using Google map javascript api v3 QUESTION: i want to place multiple markers on the map but I'm getting a map with no markers set. ANSWER: You need to change all your lines that look like this: places.push(google.maps.LatLng(40.756,-73.986)); To look like th...
[ "javascript", "google-maps", "google-maps-api-3", "latitude-longitude" ]
1
0
949
2
0
2011-06-02T18:21:52.560000
2011-06-02T22:00:40.590000
6,218,625
6,218,764
Java app handling for connections getting dropped
My app seems to be hanging overnight because of the connection getting dropped(I think that's the problem.) How can I structure my app so that it can try to roll up a new connection? Since the incident I have updated the getConnection() method that my app uses as so: private Connection getConnection() { boolean failed ...
This exception suggests that you're opening the connection only once during application's startup and keeping forever open during the application's lifetime. This is bad. The DB will reclaim the connection sooner or later because it's been open for too long. You should close connections properly in the finally block of...
Java app handling for connections getting dropped My app seems to be hanging overnight because of the connection getting dropped(I think that's the problem.) How can I structure my app so that it can try to roll up a new connection? Since the incident I have updated the getConnection() method that my app uses as so: pr...
TITLE: Java app handling for connections getting dropped QUESTION: My app seems to be hanging overnight because of the connection getting dropped(I think that's the problem.) How can I structure my app so that it can try to roll up a new connection? Since the incident I have updated the getConnection() method that my ...
[ "java", "mysql", "jdbc", "connection" ]
2
3
1,846
1
0
2011-06-02T18:22:37.193000
2011-06-02T18:32:48.967000
6,218,629
6,218,720
Unset array element based on first character
Im trying to find a way to unset an element if the first character is a certain letter, in this case the letter D... I'm not sure if there is an array function to do something of the sort or if a preg replace would do the trick? [0] => Aaron [1] => Bob [2] => Carl [3] => Dale [4] => Devin [5] => Dylan Unset all words t...
You could use the array_filter function: function filter_firstchar($var){ return $var[0]!= 'D'; } $result = array_filter($arr, 'filter_firstchar'); If the letter you are going to be filtering by is going to change, you can build a really basic filtering class: class Filter_FirstChar { private $char; function __constru...
Unset array element based on first character Im trying to find a way to unset an element if the first character is a certain letter, in this case the letter D... I'm not sure if there is an array function to do something of the sort or if a preg replace would do the trick? [0] => Aaron [1] => Bob [2] => Carl [3] => Dal...
TITLE: Unset array element based on first character QUESTION: Im trying to find a way to unset an element if the first character is a certain letter, in this case the letter D... I'm not sure if there is an array function to do something of the sort or if a preg replace would do the trick? [0] => Aaron [1] => Bob [2] ...
[ "php", "arrays", "unset" ]
1
1
352
4
0
2011-06-02T18:22:48.910000
2011-06-02T18:29:05.007000
6,218,632
6,218,875
Delays inside fx queue are not behaving ok
I need to implement a text link that triggers a message box. Premises: When I click on the link, the box appears from top of the page (unfolding). The box has 0.9 of opacity. When the box has opened, it waits 5 seconds and then fades out. If I click inside the box while it's open, it fades out. If I click on the link (...
It sounds like the issue is where you are doing the delay. I would use setTimeout/clearTimeout: var t; $('#link').click(function(){ showBox(); t = setTimeout(hideBox, 5000); }); $('#box').click(function(){ clearTimeout(t); t = setTimeout(hideBox, 5000); });
Delays inside fx queue are not behaving ok I need to implement a text link that triggers a message box. Premises: When I click on the link, the box appears from top of the page (unfolding). The box has 0.9 of opacity. When the box has opened, it waits 5 seconds and then fades out. If I click inside the box while it's o...
TITLE: Delays inside fx queue are not behaving ok QUESTION: I need to implement a text link that triggers a message box. Premises: When I click on the link, the box appears from top of the page (unfolding). The box has 0.9 of opacity. When the box has opened, it waits 5 seconds and then fades out. If I click inside th...
[ "jquery", "jquery-animate" ]
0
1
74
1
0
2011-06-02T18:23:04.497000
2011-06-02T18:42:35.303000
6,218,633
6,219,048
jQuery tools tooltip doesn't appear in first try after hide()
I've used tooltip for a. It will hide() after couple of seconds. If I'll mouse over it's trigger after it. For the first time it will not appear. Only after I move the mouse over it the second time it will appear. I used onShow event for binding and used window.setTimeOut. Is it a problem in the tooltip or in jQuery? S...
well, I've fixed it: answer here: $(document).ready(function() { x = $("button").tooltip({ api: true, **effect:"fade"**, position: "center right", onShow: function() { var hid = function() { **x.hide();** }; window.setTimeout(hid, 2000); }}); x.show(); }); http://jsfiddle.net/vKa5Z/5/
jQuery tools tooltip doesn't appear in first try after hide() I've used tooltip for a. It will hide() after couple of seconds. If I'll mouse over it's trigger after it. For the first time it will not appear. Only after I move the mouse over it the second time it will appear. I used onShow event for binding and used win...
TITLE: jQuery tools tooltip doesn't appear in first try after hide() QUESTION: I've used tooltip for a. It will hide() after couple of seconds. If I'll mouse over it's trigger after it. For the first time it will not appear. Only after I move the mouse over it the second time it will appear. I used onShow event for bi...
[ "jquery", "settimeout", "jquery-events", "jquery-tools", "jquery-ui-tooltip" ]
0
0
1,938
1
0
2011-06-02T18:23:07.273000
2011-06-02T18:57:56.033000
6,218,637
6,218,674
C# Class Changed Event causing Object reference not set to an instance of an object
I need an event to fire when I change a property. When I run this code I get a Object reference not set to an instance of an object. What am I doing wrong? What is the correct way to instantiate an event, and fire it when a property is set? public member: public event System.EventHandler ClassChanged; property set: Cla...
You need to verify the event handler it not null first: if (ClassChanged!= null) ClassChanged(this, EventArgs.Empty); But in general, you may want to wrap this up into a helper method like so: private void NotifyClassChanged() { if (ClassChanged!= null) ClassChanged(this, EventArgs.Empty); } Or possibly implement INoti...
C# Class Changed Event causing Object reference not set to an instance of an object I need an event to fire when I change a property. When I run this code I get a Object reference not set to an instance of an object. What am I doing wrong? What is the correct way to instantiate an event, and fire it when a property is ...
TITLE: C# Class Changed Event causing Object reference not set to an instance of an object QUESTION: I need an event to fire when I change a property. When I run this code I get a Object reference not set to an instance of an object. What am I doing wrong? What is the correct way to instantiate an event, and fire it w...
[ "c#", "events" ]
4
6
3,961
5
0
2011-06-02T18:23:14.400000
2011-06-02T18:25:47.883000
6,218,640
6,218,670
curly braces in HTML
I see curly braces in HTML code to be used to separate the logic (PHP) from the view (HTML) but I can't understand it.. for example in phpBB: {L_BIRTHDAYS} any help will be appreciated
What you are looking at is parsing code. the php parser will consume the html and when it comes across a pattern, in this case {} it will look in its property bag and substitute the values for the variable names inside the {} You can read more about this sort of thing by googling rendering engines.
curly braces in HTML I see curly braces in HTML code to be used to separate the logic (PHP) from the view (HTML) but I can't understand it.. for example in phpBB: {L_BIRTHDAYS} any help will be appreciated
TITLE: curly braces in HTML QUESTION: I see curly braces in HTML code to be used to separate the logic (PHP) from the view (HTML) but I can't understand it.. for example in phpBB: {L_BIRTHDAYS} any help will be appreciated ANSWER: What you are looking at is parsing code. the php parser will consume the html and when ...
[ "html", "phpbb" ]
0
0
1,517
1
0
2011-06-02T18:23:15.747000
2011-06-02T18:25:34.950000
6,218,642
6,218,680
What’s the difference between System.String and System.StringBuilder?
Possible Duplicate: Difference between string and StringBuilder in c# What’s the difference between System.String and System.StringBuilder? It seems to me that the only difference is that System.StringBuilder does not exist in the latest version of C#.
check my post: Why to use StringBuilder over string to get better performance
What’s the difference between System.String and System.StringBuilder? Possible Duplicate: Difference between string and StringBuilder in c# What’s the difference between System.String and System.StringBuilder? It seems to me that the only difference is that System.StringBuilder does not exist in the latest version of C...
TITLE: What’s the difference between System.String and System.StringBuilder? QUESTION: Possible Duplicate: Difference between string and StringBuilder in c# What’s the difference between System.String and System.StringBuilder? It seems to me that the only difference is that System.StringBuilder does not exist in the l...
[ "c#", "string" ]
0
1
2,503
1
0
2011-06-02T18:23:21.747000
2011-06-02T18:26:06.427000
6,218,643
6,218,878
Return SQL one to many / one to many all in one PHP array / object?
tbl_customers customer_id INT...... tbl_orders order_id customer_id tbl_orders_products product_id order_id Suppose I want to access all the products ordered on all the orders by one customer? Is it possible to return this in one PHP array using just 1 SQL query (MySQL db)? Expected result: array( [customer_id] => 1, [...
it is possible. you could use left joins between each table, but each row would have all of the user info and order info, along with the item specific info example result rows user_id, username, order_id, product_id_1 user_id, username, order_id, product_id_2 user_id, username, order_id, product_id_3 you could then for...
Return SQL one to many / one to many all in one PHP array / object? tbl_customers customer_id INT...... tbl_orders order_id customer_id tbl_orders_products product_id order_id Suppose I want to access all the products ordered on all the orders by one customer? Is it possible to return this in one PHP array using just 1...
TITLE: Return SQL one to many / one to many all in one PHP array / object? QUESTION: tbl_customers customer_id INT...... tbl_orders order_id customer_id tbl_orders_products product_id order_id Suppose I want to access all the products ordered on all the orders by one customer? Is it possible to return this in one PHP ...
[ "php", "sql", "one-to-many" ]
2
1
421
1
0
2011-06-02T18:23:21.873000
2011-06-02T18:42:52.283000
6,218,651
6,218,849
Best way to alias methods of member object? "Passthrough methods"
Consider the following code: class Rectangle { public: // Constructors Rectangle(){ init(0,0); } Rectangle(int h, int w){ init(h,w); } // Methods void init(int h, int w) { _h = h; _w = w; } // Getters / Setters double get_h(void){ return _h; } double get_w(void){ return _w; } void set_h(double h){ _h = h; } void set_...
The problem, I think, is conceptual. Your design is quite un-object oriented in that the house does not represent an entity, but rather provides a bit of glue around the components. From that standpoint, it would make more sense to provide accessors to the elements, rather than pass-through functions: class House { Rec...
Best way to alias methods of member object? "Passthrough methods" Consider the following code: class Rectangle { public: // Constructors Rectangle(){ init(0,0); } Rectangle(int h, int w){ init(h,w); } // Methods void init(int h, int w) { _h = h; _w = w; } // Getters / Setters double get_h(void){ return _h; } double g...
TITLE: Best way to alias methods of member object? "Passthrough methods" QUESTION: Consider the following code: class Rectangle { public: // Constructors Rectangle(){ init(0,0); } Rectangle(int h, int w){ init(h,w); } // Methods void init(int h, int w) { _h = h; _w = w; } // Getters / Setters double get_h(void){ ret...
[ "c++", "function", "alias" ]
0
4
833
2
0
2011-06-02T18:23:59.250000
2011-06-02T18:40:09.977000
6,218,653
6,218,702
How to hide a folder from the namespace
I'm working on a C# project in Visual Studio 2010 where I have the following folder structure: ProjectName ProjectName.sln AssemblyName AssemblyName.csproj src App.xaml App.xaml.cs MainWindow.xaml MainWindow.xaml.cs [additional code files and folders with code] This results in all my code files having this namespace: n...
Use Resharper: Where Does Visual Studio Remember Which Folders are "Namespace Providers"?
How to hide a folder from the namespace I'm working on a C# project in Visual Studio 2010 where I have the following folder structure: ProjectName ProjectName.sln AssemblyName AssemblyName.csproj src App.xaml App.xaml.cs MainWindow.xaml MainWindow.xaml.cs [additional code files and folders with code] This results in al...
TITLE: How to hide a folder from the namespace QUESTION: I'm working on a C# project in Visual Studio 2010 where I have the following folder structure: ProjectName ProjectName.sln AssemblyName AssemblyName.csproj src App.xaml App.xaml.cs MainWindow.xaml MainWindow.xaml.cs [additional code files and folders with code] ...
[ "c#", "visual-studio" ]
1
1
812
2
0
2011-06-02T18:24:15.507000
2011-06-02T18:27:56.713000
6,218,656
6,219,646
Google App Engine: Snapshot Database?
Hey guys, I want to write some code for our staging server that "snapshots" the GAE database by walking through each Model in the db and serializing/unserializing it in a recoverable way. This doesn't have to be thread-safe, it's purely for things like demos, and we'd love for it to run on the high replication DB. ther...
Any reason why you can't just use the standard bulkloader? You can just tell it to download all entities of all kinds, so you don't have to know their names a priori: appcfg.py download_data --application= --url=http://.appspot.com/[remote_api_path] --filename= And to upload you can do the reverse: appcfg.py upload_dat...
Google App Engine: Snapshot Database? Hey guys, I want to write some code for our staging server that "snapshots" the GAE database by walking through each Model in the db and serializing/unserializing it in a recoverable way. This doesn't have to be thread-safe, it's purely for things like demos, and we'd love for it t...
TITLE: Google App Engine: Snapshot Database? QUESTION: Hey guys, I want to write some code for our staging server that "snapshots" the GAE database by walking through each Model in the db and serializing/unserializing it in a recoverable way. This doesn't have to be thread-safe, it's purely for things like demos, and ...
[ "google-app-engine", "google-cloud-datastore" ]
0
1
432
2
0
2011-06-02T18:24:21.093000
2011-06-02T19:54:42.350000
6,218,657
6,218,683
How do i get the names of all the tables inside a database?
EDIT2: Found a fix! I used the number of the desired schema instead of the name. Should've thought of that before, really! And i think the error messages could've been a bit better aswell. Thanks for all your time! How can i get the names of all tables inside a database through sql inside asp classic? The server is run...
Have you tried the example from: http://www.kamath.com/codelibrary/cl002_listtables.asp
How do i get the names of all the tables inside a database? EDIT2: Found a fix! I used the number of the desired schema instead of the name. Should've thought of that before, really! And i think the error messages could've been a bit better aswell. Thanks for all your time! How can i get the names of all tables inside ...
TITLE: How do i get the names of all the tables inside a database? QUESTION: EDIT2: Found a fix! I used the number of the desired schema instead of the name. Should've thought of that before, really! And i think the error messages could've been a bit better aswell. Thanks for all your time! How can i get the names of ...
[ "sql", "sql-server", "asp-classic", "sql-server-2000" ]
2
1
4,736
4
0
2011-06-02T18:24:22.980000
2011-06-02T18:26:27.083000
6,218,662
6,220,281
Creating Jar files, duplicate Classpath
If I am creating superjar.jar and it needs a jar file stellar.jar I need to add the following line to the manifest file for superjar.jar Class-Path: path/to/stellar.jar. But in my classpath I already have stellar.jar. So whats the deal here? Why can't superjar.jar attempt to look up the location of stellar.jar from my ...
I need to add the following line to the manifest file for superjar.jar Class-Path: path/to/stellar.jar. You need that path in your superjar, if the environment variable CLASSPATH is ignored, and it is ignored, if you use the superjar as executable jar, and start it with java -jar superjar.jar superjar.jar can access th...
Creating Jar files, duplicate Classpath If I am creating superjar.jar and it needs a jar file stellar.jar I need to add the following line to the manifest file for superjar.jar Class-Path: path/to/stellar.jar. But in my classpath I already have stellar.jar. So whats the deal here? Why can't superjar.jar attempt to look...
TITLE: Creating Jar files, duplicate Classpath QUESTION: If I am creating superjar.jar and it needs a jar file stellar.jar I need to add the following line to the manifest file for superjar.jar Class-Path: path/to/stellar.jar. But in my classpath I already have stellar.jar. So whats the deal here? Why can't superjar.j...
[ "java", "jar" ]
1
0
617
3
0
2011-06-02T18:24:55.960000
2011-06-02T20:54:50.643000
6,218,664
6,218,705
How to get url_helper to pass permalink instead of id in Rails?
I have the following route in my Rails3 project: match "/blog/:permalink" => "posts#show",:as =>:post When I link to my post through a view as such: <%= link_to @post.title, post_path(@post) %> The id of the post is passed into the post_path helper (even though my route specifies the permalink is passed. How do I force...
Define a to_param method on the model that returns the string you want to use. class Post < ActiveRecord::Base def to_param permalink end end See this page, this Railscast, (and of course Google ) for more info. [Edit] I don't think Polymorphic URL Helpers are smart enough to handle what you want to do here. I think yo...
How to get url_helper to pass permalink instead of id in Rails? I have the following route in my Rails3 project: match "/blog/:permalink" => "posts#show",:as =>:post When I link to my post through a view as such: <%= link_to @post.title, post_path(@post) %> The id of the post is passed into the post_path helper (even t...
TITLE: How to get url_helper to pass permalink instead of id in Rails? QUESTION: I have the following route in my Rails3 project: match "/blog/:permalink" => "posts#show",:as =>:post When I link to my post through a view as such: <%= link_to @post.title, post_path(@post) %> The id of the post is passed into the post_p...
[ "ruby-on-rails", "ruby-on-rails-3", "seo", "url-routing", "permalinks" ]
1
6
2,470
2
0
2011-06-02T18:25:04.993000
2011-06-02T18:28:03.853000
6,218,667
6,220,526
C style, C++ streams or Win32 API File I/O?
I read C++ Streams vs. C-style IO? (amongst other pages) to try to help me decide which way to implement some file IO in a project I'm working on. Background I'm fairly new to C++ and Windows programming, I've traditionally worked in C and command line applications. Apologies ahead of time for the n00b-ness of this que...
To take a broader look, direct use of Win32 is good if you need a tiny application with no additional dependencies. For anything that C++ iostreams does better, you probably want to look at Boost::Spirit. Seems like it has all the type-safety of iostreams, with much better performance. You really have two problems here...
C style, C++ streams or Win32 API File I/O? I read C++ Streams vs. C-style IO? (amongst other pages) to try to help me decide which way to implement some file IO in a project I'm working on. Background I'm fairly new to C++ and Windows programming, I've traditionally worked in C and command line applications. Apologies...
TITLE: C style, C++ streams or Win32 API File I/O? QUESTION: I read C++ Streams vs. C-style IO? (amongst other pages) to try to help me decide which way to implement some file IO in a project I'm working on. Background I'm fairly new to C++ and Windows programming, I've traditionally worked in C and command line appli...
[ "c++", "winapi", "file-io" ]
5
2
5,361
4
0
2011-06-02T18:25:24.930000
2011-06-02T21:19:28.193000
6,218,677
6,219,929
NSNumber as stored object in NSDictionary
I have an algorithm that worked fine until I decided to make the local variable into a class object. The code is: NSArray*parseLine=[newline componentsSeparatedByString:@","]; float percentx=[[parseLine objectAtIndex:1] floatValue]; //this NSLog prints fine and shows good values for all three items NSLog(@"parsline:%@...
ok, i see the problem, you don't quite have a solid understanding of how ivars and properties work. TRY THIS: In your.h file... @interface YourClassName NSMutableDictionary *data; @end @property(nonatomic, retain) NSMutableDictionary *data; In your.m file... @implementation YourClassName @synthesize data - (id) init...
NSNumber as stored object in NSDictionary I have an algorithm that worked fine until I decided to make the local variable into a class object. The code is: NSArray*parseLine=[newline componentsSeparatedByString:@","]; float percentx=[[parseLine objectAtIndex:1] floatValue]; //this NSLog prints fine and shows good valu...
TITLE: NSNumber as stored object in NSDictionary QUESTION: I have an algorithm that worked fine until I decided to make the local variable into a class object. The code is: NSArray*parseLine=[newline componentsSeparatedByString:@","]; float percentx=[[parseLine objectAtIndex:1] floatValue]; //this NSLog prints fine a...
[ "objective-c" ]
0
0
616
3
0
2011-06-02T18:25:55.680000
2011-06-02T20:22:25.157000
6,218,700
6,220,290
Adding a single point with google API javascript v3 MarkerManager
Hey all, I'm having problems on adding a single marker to a google map v3 using the marker manager. I understand that the manager is better suited for adding arrays, but I wish to understand how to add a single marker as part of the learning process. Can anyone point me in the correct direction? Here is the code I am c...
If you were getting an error "google is not defined" place the link to markermanager.js e.g. within or after the BODY section of your HTML file. ======== Update: And now it works as you wish - tested!! You have to do two things: 1st: load the MarkerManager source in the HEAD by: 2nd: Tell manager to add your marker aft...
Adding a single point with google API javascript v3 MarkerManager Hey all, I'm having problems on adding a single marker to a google map v3 using the marker manager. I understand that the manager is better suited for adding arrays, but I wish to understand how to add a single marker as part of the learning process. Can...
TITLE: Adding a single point with google API javascript v3 MarkerManager QUESTION: Hey all, I'm having problems on adding a single marker to a google map v3 using the marker manager. I understand that the manager is better suited for adding arrays, but I wish to understand how to add a single marker as part of the lea...
[ "javascript", "api", "markermanager" ]
0
0
2,120
1
0
2011-06-02T18:27:45.043000
2011-06-02T20:55:45.063000
6,218,706
6,218,765
Starting a new bash shell from a bash shell
I would like to run a program from the bash shell. When the program runs, it dominates the entire shell, so I would like to start a new shell and run the program from there. Currently I am doing: gnome-terminal -x "cd Dropbox; program_name" However that give me the error Failed to execute the child process, no such fil...
I admit this doesn't really answer your question, but I think it solves your problem. Why not just use & to send it to the background. You can see if it's still running with jobs and bring it back to the foreground with fg, you can also send it back to the background, by first stopping it with Ctrl + Z then bg Example ...
Starting a new bash shell from a bash shell I would like to run a program from the bash shell. When the program runs, it dominates the entire shell, so I would like to start a new shell and run the program from there. Currently I am doing: gnome-terminal -x "cd Dropbox; program_name" However that give me the error Fail...
TITLE: Starting a new bash shell from a bash shell QUESTION: I would like to run a program from the bash shell. When the program runs, it dominates the entire shell, so I would like to start a new shell and run the program from there. Currently I am doing: gnome-terminal -x "cd Dropbox; program_name" However that give...
[ "linux", "bash", "shell", "terminal" ]
19
10
83,060
6
0
2011-06-02T18:28:09.937000
2011-06-02T18:32:54.747000
6,218,713
6,231,015
Hibernate scheme naming differs between OS
I am facing the problem that the hibernate generated schema names (table names for example) differ between Windows and Linux. On Windows all table names are small case, e.g. account, whereas under Linux created table names are camel cases, e.g. Account. On both systems I use MySQL 5 in the same version and the followin...
You might want to set the property hibernate.ejb.naming_strategy to org.hibernate.cfg.ImprovedNamingStrategy or implement your own naming strategy class.
Hibernate scheme naming differs between OS I am facing the problem that the hibernate generated schema names (table names for example) differ between Windows and Linux. On Windows all table names are small case, e.g. account, whereas under Linux created table names are camel cases, e.g. Account. On both systems I use M...
TITLE: Hibernate scheme naming differs between OS QUESTION: I am facing the problem that the hibernate generated schema names (table names for example) differ between Windows and Linux. On Windows all table names are small case, e.g. account, whereas under Linux created table names are camel cases, e.g. Account. On bo...
[ "mysql", "hibernate", "jpa", "jakarta-ee" ]
6
8
7,258
3
0
2011-06-02T18:28:47.130000
2011-06-03T18:14:23.093000
6,218,715
6,308,663
MATLAB: patches disappear in various circumstances when faceAlpha is not 1
I'm using 64 bit matlab r2010a on windows 7 (this may be relevant if this is an obscure rendering bug) this is apparently a bizarre bug that manifests itself when the text interpreter is latex set(0, 'DefaultTextInterpreter', 'Latex'); this code will produce a blue box with a black border and a legend outside the axes ...
Thanks to rasman for trying to reproduce the bug and failing. This helped me figure out that the problem is an interaction between the latex intepreter and openGL. This is apparently related to MATLAB bug 359330 The solution is to set the text properties of objects individually rather than using the default rendering o...
MATLAB: patches disappear in various circumstances when faceAlpha is not 1 I'm using 64 bit matlab r2010a on windows 7 (this may be relevant if this is an obscure rendering bug) this is apparently a bizarre bug that manifests itself when the text interpreter is latex set(0, 'DefaultTextInterpreter', 'Latex'); this code...
TITLE: MATLAB: patches disappear in various circumstances when faceAlpha is not 1 QUESTION: I'm using 64 bit matlab r2010a on windows 7 (this may be relevant if this is an obscure rendering bug) this is apparently a bizarre bug that manifests itself when the text interpreter is latex set(0, 'DefaultTextInterpreter', '...
[ "matlab", "graphics", "rendering", "patch" ]
3
3
2,758
1
0
2011-06-02T18:28:48.877000
2011-06-10T15:34:34.180000
6,218,719
6,218,791
C# error handling Question
In my code, I have a loop and inside a try catch. When an error is encountered, catch block works, should log the error and send an email to inform about the error message. Now I want it to do this and go back to the loop to continue the treatement. If I have to loop through 100 records, and an error is detected in the...
in my code I have a loop and inside a try catch, If your try-catch block is inside your loop, then you should be fine: for (... ) { try {... } catch (...) {... } } If its outside your for loop, then just move it inside:)
C# error handling Question In my code, I have a loop and inside a try catch. When an error is encountered, catch block works, should log the error and send an email to inform about the error message. Now I want it to do this and go back to the loop to continue the treatement. If I have to loop through 100 records, and ...
TITLE: C# error handling Question QUESTION: In my code, I have a loop and inside a try catch. When an error is encountered, catch block works, should log the error and send an email to inform about the error message. Now I want it to do this and go back to the loop to continue the treatement. If I have to loop through...
[ "c#", "exception", "try-catch" ]
2
1
296
4
0
2011-06-02T18:29:00.780000
2011-06-02T18:35:08.220000
6,218,722
6,218,862
Nested/Inner class in external file
I have a class MyClass and an inner class MyNestedClass like this: public class MyClass {... public class MyNestedClass {... } } Both classes are very long. Because of that i'd like to seperate them in two different files, without breaking the hierarchy. This is because the nested class shouldn't be visible to the prog...
You can make the inner class package private which means that it will only be accessible from other classes in exactly the same package. This is also done quite frequently for hidden classes inside the standard JDK packages like java.lang or java.util. in pkg/MyClass.java public class MyClass {... } in pkg/MyHiddenClas...
Nested/Inner class in external file I have a class MyClass and an inner class MyNestedClass like this: public class MyClass {... public class MyNestedClass {... } } Both classes are very long. Because of that i'd like to seperate them in two different files, without breaking the hierarchy. This is because the nested cl...
TITLE: Nested/Inner class in external file QUESTION: I have a class MyClass and an inner class MyNestedClass like this: public class MyClass {... public class MyNestedClass {... } } Both classes are very long. Because of that i'd like to seperate them in two different files, without breaking the hierarchy. This is bec...
[ "java", "file", "external", "nested-class" ]
49
20
20,735
7
0
2011-06-02T18:29:08.563000
2011-06-02T18:41:25.010000
6,218,738
6,218,985
Why can't I define a Haskell Arrow instance in terms of arr and *** / &&&
I'm still getting to grips with defining and using Arrows in Haskell. While defining new arrows, it is much easier for me to think in terms of *** or &&& rather than first and second, as most of the time I want special processing for when two arrows are combined. However the Arrow class does not allow defining the arro...
I actually believe it's the circularity that stopped someone from writing the default methods. But as @camccann pointed out, this should stop anyone. Suggest a change!
Why can't I define a Haskell Arrow instance in terms of arr and *** / &&& I'm still getting to grips with defining and using Arrows in Haskell. While defining new arrows, it is much easier for me to think in terms of *** or &&& rather than first and second, as most of the time I want special processing for when two arr...
TITLE: Why can't I define a Haskell Arrow instance in terms of arr and *** / &&& QUESTION: I'm still getting to grips with defining and using Arrows in Haskell. While defining new arrows, it is much easier for me to think in terms of *** or &&& rather than first and second, as most of the time I want special processin...
[ "haskell", "arrows" ]
12
4
444
2
0
2011-06-02T18:30:43.730000
2011-06-02T18:52:56.353000
6,218,740
6,218,796
Is it possible to use javascript to get the currently playing Itunes track
I am looking to see if it's, first, possible to even use javascript to get the currently playing Itunes song, and if so, how? A use case along the lines of: User clicks a link An alert pops up displaying song name, artist and album. Thanks
Directly, no. If the data from iTunes is sent to a service like last.fm, it can be fetched there on a regular interval to see what they are listening to. Something similar to https://github.com/niklasvh/jquery.plugin.listening
Is it possible to use javascript to get the currently playing Itunes track I am looking to see if it's, first, possible to even use javascript to get the currently playing Itunes song, and if so, how? A use case along the lines of: User clicks a link An alert pops up displaying song name, artist and album. Thanks
TITLE: Is it possible to use javascript to get the currently playing Itunes track QUESTION: I am looking to see if it's, first, possible to even use javascript to get the currently playing Itunes song, and if so, how? A use case along the lines of: User clicks a link An alert pops up displaying song name, artist and a...
[ "javascript", "html", "itunes" ]
0
1
287
1
0
2011-06-02T18:30:56.177000
2011-06-02T18:35:48.683000
6,218,746
6,218,815
deployed web application returns - 401 unauthorized
I deployed my web application created with visual studio 2010 to a remote server with IIS 6.0 windows 2003. When trying to browse to the site, it returns the default heading and in the page body the error: The Request Failed with HTTP status 401: Unauthorized Now I am logged in as administrator and have set the permiss...
Almost definitely an NTFS filesystem security issue, you need to add IUSR_ and ASPNET (ASP.NET Machine user account) with read and execute rights for the folder your site/application is in.
deployed web application returns - 401 unauthorized I deployed my web application created with visual studio 2010 to a remote server with IIS 6.0 windows 2003. When trying to browse to the site, it returns the default heading and in the page body the error: The Request Failed with HTTP status 401: Unauthorized Now I am...
TITLE: deployed web application returns - 401 unauthorized QUESTION: I deployed my web application created with visual studio 2010 to a remote server with IIS 6.0 windows 2003. When trying to browse to the site, it returns the default heading and in the page body the error: The Request Failed with HTTP status 401: Una...
[ "asp.net", "visual-studio-2010", "web-applications", "iis-6" ]
1
3
4,652
3
0
2011-06-02T18:31:12.027000
2011-06-02T18:37:10.763000
6,218,752
6,239,097
Trigger .changePage() when html5 video ends, iOS
Here is a snippet that gets the job done on Android (v2.2) and various desktop browsers (Chrome, FF). The issue lies with iOS, which will happily alert, but won't change the page. It seems to be waiting for the user to click the Done button, which I would like to avoid. I know this is possible to achieve, because someo...
Removing the container answers the question of closing the video:......
Trigger .changePage() when html5 video ends, iOS Here is a snippet that gets the job done on Android (v2.2) and various desktop browsers (Chrome, FF). The issue lies with iOS, which will happily alert, but won't change the page. It seems to be waiting for the user to click the Done button, which I would like to avoid. ...
TITLE: Trigger .changePage() when html5 video ends, iOS QUESTION: Here is a snippet that gets the job done on Android (v2.2) and various desktop browsers (Chrome, FF). The issue lies with iOS, which will happily alert, but won't change the page. It seems to be waiting for the user to click the Done button, which I wou...
[ "ios", "jquery-mobile", "html5-video" ]
1
1
5,467
2
0
2011-06-02T18:31:43.183000
2011-06-04T20:07:11.993000
6,218,759
6,218,892
jQuery - Selector for data returned from .post
I am doing a simple jQuery post: $.post('/form.html', $("#form").serialize(), function(data, textStatus) { //Selector for finding a field in the data }); How do I process a selector against the variable data? I need to look for a specific id that exists within the html returned from the post call?
Is the data a block of HTML that has an HTML element with an id? For example, say the data returned from the post looks like " Some text Some more text " and say that you just want to pull out the value of the "hiddenField" element. You can do $.post('/form.html', $("#form").serialize(), function(data, textStatus) { va...
jQuery - Selector for data returned from .post I am doing a simple jQuery post: $.post('/form.html', $("#form").serialize(), function(data, textStatus) { //Selector for finding a field in the data }); How do I process a selector against the variable data? I need to look for a specific id that exists within the html ret...
TITLE: jQuery - Selector for data returned from .post QUESTION: I am doing a simple jQuery post: $.post('/form.html', $("#form").serialize(), function(data, textStatus) { //Selector for finding a field in the data }); How do I process a selector against the variable data? I need to look for a specific id that exists w...
[ "jquery" ]
1
3
1,516
2
0
2011-06-02T18:32:12.087000
2011-06-02T18:44:11.090000
6,218,780
6,218,939
Incoherent stores
Why this kernel produces incoherent stores __global__ void reverseArrayBlock(int *d_out, int *d_in) { int inOffset = blockDim.x * blockIdx.x; int outOffset = blockDim.x * (gridDim.x - 1 - blockIdx.x); int in = inOffset + threadIdx.x; int out = outOffset + (blockDim.x - 1 - threadIdx.x); d_out[out] = d_in[in]; } and thi...
Coalescing requires that the addresses follow a "base + tid" pattern within a warp, where tid is short for the thread index. In other words, as tid increases, so does the address. Your comment calls this "forward order". In the first kernel, addresses are generated such that as tid increases, the address decreases, i.e...
Incoherent stores Why this kernel produces incoherent stores __global__ void reverseArrayBlock(int *d_out, int *d_in) { int inOffset = blockDim.x * blockIdx.x; int outOffset = blockDim.x * (gridDim.x - 1 - blockIdx.x); int in = inOffset + threadIdx.x; int out = outOffset + (blockDim.x - 1 - threadIdx.x); d_out[out] = d...
TITLE: Incoherent stores QUESTION: Why this kernel produces incoherent stores __global__ void reverseArrayBlock(int *d_out, int *d_in) { int inOffset = blockDim.x * blockIdx.x; int outOffset = blockDim.x * (gridDim.x - 1 - blockIdx.x); int in = inOffset + threadIdx.x; int out = outOffset + (blockDim.x - 1 - threadIdx....
[ "cuda" ]
0
3
175
2
0
2011-06-02T18:34:24.303000
2011-06-02T18:48:08.570000
6,218,785
6,218,868
Why do my IBActions not get called in pageControll?
I have a view with IBActions tied to UITextFields and UIButtons. They all work as intended unless I use that view inside of a pageControl. If I do that the UITextField IBActions don't work but the UIButton IBActions do work.
I assume that by "page control" you mean UIScrollView + UIPagecontrol. In this case, the problem you are facing is the "greediness" of UIScrollView when it comes to touches. A UIScrollView will swallows all the touches (like a touch black hole) and will not let other controls receive them. One way forward is (but I am ...
Why do my IBActions not get called in pageControll? I have a view with IBActions tied to UITextFields and UIButtons. They all work as intended unless I use that view inside of a pageControl. If I do that the UITextField IBActions don't work but the UIButton IBActions do work.
TITLE: Why do my IBActions not get called in pageControll? QUESTION: I have a view with IBActions tied to UITextFields and UIButtons. They all work as intended unless I use that view inside of a pageControl. If I do that the UITextField IBActions don't work but the UIButton IBActions do work. ANSWER: I assume that by...
[ "iphone", "objective-c", "ibaction" ]
0
1
151
1
0
2011-06-02T18:34:45.147000
2011-06-02T18:41:44.453000
6,218,786
6,218,895
adding javascript image uploader to .NET website - security concerns
I have a site built on ASP.NET and C#. One of the requirements of the site is to allow users to enter text in a WYSIWYG type editor as well as upload images. I started development using the.NET HTMLEditor and at first was pleased. I gave up on the control after spending a handful of hours attempting to add an image upl...
yes it is, javascript-code is always executed on the client side. its not possible to access any resources of your webserver with javascript.
adding javascript image uploader to .NET website - security concerns I have a site built on ASP.NET and C#. One of the requirements of the site is to allow users to enter text in a WYSIWYG type editor as well as upload images. I started development using the.NET HTMLEditor and at first was pleased. I gave up on the con...
TITLE: adding javascript image uploader to .NET website - security concerns QUESTION: I have a site built on ASP.NET and C#. One of the requirements of the site is to allow users to enter text in a WYSIWYG type editor as well as upload images. I started development using the.NET HTMLEditor and at first was pleased. I ...
[ "javascript", ".net", "asp.net", "security", "obout" ]
1
2
286
1
0
2011-06-02T18:34:50.493000
2011-06-02T18:44:27.780000
6,218,789
6,220,286
Google +1 Button not working in IE7?
Works fine in IE8, IE9, and latest Chrome and Firefox, but can't seem to get it to show up in IE7. This is even with the most basic example of using the script. Anyone had similar issues? Thanks!
http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=1151309 Looks like it's not supported.
Google +1 Button not working in IE7? Works fine in IE8, IE9, and latest Chrome and Firefox, but can't seem to get it to show up in IE7. This is even with the most basic example of using the script. Anyone had similar issues? Thanks!
TITLE: Google +1 Button not working in IE7? QUESTION: Works fine in IE8, IE9, and latest Chrome and Firefox, but can't seem to get it to show up in IE7. This is even with the most basic example of using the script. Anyone had similar issues? Thanks! ANSWER: http://www.google.com/support/accounts/bin/answer.py?hl=en&a...
[ "internet-explorer-7", "google-plus-one" ]
60
82
23,357
1
0
2011-06-02T18:35:02.397000
2011-06-02T20:55:27.493000
6,218,792
6,218,933
Is it possible to store a SQL Server table on the user's local hard drive?
I have a database in a state own ms sql server. Writing user information in a table in the server means that the information is public. I would like to be able to write a table to the users hard drive - so the information is not on the server and be able to access through a query in php with the state server in order t...
Your real problem is of data privacy and not where you store it. See this link: How to: Encrypt a Column of Data Without more info an exactly what you are doing, it is impossible to provide you with a more specific answer.
Is it possible to store a SQL Server table on the user's local hard drive? I have a database in a state own ms sql server. Writing user information in a table in the server means that the information is public. I would like to be able to write a table to the users hard drive - so the information is not on the server an...
TITLE: Is it possible to store a SQL Server table on the user's local hard drive? QUESTION: I have a database in a state own ms sql server. Writing user information in a table in the server means that the information is public. I would like to be able to write a table to the users hard drive - so the information is no...
[ "php", "sql", "sql-server", "sql-server-2008" ]
1
0
1,338
3
0
2011-06-02T18:35:25.533000
2011-06-02T18:47:35.723000
6,218,793
6,218,840
Externing functions in C++
When externing a function in the cpp file does the compiler treat these differently? extern void foo(char * dataPtr); void foo(char *); extern void foo(char * ); I am wondering because I have see all these in code and not sure what the difference is.
Case by case: extern void foo(char * dataPtr); functions have external linkage by default, so the extern is not necessary - this is equivalent to: void foo(char * dataPtr); Parameter names are not significant in function declarations, so the above is equivalent to: void foo(char * ); Use whichever you feel happiest wit...
Externing functions in C++ When externing a function in the cpp file does the compiler treat these differently? extern void foo(char * dataPtr); void foo(char *); extern void foo(char * ); I am wondering because I have see all these in code and not sure what the difference is.
TITLE: Externing functions in C++ QUESTION: When externing a function in the cpp file does the compiler treat these differently? extern void foo(char * dataPtr); void foo(char *); extern void foo(char * ); I am wondering because I have see all these in code and not sure what the difference is. ANSWER: Case by case: e...
[ "c++", "extern" ]
7
9
389
4
0
2011-06-02T18:35:38.097000
2011-06-02T18:39:30.040000
6,218,812
6,219,150
Implementing comparison operators via 'tuple' and 'tie', a good idea?
(Note: tuple and tie can be taken from Boost or C++11.) When writing small structs with only two elements, I sometimes tend to choose a std::pair, as all important stuff is already done for that datatype, like operator< for strict-weak-ordering. The downsides though are the pretty much useless variable names. Even if I...
This is certainly going to make it easier to write a correct operator than rolling it yourself. I'd say only consider a different approach if profiling shows the comparison operation to be a time-consuming part of your application. Otherwise the ease of maintaining this should outweigh any possible performance concerns...
Implementing comparison operators via 'tuple' and 'tie', a good idea? (Note: tuple and tie can be taken from Boost or C++11.) When writing small structs with only two elements, I sometimes tend to choose a std::pair, as all important stuff is already done for that datatype, like operator< for strict-weak-ordering. The ...
TITLE: Implementing comparison operators via 'tuple' and 'tie', a good idea? QUESTION: (Note: tuple and tie can be taken from Boost or C++11.) When writing small structs with only two elements, I sometimes tend to choose a std::pair, as all important stuff is already done for that datatype, like operator< for strict-w...
[ "c++", "c++11", "operators", "tuples", "strict-weak-ordering" ]
115
67
21,007
4
0
2011-06-02T18:36:53.410000
2011-06-02T19:07:04.757000
6,218,813
6,218,958
How do i get type from pointer in a template?
I know how to write something up but i am sure there is a standard way of passing in something like func () and using template magic to extract TheType for use in your code (maybe TheType::SomeStaticCall). What is the standard way/function to get that type when a ptr is passed in?
I think you want to remove the pointer-ness from the type argument to the function. If so, then here is how you can do this, template void func() { typename remove_pointer::type type; //you can use `type` which is free from pointer-ness //if T = int*, then type = int //if T = int****, then type = int //if T = vector, ...
How do i get type from pointer in a template? I know how to write something up but i am sure there is a standard way of passing in something like func () and using template magic to extract TheType for use in your code (maybe TheType::SomeStaticCall). What is the standard way/function to get that type when a ptr is pas...
TITLE: How do i get type from pointer in a template? QUESTION: I know how to write something up but i am sure there is a standard way of passing in something like func () and using template magic to extract TheType for use in your code (maybe TheType::SomeStaticCall). What is the standard way/function to get that type...
[ "c++", "templates" ]
10
20
5,813
1
0
2011-06-02T18:37:01.197000
2011-06-02T18:50:16.273000
6,218,817
6,219,683
Codeigniter min_length[] not working
I have this code: $this->form_validation->set_rules('quadra_numero', 'Quadra número', 'required|trim|numeric|xss_clean|min_length[3]|max_length[3]|callback_valida_quadra_setor'); The max_length[3] works but not the min_length[3]. I've checked the returned value with strlen($quadra_numero) and it returns me 2 characters...
Just at a first glance, you probably need to typecast the variable to a string before sending it in. $quadra_numero = (string)$quadra_numero; or $quadra_numero = strval($quadra_numero); and see if that takes care of the problem. The strlen is converting the variable to a string before it checks the length, but the vali...
Codeigniter min_length[] not working I have this code: $this->form_validation->set_rules('quadra_numero', 'Quadra número', 'required|trim|numeric|xss_clean|min_length[3]|max_length[3]|callback_valida_quadra_setor'); The max_length[3] works but not the min_length[3]. I've checked the returned value with strlen($quadra_n...
TITLE: Codeigniter min_length[] not working QUESTION: I have this code: $this->form_validation->set_rules('quadra_numero', 'Quadra número', 'required|trim|numeric|xss_clean|min_length[3]|max_length[3]|callback_valida_quadra_setor'); The max_length[3] works but not the min_length[3]. I've checked the returned value wit...
[ "php", "codeigniter", "frameworks" ]
3
2
984
1
0
2011-06-02T18:37:30.640000
2011-06-02T19:57:39.140000
6,218,822
6,218,980
REST Web service. Making service system not accessible
I have REST Web service written in Java. Now I want to disable Web service such as services (GET methods) won't be accessible over URI or by application. That means I still can access the service program over Web browser but other people would not be able to invokes service methods with URI or other programs. I want to...
there is no reliable way to do this. You could require a request header for user-agent, but nothing stops a minimally savvy user from just putting a false request header on the request, regardless of the tool they are using. you should instead focus on implementing proper security via authentication and authorization. ...
REST Web service. Making service system not accessible I have REST Web service written in Java. Now I want to disable Web service such as services (GET methods) won't be accessible over URI or by application. That means I still can access the service program over Web browser but other people would not be able to invoke...
TITLE: REST Web service. Making service system not accessible QUESTION: I have REST Web service written in Java. Now I want to disable Web service such as services (GET methods) won't be accessible over URI or by application. That means I still can access the service program over Web browser but other people would not...
[ "java", "rest" ]
1
1
208
1
0
2011-06-02T18:37:53.347000
2011-06-02T18:52:33.607000
6,218,825
6,218,864
modify loop to display message 1 time for all instances
My code check the 1st 3 messages of the twitter wall and looks for a string called "code". if its there it will echo "code available" and if its not it will echo "no code". Right now it echos 3 times for each message. how would i modify this code to check all 3 messages still, but only echo the "no code" or "code avail...
How about this: function echo_messages($url,$max = 1) { $data = json_decode(file_get_contents($url)); $counter = 0; foreach($data->data as $post) { preg_match("/code/", $post->message, $code); if (strlen($code[0])!= 0){ echo ' Facebook: Code Available '; return; } $counter++; if($counter >= $max) break; } echo ' Facebo...
modify loop to display message 1 time for all instances My code check the 1st 3 messages of the twitter wall and looks for a string called "code". if its there it will echo "code available" and if its not it will echo "no code". Right now it echos 3 times for each message. how would i modify this code to check all 3 me...
TITLE: modify loop to display message 1 time for all instances QUESTION: My code check the 1st 3 messages of the twitter wall and looks for a string called "code". if its there it will echo "code available" and if its not it will echo "no code". Right now it echos 3 times for each message. how would i modify this code...
[ "php" ]
0
1
143
2
0
2011-06-02T18:38:05.657000
2011-06-02T18:41:33.120000
6,218,831
6,262,511
Spring Roo Video Player
I want to play a video in my web application. İs there any short way to play theese video in my web application
Yes, you can create and use your own custom tag which supports video -- with the video url passed as a parameter for a flash based or html5 video player.
Spring Roo Video Player I want to play a video in my web application. İs there any short way to play theese video in my web application
TITLE: Spring Roo Video Player QUESTION: I want to play a video in my web application. İs there any short way to play theese video in my web application ANSWER: Yes, you can create and use your own custom tag which supports video -- with the video url passed as a parameter for a flash based or html5 video player.
[ "spring", "video", "media-player", "spring-roo" ]
1
0
128
1
0
2011-06-02T18:38:27.180000
2011-06-07T08:27:12.703000
6,218,839
6,219,666
Javascript doesn't run when loading file from local disk on Android
While trying to develop some Android app I ran into the following problem: I load an swf file to a WebView, that makes js calls. I want to catch those js calls, so I use WebViews.addJavascriptInterface() to do so. Everything worked just fine when i loaded the swf file from a remote server, but when I load the same swf ...
I think it's because of the Flash sandbox. When you run a file locally you can not run Javascript code as it does things outside the SWF. However running it from a remote server has the sandbox privileges of the domain. Check this link for more detail: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b...
Javascript doesn't run when loading file from local disk on Android While trying to develop some Android app I ran into the following problem: I load an swf file to a WebView, that makes js calls. I want to catch those js calls, so I use WebViews.addJavascriptInterface() to do so. Everything worked just fine when i loa...
TITLE: Javascript doesn't run when loading file from local disk on Android QUESTION: While trying to develop some Android app I ran into the following problem: I load an swf file to a WebView, that makes js calls. I want to catch those js calls, so I use WebViews.addJavascriptInterface() to do so. Everything worked ju...
[ "javascript", "android", "flash" ]
0
0
937
1
0
2011-06-02T18:39:25.320000
2011-06-02T19:56:08.110000
6,218,843
6,218,877
Php file tries to download instead of execute code
I have the following in my.php file. Just trying a simple search on Flickr. When I visit this.php page in my browser a download dialog pop up. I was expecting to see the json echoed out on the page. I am using WAMP and have url fopen() enabled.If I comment out this code and echo out "WORKING" it does work just fine. $a...
See this previous question that I answered about the same issue: How can I prevent user-agents from presenting a download window for unrecognized mime types?
Php file tries to download instead of execute code I have the following in my.php file. Just trying a simple search on Flickr. When I visit this.php page in my browser a download dialog pop up. I was expecting to see the json echoed out on the page. I am using WAMP and have url fopen() enabled.If I comment out this cod...
TITLE: Php file tries to download instead of execute code QUESTION: I have the following in my.php file. Just trying a simple search on Flickr. When I visit this.php page in my browser a download dialog pop up. I was expecting to see the json echoed out on the page. I am using WAMP and have url fopen() enabled.If I co...
[ "php" ]
0
1
649
1
0
2011-06-02T18:39:52.457000
2011-06-02T18:42:51.920000
6,218,853
6,218,906
Nonsensical Padding in HTML List
I have an HTML list, like millions of others I have made...and the way it is behaving is just really confounding me. Basically there is just this invisible padding on the right side of each element. I can't tell if it is on the hyperlink, the list item, or what... but this is everything I have, for your evaluation. Scr...
You have whitespace between you elements, remove that and no more odd space in the UI. The return that you have causes this. I created a http://jsfiddle.net/59sTg/1/ to show you that it works without the whitespace. Ultimately this is a result of the display:inline-block; attribute. One of many ways of solving this (be...
Nonsensical Padding in HTML List I have an HTML list, like millions of others I have made...and the way it is behaving is just really confounding me. Basically there is just this invisible padding on the right side of each element. I can't tell if it is on the hyperlink, the list item, or what... but this is everything...
TITLE: Nonsensical Padding in HTML List QUESTION: I have an HTML list, like millions of others I have made...and the way it is behaving is just really confounding me. Basically there is just this invisible padding on the right side of each element. I can't tell if it is on the hyperlink, the list item, or what... but ...
[ "css", "html" ]
4
3
279
2
0
2011-06-02T18:40:43.010000
2011-06-02T18:45:12.543000
6,218,857
6,219,990
Mysql Update errors on keys
Update AAA.master A, BBB.images B, BBB.content C set A.caption = B.image_txt where C.content_id_key = A.media_id I get the following error although I am certain they are both primary keys. Do they have to have a PK->FK relationship? I dont think so. You are using safe update mode and you tried to update a table without...
The solution is in the error. But first of all you need to rewrite your query. Repeat after me: I must not use implicit where joins, because they are confusing! Rewrite the update query into this: Update AAA.master a INNER JOIN BBB.images b ON (a.someid = b.someid) #<<-- your error is here INNER JOIN BBB.content c ON (...
Mysql Update errors on keys Update AAA.master A, BBB.images B, BBB.content C set A.caption = B.image_txt where C.content_id_key = A.media_id I get the following error although I am certain they are both primary keys. Do they have to have a PK->FK relationship? I dont think so. You are using safe update mode and you tri...
TITLE: Mysql Update errors on keys QUESTION: Update AAA.master A, BBB.images B, BBB.content C set A.caption = B.image_txt where C.content_id_key = A.media_id I get the following error although I am certain they are both primary keys. Do they have to have a PK->FK relationship? I dont think so. You are using safe updat...
[ "mysql" ]
1
1
301
2
0
2011-06-02T18:40:50.343000
2011-06-02T20:27:33.117000
6,218,860
6,218,897
Javascript update input element
I have quite a large IF statement which needs to update another form element depending on which scenarion only Its not working, By not working I mean its not updating the form element nor executing any more code in that statement. My code is... window.onload = function() { new Dragdealer('magnifier', { steps: 10, snap:...
Don't know if you cut and pasted your code but: document.getElementById(coff_upd).value = '5'; won't work as js is looking for a variable named coff_upd. You need to put quotes around it: document.getElementById("coff_upd").value = '5';
Javascript update input element I have quite a large IF statement which needs to update another form element depending on which scenarion only Its not working, By not working I mean its not updating the form element nor executing any more code in that statement. My code is... window.onload = function() { new Dragdealer...
TITLE: Javascript update input element QUESTION: I have quite a large IF statement which needs to update another form element depending on which scenarion only Its not working, By not working I mean its not updating the form element nor executing any more code in that statement. My code is... window.onload = function(...
[ "javascript" ]
0
4
386
1
0
2011-06-02T18:41:06.530000
2011-06-02T18:44:50.177000
6,218,867
6,218,896
Can I generate a SHA1 in Perl or PHP?
Verotel requires some data to be hashed with sha1_hex function. What exactly is it? No info about it in the whole internet. They say "SHA-1 hash is used (hexadecimal output)". Sha1 with hex output? Heres one example which I can't seem to reproduce: sha1_hex("abc777X:description=some description of product:priceAmount=5...
echo sha1('abc777X:description=some description of product:priceAmount=51.20:priceCurrency=EUR:shopID=60678:version=1'); Actually, that sha1_hex is named sha1() in php. Here is an example, working on your input: http://codepad.org/9fLlr9VJ
Can I generate a SHA1 in Perl or PHP? Verotel requires some data to be hashed with sha1_hex function. What exactly is it? No info about it in the whole internet. They say "SHA-1 hash is used (hexadecimal output)". Sha1 with hex output? Heres one example which I can't seem to reproduce: sha1_hex("abc777X:description=som...
TITLE: Can I generate a SHA1 in Perl or PHP? QUESTION: Verotel requires some data to be hashed with sha1_hex function. What exactly is it? No info about it in the whole internet. They say "SHA-1 hash is used (hexadecimal output)". Sha1 with hex output? Heres one example which I can't seem to reproduce: sha1_hex("abc77...
[ "php", "perl", "hex", "sha1" ]
4
9
5,129
5
0
2011-06-02T18:41:36.403000
2011-06-02T18:44:39.037000
6,218,871
6,227,293
Move MySQL tables and data from storage engine MyISAM to InnoDB
This question is probably for MySQL experts and admins that have done this sort of migration before. I have 17 MySQL tables, triggers and stored procedures on MyISAM storage engine. These tables have around 8 MiB data combined. Since I am moving the application and database to Amazon EC2 and RDS I was wondering what ar...
There are many differences between MyISAM and InnoDB but the main points that you should be aware of before the migration., 1. Data backups cannot be done by simply copying over files as in MyISAM 2. InnoDB does not work in an optimized way when run with default options, you will have to configure and tune according to...
Move MySQL tables and data from storage engine MyISAM to InnoDB This question is probably for MySQL experts and admins that have done this sort of migration before. I have 17 MySQL tables, triggers and stored procedures on MyISAM storage engine. These tables have around 8 MiB data combined. Since I am moving the applic...
TITLE: Move MySQL tables and data from storage engine MyISAM to InnoDB QUESTION: This question is probably for MySQL experts and admins that have done this sort of migration before. I have 17 MySQL tables, triggers and stored procedures on MyISAM storage engine. These tables have around 8 MiB data combined. Since I am...
[ "mysql", "innodb", "myisam" ]
5
2
6,546
3
0
2011-06-02T18:42:09.890000
2011-06-03T12:49:29.540000
6,218,874
6,219,028
Knowing the Child type of an abstract class
I'm having problems designing a service layer when using a Table per Hierarchy setup with entity framework. My problem is that I am getting an object of a specific type but I want to check what the type is. This is better explained in codes: Abstract Domain Class public abstract class Order { public string OrderId { ge...
I'm not completely sure what you are asking but i think you are looking for the is operator: Order order = //... bool isSubscription = order is OrderSubscription; Also if you want to use the value after that you can also use as and this will cast it or return null it it's not of the type. Order order = //... OrderSubsc...
Knowing the Child type of an abstract class I'm having problems designing a service layer when using a Table per Hierarchy setup with entity framework. My problem is that I am getting an object of a specific type but I want to check what the type is. This is better explained in codes: Abstract Domain Class public abstr...
TITLE: Knowing the Child type of an abstract class QUESTION: I'm having problems designing a service layer when using a Table per Hierarchy setup with entity framework. My problem is that I am getting an object of a specific type but I want to check what the type is. This is better explained in codes: Abstract Domain ...
[ "c#", "oop" ]
2
2
1,486
2
0
2011-06-02T18:42:24.183000
2011-06-02T18:56:07.003000
6,218,881
6,236,419
How to prevent .kml files from being cached on an IIS7 server?
Right now the.kml files that I use for a Google Maps implementation on my site are being cached for 7 days because the Cache-Control header within IIS7 is set to 7 days ( as per these instructions ). I could use version control to update the.kml files when changes are made, but I would rather not because other people m...
You can set/change the expire headers at a per directory basis in IIS. The easiest way to accomplish what you want is to create a new directory where you serve the.kml files from. Remove the expire headers from that directory.
How to prevent .kml files from being cached on an IIS7 server? Right now the.kml files that I use for a Google Maps implementation on my site are being cached for 7 days because the Cache-Control header within IIS7 is set to 7 days ( as per these instructions ). I could use version control to update the.kml files when ...
TITLE: How to prevent .kml files from being cached on an IIS7 server? QUESTION: Right now the.kml files that I use for a Google Maps implementation on my site are being cached for 7 days because the Cache-Control header within IIS7 is set to 7 days ( as per these instructions ). I could use version control to update t...
[ "caching", "google-maps", "google-maps-api-3", "kml", "cache-control" ]
0
1
684
1
0
2011-06-02T18:43:00.207000
2011-06-04T11:16:56.700000
6,218,886
6,218,909
what does the following syntax mean in C#
I learn something new everyday about C# and came across this construct. I am not 100% sure what it does, so can someone please explain it: new { Name = "John"} This was used where a string was expected as an argument to a method call. Thanks
It's an object initializer for an anonymous class. It constructs an object with a single property, Name, with value "John." Since you have no way to refer to the object, you would use it right away, as in a LINQ statement or as a parameter as you mentioned. See also this answer.
what does the following syntax mean in C# I learn something new everyday about C# and came across this construct. I am not 100% sure what it does, so can someone please explain it: new { Name = "John"} This was used where a string was expected as an argument to a method call. Thanks
TITLE: what does the following syntax mean in C# QUESTION: I learn something new everyday about C# and came across this construct. I am not 100% sure what it does, so can someone please explain it: new { Name = "John"} This was used where a string was expected as an argument to a method call. Thanks ANSWER: It's an o...
[ "c#", ".net" ]
4
7
181
4
0
2011-06-02T18:43:31.407000
2011-06-02T18:45:20.737000
6,218,889
6,219,428
after running program leave interactive shell to use
I want to run any program given as argument, through shell then want that shell left as interactive shell to use later. #!/bin/bash bash -i < /dev/tty EOF But it is not working with zsh #!/bin/bash zsh -i < /dev/tty EOF as well as if somebody know more improved way to do it please let me know.
Approach 1: bash, zsh and a few other shells read a file whose name is in the ENV environment variable after the usual rc files and before the interactive commands or the script to run. However bash only does this if invoked as sh, and zsh only does this if invoked as sh or ksh, which is rather limiting. temp_rc=$(mkte...
after running program leave interactive shell to use I want to run any program given as argument, through shell then want that shell left as interactive shell to use later. #!/bin/bash bash -i < /dev/tty EOF But it is not working with zsh #!/bin/bash zsh -i < /dev/tty EOF as well as if somebody know more improved way t...
TITLE: after running program leave interactive shell to use QUESTION: I want to run any program given as argument, through shell then want that shell left as interactive shell to use later. #!/bin/bash bash -i < /dev/tty EOF But it is not working with zsh #!/bin/bash zsh -i < /dev/tty EOF as well as if somebody know m...
[ "bash", "shell", "exec", "zsh" ]
10
4
2,789
4
0
2011-06-02T18:43:45.230000
2011-06-02T19:32:42.507000
6,218,890
6,218,975
Python - how can I read stdin from shell, and send stdout to shell and file
I'd like to have a Python script read stdin from the shell (bash), and send stdout to shell as well a redirected file. I tried the following: $ cat test.py #!/usr/bin/python val = raw_input("enter val: ") print val $./test.py | tee out testing enter val: testing $ cat out enter val: testing For some reason, the raw_...
#!/usr/bin/python import sys print "enter val: ", sys.stdout.flush() val = raw_input() print val Or #!/usr/bin/python import sys sys.stdout = sys.stderr val = raw_input("enter val: ") sys.stdout = sys.__stdout__ print val
Python - how can I read stdin from shell, and send stdout to shell and file I'd like to have a Python script read stdin from the shell (bash), and send stdout to shell as well a redirected file. I tried the following: $ cat test.py #!/usr/bin/python val = raw_input("enter val: ") print val $./test.py | tee out testin...
TITLE: Python - how can I read stdin from shell, and send stdout to shell and file QUESTION: I'd like to have a Python script read stdin from the shell (bash), and send stdout to shell as well a redirected file. I tried the following: $ cat test.py #!/usr/bin/python val = raw_input("enter val: ") print val $./test.p...
[ "python", "bash" ]
3
2
4,313
2
0
2011-06-02T18:43:51.277000
2011-06-02T18:51:46.847000
6,218,891
6,218,937
if statment in Sql Server view
I want to set the saletype to 0 if the sale date has expired or is not yet active but only if assignDate is true. how can I build it in the view? SELECT dbo.ItemStore.SaleType, dbo.ItemStore.SpecialBuyFromDate AS SaleStartDate, dbo.ItemStore.SpecialBuyToDate AS SaleEndDate, dbo.ItemStore.AssignDate FROM dbo.ItemMainAnd...
Use a CASE expression You'll need to allow for the time aspect of GETDATE() hence my DATEADD/DATEDIFF to remove the time component for correct date range checks. For SQL Server 2008+ you can just use CAST(GETDATE() as date) SELECT CASE WHEN DATEADD(day, 0, DATEDIFF(day, 0, GETDATE())) BETWEEN dbo.ItemStore.SpecialBuyFr...
if statment in Sql Server view I want to set the saletype to 0 if the sale date has expired or is not yet active but only if assignDate is true. how can I build it in the view? SELECT dbo.ItemStore.SaleType, dbo.ItemStore.SpecialBuyFromDate AS SaleStartDate, dbo.ItemStore.SpecialBuyToDate AS SaleEndDate, dbo.ItemStore....
TITLE: if statment in Sql Server view QUESTION: I want to set the saletype to 0 if the sale date has expired or is not yet active but only if assignDate is true. how can I build it in the view? SELECT dbo.ItemStore.SaleType, dbo.ItemStore.SpecialBuyFromDate AS SaleStartDate, dbo.ItemStore.SpecialBuyToDate AS SaleEndDa...
[ "sql" ]
1
3
145
3
0
2011-06-02T18:43:56.370000
2011-06-02T18:47:58.083000
6,218,900
6,219,115
iPhone Copy/Paste
I want two buttons in the app in a certain view, Copy and Paste. This view also has a textview. If someone presses the copy button, I want all of the text in that textview to be copied. If someone presses the past button, I want to append the text in the textview with that which is in the clipboard? How do I?
-(IBAction)copy { pasteboard = [textField text]; } -(IBAction)paste { [textField setText:[[textField text] stringByAppendingString:pasteboard] ]; } where pasteboard is a NSString
iPhone Copy/Paste I want two buttons in the app in a certain view, Copy and Paste. This view also has a textview. If someone presses the copy button, I want all of the text in that textview to be copied. If someone presses the past button, I want to append the text in the textview with that which is in the clipboard? H...
TITLE: iPhone Copy/Paste QUESTION: I want two buttons in the app in a certain view, Copy and Paste. This view also has a textview. If someone presses the copy button, I want all of the text in that textview to be copied. If someone presses the past button, I want to append the text in the textview with that which is i...
[ "iphone" ]
1
3
422
2
0
2011-06-02T18:45:00.217000
2011-06-02T19:04:23.587000