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,229,345
6,229,736
sass @import "compass/reset" error
I'd like to use Sass with Compass on my static HTML project, but following the instructions does not work. This is what I did: $ gem install compass $ cd $ compass install compass. which was following by awaiting: directory./sass/ directory./stylesheets/ create./sass/screen.scss create./sass/print.scss create./sass/ie....
Use compass watch instead of sass --watch sass:stylesheets. If you're using compass, you don't need to bother with sass command. Just use the compass command.
sass @import "compass/reset" error I'd like to use Sass with Compass on my static HTML project, but following the instructions does not work. This is what I did: $ gem install compass $ cd $ compass install compass. which was following by awaiting: directory./sass/ directory./stylesheets/ create./sass/screen.scss creat...
TITLE: sass @import "compass/reset" error QUESTION: I'd like to use Sass with Compass on my static HTML project, but following the instructions does not work. This is what I did: $ gem install compass $ cd $ compass install compass. which was following by awaiting: directory./sass/ directory./stylesheets/ create./sass...
[ "ruby", "rubygems", "sass" ]
12
15
11,321
2
0
2011-06-03T15:42:56.097000
2011-06-03T16:09:35.857000
6,229,348
6,229,446
Using Curly Braces with $_REQUEST to retrieve its indexes
I've been reviewing a sample code to learn PHP and what I saw made me confused in the following code: $in = $_REQUEST; require_once 'utils.php'; require_once 'utils_user.php'; require_once 'utils_email.php'; require_once 'utils_affiliate.php'; #Load Settings $globalSettings = parse_ini_file("settings.ini", true); if(...
The curly braces can be used to access array keys instead of the square ones. $array{'a'} === $array['a'] The syntax is exactly the same with the only difference that curly brackets can't be used for pushing values: $array{} = 'x'; // doesn't work $array[] = 'x'; // works This alternative syntax was originally intended...
Using Curly Braces with $_REQUEST to retrieve its indexes I've been reviewing a sample code to learn PHP and what I saw made me confused in the following code: $in = $_REQUEST; require_once 'utils.php'; require_once 'utils_user.php'; require_once 'utils_email.php'; require_once 'utils_affiliate.php'; #Load Settings $g...
TITLE: Using Curly Braces with $_REQUEST to retrieve its indexes QUESTION: I've been reviewing a sample code to learn PHP and what I saw made me confused in the following code: $in = $_REQUEST; require_once 'utils.php'; require_once 'utils_user.php'; require_once 'utils_email.php'; require_once 'utils_affiliate.php'; ...
[ "php" ]
1
6
153
3
0
2011-06-03T15:43:16.473000
2011-06-03T15:49:07.350000
6,229,353
6,229,447
Permissions with mkdir won't work
I can't understand why I have to use chmod to get the correct permissions.. The file is created succesfully but with 0755 and not 0775 that I specify in mkdir. ( http://php.net/manual/en/function.mkdir.php ) I have to do chmod after mkdir to set the correct permissions. Safe mode is off in php.ini and the folder belong...
Yes, it's because of umask... from comments of docs: http://php.net/manual/en/function.mkdir.php You might notice that when you create a new directory using this code: mkdir($dir, 0777); The created folder actually has permissions of 0755, instead of the specified 0777. Why is this you ask? Because of umask(): http://p...
Permissions with mkdir won't work I can't understand why I have to use chmod to get the correct permissions.. The file is created succesfully but with 0755 and not 0775 that I specify in mkdir. ( http://php.net/manual/en/function.mkdir.php ) I have to do chmod after mkdir to set the correct permissions. Safe mode is of...
TITLE: Permissions with mkdir won't work QUESTION: I can't understand why I have to use chmod to get the correct permissions.. The file is created succesfully but with 0755 and not 0775 that I specify in mkdir. ( http://php.net/manual/en/function.mkdir.php ) I have to do chmod after mkdir to set the correct permission...
[ "php", "linux" ]
27
44
13,945
3
0
2011-06-03T15:43:41.747000
2011-06-03T15:49:17.930000
6,229,356
6,229,505
-[NSURL objectAtIndex:]: unrecognized selector sent to instance 0x4e1d6d0 ASIHTTPRequest
I'm formatting an ASIHTTPRequest to send array data to a server. I have an array for keys (propertyKeys) and an array for the information (propertyValues) and have created a loop to set the post and key values as such. for(int i = 0;i<13;i++){ [request setPostValue:[propertyValues objectAtIndex:i] forKey:[propertyKeys ...
Is that error happening within the code that you posted, or elsewhere? Running the app in debug mode (Cmd-Y) will let you follow the stack trace up to see exactly where a crash happened. That said, if the crash is happening within what you posted, it probably means that either propertyKeys or propertyValues has been de...
-[NSURL objectAtIndex:]: unrecognized selector sent to instance 0x4e1d6d0 ASIHTTPRequest I'm formatting an ASIHTTPRequest to send array data to a server. I have an array for keys (propertyKeys) and an array for the information (propertyValues) and have created a loop to set the post and key values as such. for(int i = ...
TITLE: -[NSURL objectAtIndex:]: unrecognized selector sent to instance 0x4e1d6d0 ASIHTTPRequest QUESTION: I'm formatting an ASIHTTPRequest to send array data to a server. I have an array for keys (propertyKeys) and an array for the information (propertyValues) and have created a loop to set the post and key values as ...
[ "objective-c", "asihttprequest", "sigabrt" ]
1
2
922
2
0
2011-06-03T15:43:53.793000
2011-06-03T15:53:15.720000
6,229,358
6,229,576
Running commands from within python that need root access
I have been playing around with subprocess lately. As I do more and more; I find myself needing root access. I was wondering if there is an easy way to enter the root password for a command that needs it with subprocess module. So when I am prompted for the password my script and provide it and run the command. I know ...
It would probably be best to leverage sudo for the user running the Python program. You can specify specific commands and arguments that can be run from sudo without requiring a password. Here is an example: There are many approaches but I prefer the one that assigns command sets to groups. So let's say we want to crea...
Running commands from within python that need root access I have been playing around with subprocess lately. As I do more and more; I find myself needing root access. I was wondering if there is an easy way to enter the root password for a command that needs it with subprocess module. So when I am prompted for the pass...
TITLE: Running commands from within python that need root access QUESTION: I have been playing around with subprocess lately. As I do more and more; I find myself needing root access. I was wondering if there is an easy way to enter the root password for a command that needs it with subprocess module. So when I am pro...
[ "python", "subprocess", "sudo" ]
6
10
6,766
1
0
2011-06-03T15:43:58.357000
2011-06-03T15:58:07.053000
6,229,361
6,229,444
Why can't you call methods with c# object initializer syntax?
Why can't you call methods with c# object initializer syntax? It seems to me that the property setters are called in the order that they are set in the syntax, so why not allow calls to methods as well? If there is a good reason, I'm missing it. EDIT I realize the semantic differences between methods and properties and...
The answer is in the name -- object initializer syntax is syntactic sugar to visually group the object's initial state. Methods change the object state, so once it's changed, it's no longer the initial state. For example: say you buy a car. It is a red coupe with 55,000 miles on it. Then, you decide to drive it. It end...
Why can't you call methods with c# object initializer syntax? Why can't you call methods with c# object initializer syntax? It seems to me that the property setters are called in the order that they are set in the syntax, so why not allow calls to methods as well? If there is a good reason, I'm missing it. EDIT I reali...
TITLE: Why can't you call methods with c# object initializer syntax? QUESTION: Why can't you call methods with c# object initializer syntax? It seems to me that the property setters are called in the order that they are set in the syntax, so why not allow calls to methods as well? If there is a good reason, I'm missin...
[ "c#", ".net" ]
15
9
7,746
5
0
2011-06-03T15:44:03.567000
2011-06-03T15:49:04.603000
6,229,363
6,229,397
String as an array index
In 3["XoePhoenix"], array index is of type array of characters. Can we do this in C? Isn't it true that an array index must be an integer? What does 3["XeoPhoenix"] mean?
3["XoePhoenix"] is the same as "XoePhoenix"[3], so it will evaluate to the char 'P'. The array syntax in C is not more than a different way of writing *( x + y ), where x and y are the sub expressions before and inside the brackets. Due to the commutativity of the addition these sub expressions can be exchanged without...
String as an array index In 3["XoePhoenix"], array index is of type array of characters. Can we do this in C? Isn't it true that an array index must be an integer? What does 3["XeoPhoenix"] mean?
TITLE: String as an array index QUESTION: In 3["XoePhoenix"], array index is of type array of characters. Can we do this in C? Isn't it true that an array index must be an integer? What does 3["XeoPhoenix"] mean? ANSWER: 3["XoePhoenix"] is the same as "XoePhoenix"[3], so it will evaluate to the char 'P'. The array sy...
[ "c", "arrays" ]
4
6
163
3
0
2011-06-03T15:44:08
2011-06-03T15:46:33.467000
6,229,366
6,252,707
How do I get Eclipse/EPIC to stop warning about "Use of uninitialized value $ENV{whatever}" in my perl script?
This appears in the Eclipse text editor the first time EPIC encounters use of the special %ENV variable in a Perl script. I'm not running anything in this environment, I just want the warning to go away. I fiddled around in the "run configurations" section, but that didn't seem to help. UPDATE 1: All these answers are ...
Actually I believe this is not currently possible, see this feature request and forum post
How do I get Eclipse/EPIC to stop warning about "Use of uninitialized value $ENV{whatever}" in my perl script? This appears in the Eclipse text editor the first time EPIC encounters use of the special %ENV variable in a Perl script. I'm not running anything in this environment, I just want the warning to go away. I fid...
TITLE: How do I get Eclipse/EPIC to stop warning about "Use of uninitialized value $ENV{whatever}" in my perl script? QUESTION: This appears in the Eclipse text editor the first time EPIC encounters use of the special %ENV variable in a Perl script. I'm not running anything in this environment, I just want the warning...
[ "eclipse", "perl", "warnings", "initialization" ]
2
0
1,170
4
0
2011-06-03T15:44:12.077000
2011-06-06T13:28:00.120000
6,229,372
6,233,207
Modifying Saved Artifacts On a Particular Jenkins Build for Deployment
We have a.NET Jenkins installation that builds a few.NET apps. These apps include a bunch of *.exe and *.exe.config files. Right now, I save the app as a zipfile containing all of the *.exe, the required DLLs and *.xml files, and the default *.exe.config files. The default *.exe.config get their value from what is in t...
It's not as elegant, but I think you can implement what you want as a separate build. You need: A Parameterized Build (which you know about) A way to access artifacts from another build Given these pieces, you should be able to create a Parameterized Build that does exactly what you describe: grabs the build artifact, ...
Modifying Saved Artifacts On a Particular Jenkins Build for Deployment We have a.NET Jenkins installation that builds a few.NET apps. These apps include a bunch of *.exe and *.exe.config files. Right now, I save the app as a zipfile containing all of the *.exe, the required DLLs and *.xml files, and the default *.exe.c...
TITLE: Modifying Saved Artifacts On a Particular Jenkins Build for Deployment QUESTION: We have a.NET Jenkins installation that builds a few.NET apps. These apps include a bunch of *.exe and *.exe.config files. Right now, I save the app as a zipfile containing all of the *.exe, the required DLLs and *.xml files, and t...
[ "hudson", "jenkins", "hudson-plugin-batch-task" ]
1
0
1,238
1
0
2011-06-03T15:44:37.640000
2011-06-03T22:18:04.550000
6,229,378
6,229,690
Resizing an indexed image in Java without losing transparency
This is my function to resize images. The quality is not photoshop but it's acceptable. What's not acceptable is the behaviour on indexed png. We expect that if we scale down an image with a 256 colors palette with a transparent index we would get a resized image with same transparency, but this it not the case. So we ...
Try changing BufferedImage indexedImage = new BufferedImage(destWidth, destHeight, BufferedImage.TYPE_BYTE_INDEXED); to BufferedImage indexedImage = new BufferedImage(destWidth, destHeight, BufferedImage.TYPE_BYTE_INDEXED, (IndexColorModel) source.getColorModel()); Even if that specifically doesn't help you (which it m...
Resizing an indexed image in Java without losing transparency This is my function to resize images. The quality is not photoshop but it's acceptable. What's not acceptable is the behaviour on indexed png. We expect that if we scale down an image with a 256 colors palette with a transparent index we would get a resized ...
TITLE: Resizing an indexed image in Java without losing transparency QUESTION: This is my function to resize images. The quality is not photoshop but it's acceptable. What's not acceptable is the behaviour on indexed png. We expect that if we scale down an image with a 256 colors palette with a transparent index we wo...
[ "java", "image", "png", "java-2d" ]
4
5
4,595
2
0
2011-06-03T15:45:05.410000
2011-06-03T16:06:21.583000
6,229,384
6,229,454
Check for duplicate CartID during Order insertion into SQL Server db using NOT EXISTS
To prevent a duplicate shopping cart being added I am attempting to modify my stored procedure to use NOT EXISTS. I have used this before in the WHERE statement but this one is a puzzle. How do I apply a NOT EXISTS to Orders insert that quits the entire process if the CartID already exists. ALTER PROCEDURE [dbo].[Creat...
Change the insert to: INSERT INTO OrderDetail (OrderID, ProductID, ProductName, Quantity, UnitCost) SELECT @OrderID, Product.ProductID, Product.Name, ShoppingCart.Quantity, Product.Price FROM Product JOIN ShoppingCart ON Product.ProductID = ShoppingCart.ProductID WHERE NOT EXISTS (SELECT 1 FROM ShoppingCart a WHERE a.C...
Check for duplicate CartID during Order insertion into SQL Server db using NOT EXISTS To prevent a duplicate shopping cart being added I am attempting to modify my stored procedure to use NOT EXISTS. I have used this before in the WHERE statement but this one is a puzzle. How do I apply a NOT EXISTS to Orders insert th...
TITLE: Check for duplicate CartID during Order insertion into SQL Server db using NOT EXISTS QUESTION: To prevent a duplicate shopping cart being added I am attempting to modify my stored procedure to use NOT EXISTS. I have used this before in the WHERE statement but this one is a puzzle. How do I apply a NOT EXISTS t...
[ "sql-server", "t-sql" ]
0
1
205
1
0
2011-06-03T15:45:57.543000
2011-06-03T15:49:36.047000
6,229,393
6,229,574
Scope of Objects Passed as Arguments - Python
I want to send a session object of sqlalchemy to a function of another class. From class OraDialog 's function oraconnect to class oraconn 's assign function. Actually My need is to use the session object in oraconn 's another function map I can't send the session object directly to map function because it is a slot - ...
If you're using Qt, then this is likely a GUI app. Maybe there are threading issues; maybe self refers to different objects. It's hard to tell with only what you've given us. Before you go any further, add: print self near the top of each method. At least then you can confirm whether both are operating on the same obje...
Scope of Objects Passed as Arguments - Python I want to send a session object of sqlalchemy to a function of another class. From class OraDialog 's function oraconnect to class oraconn 's assign function. Actually My need is to use the session object in oraconn 's another function map I can't send the session object di...
TITLE: Scope of Objects Passed as Arguments - Python QUESTION: I want to send a session object of sqlalchemy to a function of another class. From class OraDialog 's function oraconnect to class oraconn 's assign function. Actually My need is to use the session object in oraconn 's another function map I can't send the...
[ "python", "object", "sqlalchemy", "pyqt4" ]
0
2
309
2
0
2011-06-03T15:46:16.343000
2011-06-03T15:58:00.850000
6,229,394
6,237,742
Silverlight + RIA: problem editing entity
I have a Silverlight 4 application with EntityFramework as data layer. There are two entities: Customer and Products. When I get customer from a database, the related products are also read, as I added related 'Include' attribute in customer's metadata and call Include method in get query: public IQueryable GetCustomer...
This is the real problem with RIA+EF so we keep all our entities in one domain service because at client side it is difficult to deal with multiple entities related via navigation properties. Think for a minute it actually makes no difference and we use EF T4 template to generate all domain service operation in one cla...
Silverlight + RIA: problem editing entity I have a Silverlight 4 application with EntityFramework as data layer. There are two entities: Customer and Products. When I get customer from a database, the related products are also read, as I added related 'Include' attribute in customer's metadata and call Include method i...
TITLE: Silverlight + RIA: problem editing entity QUESTION: I have a Silverlight 4 application with EntityFramework as data layer. There are two entities: Customer and Products. When I get customer from a database, the related products are also read, as I added related 'Include' attribute in customer's metadata and cal...
[ "silverlight", "entity-framework", "ria" ]
3
2
2,005
4
0
2011-06-03T15:46:21.920000
2011-06-04T15:49:21.600000
6,229,401
6,229,547
Android ... how to find out if I'm on a wifi internet?
In my application I just need to know if the device is connected to wifi network or not. I think this function works on emulator but not on real device. public static boolean wifiInternet(Context c) { try { ConnectivityManager connectivityManager = (ConnectivityManager)c.getSystemService(Context.CONNECTIVITY_SERVICE); ...
Try this: public boolean isUsingWiFi() { ConnectivityManager connectivity = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifiInfo = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (wifiInfo!= null && wifiInfo.getState() == NetworkInfo.State.CONNECTED || wifiInfo.get...
Android ... how to find out if I'm on a wifi internet? In my application I just need to know if the device is connected to wifi network or not. I think this function works on emulator but not on real device. public static boolean wifiInternet(Context c) { try { ConnectivityManager connectivityManager = (ConnectivityMan...
TITLE: Android ... how to find out if I'm on a wifi internet? QUESTION: In my application I just need to know if the device is connected to wifi network or not. I think this function works on emulator but not on real device. public static boolean wifiInternet(Context c) { try { ConnectivityManager connectivityManager ...
[ "android", "wifi" ]
1
12
3,304
1
0
2011-06-03T15:46:38.233000
2011-06-03T15:56:09.783000
6,229,409
6,229,573
Looking for an idea how to measure line count
I want to take a text on a webpage and measure it's height in lines, regardless of any other parameter, so if I shrink the text width and get more lines, i will get the new line count. Any ideas how to do that using JS and jQuery? Also, what kind of line numbering techniques are common?
Almost same idea as Ghommey's comment, but with line-height instead of height. Fiddle here: http://jsfiddle.net/k_rma/vbCJm/
Looking for an idea how to measure line count I want to take a text on a webpage and measure it's height in lines, regardless of any other parameter, so if I shrink the text width and get more lines, i will get the new line count. Any ideas how to do that using JS and jQuery? Also, what kind of line numbering technique...
TITLE: Looking for an idea how to measure line count QUESTION: I want to take a text on a webpage and measure it's height in lines, regardless of any other parameter, so if I shrink the text width and get more lines, i will get the new line count. Any ideas how to do that using JS and jQuery? Also, what kind of line n...
[ "javascript", "jquery", "height", "line", "css" ]
3
4
1,633
3
0
2011-06-03T15:47:01.713000
2011-06-03T15:58:00.770000
6,229,411
6,229,591
Using Java Annotations - Generating Code
I'm using java 6 annotation processing api. I have followed the following excellent tutorial for creating an annotation processor that displays a message at build-time: http://kerebus.com/2011/02/using-java-6-processors-in-eclipse/ However, in my case, I have a simple class as such: import java.lang.annotation.ElementT...
If you want runtime modification of you classes, you can use your own classloader and intercept loading of classes, introspect what you want and generate new bytecode using asm library instead of original classes. It is not very tricky, but you must be sure you need exactly that.
Using Java Annotations - Generating Code I'm using java 6 annotation processing api. I have followed the following excellent tutorial for creating an annotation processor that displays a message at build-time: http://kerebus.com/2011/02/using-java-6-processors-in-eclipse/ However, in my case, I have a simple class as s...
TITLE: Using Java Annotations - Generating Code QUESTION: I'm using java 6 annotation processing api. I have followed the following excellent tutorial for creating an annotation processor that displays a message at build-time: http://kerebus.com/2011/02/using-java-6-processors-in-eclipse/ However, in my case, I have a...
[ "java", "annotations" ]
4
0
5,754
2
0
2011-06-03T15:47:07.373000
2011-06-03T15:59:13.657000
6,229,412
6,235,908
CMWC (Complementary Multiply-with-carry) Matlab
To cite Mr. Marsaglia about generating more parameters for the CMWC PRNG: "Those wanting even more pairs r,a will need to find primes of the form p=ab^r+1 for which b=2^32-1 is a primitive root". My question is in the method I should be using to do this. Especially with very large primes. This is what I've written in M...
Well one could always use my vpi toolbox in matlab. While I did not provide a tool to explicitly generate/test for a primitive root, vpi does have the ability to work with arbitrarily large integers, as well as a powermod function to do much of the work. I will point out however, that a simple, brute force loop over 2^...
CMWC (Complementary Multiply-with-carry) Matlab To cite Mr. Marsaglia about generating more parameters for the CMWC PRNG: "Those wanting even more pairs r,a will need to find primes of the form p=ab^r+1 for which b=2^32-1 is a primitive root". My question is in the method I should be using to do this. Especially with v...
TITLE: CMWC (Complementary Multiply-with-carry) Matlab QUESTION: To cite Mr. Marsaglia about generating more parameters for the CMWC PRNG: "Those wanting even more pairs r,a will need to find primes of the form p=ab^r+1 for which b=2^32-1 is a primitive root". My question is in the method I should be using to do this....
[ "matlab", "random", "generator" ]
2
1
672
1
0
2011-06-03T15:47:11.033000
2011-06-04T09:28:51.090000
6,229,413
6,229,464
C++ keyword using
Possible Duplicate: Why shall I use the “using” keyword to access my base class method? Hi, I can't find out why I needed the keyword using in the following case: // Pure virtual class. class Visitor { public: void operator()(Ast&); virtual void operator()(Node&) = 0; }; // Define the default visit methods. class Def...
See this Why should I use the "using" keyword to access my base class method? Also this using The using keyword is used to import a namespace (or parts of a namespace) into the current scope. Example code: For example, the following code imports the entire std namespace into the current scope so that items within that ...
C++ keyword using Possible Duplicate: Why shall I use the “using” keyword to access my base class method? Hi, I can't find out why I needed the keyword using in the following case: // Pure virtual class. class Visitor { public: void operator()(Ast&); virtual void operator()(Node&) = 0; }; // Define the default visit ...
TITLE: C++ keyword using QUESTION: Possible Duplicate: Why shall I use the “using” keyword to access my base class method? Hi, I can't find out why I needed the keyword using in the following case: // Pure virtual class. class Visitor { public: void operator()(Ast&); virtual void operator()(Node&) = 0; }; // Define ...
[ "c++" ]
1
1
1,816
1
0
2011-06-03T15:47:11.110000
2011-06-03T15:50:34.800000
6,229,419
6,252,809
PHP & GD - transparent background being filled with nearby color
I know PHP+GD Transparency issues have been beat to death on this and many other sites, but I've followed all the recommendations and I can't seem to fix my issue. First, the explanation: I am trying to overlay one image on top of another one. They both have areas that are transparent. As a demo that I know should look...
Note that it doesn't matter that you create the handle in newImage and call imagealphablending and imagesavealpha on it, because loadImage throws that handle away. The reason it is "filling" the transparent area with the blue color is that it is not filling the transparent area with anything at all. It it just complete...
PHP & GD - transparent background being filled with nearby color I know PHP+GD Transparency issues have been beat to death on this and many other sites, but I've followed all the recommendations and I can't seem to fix my issue. First, the explanation: I am trying to overlay one image on top of another one. They both h...
TITLE: PHP & GD - transparent background being filled with nearby color QUESTION: I know PHP+GD Transparency issues have been beat to death on this and many other sites, but I've followed all the recommendations and I can't seem to fix my issue. First, the explanation: I am trying to overlay one image on top of anothe...
[ "php", "image-processing", "transparency", "gd" ]
6
2
3,244
1
0
2011-06-03T15:47:45.167000
2011-06-06T13:35:32.557000
6,229,422
6,229,476
NI Number Validation Jquery
$.validator.addMethod( "ninumber", function(value, element) { return this.optional(element) || /^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$/.test(value); }, "Please enter a valid NI Number." ); Can anyone spot any issues with the code sample? It seems fine to me, yet the correct values are still sho...
It doesn't allow for spaces, so you need to strip those first. I've just checked and it validates my NI number, but only without spaces. So, you'd want something like: /^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$/.test(value.replace(/\s/g, '')); if you really wanted to keep it to a one-line validati...
NI Number Validation Jquery $.validator.addMethod( "ninumber", function(value, element) { return this.optional(element) || /^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$/.test(value); }, "Please enter a valid NI Number." ); Can anyone spot any issues with the code sample? It seems fine to me, yet the ...
TITLE: NI Number Validation Jquery QUESTION: $.validator.addMethod( "ninumber", function(value, element) { return this.optional(element) || /^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$/.test(value); }, "Please enter a valid NI Number." ); Can anyone spot any issues with the code sample? It seems fi...
[ "jquery", "validation" ]
3
3
492
1
0
2011-06-03T15:47:59.457000
2011-06-03T15:51:22.100000
6,229,433
6,229,754
How to extract MDCT coefficients from audio files?
I have an AAC file. I want to extract MDCT coefficients. Are there any libraries or tools in Java which can be used?
I believe this code demonstrates the extraction of MDCT from AAC files.
How to extract MDCT coefficients from audio files? I have an AAC file. I want to extract MDCT coefficients. Are there any libraries or tools in Java which can be used?
TITLE: How to extract MDCT coefficients from audio files? QUESTION: I have an AAC file. I want to extract MDCT coefficients. Are there any libraries or tools in Java which can be used? ANSWER: I believe this code demonstrates the extraction of MDCT from AAC files.
[ "java", "audio" ]
0
1
656
1
0
2011-06-03T15:48:34.327000
2011-06-03T16:11:26.727000
6,229,436
6,235,233
wikitext to xml
Is there a way to convert wikitext data into simple XML in a Java application? Input example: == A section == this is some text... {{MyTemplate |attr1=some value |attr2=some other value... Output example: this is some text... It seems like a trivial task but I couldn't find a library to do it in Java. Mulone
XML has a tree structure, wikitext for the most part does not. E. g. this is fully legal: == A section {{DoubleEqual{{echo|Sign}}}} The template syntax itself is hierarchical, and MediaWiki itself transforms it to XML (you can use Special:ExpandTemplates to check it out), but the rest of the syntax is much too loose fo...
wikitext to xml Is there a way to convert wikitext data into simple XML in a Java application? Input example: == A section == this is some text... {{MyTemplate |attr1=some value |attr2=some other value... Output example: this is some text... It seems like a trivial task but I couldn't find a library to do it in Java. ...
TITLE: wikitext to xml QUESTION: Is there a way to convert wikitext data into simple XML in a Java application? Input example: == A section == this is some text... {{MyTemplate |attr1=some value |attr2=some other value... Output example: this is some text... It seems like a trivial task but I couldn't find a library ...
[ "java", "xml", "wiki", "mediawiki" ]
0
1
542
2
0
2011-06-03T15:48:38.463000
2011-06-04T06:46:35.510000
6,229,443
6,229,455
Do objects of one class share code
If there is a class A and I instantiate three objects x,y,z of A, and there is a function foo() in A, then will three copies of machine code exist for f (one for each object)? What is the purpose of class methods? When all objects have shared code why use class methods anyway? Is it just an abstraction to an HLL progra...
No, there won't. There will be only one copy of the code. Each class instance will however have its own copies of the class's member variables.
Do objects of one class share code If there is a class A and I instantiate three objects x,y,z of A, and there is a function foo() in A, then will three copies of machine code exist for f (one for each object)? What is the purpose of class methods? When all objects have shared code why use class methods anyway? Is it j...
TITLE: Do objects of one class share code QUESTION: If there is a class A and I instantiate three objects x,y,z of A, and there is a function foo() in A, then will three copies of machine code exist for f (one for each object)? What is the purpose of class methods? When all objects have shared code why use class metho...
[ "oop", "coding-style" ]
0
5
108
2
0
2011-06-03T15:48:58.760000
2011-06-03T15:49:44.987000
6,229,457
6,229,604
XUL: Getting drop target ID
The following code is used for listbox items supposed to get the ID of the source and target items. It works for getting the source and stores it in the data variable. But data2 only retrieves the ID if the target list item is empty. If the target has text it doesn't work. How can I get the id of the list item and not ...
Personally, I would use the property parentNode and keep going up in the hierachy until I find something of type list item.
XUL: Getting drop target ID The following code is used for listbox items supposed to get the ID of the source and target items. It works for getting the source and stores it in the data variable. But data2 only retrieves the ID if the target list item is empty. If the target has text it doesn't work. How can I get the ...
TITLE: XUL: Getting drop target ID QUESTION: The following code is used for listbox items supposed to get the ID of the source and target items. It works for getting the source and stores it in the data variable. But data2 only retrieves the ID if the target list item is empty. If the target has text it doesn't work. ...
[ "javascript", "firefox", "firefox-addon", "xul" ]
0
1
491
2
0
2011-06-03T15:49:51.877000
2011-06-03T15:59:57.793000
6,229,458
6,233,629
javascript - how to wrap text blocks in <span> containing html tags in IE
I'm unable to figure this out in Internet Explorer, but I want to be able to wrap a text block with tags that contain various html tags in it. I am writing a highlighting function where you highlight text with your mouse and the selection you highlight is wrapped in a tag. For example, consider the following text block...
This is tricky to achieve in the general case (think of selections crossing element boundaries: a single cannot be used to surround such a selection). You can use document.execCommand() to do this in all major browsers. See my answer to a similar question here: How can I highlight the text of the DOM Range object? UPDA...
javascript - how to wrap text blocks in <span> containing html tags in IE I'm unable to figure this out in Internet Explorer, but I want to be able to wrap a text block with tags that contain various html tags in it. I am writing a highlighting function where you highlight text with your mouse and the selection you hig...
TITLE: javascript - how to wrap text blocks in <span> containing html tags in IE QUESTION: I'm unable to figure this out in Internet Explorer, but I want to be able to wrap a text block with tags that contain various html tags in it. I am writing a highlighting function where you highlight text with your mouse and the...
[ "javascript", "internet-explorer" ]
0
1
1,222
1
0
2011-06-03T15:50:04.737000
2011-06-03T23:33:09.867000
6,229,459
6,233,492
Issue with xib files for iPad universal
I have a running iPhone app and I am trying to change it into an universal app in Xcode 3.2. I only want to create new xib files for iPad. So I simply expand Targets click “Project\Upgrade Current Target for iPad” and choose “One universal application”. On my app I have a lot of xib files and I want to creat new iPad x...
You can create iPad specific xibs very simple from existing standard iPhone xibs: open iPhone xib in Interface Builder in Menu of Interface Builder select File and Create iPad version (or Create iPad version using Autosizing Masks ) save the new iPad xib and add it to your project; the name of iPad xib should be the sa...
Issue with xib files for iPad universal I have a running iPhone app and I am trying to change it into an universal app in Xcode 3.2. I only want to create new xib files for iPad. So I simply expand Targets click “Project\Upgrade Current Target for iPad” and choose “One universal application”. On my app I have a lot of ...
TITLE: Issue with xib files for iPad universal QUESTION: I have a running iPhone app and I am trying to change it into an universal app in Xcode 3.2. I only want to create new xib files for iPad. So I simply expand Targets click “Project\Upgrade Current Target for iPad” and choose “One universal application”. On my ap...
[ "iphone", "ios", "ipad", "xib" ]
7
17
4,715
1
0
2011-06-03T15:50:05.697000
2011-06-03T23:07:09.673000
6,229,460
6,229,526
.Net Regular Expression Currency
I am trying to find the currency in strings like "NTE $22,539,420.00" I tried to use several regular expressions including ^\s*[\+-]?\s?\$?\s?(\d*\.?\d{2}?){1}$ but none of them seem to work. Does anyone have any suggestions or reasons why the above would not work. Thanks, Jim
You are matching the beginning of the string by using ^, and the beginning of your string does not start with any whitespace. You are also not taking into consideration the ',' characters. Try this \s*[+-]?\s?\$?\s?((\d{1,3},?)+.?\d{2}?)
.Net Regular Expression Currency I am trying to find the currency in strings like "NTE $22,539,420.00" I tried to use several regular expressions including ^\s*[\+-]?\s?\$?\s?(\d*\.?\d{2}?){1}$ but none of them seem to work. Does anyone have any suggestions or reasons why the above would not work. Thanks, Jim
TITLE: .Net Regular Expression Currency QUESTION: I am trying to find the currency in strings like "NTE $22,539,420.00" I tried to use several regular expressions including ^\s*[\+-]?\s?\$?\s?(\d*\.?\d{2}?){1}$ but none of them seem to work. Does anyone have any suggestions or reasons why the above would not work. Tha...
[ "c#", ".net", "regex", "vb.net" ]
2
3
6,017
5
0
2011-06-03T15:50:06.390000
2011-06-03T15:54:31.190000
6,229,469
6,229,520
How to use a While loop in PHP?
I am having trouble with the most simple piece of code. For some reason, the following code only retrieves the first row out of the database. I am trying a while loop and it just is not working for me. Here is my code: = 1) { //Loop through the entire table while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { $s...
You are overwriting the value of $result: $query = "SELECT * FROM past_due_students....."; $result = mysqli_query($dbc, $query); //Loop through the entire table while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { $query = "UPDATE past_due_students SET...."; $result = mysqli_query($dbc, $query); <-- OVERWRITTING...
How to use a While loop in PHP? I am having trouble with the most simple piece of code. For some reason, the following code only retrieves the first row out of the database. I am trying a while loop and it just is not working for me. Here is my code: = 1) { //Loop through the entire table while ($row = mysqli_fetch_ar...
TITLE: How to use a While loop in PHP? QUESTION: I am having trouble with the most simple piece of code. For some reason, the following code only retrieves the first row out of the database. I am trying a while loop and it just is not working for me. Here is my code: = 1) { //Loop through the entire table while ($row...
[ "php", "database", "while-loop" ]
1
4
764
4
0
2011-06-03T15:50:57.130000
2011-06-03T15:54:06.233000
6,229,470
6,229,729
Application Phantom Crash When One Function Call Added
My application has some debug code written specifically to send debug data to the Output Window when running in debug mode. When the function GetCurrTime is called in the below code snippet the application crashes on the following call to malloc when I step through the code, or on the line preceding the call to malloc,...
ptRetVal = (TCHAR *)::malloc( iTimeStrLen ) Will allocate a number of bytes when you probably want to allocate that number of wchar_t s.
Application Phantom Crash When One Function Call Added My application has some debug code written specifically to send debug data to the Output Window when running in debug mode. When the function GetCurrTime is called in the below code snippet the application crashes on the following call to malloc when I step through...
TITLE: Application Phantom Crash When One Function Call Added QUESTION: My application has some debug code written specifically to send debug data to the Output Window when running in debug mode. When the function GetCurrTime is called in the below code snippet the application crashes on the following call to malloc w...
[ "c++", "visual-studio", "visual-studio-2008", "crash", "first-chance-exception" ]
0
2
346
1
0
2011-06-03T15:50:58.507000
2011-06-03T16:08:52.043000
6,229,475
6,230,080
Only first content script is loading
I am trying to build my first chrome extension, I have a problem where only first content script is being loaded. This is what I have defined in manifest.json "content_scripts": [ { "matches": ["http://www.facebook.com/connect/login_success.html*"], "js": ["prototype.js", "intercept.js"] }] } When I see the scripts loa...
Actually, scratch all of this. I got it working now with no apparent changes on my end. When you inject a script, however, you shouldn't be able to see it in the DOM IIRC. Is it possible you just have a stray typo that's causing it to not render? You might want to test it on other pages. Unless it was Chrome pushing so...
Only first content script is loading I am trying to build my first chrome extension, I have a problem where only first content script is being loaded. This is what I have defined in manifest.json "content_scripts": [ { "matches": ["http://www.facebook.com/connect/login_success.html*"], "js": ["prototype.js", "intercept...
TITLE: Only first content script is loading QUESTION: I am trying to build my first chrome extension, I have a problem where only first content script is being loaded. This is what I have defined in manifest.json "content_scripts": [ { "matches": ["http://www.facebook.com/connect/login_success.html*"], "js": ["prototy...
[ "google-chrome-extension" ]
0
2
283
1
0
2011-06-03T15:51:19.963000
2011-06-03T16:41:37.030000
6,229,478
6,229,593
Get all namespaces from .dll
In a DLL (GUI) I need to get a List of all namespaces in the current Application (so for example if I would bind that DLL into a Project named "Hundekuchen", it should List { "GUI", "Hundekuchen" } Is there any inbuilt function for this?
Look into the System.Reflection namespace, this is where you will find the functionality to retrieve information about assemblies. This may not be exactly what you need but it shows the sort of things you can achieve, I am getting all the types in the currently executing assembly, iterates them and prints out the names...
Get all namespaces from .dll In a DLL (GUI) I need to get a List of all namespaces in the current Application (so for example if I would bind that DLL into a Project named "Hundekuchen", it should List { "GUI", "Hundekuchen" } Is there any inbuilt function for this?
TITLE: Get all namespaces from .dll QUESTION: In a DLL (GUI) I need to get a List of all namespaces in the current Application (so for example if I would bind that DLL into a Project named "Hundekuchen", it should List { "GUI", "Hundekuchen" } Is there any inbuilt function for this? ANSWER: Look into the System.Refle...
[ "c#", "assemblies" ]
3
1
7,833
3
0
2011-06-03T15:51:25.057000
2011-06-03T15:59:15.877000
6,229,483
6,229,529
Which is the most important factor while drawing UML diagrams
This is the interview question asked. Which is the most important factor while drawing UML diagrams.
Understanding the requirements possibly. or Using a common set of rules/objects so that others understand what you're designing. It's designed to get you speaking about UML, so they can gauge if you've used it before. They're not looking for one particular answer.
Which is the most important factor while drawing UML diagrams This is the interview question asked. Which is the most important factor while drawing UML diagrams.
TITLE: Which is the most important factor while drawing UML diagrams QUESTION: This is the interview question asked. Which is the most important factor while drawing UML diagrams. ANSWER: Understanding the requirements possibly. or Using a common set of rules/objects so that others understand what you're designing. I...
[ "uml" ]
2
5
235
1
0
2011-06-03T15:51:36.477000
2011-06-03T15:54:56.663000
6,229,488
6,230,445
Corners of a custom table view grouped
I am creating a custom tableView with style grouped. My custom cell doesn't adjust with the rounded corners, only when the table is selected. Any idea why this happens? Thanks
Given the limited provided information about how you draw the cells, here is a blog post that shows a good way of how to do it, along with a gradient background. Basically, you need to draw the corners yourself because iOS wont clip it for you if you override the drawing behavior. Full Disclosure: It is my code blog.
Corners of a custom table view grouped I am creating a custom tableView with style grouped. My custom cell doesn't adjust with the rounded corners, only when the table is selected. Any idea why this happens? Thanks
TITLE: Corners of a custom table view grouped QUESTION: I am creating a custom tableView with style grouped. My custom cell doesn't adjust with the rounded corners, only when the table is selected. Any idea why this happens? Thanks ANSWER: Given the limited provided information about how you draw the cells, here is a...
[ "iphone", "ios", "ipad", "uitableview" ]
1
0
1,234
1
0
2011-06-03T15:52:07.413000
2011-06-03T17:18:58.160000
6,229,497
6,229,602
Synchronising multiple timers to step up/down speed
I have several instances in my application. Each of these instances have a Timer object which will trigger the object's own method after an amount of time. As this would be a simple simulation app, I intend to allow it to have a pause/continue simulation feature as well as an "step up/down speed" feature to the timers....
You could always use an event-driven approach. Have each object register as a listener of the main controller and when an option is changed, just trigger an event and let all of the instances update themselves.
Synchronising multiple timers to step up/down speed I have several instances in my application. Each of these instances have a Timer object which will trigger the object's own method after an amount of time. As this would be a simple simulation app, I intend to allow it to have a pause/continue simulation feature as we...
TITLE: Synchronising multiple timers to step up/down speed QUESTION: I have several instances in my application. Each of these instances have a Timer object which will trigger the object's own method after an amount of time. As this would be a simple simulation app, I intend to allow it to have a pause/continue simula...
[ "java", "multithreading", "concurrency", "timer", "simulation" ]
0
3
365
5
0
2011-06-03T15:52:49.613000
2011-06-03T15:59:40.347000
6,229,501
6,229,784
overriding a function defined in jquery closure
I have a function defined in jquery closure and called by another function in the same closure. Could I override the function being called without changing the closure itself. See the code for example (function($){ function Myfunction(value) { //do something with the value } $('a').live('click',function(){ MyFunction($...
You can't. Functions defined inside closures are private - and they: [cannot] be accessed directly from outside the anonymous function
overriding a function defined in jquery closure I have a function defined in jquery closure and called by another function in the same closure. Could I override the function being called without changing the closure itself. See the code for example (function($){ function Myfunction(value) { //do something with the valu...
TITLE: overriding a function defined in jquery closure QUESTION: I have a function defined in jquery closure and called by another function in the same closure. Could I override the function being called without changing the closure itself. See the code for example (function($){ function Myfunction(value) { //do somet...
[ "javascript", "jquery", "closures" ]
3
2
1,102
2
0
2011-06-03T15:53:00.670000
2011-06-03T16:14:07.473000
6,229,503
6,234,507
What are the Pros and Cons of using URI vs Accept Headers for REST content format negotiation?
Based on info in the following question REST Content-Type: Should it be based on extension or Accept header?, I'm aware either custom URIs or specifying Accept Headers are 'acceptable' (pun intended) methods for for a REST-ish web service to determine response format for the client. However, a lot of big names seem to ...
In REST, URIs are intended to identify only a resource. Content negotiation is used to identify representation format. It's your traditional separation of concerns. When using the URI to identify the representation format you are mixing those concerns. In addition to mixing concerns, my observation is that when using t...
What are the Pros and Cons of using URI vs Accept Headers for REST content format negotiation? Based on info in the following question REST Content-Type: Should it be based on extension or Accept header?, I'm aware either custom URIs or specifying Accept Headers are 'acceptable' (pun intended) methods for for a REST-is...
TITLE: What are the Pros and Cons of using URI vs Accept Headers for REST content format negotiation? QUESTION: Based on info in the following question REST Content-Type: Should it be based on extension or Accept header?, I'm aware either custom URIs or specifying Accept Headers are 'acceptable' (pun intended) methods...
[ "rest", "content-negotiation" ]
4
3
939
1
0
2011-06-03T15:53:04.407000
2011-06-04T03:30:46.730000
6,229,504
6,229,537
Inconsistent Accessibility: Parameter type is less accessible than method
I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form: private ACTInterface oActInterface; public void button1_Click(object sender, EventArgs e) { oActInterface = new ACTInterface(@"\\actserver\Databa...
Constructor of public class clients is public but it has a parameter of type ACTInterface that is private (it is nested in a class?). You can't do that. You need to make ACTInterface at least as accessible as clients.
Inconsistent Accessibility: Parameter type is less accessible than method I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form: private ACTInterface oActInterface; public void button1_Click(object se...
TITLE: Inconsistent Accessibility: Parameter type is less accessible than method QUESTION: I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form: private ACTInterface oActInterface; public void butto...
[ "c#", "object" ]
293
444
576,542
13
0
2011-06-03T15:53:07.637000
2011-06-03T15:55:29.937000
6,229,508
6,229,558
SQL - How to escape parentheses in PostgreSQL
I have the following sql command, i need to escape parentheses in PostgreSQL, how can i do that? SELECT rua FROM logradouros WHERE rua ~* 'Antonio De Sant\'Ana Galvao Av Frei (Av 01 Parte A)' LIMIT 100;
Use backslash to escape parentheses. Note that if standard_conforming_strings parameter is set to off (which is default behaviour up to PostgreSQL 9.1) you need use two backslashes \\. Generally there are three approaches how to escape parentheses: ordinary 'pattern' syntax, which is dependent on standard_conforming_st...
SQL - How to escape parentheses in PostgreSQL I have the following sql command, i need to escape parentheses in PostgreSQL, how can i do that? SELECT rua FROM logradouros WHERE rua ~* 'Antonio De Sant\'Ana Galvao Av Frei (Av 01 Parte A)' LIMIT 100;
TITLE: SQL - How to escape parentheses in PostgreSQL QUESTION: I have the following sql command, i need to escape parentheses in PostgreSQL, how can i do that? SELECT rua FROM logradouros WHERE rua ~* 'Antonio De Sant\'Ana Galvao Av Frei (Av 01 Parte A)' LIMIT 100; ANSWER: Use backslash to escape parentheses. Note th...
[ "sql", "postgresql" ]
6
4
16,778
6
0
2011-06-03T15:53:23.443000
2011-06-03T15:57:21.980000
6,229,513
6,230,252
What is the retry interval for Apache once it has hit it's max connections?
If Apache reaches it's max number of connections, or it's max clients, how long will it wait, before trying again to connect any of the connections that couldn't connect? Or will it just drop the connection the first time and never try again? If it does wait, is there a setting for that?
Apache will simply queue connections into its ListenBackLog. Then once a current connection is done, Apache will attempt to serve the oldest queued connection. http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listenbacklog I think the TimeOut Directive does effect what happens with a connection in the ListenBackLog...
What is the retry interval for Apache once it has hit it's max connections? If Apache reaches it's max number of connections, or it's max clients, how long will it wait, before trying again to connect any of the connections that couldn't connect? Or will it just drop the connection the first time and never try again? I...
TITLE: What is the retry interval for Apache once it has hit it's max connections? QUESTION: If Apache reaches it's max number of connections, or it's max clients, how long will it wait, before trying again to connect any of the connections that couldn't connect? Or will it just drop the connection the first time and ...
[ "apache", "max", "connection" ]
0
2
1,248
1
0
2011-06-03T15:53:44.970000
2011-06-03T17:01:17.143000
6,229,514
6,229,783
Access control within datatemplate
This is XAML: This is codebehind: private void RadioButton_Click(object sender, RoutedEventArgs e) { StackPanel sp = ((RadioButton)sender).Parent as StackPanel; DockPanel dp = sp.Parent as DockPanel; TextBox txtbox = dp.FindName("txtBox") as TextBox; MessageBox.Show(txtbox.Text); } Is there a more simple way to access...
Your code is not that complex! However, you could simplify it by using Linq-to-VisualTree: private void RadioButton_Click(object sender, RoutedEventArgs e) { RadioButton rb = sender as RadioButton; TextBox txtbox= rb.Ancestors ().First().Elements ().First() as TextBox; MessageBox.Show(txtbox.Text); } The Linq query abo...
Access control within datatemplate This is XAML: This is codebehind: private void RadioButton_Click(object sender, RoutedEventArgs e) { StackPanel sp = ((RadioButton)sender).Parent as StackPanel; DockPanel dp = sp.Parent as DockPanel; TextBox txtbox = dp.FindName("txtBox") as TextBox; MessageBox.Show(txtbox.Text); } I...
TITLE: Access control within datatemplate QUESTION: This is XAML: This is codebehind: private void RadioButton_Click(object sender, RoutedEventArgs e) { StackPanel sp = ((RadioButton)sender).Parent as StackPanel; DockPanel dp = sp.Parent as DockPanel; TextBox txtbox = dp.FindName("txtBox") as TextBox; MessageBox.Show...
[ "wpf", "xaml", "datatemplate" ]
3
2
3,351
2
0
2011-06-03T15:53:47.060000
2011-06-03T16:13:59.140000
6,229,515
6,233,988
Rails Model Versioning with Approval
I have a model that members will be able to update but their changes wont take effect until an admin approves their changes. Has anyone solved this same problem and what gems would you recommend for versioning? PaperTrail? Vestal versions?
Perhaps you could use vestal_versions with a slight twist. Add an after_update action in your controller which rolls back to the previous version if the user who made the change is not an admin. Then you can set the instance's status to pending, which would alert an admin for review. The admin would then just review th...
Rails Model Versioning with Approval I have a model that members will be able to update but their changes wont take effect until an admin approves their changes. Has anyone solved this same problem and what gems would you recommend for versioning? PaperTrail? Vestal versions?
TITLE: Rails Model Versioning with Approval QUESTION: I have a model that members will be able to update but their changes wont take effect until an admin approves their changes. Has anyone solved this same problem and what gems would you recommend for versioning? PaperTrail? Vestal versions? ANSWER: Perhaps you coul...
[ "ruby-on-rails", "ruby-on-rails-3" ]
7
7
1,978
2
0
2011-06-03T15:53:52.850000
2011-06-04T01:01:34.427000
6,229,519
6,229,665
numpy: column-wise dot product
Given a 2D numpy array, I need to compute the dot product of every column with itself, and store the result in a 1D array. The following works: In [45]: A = np.array([[1,2,3,4],[5,6,7,8]]) In [46]: np.array([np.dot(A[:,i], A[:,i]) for i in xrange(A.shape[1])]) Out[46]: array([26, 40, 58, 80]) Is there a simple way to ...
How about: >>> A = np.array([[1,2,3,4],[5,6,7,8]]) >>> (A*A).sum(axis=0) array([26, 40, 58, 80]) EDIT: Hmm, okay, you don't want intermediate large objects. Maybe: >>> from numpy.core.umath_tests import inner1d >>> A = np.array([[1,2,3,4],[5,6,7,8]]) >>> inner1d(A.T, A.T) array([26, 40, 58, 80]) which seems a little fa...
numpy: column-wise dot product Given a 2D numpy array, I need to compute the dot product of every column with itself, and store the result in a 1D array. The following works: In [45]: A = np.array([[1,2,3,4],[5,6,7,8]]) In [46]: np.array([np.dot(A[:,i], A[:,i]) for i in xrange(A.shape[1])]) Out[46]: array([26, 40, 58,...
TITLE: numpy: column-wise dot product QUESTION: Given a 2D numpy array, I need to compute the dot product of every column with itself, and store the result in a 1D array. The following works: In [45]: A = np.array([[1,2,3,4],[5,6,7,8]]) In [46]: np.array([np.dot(A[:,i], A[:,i]) for i in xrange(A.shape[1])]) Out[46]: ...
[ "python", "numpy", "dot-product" ]
16
22
16,669
3
0
2011-06-03T15:54:03.207000
2011-06-03T16:04:58.940000
6,229,532
6,229,791
Creating Views in PHP - Best Practice
I am working on a website with 2 other developers. I am only responsible to creating the views. The data is available in an object, and I have getters to read the data then create XHTML pages. What is the best practice to do this, without using any template engine? Thanks a lot.
If you don't want to use a templating engine, you can make use of PHP's basic templating capabilities. Actually, you should just write the HTML, and whenever you need to output a variable's value, open a PHP part with and close it with?>. I will assume for the examples that $data is your data object. For example: getWh...
Creating Views in PHP - Best Practice I am working on a website with 2 other developers. I am only responsible to creating the views. The data is available in an object, and I have getters to read the data then create XHTML pages. What is the best practice to do this, without using any template engine? Thanks a lot.
TITLE: Creating Views in PHP - Best Practice QUESTION: I am working on a website with 2 other developers. I am only responsible to creating the views. The data is available in an object, and I have getters to read the data then create XHTML pages. What is the best practice to do this, without using any template engine...
[ "php", "templates", "xhtml", "separation-of-concerns" ]
8
11
1,169
3
0
2011-06-03T15:55:08.767000
2011-06-03T16:15:08.190000
6,229,544
6,230,231
UISearchDisplayController across multiple views
Is is possible to use the same UISearchDisplayController/UISearchbar/UISearchDisplayController ResultsTable logic across multiple views? I have an application which utilizes a site wide search, using a UISearchBar above nearly every view, therefore i have a lot of duplication throughout the application as each view has...
You could factor out the common code into it's own class, and then if there is any specific behavior needed by any one implementation, you can override specific methods (such as cellForRowAtIndexpath or didSelectCellForIndexPath).
UISearchDisplayController across multiple views Is is possible to use the same UISearchDisplayController/UISearchbar/UISearchDisplayController ResultsTable logic across multiple views? I have an application which utilizes a site wide search, using a UISearchBar above nearly every view, therefore i have a lot of duplica...
TITLE: UISearchDisplayController across multiple views QUESTION: Is is possible to use the same UISearchDisplayController/UISearchbar/UISearchDisplayController ResultsTable logic across multiple views? I have an application which utilizes a site wide search, using a UISearchBar above nearly every view, therefore i hav...
[ "iphone", "objective-c", "cocoa-touch", "uisearchdisplaycontroller" ]
0
0
200
1
0
2011-06-03T15:56:01.720000
2011-06-03T16:59:30.830000
6,229,554
6,229,587
Settings For Individual Programmers In A Config File
I'm wondering if there is a way to create settings in a config file for individual programmers. The situation I'm encountering is that there are some programmers who want settings turned on and several that want them turned off. Our config files are in SVN source control, so using a shared config file means we are alwa...
Remove the config file from source control and set the svn:ignore property on it. Then it won't be committed. Then, also create another file, like, Production.web.config, that has the production values in it, so you still keep those around too. That's what I do!
Settings For Individual Programmers In A Config File I'm wondering if there is a way to create settings in a config file for individual programmers. The situation I'm encountering is that there are some programmers who want settings turned on and several that want them turned off. Our config files are in SVN source con...
TITLE: Settings For Individual Programmers In A Config File QUESTION: I'm wondering if there is a way to create settings in a config file for individual programmers. The situation I'm encountering is that there are some programmers who want settings turned on and several that want them turned off. Our config files are...
[ "c#", "asp.net", "visual-studio" ]
0
0
193
5
0
2011-06-03T15:56:49.947000
2011-06-03T15:58:44.580000
6,229,560
6,233,389
Unable to "run" on Heroku
I have deployed a Clojure app to Heroku. When I run/request it I get an error: http://glowing-planet-168.herokuapp.com/. So now I want to start up a REPL to see if I can get some more info. But when I try it I get: D:\Mijn documenten\My Dropbox\dev\clojure-projects\hebrewajax>heroku run lein repl C:/RailsInstaller/Rub...
I don't have experience with heroku or Windows, but it looks like you're missing the shell command 'tput', which is (in this case) used to get the width of your terminal window. If I understand correctly, you need to have Cygwin installed, which might have been installed with RailsInstaller. You might also need to inst...
Unable to "run" on Heroku I have deployed a Clojure app to Heroku. When I run/request it I get an error: http://glowing-planet-168.herokuapp.com/. So now I want to start up a REPL to see if I can get some more info. But when I try it I get: D:\Mijn documenten\My Dropbox\dev\clojure-projects\hebrewajax>heroku run lein r...
TITLE: Unable to "run" on Heroku QUESTION: I have deployed a Clojure app to Heroku. When I run/request it I get an error: http://glowing-planet-168.herokuapp.com/. So now I want to start up a REPL to see if I can get some more info. But when I try it I get: D:\Mijn documenten\My Dropbox\dev\clojure-projects\hebrewajax...
[ "clojure", "heroku" ]
3
1
590
1
0
2011-06-03T15:57:24.860000
2011-06-03T22:48:51.043000
6,229,565
6,229,874
IIS7.5 ASP.NET MVC users hitting strange URLs: /(F(1xe9eXIxPz
We are getting reports from a small number of users that they are ending up on very strange paths in our web app, of the form: https://www.example.com/(F(1xe9eXIxPzMALrZu6xd_6LBxDDlJI3lH2lkSvREZZKCfPBH20SF5EcNql6uXvyBVLgiNZshp9vXxaEzuLa5zm8c4ruux6gqu3B90eXGNmKDypu-wKR4OW_GwQctfjCdoxFYcDlLwglfE6rICL3JGkxtq4jgxggiQgJopKZ...
Take a look at Understand How the ASP.NET Cookieless Feature Works: In V2.0, Anonymous Identification and Forms Authentication also use this feature. The URL may now look like this: http://MySite.com/MyWebApplication/(A(XXXX)S(XXXX)F(XXXX))/home.aspx and further down: F(XXXX): This is the Forms Authentication ticket. P...
IIS7.5 ASP.NET MVC users hitting strange URLs: /(F(1xe9eXIxPz We are getting reports from a small number of users that they are ending up on very strange paths in our web app, of the form: https://www.example.com/(F(1xe9eXIxPzMALrZu6xd_6LBxDDlJI3lH2lkSvREZZKCfPBH20SF5EcNql6uXvyBVLgiNZshp9vXxaEzuLa5zm8c4ruux6gqu3B90eXGN...
TITLE: IIS7.5 ASP.NET MVC users hitting strange URLs: /(F(1xe9eXIxPz QUESTION: We are getting reports from a small number of users that they are ending up on very strange paths in our web app, of the form: https://www.example.com/(F(1xe9eXIxPzMALrZu6xd_6LBxDDlJI3lH2lkSvREZZKCfPBH20SF5EcNql6uXvyBVLgiNZshp9vXxaEzuLa5zm8...
[ "security", "asp.net-mvc-2", "iis" ]
5
2
1,671
2
0
2011-06-03T15:57:43.383000
2011-06-03T16:23:59.020000
6,229,566
6,229,678
What is easier for OS to set up, a new process or a new thread?
Question as stated above.. from the stand point of Operating System, which one is easier to create, a thread or a process?
A new thread should be faster to create than a new process. A process is a heavy weight system structure. It has it's own virtual memory space, owns all handles (mutexes, semaphores, open files), and has protection from other processes. Cross-process communication has to go through the OS. A thread is a "child" to a pr...
What is easier for OS to set up, a new process or a new thread? Question as stated above.. from the stand point of Operating System, which one is easier to create, a thread or a process?
TITLE: What is easier for OS to set up, a new process or a new thread? QUESTION: Question as stated above.. from the stand point of Operating System, which one is easier to create, a thread or a process? ANSWER: A new thread should be faster to create than a new process. A process is a heavy weight system structure. ...
[ "process", "operating-system", "pthreads" ]
2
3
416
5
0
2011-06-03T15:57:44.577000
2011-06-03T16:05:31.380000
6,229,571
6,229,645
Safely using hook events in JavaScript
In source code here http://www.daftlogic.com/sandbox-javascript-slider-control.htm There is these instructions: // safely hook document/window events if (document.onmousemove!= f_sliderMouseMove) { window.f_savedMouseMove = document.onmousemove; document.onmousemove = f_sliderMouseMove; } I don't understand what it doe...
It might be that some other code already assigned an event handler to document.onmousemove. The problem with this method, as opposed to addEventListener, is that only one function can be assigned to element.onXXXX. Thus, if you blindly assign a new event handler, an already existing one might be overwritten and other c...
Safely using hook events in JavaScript In source code here http://www.daftlogic.com/sandbox-javascript-slider-control.htm There is these instructions: // safely hook document/window events if (document.onmousemove!= f_sliderMouseMove) { window.f_savedMouseMove = document.onmousemove; document.onmousemove = f_sliderMous...
TITLE: Safely using hook events in JavaScript QUESTION: In source code here http://www.daftlogic.com/sandbox-javascript-slider-control.htm There is these instructions: // safely hook document/window events if (document.onmousemove!= f_sliderMouseMove) { window.f_savedMouseMove = document.onmousemove; document.onmousem...
[ "javascript", "dom-events" ]
2
3
3,280
3
0
2011-06-03T15:57:56.313000
2011-06-03T16:03:14.517000
6,229,583
6,229,684
URL change ajax call in Facebook
In facebook, whenever you navigate to a different URL (in some situations), the URL changes but there is no feeling sensed as going to a different page. For example: when we view pictures in facebook, and when we move to the next image the URL changes in the address bar FROM >facebook.com/foo?bar=foobar&xxxx= TO > >>fa...
wow. I just asked it few minutes ago... use search next time;) Dynamic favicon when I'm proccessing ajax data Modify the URL without reloading the page
URL change ajax call in Facebook In facebook, whenever you navigate to a different URL (in some situations), the URL changes but there is no feeling sensed as going to a different page. For example: when we view pictures in facebook, and when we move to the next image the URL changes in the address bar FROM >facebook.c...
TITLE: URL change ajax call in Facebook QUESTION: In facebook, whenever you navigate to a different URL (in some situations), the URL changes but there is no feeling sensed as going to a different page. For example: when we view pictures in facebook, and when we move to the next image the URL changes in the address ba...
[ "javascript", "ajax", "facebook", "iframe" ]
0
0
1,646
4
0
2011-06-03T15:58:27.730000
2011-06-03T16:05:56.187000
6,229,585
6,229,845
Javascript text input editing: How to turn multiple string text shader in one text input into another representation?
So I want to have 2 input feilds, one editable. I need some script that would turn such shader text input: #ifdef GL_ES precision highp float; #endif varying vec4 v_color; void main (void) { gl_FragColor = v_color; } into such output: "#ifdef GL_ES\n" "precision highp float;\n" "#endif\n" "\n" "varying vec4 v_color;\...
try regular expressions. html: #ifdef GL_ES precision highp float; #endif varying vec4 v_color; void main (void) { gl_FragColor = v_color; } javascript: var text = document.getElementById("text1").value; text = text.replace(/\n/g, "\\n\"\n\""); document.getElementById("text2").value = "\""+text+"\\n\""; http://jsfidd...
Javascript text input editing: How to turn multiple string text shader in one text input into another representation? So I want to have 2 input feilds, one editable. I need some script that would turn such shader text input: #ifdef GL_ES precision highp float; #endif varying vec4 v_color; void main (void) { gl_FragCo...
TITLE: Javascript text input editing: How to turn multiple string text shader in one text input into another representation? QUESTION: So I want to have 2 input feilds, one editable. I need some script that would turn such shader text input: #ifdef GL_ES precision highp float; #endif varying vec4 v_color; void main ...
[ "javascript", "jquery", "string", "text", "shader" ]
0
1
617
1
0
2011-06-03T15:58:39.437000
2011-06-03T16:21:18.707000
6,229,594
6,265,629
"Workspace" child views not filling height on Google "iosched" app
I'm playing around with the iosched app from Google I/O 2011. Looking at the ScheduleFragment, I'm testing a different view on the Workspace children for flinging the pages back and forth. However, I'm having trouble getting my child views to fill the parent. I added several background colors and some padding to show w...
I figured out a solution. I started debugging the onLayout in Workspace.java. In the child.layout function call, I changed child.getMeasuredHeight() to this.getMeasuredHeight() to use the height of the workspace instead. Seems to work fine for the case of a page that is shorter than the workspace height as well as a ch...
"Workspace" child views not filling height on Google "iosched" app I'm playing around with the iosched app from Google I/O 2011. Looking at the ScheduleFragment, I'm testing a different view on the Workspace children for flinging the pages back and forth. However, I'm having trouble getting my child views to fill the p...
TITLE: "Workspace" child views not filling height on Google "iosched" app QUESTION: I'm playing around with the iosched app from Google I/O 2011. Looking at the ScheduleFragment, I'm testing a different view on the Workspace children for flinging the pages back and forth. However, I'm having trouble getting my child v...
[ "android", "workspace", "fill-parent" ]
3
0
680
2
0
2011-06-03T15:59:23.003000
2011-06-07T13:07:17.403000
6,229,597
6,229,982
SSIS: Get any flat file source from folder and cache the name as a super global variable
I'm working in SSIS and Visual Studio 2008. When executed, I need to have the SSIS package perform the following tasks: Check a folder for a file If a file exists take the file and use it as the source for the flat file Store the name of the file into a global variable that I can access in other parts of my package The...
The easiest way would be to set up a Foreach Loop container that has all the "work" of your package inside of it (optionally, you can it as a precursor step and use a conditional expression off of it). Assuming you have 2 variables called FileName (which is what you will have the value assigned to) and an InputFolder v...
SSIS: Get any flat file source from folder and cache the name as a super global variable I'm working in SSIS and Visual Studio 2008. When executed, I need to have the SSIS package perform the following tasks: Check a folder for a file If a file exists take the file and use it as the source for the flat file Store the n...
TITLE: SSIS: Get any flat file source from folder and cache the name as a super global variable QUESTION: I'm working in SSIS and Visual Studio 2008. When executed, I need to have the SSIS package perform the following tasks: Check a folder for a file If a file exists take the file and use it as the source for the fla...
[ "ssis" ]
3
7
36,656
2
0
2011-06-03T15:59:32.837000
2011-06-03T16:33:29.700000
6,229,610
6,229,675
How to manage string memory with python ctypes
My python code is calling a C function in a native library (also written by me). The function takes two strings as arguments and returns its response as a string. The two argument strings that python passes to C library are only read by the C library, so I am not worried about their memory management. AFAIK, their memo...
I'd recommend strongly against memory allocation in a foreign function called via ctypes and freeing this memory from Python. Whenever possible, allocate the memory in Python. In your case, if you know in advance an upper limit for the length of the returned string, use buf = ctypes.create_string_buffer(upper_limt) to ...
How to manage string memory with python ctypes My python code is calling a C function in a native library (also written by me). The function takes two strings as arguments and returns its response as a string. The two argument strings that python passes to C library are only read by the C library, so I am not worried a...
TITLE: How to manage string memory with python ctypes QUESTION: My python code is calling a C function in a native library (also written by me). The function takes two strings as arguments and returns its response as a string. The two argument strings that python passes to C library are only read by the C library, so ...
[ "python", "memory-management", "ctypes" ]
1
4
2,711
2
0
2011-06-03T16:00:25.853000
2011-06-03T16:05:27.223000
6,229,614
6,231,793
How can I boot Rails 3 in a daemonized ruby script?
I am pulling email via pop into my Rails 3 application so i have a file called dropbox_receiver.rb in the rails lib directory. This pulls in all email and calls DropBox.receive(email) I can run this using rails/runner but when i run it from the daemon_controller.rb file i get the error initialized constant Object::Drop...
Put this at the top of your script: ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development' require File.expand_path(File.dirname(__FILE__) + "/../../config/environment" That's for a script in app/controllers. You'll need to adjust the path to config/environment if your daemon is elsewhere.
How can I boot Rails 3 in a daemonized ruby script? I am pulling email via pop into my Rails 3 application so i have a file called dropbox_receiver.rb in the rails lib directory. This pulls in all email and calls DropBox.receive(email) I can run this using rails/runner but when i run it from the daemon_controller.rb fi...
TITLE: How can I boot Rails 3 in a daemonized ruby script? QUESTION: I am pulling email via pop into my Rails 3 application so i have a file called dropbox_receiver.rb in the rails lib directory. This pulls in all email and calls DropBox.receive(email) I can run this using rails/runner but when i run it from the daemo...
[ "ruby-on-rails", "ruby", "ruby-on-rails-3", "daemon" ]
2
1
309
2
0
2011-06-03T16:00:32.157000
2011-06-03T19:33:23.483000
6,229,616
6,229,761
an AS3 class cannot pass a MovieClip as a parameter to its super class...?
Is there a reason why it can't work?? Here is a code sample: main.as package{ import flash.display.MovieClip; public class main extends MovieClip{ public function main(){ addChild(new Square()); } } } Square.as (Which is a linked MovieClip that have a MovieClip called "submc" on its timeline) package{ import flash.disp...
Old Answer You have to initialize submc. The body of the Square class should look like this: public var submc:MovieClip; public function Square() { submc = new MovieClip(); super(submc, 1234); trace("submc: " + submc); } The variable submc is null until you either initialize it or make it reference some other instantia...
an AS3 class cannot pass a MovieClip as a parameter to its super class...? Is there a reason why it can't work?? Here is a code sample: main.as package{ import flash.display.MovieClip; public class main extends MovieClip{ public function main(){ addChild(new Square()); } } } Square.as (Which is a linked MovieClip that ...
TITLE: an AS3 class cannot pass a MovieClip as a parameter to its super class...? QUESTION: Is there a reason why it can't work?? Here is a code sample: main.as package{ import flash.display.MovieClip; public class main extends MovieClip{ public function main(){ addChild(new Square()); } } } Square.as (Which is a link...
[ "actionscript-3", "parameters", "constructor", "parameter-passing", "movieclip" ]
0
0
1,380
1
0
2011-06-03T16:00:34.297000
2011-06-03T16:12:13.260000
6,229,619
6,229,798
How do you generate a preview of html code in other window fetched from a table
I have a page which generates a html code in a text box. When code generation happens parallel I am inserting the same code in a table. All this is in between asp controllers. Under that text box I have button called preview. All I need is when I click on the button it should fetch the code and preview it like html fil...
You can easily do this with JavaScript. Open a new window and write the contents of your text box on the new window. on you preview button tag add onclick=preview()
How do you generate a preview of html code in other window fetched from a table I have a page which generates a html code in a text box. When code generation happens parallel I am inserting the same code in a table. All this is in between asp controllers. Under that text box I have button called preview. All I need is ...
TITLE: How do you generate a preview of html code in other window fetched from a table QUESTION: I have a page which generates a html code in a text box. When code generation happens parallel I am inserting the same code in a table. All this is in between asp controllers. Under that text box I have button called previ...
[ "c#", "asp.net" ]
1
1
850
1
0
2011-06-03T16:00:53.340000
2011-06-03T16:15:58.090000
6,229,621
6,229,788
problem with table into section of accordion jquery ui
i'm trying to create a table into a accordion but although i set into the table the width, i could make it fit into the section of accordion resulting of this this is the accordion closed this is the accordion open: note's that when it's open the table inside the section doesn't fit into the width and for consecuense a...
There is a tag inside your code: This has 300px margins on either side, which makes it take up 600px inside the table cell. That overrides your 400px. I would place that image like this:
problem with table into section of accordion jquery ui i'm trying to create a table into a accordion but although i set into the table the width, i could make it fit into the section of accordion resulting of this this is the accordion closed this is the accordion open: note's that when it's open the table inside the s...
TITLE: problem with table into section of accordion jquery ui QUESTION: i'm trying to create a table into a accordion but although i set into the table the width, i could make it fit into the section of accordion resulting of this this is the accordion closed this is the accordion open: note's that when it's open the ...
[ "jquery", "jquery-ui" ]
0
2
1,261
1
0
2011-06-03T16:01:10.390000
2011-06-03T16:14:47.363000
6,229,628
6,229,700
Should I use XHTML/CSS2 or HTML5/CSS3 on my blog project?
I'm going to develop a theme for a WordPress blog but I'm not sure if I should do it using XHTML/CSS2 or if I already can do it using HTML5/CSS3. Usually, I use 960.gs framework but it isn't available with HTML5/CSS3. I've heard that the 52framework works fine as well and I'm thinking about adopt it for my project, but...
HTML5 and CSS3 are "ready to use" - you need to learn a little about the concept of "Polyfilling", but you can make the user experience very similar in all browsers, even if you lose a few transition effects and rounded corners along the way. My website has been HTML5 since 2009 and I tested it across many, many browse...
Should I use XHTML/CSS2 or HTML5/CSS3 on my blog project? I'm going to develop a theme for a WordPress blog but I'm not sure if I should do it using XHTML/CSS2 or if I already can do it using HTML5/CSS3. Usually, I use 960.gs framework but it isn't available with HTML5/CSS3. I've heard that the 52framework works fine a...
TITLE: Should I use XHTML/CSS2 or HTML5/CSS3 on my blog project? QUESTION: I'm going to develop a theme for a WordPress blog but I'm not sure if I should do it using XHTML/CSS2 or if I already can do it using HTML5/CSS3. Usually, I use 960.gs framework but it isn't available with HTML5/CSS3. I've heard that the 52fram...
[ "html", "frameworks", "css" ]
0
2
1,144
6
0
2011-06-03T16:01:23.837000
2011-06-03T16:07:02.210000
6,229,633
6,229,829
Writing a GUI to display statistics
I'm working with a hardware simulator for a project. It outputs statistics at the end in a very structured but ugly way. It can be tiresome to read so I would like to write a GUI to help me display it better. Would anybody have an idea of what framework and widgets I could use to quickly and painlessly construct someth...
When I'm just trying to display some information, and I don't really need interaction, I sometimes make the program output a simple html page. It's fast and trivial to do things like tables and images (in virtually any format). If you need graphs, there are web-APIs like Google's chart API.
Writing a GUI to display statistics I'm working with a hardware simulator for a project. It outputs statistics at the end in a very structured but ugly way. It can be tiresome to read so I would like to write a GUI to help me display it better. Would anybody have an idea of what framework and widgets I could use to qui...
TITLE: Writing a GUI to display statistics QUESTION: I'm working with a hardware simulator for a project. It outputs statistics at the end in a very structured but ugly way. It can be tiresome to read so I would like to write a GUI to help me display it better. Would anybody have an idea of what framework and widgets ...
[ "c++", "user-interface", "statistics", "numbers", "visualization" ]
4
5
399
2
0
2011-06-03T16:01:40.583000
2011-06-03T16:19:46.577000
6,229,636
6,231,039
How is backgroundColor handled for UIView in Objective_C?
I have been playing with some of Apple's example code for customizing UITableViewCells. I have run into some weird behavior that has left me completely confused about how backgroundColor works. The following code is a much reduced version of Apple's example custom UIView within custom UITableViewCell. The init function...
Your -drawRect: implementation doesn't actually do any drawing, so it's not going to change anything itself. Presumably, the drawing is being done by a layer associated with your view. It looks like, in your environment, the background-colored layer is doing its drawing before your -drawRect: method is called. When the...
How is backgroundColor handled for UIView in Objective_C? I have been playing with some of Apple's example code for customizing UITableViewCells. I have run into some weird behavior that has left me completely confused about how backgroundColor works. The following code is a much reduced version of Apple's example cust...
TITLE: How is backgroundColor handled for UIView in Objective_C? QUESTION: I have been playing with some of Apple's example code for customizing UITableViewCells. I have run into some weird behavior that has left me completely confused about how backgroundColor works. The following code is a much reduced version of Ap...
[ "objective-c", "uiview", "uitableview", "background-color" ]
3
0
1,481
2
0
2011-06-03T16:02:06.230000
2011-06-03T18:16:42.257000
6,229,639
6,230,383
registerReceiver issue with in-app billing messages?
I'm implementing in-app billing support in my application. I just realized that even though the application has been stopped, the standard billing broadcast receiver is still receiving billing messages from the market service. So, instead of declaring my receiver inside the manifest file: I decided to go with the Conte...
Why do you not want to receive billing messages when the application has been stopped? It means that you could miss important messages from the market about purchases and refunds. You'll notice that in the dungeons example they have a database that they log all purchase information to. Then their UI uses the database t...
registerReceiver issue with in-app billing messages? I'm implementing in-app billing support in my application. I just realized that even though the application has been stopped, the standard billing broadcast receiver is still receiving billing messages from the market service. So, instead of declaring my receiver ins...
TITLE: registerReceiver issue with in-app billing messages? QUESTION: I'm implementing in-app billing support in my application. I just realized that even though the application has been stopped, the standard billing broadcast receiver is still receiving billing messages from the market service. So, instead of declari...
[ "android" ]
1
2
824
1
0
2011-06-03T16:02:15.433000
2011-06-03T17:13:48.317000
6,229,643
6,230,096
Django + nginx + gunicorn gives 502 error. very little log information
I have my server configured like this (this is on a fresh install of ubuntu 10.10) nginx + gunicorn + django + supervisord to run it when I try to access my site, I get a 502 error. and this will show up in the error log: 2011/06/03 10:40:59 [error] 15066#0: *1 connect() failed (111: Connection refused) while connectin...
You can do debugging if you run supervisord in this way:: supervisord --nodaemon --loglevel DEBUG All errors will be dumped to the console. Also you can try to run debug server on this machine. Maybe your site does not work at all.
Django + nginx + gunicorn gives 502 error. very little log information I have my server configured like this (this is on a fresh install of ubuntu 10.10) nginx + gunicorn + django + supervisord to run it when I try to access my site, I get a 502 error. and this will show up in the error log: 2011/06/03 10:40:59 [error]...
TITLE: Django + nginx + gunicorn gives 502 error. very little log information QUESTION: I have my server configured like this (this is on a fresh install of ubuntu 10.10) nginx + gunicorn + django + supervisord to run it when I try to access my site, I get a 502 error. and this will show up in the error log: 2011/06/0...
[ "django", "nginx", "gunicorn", "supervisord" ]
2
5
2,734
2
0
2011-06-03T16:02:43.883000
2011-06-03T16:43:39.717000
6,229,656
6,229,746
Moose (Perl): access attribute definitions in base classes
Using __PACKAGE__->meta->get_attribute('foo'), you can access the foo attribute definitions in a given class, which can be useful. #!perl package Bla; use Moose; has bla => is => 'ro', isa => 'Str'; has hui => is => 'ro', isa => 'Str', required => 1; no Moose; __PACKAGE__->meta->make_immutable; package Blub; use Moose...
NOTE that get_attribute does not search superclasses, for that you need to use find_attribute_by_name — Class::MOP::Class docs. And indeed this code passes: my $attr = Bla->meta->find_attribute_by_name('hui'); is $attr->is_required, 1; $attr = Blub->meta->find_attribute_by_name('hui'); is $attr->is_required, 0; $attr...
Moose (Perl): access attribute definitions in base classes Using __PACKAGE__->meta->get_attribute('foo'), you can access the foo attribute definitions in a given class, which can be useful. #!perl package Bla; use Moose; has bla => is => 'ro', isa => 'Str'; has hui => is => 'ro', isa => 'Str', required => 1; no Moose; ...
TITLE: Moose (Perl): access attribute definitions in base classes QUESTION: Using __PACKAGE__->meta->get_attribute('foo'), you can access the foo attribute definitions in a given class, which can be useful. #!perl package Bla; use Moose; has bla => is => 'ro', isa => 'Str'; has hui => is => 'ro', isa => 'Str', require...
[ "perl", "moose" ]
7
9
796
1
0
2011-06-03T16:04:19.770000
2011-06-03T16:10:44.407000
6,229,671
6,229,705
How to use str.format() with a dictionary in Python?
What is wrong with this piece of code? dic = { 'fruit': 'apple', 'place':'table' } test = "I have one {fruit} on the {place}.".format(dic) print(test) >>> KeyError: 'fruit'
Should be test = "I have one {fruit} on the {place}.".format(**dic) Note the **. format() does not accept a single dictionary, but rather keyword arguments.
How to use str.format() with a dictionary in Python? What is wrong with this piece of code? dic = { 'fruit': 'apple', 'place':'table' } test = "I have one {fruit} on the {place}.".format(dic) print(test) >>> KeyError: 'fruit'
TITLE: How to use str.format() with a dictionary in Python? QUESTION: What is wrong with this piece of code? dic = { 'fruit': 'apple', 'place':'table' } test = "I have one {fruit} on the {place}.".format(dic) print(test) >>> KeyError: 'fruit' ANSWER: Should be test = "I have one {fruit} on the {place}.".format(**dic...
[ "python", "string", "dictionary" ]
22
42
21,997
3
0
2011-06-03T16:05:19.623000
2011-06-03T16:07:08.017000
6,229,676
6,230,963
Correlation matrix between different files
I have 82.csv files, each of them a zoo object, with the following format: "Index", "code", "pp" 1951-01-01, 2030, 22.9 1951-01-02, 2030, 0.5 1951-01-03, 2030, 0.0 I want to do a correlation matrix between the pp of all of my files. I found out how to do it "manually" between two files: zz<-merge(x,y, all = FALSE) z<-c...
I think you have the bones of a perfectly good solution here, actually. If you start with list.files() to generate a list of your csv files: fileList <- list.files(path="path/to/csv/files") then read in all the files using lapply(): datList <- lapply(fileList,read.csv) then merge the first two files (assuming the code ...
Correlation matrix between different files I have 82.csv files, each of them a zoo object, with the following format: "Index", "code", "pp" 1951-01-01, 2030, 22.9 1951-01-02, 2030, 0.5 1951-01-03, 2030, 0.0 I want to do a correlation matrix between the pp of all of my files. I found out how to do it "manually" between ...
TITLE: Correlation matrix between different files QUESTION: I have 82.csv files, each of them a zoo object, with the following format: "Index", "code", "pp" 1951-01-01, 2030, 22.9 1951-01-02, 2030, 0.5 1951-01-03, 2030, 0.0 I want to do a correlation matrix between the pp of all of my files. I found out how to do it "...
[ "r", "matrix", "correlation" ]
1
4
1,391
1
0
2011-06-03T16:05:27.577000
2011-06-03T18:09:03.987000
6,229,685
6,229,722
sql view daily email
I have a database view that gathers about 10 member names a day, based on when they joined. I want to setup something where these people will automatically be emailed an html page i have made. and repeat this daily, at first i was going to build an asp.net page where i would pull the view and loop through the email add...
You can use sp_send_dbmail to send email directly from SQL Server, assuming you've set up Database Mail.
sql view daily email I have a database view that gathers about 10 member names a day, based on when they joined. I want to setup something where these people will automatically be emailed an html page i have made. and repeat this daily, at first i was going to build an asp.net page where i would pull the view and loop ...
TITLE: sql view daily email QUESTION: I have a database view that gathers about 10 member names a day, based on when they joined. I want to setup something where these people will automatically be emailed an html page i have made. and repeat this daily, at first i was going to build an asp.net page where i would pull ...
[ "sql", "sql-server-2005" ]
0
0
209
3
0
2011-06-03T16:05:56.877000
2011-06-03T16:08:13.427000
6,229,686
6,229,732
WCF IDictionary<TKey, TValue> - How to indicate that TValue can be null?
Basically, I want to pass back the following in my WCF service: [DataMember(IsRequired = true)] IDictionary objects { get; set; } How can I make it so that the MyObj can be null so that when I receive it on the other end it doesn't instantiate a blank item, but instead leaves it null?
It can be null, you don't need to do anything special. The IsRequired=true applies to the dictionary itself, not to specific instances of the dictionary. Also, you shouldn't use IDictionary (unless you want to deal with [KnownType]s), Dictionary should do fine.
WCF IDictionary<TKey, TValue> - How to indicate that TValue can be null? Basically, I want to pass back the following in my WCF service: [DataMember(IsRequired = true)] IDictionary objects { get; set; } How can I make it so that the MyObj can be null so that when I receive it on the other end it doesn't instantiate a b...
TITLE: WCF IDictionary<TKey, TValue> - How to indicate that TValue can be null? QUESTION: Basically, I want to pass back the following in my WCF service: [DataMember(IsRequired = true)] IDictionary objects { get; set; } How can I make it so that the MyObj can be null so that when I receive it on the other end it doesn...
[ "wcf", "dictionary", "null", "isrequired" ]
0
3
164
1
0
2011-06-03T16:06:08.527000
2011-06-03T16:09:14.963000
6,229,688
6,252,221
WPF 3.5: MultiValueConverter Values are NamedObjects Where Single ValueConverters Work as per Normal
I'm having a problem with a MultiValueConverter that feels more and more like a.NET bug the more I try to fix it. Here's what's up: I am binding the IsEnabled property of both a Stackpanel and a User Control (UC) using a similar MultiBinding definition (of course, I'm using for the UC): The 'current' UC (the one contai...
Worked it out, to an extent at least. You need to be more robust with your multibinding converter (InfoSectionIsEnabled). In my case, my converter was as follows: Public Function Convert(values() As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements...
WPF 3.5: MultiValueConverter Values are NamedObjects Where Single ValueConverters Work as per Normal I'm having a problem with a MultiValueConverter that feels more and more like a.NET bug the more I try to fix it. Here's what's up: I am binding the IsEnabled property of both a Stackpanel and a User Control (UC) using ...
TITLE: WPF 3.5: MultiValueConverter Values are NamedObjects Where Single ValueConverters Work as per Normal QUESTION: I'm having a problem with a MultiValueConverter that feels more and more like a.NET bug the more I try to fix it. Here's what's up: I am binding the IsEnabled property of both a Stackpanel and a User C...
[ "wpf", "binding", "imultivalueconverter" ]
1
3
1,517
1
0
2011-06-03T16:06:15.233000
2011-06-06T12:46:01.980000
6,229,689
6,229,748
SQL - how to determine which position/order/count my selected record is in?
Imagine I have a table: ID field1 field2 --- ------- ------ 111 1 11113 112 1 11114 113 1 44321 114 1 49339 115 2 53234 I'm interested in all records where field1 = 1 - and specifically field2 = 44321, but I want to know what position it is in my selection of field1=1 (in this case, it'd be 3). SELECT * FROM table WHER...
Try this: POS column will give the position of the record that you are looking for WITH qry AS ( SELECT a.* ROW_NUMBER() OVER(ORDER BY id) POS FROM table a WHERE field1 = 1 ) SELECT qry.pos FROM qry WHERE field2 = 44321
SQL - how to determine which position/order/count my selected record is in? Imagine I have a table: ID field1 field2 --- ------- ------ 111 1 11113 112 1 11114 113 1 44321 114 1 49339 115 2 53234 I'm interested in all records where field1 = 1 - and specifically field2 = 44321, but I want to know what position it is in ...
TITLE: SQL - how to determine which position/order/count my selected record is in? QUESTION: Imagine I have a table: ID field1 field2 --- ------- ------ 111 1 11113 112 1 11114 113 1 44321 114 1 49339 115 2 53234 I'm interested in all records where field1 = 1 - and specifically field2 = 44321, but I want to know what ...
[ "sql", "t-sql", "count", "position" ]
5
7
3,018
2
0
2011-06-03T16:06:19.260000
2011-06-03T16:10:58.060000
6,229,702
6,229,789
Command to trim the first and last character of a line in a text file
I am looking for I one liner hopefully, that can trim the first and last character of a line, on multiple lines e.g. test.txt Before: xyyyyyyyyyyyyyyyyyyyx pyyyyyyyyyyyyyyyyyyyz After: yyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyy
$ cat /tmp/txt xyyyyyyyyyyyyyyyyyyyx pyyyyyyyyyyyyyyyyyyyz $ sed 's/^.\(.*\).$/\1/' /tmp/txt yyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyy
Command to trim the first and last character of a line in a text file I am looking for I one liner hopefully, that can trim the first and last character of a line, on multiple lines e.g. test.txt Before: xyyyyyyyyyyyyyyyyyyyx pyyyyyyyyyyyyyyyyyyyz After: yyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyy
TITLE: Command to trim the first and last character of a line in a text file QUESTION: I am looking for I one liner hopefully, that can trim the first and last character of a line, on multiple lines e.g. test.txt Before: xyyyyyyyyyyyyyyyyyyyx pyyyyyyyyyyyyyyyyyyyz After: yyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyy ANSWER...
[ "sed" ]
5
14
12,355
3
0
2011-06-03T16:07:04.567000
2011-06-03T16:14:57.473000
6,229,709
6,229,779
Joomla template with giant menu
I am looking for a joomla or wordpress template (free | commercial) with giant menu. I like such types of websites where you pull the menu and see evrything. It makes it easier for visitors to see the big picture instead of being forced to navigate from page to page examples: reuters.com, vmware.com etc Thank you in ad...
I haven't come across a theme persay, however there is UberMenu. A WP Plugin in for just such occasions.
Joomla template with giant menu I am looking for a joomla or wordpress template (free | commercial) with giant menu. I like such types of websites where you pull the menu and see evrything. It makes it easier for visitors to see the big picture instead of being forced to navigate from page to page examples: reuters.com...
TITLE: Joomla template with giant menu QUESTION: I am looking for a joomla or wordpress template (free | commercial) with giant menu. I like such types of websites where you pull the menu and see evrything. It makes it easier for visitors to see the big picture instead of being forced to navigate from page to page exa...
[ "wordpress-theming", "joomla-template" ]
0
0
102
1
0
2011-06-03T16:07:16.950000
2011-06-03T16:13:50.337000
6,229,712
6,232,462
{01/01/0001 00:00:00} being passed as default date and time, MVC 2
Whenever i try to update an object that has a registered date field, this value is being passed in the model {01/01/0001 00:00:00} It happens even when i add <%: Html.EditorFor(model => model.RegisteredDate) %> into the view, even though the registered date is displayed in the editor like 18/03/2011 00:00:00 The other ...
The date you gave - 18/03/2011 - looks to be in the format day/month/year, which is invalid. The default format for DateTime is month/day/year (MM/dd/yyyy)..Net is trying to parse 18 as a month, which obviously is wrong, hence the error and the default datetime value of 01/01/0001 00:00:00 being used.
{01/01/0001 00:00:00} being passed as default date and time, MVC 2 Whenever i try to update an object that has a registered date field, this value is being passed in the model {01/01/0001 00:00:00} It happens even when i add <%: Html.EditorFor(model => model.RegisteredDate) %> into the view, even though the registered ...
TITLE: {01/01/0001 00:00:00} being passed as default date and time, MVC 2 QUESTION: Whenever i try to update an object that has a registered date field, this value is being passed in the model {01/01/0001 00:00:00} It happens even when i add <%: Html.EditorFor(model => model.RegisteredDate) %> into the view, even thou...
[ "asp.net-mvc", "datetime" ]
3
4
2,983
1
0
2011-06-03T16:07:27.570000
2011-06-03T20:43:30.687000
6,229,713
6,229,738
Why does a fieldset exceed the height of its container when the height is set to 100%?
See my code in action at: http://losthobbit.net/temp/radiogroup.html Here's the code: Radio Group Test Radiogroup Why does the fieldset exceed the height of the div? Thanks in advance
Browsers add some padding to fieldsets by default. Since it usually goes by the original W3C box model, the padding adds to the height rather than being part of it, hence what you see. You can easily remove that by setting zero padding on your fieldset. You also have to take into account the height of the legend that's...
Why does a fieldset exceed the height of its container when the height is set to 100%? See my code in action at: http://losthobbit.net/temp/radiogroup.html Here's the code: Radio Group Test Radiogroup Why does the fieldset exceed the height of the div? Thanks in advance
TITLE: Why does a fieldset exceed the height of its container when the height is set to 100%? QUESTION: See my code in action at: http://losthobbit.net/temp/radiogroup.html Here's the code: Radio Group Test Radiogroup Why does the fieldset exceed the height of the div? Thanks in advance ANSWER: Browsers add some padd...
[ "html", "css" ]
2
2
1,643
2
0
2011-06-03T16:07:34.933000
2011-06-03T16:09:46.710000
6,229,724
6,229,765
Change theme at runtime
I have a WPF application with a theme (ShinyRed.xaml) and I want to have a button that when clicked changes the theme to ShinyBlue.xaml I load in the theme initially in App.xaml: How might I do this?
Here is an article that will walk you through it: http://svetoslavsavov.blogspot.com/2009/07/switching-wpf-interface-themes-at.html Basically you need to remove the "old" theme from the resource dictionary and then merge in the new one. The above article shows you how to make this change very simple.
Change theme at runtime I have a WPF application with a theme (ShinyRed.xaml) and I want to have a button that when clicked changes the theme to ShinyBlue.xaml I load in the theme initially in App.xaml: How might I do this?
TITLE: Change theme at runtime QUESTION: I have a WPF application with a theme (ShinyRed.xaml) and I want to have a button that when clicked changes the theme to ShinyBlue.xaml I load in the theme initially in App.xaml: How might I do this? ANSWER: Here is an article that will walk you through it: http://svetoslavsav...
[ "wpf" ]
24
7
41,153
5
0
2011-06-03T16:08:18.173000
2011-06-03T16:12:25.600000
6,229,727
6,229,833
How does SQL Server 2008 R2 license work for production and QA?
My client wants to save on software licensing. When you purchase a production SQL Server 2008 R2 license, can you use it on QA as well or do you have to purchase an additional license? If you can't use the same license on QA, is the Developer Edition approved by Microsoft for QA? Thanks.
It is not a super straight forward answer unfortunately. If you licensed SQL Server by processor, you can connect use it however you want with no restrictions. If you license it for Server plus Device or User CALs you need to make sure you have enough CALs to cover the client and QA connections. See http://www.microsof...
How does SQL Server 2008 R2 license work for production and QA? My client wants to save on software licensing. When you purchase a production SQL Server 2008 R2 license, can you use it on QA as well or do you have to purchase an additional license? If you can't use the same license on QA, is the Developer Edition appro...
TITLE: How does SQL Server 2008 R2 license work for production and QA? QUESTION: My client wants to save on software licensing. When you purchase a production SQL Server 2008 R2 license, can you use it on QA as well or do you have to purchase an additional license? If you can't use the same license on QA, is the Devel...
[ "sql-server-2008-r2" ]
0
2
3,850
1
0
2011-06-03T16:08:27.623000
2011-06-03T16:20:03.780000
6,229,737
6,230,327
Access Parent View Controller from tableViewController in popover view
I am trying to implement a popover view in a tableview controller. My intention is for the user to select an option from the table list as shown below. Note that my popover view actually displays the data from a separate table view controller. I am creating the popover view controller via the following initialization m...
The two approaches I've seen are roughly the standard sort of fare: create a delegate protocol for the class type of optionsTableViewController, have the controller that creates the popover implement it and set itself as the delegate when issuing the popover use the NSNotificationCenter (which actually fits the intende...
Access Parent View Controller from tableViewController in popover view I am trying to implement a popover view in a tableview controller. My intention is for the user to select an option from the table list as shown below. Note that my popover view actually displays the data from a separate table view controller. I am ...
TITLE: Access Parent View Controller from tableViewController in popover view QUESTION: I am trying to implement a popover view in a tableview controller. My intention is for the user to select an option from the table list as shown below. Note that my popover view actually displays the data from a separate table view...
[ "objective-c", "cocoa-touch", "ios", "uitableview", "uipopovercontroller" ]
1
4
2,090
1
0
2011-06-03T16:09:37.403000
2011-06-03T17:07:56.813000
6,229,740
6,230,102
How to change a Javascript singleton to something that can be used multiple times?
A bit of an architectural question... I originally created a Javascript singleton to house methods needed to operate a photo gallery module in a template file for a CMS system. The original specification only called for one instance of this photo gallery module on a page. (The code below is a gross simplification of wh...
I think the easiest way is to just turn your code into a plugin. So for the following HTML:...... You would create the plugin with $.fn.photoGallery where you pass in an index as a parameter: $.fn.photoGallery = function (index) { var $this = this, module = { json: '', numSlidesInJson: '', currentSlide: '', updateSlide...
How to change a Javascript singleton to something that can be used multiple times? A bit of an architectural question... I originally created a Javascript singleton to house methods needed to operate a photo gallery module in a template file for a CMS system. The original specification only called for one instance of t...
TITLE: How to change a Javascript singleton to something that can be used multiple times? QUESTION: A bit of an architectural question... I originally created a Javascript singleton to house methods needed to operate a photo gallery module in a template file for a CMS system. The original specification only called for...
[ "javascript", "jquery" ]
8
5
697
2
0
2011-06-03T16:10:00.877000
2011-06-03T16:44:10.507000
6,229,750
6,230,084
PHP PEAR/DataObject equivalent to Rails' easy ActiveRecord finding functionality
In Rails, say a blogging application, given a particular post object you could get the name of the author of the post doing something like: post = Post.find(1) author_name = post.author.name Is there a PHP equivalent using DataObject, something like (just making up imaginary syntax here): $postsTable = DB_DataObject::f...
If you want an ORM with an API like that I would recommend PHP ActiveRecord: $posts = Post::find('all', array('limit' => 10, 'include' => array('author'))); foreach ($posts as $post) { echo $post->author->first_name; } http://www.phpactiverecord.org/projects/main/wiki/Finders You may also be interested in Propel ORM: $...
PHP PEAR/DataObject equivalent to Rails' easy ActiveRecord finding functionality In Rails, say a blogging application, given a particular post object you could get the name of the author of the post doing something like: post = Post.find(1) author_name = post.author.name Is there a PHP equivalent using DataObject, some...
TITLE: PHP PEAR/DataObject equivalent to Rails' easy ActiveRecord finding functionality QUESTION: In Rails, say a blogging application, given a particular post object you could get the name of the author of the post doing something like: post = Post.find(1) author_name = post.author.name Is there a PHP equivalent usin...
[ "php", "pear", "data-objects" ]
2
1
308
2
0
2011-06-03T16:11:06.170000
2011-06-03T16:42:35.230000
6,229,753
6,229,957
AspectJ 'around' advice - do you have to call 'proceed'?
Here's an easy one, surely someone knows this off the top of their head... Question When you write 'around' advice in AspectJ, do you have to call proceed? Lets say you wanted to make a method do something COMPLETELY different? Can you leave 'proceed' out or will it generate an error (forcing you to call proceed but ig...
Call proceed() or proceed(..) only if you want to call the functionality of your adviced method. So in your case if you want to do something completely different, don't call it.
AspectJ 'around' advice - do you have to call 'proceed'? Here's an easy one, surely someone knows this off the top of their head... Question When you write 'around' advice in AspectJ, do you have to call proceed? Lets say you wanted to make a method do something COMPLETELY different? Can you leave 'proceed' out or will...
TITLE: AspectJ 'around' advice - do you have to call 'proceed'? QUESTION: Here's an easy one, surely someone knows this off the top of their head... Question When you write 'around' advice in AspectJ, do you have to call proceed? Lets say you wanted to make a method do something COMPLETELY different? Can you leave 'pr...
[ "java", "aspectj" ]
6
10
4,254
1
0
2011-06-03T16:11:24.163000
2011-06-03T16:32:08.197000
6,229,759
6,229,856
How update a label periodically on iOS (every second)?
I use a NSTimer which fires every second and updates a label which displays the remaining time until an event. I works fine so far. The problem is while I am scrolling the TableView my Label does not update, because the MainThread is blocked by the touch/scroll event. I thought about creating a second thread for the Ti...
The problem is that a scheduledTimer will not get called while the main thread is tracking touches. You need to schedule the timer in the main run loop. So instead of doing [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(updateLabel:) userInfo:nil repeats:YES]; use NSTimer* timer = [NSTimer ...
How update a label periodically on iOS (every second)? I use a NSTimer which fires every second and updates a label which displays the remaining time until an event. I works fine so far. The problem is while I am scrolling the TableView my Label does not update, because the MainThread is blocked by the touch/scroll eve...
TITLE: How update a label periodically on iOS (every second)? QUESTION: I use a NSTimer which fires every second and updates a label which displays the remaining time until an event. I works fine so far. The problem is while I am scrolling the TableView my Label does not update, because the MainThread is blocked by th...
[ "iphone", "uikit" ]
31
46
19,287
3
0
2011-06-03T16:11:51.927000
2011-06-03T16:22:20.843000
6,229,760
6,229,793
Error 1017 when extending SimpleButton class in Flash/AS3
I am receiving the following compile time error when attempting to extend the SimpleButton class in AS3: 1017: the definition of base class SimpleButton was not found and the code: package com.shakti.gameState{ import flash.display.SimpleButton.SimpleButton; public class buttonTile extends SimpleButton { public var ...
Import the class. import flash.display.SimpleButton I get this all the time from copy and paste:)
Error 1017 when extending SimpleButton class in Flash/AS3 I am receiving the following compile time error when attempting to extend the SimpleButton class in AS3: 1017: the definition of base class SimpleButton was not found and the code: package com.shakti.gameState{ import flash.display.SimpleButton.SimpleButton; p...
TITLE: Error 1017 when extending SimpleButton class in Flash/AS3 QUESTION: I am receiving the following compile time error when attempting to extend the SimpleButton class in AS3: 1017: the definition of base class SimpleButton was not found and the code: package com.shakti.gameState{ import flash.display.SimpleButto...
[ "flash", "actionscript-3", "actionscript", "compiler-errors" ]
0
1
1,305
1
0
2011-06-03T16:12:08.433000
2011-06-03T16:15:16.940000
6,229,763
6,230,166
Update decimal numbers when using other local
I have this Model public class SalesModelView { [Key] public int SaleId { get; set; } public int ShopId { get; set; } public string ShopName { get; set; } [Display(Name = "Date")] public DateTime SaleDate { get; set; } [Required] [Display(Name = "Timer")] [Range(0, 24)] public int Hours { get; set; } [Required] [Disp...
The DefaultModelBinder doesn't work well in these situations. You could write your own or make sure to submit en-US values. Here is an article talking about it. Model Binding Decimal Values
Update decimal numbers when using other local I have this Model public class SalesModelView { [Key] public int SaleId { get; set; } public int ShopId { get; set; } public string ShopName { get; set; } [Display(Name = "Date")] public DateTime SaleDate { get; set; } [Required] [Display(Name = "Timer")] [Range(0, 24)] p...
TITLE: Update decimal numbers when using other local QUESTION: I have this Model public class SalesModelView { [Key] public int SaleId { get; set; } public int ShopId { get; set; } public string ShopName { get; set; } [Display(Name = "Date")] public DateTime SaleDate { get; set; } [Required] [Display(Name = "Timer")...
[ "validation", "asp.net-mvc-3", "localization" ]
3
2
130
1
0
2011-06-03T16:12:18.417000
2011-06-03T16:52:43.850000
6,229,764
6,229,837
Overwriting my local branch with remote branch
I have completely fubar'd my local branch, and would like to start over. The version on the server is correct. I don't want to start over, I would like to use my local history to fix my huge screwup. (I can if I have to.) git fetch branchname, and git pull branchname don't work. The message I get is " up to date " howe...
First, create a new branch in the current position (in case you need your old 'meesed up' history): git branch fubar-pin Update your list of remote branches and sync new commits: git fetch --all Then, reset your branch to the point where origin/branch points to: git reset --hard origin/branch Be careful, this will remo...
Overwriting my local branch with remote branch I have completely fubar'd my local branch, and would like to start over. The version on the server is correct. I don't want to start over, I would like to use my local history to fix my huge screwup. (I can if I have to.) git fetch branchname, and git pull branchname don't...
TITLE: Overwriting my local branch with remote branch QUESTION: I have completely fubar'd my local branch, and would like to start over. The version on the server is correct. I don't want to start over, I would like to use my local history to fix my huge screwup. (I can if I have to.) git fetch branchname, and git pul...
[ "git" ]
169
280
136,743
4
0
2011-06-03T16:12:24.227000
2011-06-03T16:20:39.640000
6,229,766
6,232,241
Delaying a method based on page results
I am retrieving results from NCBI's online Blast tool with 'net/http' and 'uri'. To do this I have to search through an html page to check if one of the lines is "Status=WAITING" or "Status=READY". When the Blast tool has finished the status will change to ready and results will be posted on the html page. I have a wor...
Take a look at this implementation. This is what he does: res='http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Get&FORMAT_OBJECT=SearchInfo&RID=' + @rid while status = open(res).read.scan(/Status=(.*?)$/).to_s=='WAITING' @logger.debug("Status=WAITING") sleep(3) end I think using the string scanner might be a bit more e...
Delaying a method based on page results I am retrieving results from NCBI's online Blast tool with 'net/http' and 'uri'. To do this I have to search through an html page to check if one of the lines is "Status=WAITING" or "Status=READY". When the Blast tool has finished the status will change to ready and results will ...
TITLE: Delaying a method based on page results QUESTION: I am retrieving results from NCBI's online Blast tool with 'net/http' and 'uri'. To do this I have to search through an html page to check if one of the lines is "Status=WAITING" or "Status=READY". When the Blast tool has finished the status will change to ready...
[ "ruby-on-rails", "ruby" ]
1
0
72
1
0
2011-06-03T16:12:32.533000
2011-06-03T20:21:43.347000
6,229,774
6,254,443
How would I make a simple 'up one level' link in Kentico portal mode?
I have a simple Kentico transformation shown below. The 'a' tag is intended to send the user back up one level in the CMS site tree. I got the single dot wildcard from Kentico documentation here http://devnet.kentico.com/docs/5_5r2/devguide/index.html?wildcard_urls.htm. <%# Eval("ArticleTitle",true) %> <%# Eval("Articl...
Actually, if you don't mind having this functionality at the top of the page you could simply use the breadcrumb web part. Optionally, you could actually include the web part inside your transformation, and possibly restyle it to get the effect that you want. That shouldn't be too hard if you have basic knowledge of AS...
How would I make a simple 'up one level' link in Kentico portal mode? I have a simple Kentico transformation shown below. The 'a' tag is intended to send the user back up one level in the CMS site tree. I got the single dot wildcard from Kentico documentation here http://devnet.kentico.com/docs/5_5r2/devguide/index.htm...
TITLE: How would I make a simple 'up one level' link in Kentico portal mode? QUESTION: I have a simple Kentico transformation shown below. The 'a' tag is intended to send the user back up one level in the CMS site tree. I got the single dot wildcard from Kentico documentation here http://devnet.kentico.com/docs/5_5r2/...
[ "asp.net", "kentico" ]
1
1
373
2
0
2011-06-03T16:13:28.307000
2011-06-06T15:36:35.190000
6,229,778
6,230,765
How do I get hold of exceptions thrown in a Scala Future?
I've been working up my answer to Is there a standard Scala function for running a block with a timeout?, and have run into a problem if an exception is thrown in a Future. def runWithTimeout[T](timeoutMs: Long)(f: => T): Option[T] = { awaitAll(timeoutMs, future(f)).head.asInstanceOf[Option[T]] } So that runWithTimeout...
Short answer: no. Exceptions don't do what you want when you're working in a threaded context, because you want to know about the exception in the caller, and the exception happens in the future's thread. Instead, if you want to know what the exception was, you should return an Either[Exception,WhatYouWant] --of course...
How do I get hold of exceptions thrown in a Scala Future? I've been working up my answer to Is there a standard Scala function for running a block with a timeout?, and have run into a problem if an exception is thrown in a Future. def runWithTimeout[T](timeoutMs: Long)(f: => T): Option[T] = { awaitAll(timeoutMs, future...
TITLE: How do I get hold of exceptions thrown in a Scala Future? QUESTION: I've been working up my answer to Is there a standard Scala function for running a block with a timeout?, and have run into a problem if an exception is thrown in a Future. def runWithTimeout[T](timeoutMs: Long)(f: => T): Option[T] = { awaitAll...
[ "scala", "exception", "concurrency", "actor" ]
17
17
19,362
6
0
2011-06-03T16:13:49.773000
2011-06-03T17:51:41.090000
6,229,785
6,229,816
Why is this very simple SQL query failing in MS Access?
I have a query that by all rights should not possibly fail, and I can't for the life of me figure out why INSERT INTO Grocery_Store_Prices(Store,Item,Brand,Price,Unit,Quantity,Note) VALUES("Kroger","Cheesy Poof","Cartman",0.51,"fart",15,"what is going on"); When I try to run the query I get "Syntax error in INSERT INTO...
"Note" is a reserved word in Microsoft Access. You need to surround it with square brackets: INSERT INTO Grocery_Store_Prices(Store,Item,Brand,Price,Unit,Quantity,[Note]) VALUES("Kroger","Cheesy Poof","Cartman",0.51,"fart",15,"what the ____"); Helpful list of reserved words here: http://support.microsoft.com/kb/286335 ...
Why is this very simple SQL query failing in MS Access? I have a query that by all rights should not possibly fail, and I can't for the life of me figure out why INSERT INTO Grocery_Store_Prices(Store,Item,Brand,Price,Unit,Quantity,Note) VALUES("Kroger","Cheesy Poof","Cartman",0.51,"fart",15,"what is going on"); When I...
TITLE: Why is this very simple SQL query failing in MS Access? QUESTION: I have a query that by all rights should not possibly fail, and I can't for the life of me figure out why INSERT INTO Grocery_Store_Prices(Store,Item,Brand,Price,Unit,Quantity,Note) VALUES("Kroger","Cheesy Poof","Cartman",0.51,"fart",15,"what is ...
[ "sql", "ms-access", "jet", "jet-sql" ]
5
9
1,386
2
0
2011-06-03T16:14:12.060000
2011-06-03T16:18:13.527000
6,229,806
6,230,196
c#.NET ListBox with dynamic data and multiselection problem
Im trying to get values from a ListBox that has multiselection and dynamic ListItems in it. My problem is that I can't get the values once I press my "assign" button. The idea is that I have like 10-15 listitems and they should be assigned with values. And I want to be able to select like 5 of them and press my assign ...
Something like this? ASPX page Code Behind protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataBindListBox(); } } protected void ButtonSubmit_Click(object sender, EventArgs e) { List selectedItems1 = ListBox1.Items.Cast ().Where(li => li.Selected).ToList(); // or string[] selectedItems2 = (...
c#.NET ListBox with dynamic data and multiselection problem Im trying to get values from a ListBox that has multiselection and dynamic ListItems in it. My problem is that I can't get the values once I press my "assign" button. The idea is that I have like 10-15 listitems and they should be assigned with values. And I w...
TITLE: c#.NET ListBox with dynamic data and multiselection problem QUESTION: Im trying to get values from a ListBox that has multiselection and dynamic ListItems in it. My problem is that I can't get the values once I press my "assign" button. The idea is that I have like 10-15 listitems and they should be assigned wi...
[ "c#", "listbox", "multi-select" ]
0
1
1,492
2
0
2011-06-03T16:16:53.223000
2011-06-03T16:56:30.883000
6,229,823
6,229,861
Creating a proxy function to fprintf in an unobtrusive way?
I'd like to create a proxy to fprintf, like so: void raise_exception(char *filename, int line, char *format_string,...) { fprintf(stderr, "Exception in `%s`:%d!\n", filename, line); fprintf(stderr, format_string,...); exit(EXIT_FAILURE); } But what do I put in the place of the second ellipsis? Is it at all possible? I'...
#include void raise_exception(char *filename, int line, char *format_string,...) { va_list args; fprintf(stderr, "Exception in `%s`:%d!\n", filename, line); va_start(args, format_string); vfprintf(stderr, format_string, args); va_end(args); exit(EXIT_FAILURE); }
Creating a proxy function to fprintf in an unobtrusive way? I'd like to create a proxy to fprintf, like so: void raise_exception(char *filename, int line, char *format_string,...) { fprintf(stderr, "Exception in `%s`:%d!\n", filename, line); fprintf(stderr, format_string,...); exit(EXIT_FAILURE); } But what do I put in...
TITLE: Creating a proxy function to fprintf in an unobtrusive way? QUESTION: I'd like to create a proxy to fprintf, like so: void raise_exception(char *filename, int line, char *format_string,...) { fprintf(stderr, "Exception in `%s`:%d!\n", filename, line); fprintf(stderr, format_string,...); exit(EXIT_FAILURE); } Bu...
[ "c", "exception", "argument-passing" ]
2
6
1,146
3
0
2011-06-03T16:18:57.033000
2011-06-03T16:22:59.533000
6,229,824
6,230,250
Winsorize dataframe
I want to perform winsorization in a dataframe like this: event_date beta_before beta_after 2000-05-05 1.2911707054 1.3215648954 1999-03-30 0.5089734305 0.4269575657 2000-05-05 0.5414700258 0.5326762272 2000-02-09 1.5491034852 1.2839988507 1999-03-30 1.9380674599 1.6169735009 1999-03-30 1.3109909155 1.4468207148 2000-0...
Here is a function that does the winsorzation you describe: winsorize <- function(x) { Min <- which.min(x) Max <- which.max(x) ord <- order(x) x[Min] <- x[ord][2] x[Max] <- x[ord][length(x)-1] x } If you data are in a data frame dat, then we can windsoroize the data using your procedure via: dat2 <- dat dat2[, -1] <- s...
Winsorize dataframe I want to perform winsorization in a dataframe like this: event_date beta_before beta_after 2000-05-05 1.2911707054 1.3215648954 1999-03-30 0.5089734305 0.4269575657 2000-05-05 0.5414700258 0.5326762272 2000-02-09 1.5491034852 1.2839988507 1999-03-30 1.9380674599 1.6169735009 1999-03-30 1.3109909155...
TITLE: Winsorize dataframe QUESTION: I want to perform winsorization in a dataframe like this: event_date beta_before beta_after 2000-05-05 1.2911707054 1.3215648954 1999-03-30 0.5089734305 0.4269575657 2000-05-05 0.5414700258 0.5326762272 2000-02-09 1.5491034852 1.2839988507 1999-03-30 1.9380674599 1.6169735009 1999-...
[ "r", "transformation" ]
3
5
10,384
5
0
2011-06-03T16:19:14.460000
2011-06-03T17:01:15.413000
6,229,827
6,230,077
Django : is GeoDjango a Good Fit for my Website?
I'm building a real estate site in Django and have a Home model, which stores various information including the address. Database backend is using MySQL. Want to create a Yelp like search. A search where users can enter in zip code or city name, then get Home results in that area. Users can also choose the radius(5 mi,...
GeoDjango could handle something like that. Supposing your Home model looks like this: from django.contrib.gis.db.models import PointField class Home(Model): location = PointField().. etc You could fetch all Home models within x miles of a point like this: from django.contrib.gis.measure import D from django.contrib.g...
Django : is GeoDjango a Good Fit for my Website? I'm building a real estate site in Django and have a Home model, which stores various information including the address. Database backend is using MySQL. Want to create a Yelp like search. A search where users can enter in zip code or city name, then get Home results in ...
TITLE: Django : is GeoDjango a Good Fit for my Website? QUESTION: I'm building a real estate site in Django and have a Home model, which stores various information including the address. Database backend is using MySQL. Want to create a Yelp like search. A search where users can enter in zip code or city name, then ge...
[ "django", "google-maps", "geolocation", "geodjango" ]
0
3
2,199
4
0
2011-06-03T16:19:32.663000
2011-06-03T16:41:20.173000
6,229,848
6,230,874
Cocoa: setting the key equivalent
i want to set the key equivalent of a menuitem with [menuitem setKeyEquivalent:(NSString *)s], how can i do that if i have multiple modifiers? i tried: unichar shift = NSShiftKeyMask, cmd = NSCommandKeyMask; NSMutableString *keyequiv = [[NSMutableString alloc] init]; [keyequiv appendString:[NSString stringWithCharacte...
The modifier key masks are just that: masks, not characters. You can't insert them into the key equivalent string. To apply them, use setKeyEquivalentModifierMask: [menuItem setKeyEquivalentModifierMask: NSShiftKeyMask | NSCommandKeyMask]; [menuItem setKeyEquivalent:@"x"]; As with any other mask, use the bitwise OR ope...
Cocoa: setting the key equivalent i want to set the key equivalent of a menuitem with [menuitem setKeyEquivalent:(NSString *)s], how can i do that if i have multiple modifiers? i tried: unichar shift = NSShiftKeyMask, cmd = NSCommandKeyMask; NSMutableString *keyequiv = [[NSMutableString alloc] init]; [keyequiv appendS...
TITLE: Cocoa: setting the key equivalent QUESTION: i want to set the key equivalent of a menuitem with [menuitem setKeyEquivalent:(NSString *)s], how can i do that if i have multiple modifiers? i tried: unichar shift = NSShiftKeyMask, cmd = NSCommandKeyMask; NSMutableString *keyequiv = [[NSMutableString alloc] init]; ...
[ "objective-c", "cocoa", "key", "menuitem", "hotkeys" ]
21
31
12,096
5
0
2011-06-03T16:21:28.560000
2011-06-03T18:01:09.027000
6,229,853
6,230,722
Heroku rake db:seed permission denied when opening .xls with spreadsheet gem
I have been using the spreadsheet gem from http://spreadsheet.ch/ to read in seed data to a Rails 3 application. I was using Spreadsheet.open "xxxx" which ran fine on my dev machine but when pushed to Heroku errored with "Permission denied" The guide http://spreadsheet.rubyforge.org/files/GUIDE_txt.html is only very ba...
Down we go into the 'long series of debugging questions' rabbit hole: "Is the spreadsheet checked into git, such that it would show up on Heroku?" "Is ruby spreadsheet trying to write to a file that's in one of the read only parts of heroku?" "Are you using Spreadsheet.open or?" I guess in general it would be nice if y...
Heroku rake db:seed permission denied when opening .xls with spreadsheet gem I have been using the spreadsheet gem from http://spreadsheet.ch/ to read in seed data to a Rails 3 application. I was using Spreadsheet.open "xxxx" which ran fine on my dev machine but when pushed to Heroku errored with "Permission denied" Th...
TITLE: Heroku rake db:seed permission denied when opening .xls with spreadsheet gem QUESTION: I have been using the spreadsheet gem from http://spreadsheet.ch/ to read in seed data to a Rails 3 application. I was using Spreadsheet.open "xxxx" which ran fine on my dev machine but when pushed to Heroku errored with "Per...
[ "ruby-on-rails-3", "permissions", "heroku" ]
0
1
825
2
0
2011-06-03T16:22:13.100000
2011-06-03T17:48:01.593000
6,229,857
6,229,938
CSS/PHP Fill Screen with divs
I am trying to fill the screen with divs, and I'm thinking about using php to dynamically resize the divs based on the screen resoultion, so, for example, 16 divs always appear in each row. Example A is the problem, in Example B I resize the divs to fit the screen. So, is this efficient? I would have something like thi...
I don't see why you need any scripting in any language? If you set every div to float left with a width of 6% then 16 divs will take up 96% of the width no matter what the screen is resized to. You can wrap them in another div with a 4% margin to handle the remaining 4%.
CSS/PHP Fill Screen with divs I am trying to fill the screen with divs, and I'm thinking about using php to dynamically resize the divs based on the screen resoultion, so, for example, 16 divs always appear in each row. Example A is the problem, in Example B I resize the divs to fit the screen. So, is this efficient? I...
TITLE: CSS/PHP Fill Screen with divs QUESTION: I am trying to fill the screen with divs, and I'm thinking about using php to dynamically resize the divs based on the screen resoultion, so, for example, 16 divs always appear in each row. Example A is the problem, in Example B I resize the divs to fit the screen. So, is...
[ "php", "javascript", "jquery", "html", "css" ]
0
2
332
2
0
2011-06-03T16:22:33.423000
2011-06-03T16:30:24.650000
6,229,863
6,229,916
How do I have values from an array show up in a php string?
I have two values in an array that I want to have show up in a string variable that I am building. Theses values are dynamic and are subject to change, so I want to be able to build the string straight from the array. I thought I was on the right track but the values are not showing up. My Code: $range = "WHERE transda...
The following works for me in php 5.3.5 cli. I haven't modified your string $halfway = array( 'startdate' => 'somedate', 'enddate' => 'otherdate' ); $range = "WHERE transdate >= \"{$halfway['startdate']}\" AND transdate <= \"{$halfway['enddate']}\""; print $range; Output: WHERE transdate >= "somedate" AND transdate <...
How do I have values from an array show up in a php string? I have two values in an array that I want to have show up in a string variable that I am building. Theses values are dynamic and are subject to change, so I want to be able to build the string straight from the array. I thought I was on the right track but the...
TITLE: How do I have values from an array show up in a php string? QUESTION: I have two values in an array that I want to have show up in a string variable that I am building. Theses values are dynamic and are subject to change, so I want to be able to build the string straight from the array. I thought I was on the r...
[ "php", "cakephp" ]
0
4
63
3
0
2011-06-03T16:23:12.077000
2011-06-03T16:28:13.623000
6,229,865
6,230,406
Why does Ruby give this large precision decimal result?
I want to convert a subtitle time code: begin="00:00:07.71" dur="00:00:03.67 to pure seconds: begin=7.1 end=11.38 I wrote a Ruby code: def to_sec(value) a = value.split(':') a[0].to_i*3600+a[1].to_i*60+a[2].to_f end which resulted in 11.379999999999999. Can anybody tell me why this happens? Is there any Time library th...
It'll probably be easiest for you to represent your underlying datatype as integer hundredths of a second (centiseconds): def to_csec(value) #if you had CSec < Integer this would be `def self.[](value)` a = value.split(':') #tacking on a couple zeros to each a[0].to_i*360000+a[1].to_i*6000+(a[2].to_f * 100).to_i end Yo...
Why does Ruby give this large precision decimal result? I want to convert a subtitle time code: begin="00:00:07.71" dur="00:00:03.67 to pure seconds: begin=7.1 end=11.38 I wrote a Ruby code: def to_sec(value) a = value.split(':') a[0].to_i*3600+a[1].to_i*60+a[2].to_f end which resulted in 11.379999999999999. Can anybod...
TITLE: Why does Ruby give this large precision decimal result? QUESTION: I want to convert a subtitle time code: begin="00:00:07.71" dur="00:00:03.67 to pure seconds: begin=7.1 end=11.38 I wrote a Ruby code: def to_sec(value) a = value.split(':') a[0].to_i*3600+a[1].to_i*60+a[2].to_f end which resulted in 11.379999999...
[ "ruby" ]
0
0
116
2
0
2011-06-03T16:23:24.963000
2011-06-03T17:15:20.047000
6,229,866
6,229,949
c++ #include style differences
So the other day, I was looking through some old C++ books and noticed a way of creating a C++ class I had never seen before. Everything I have seen up to that point had always used the #include "header.h" and compiled the implementation files separately. What I saw the author of this book do is actually put an include...
Doing this will bring the definition of the class in to every translation unit where the header file is included. This is a very unusual paradigm, and could be hazardous to your coding health. In particular, if you have main.cpp and foo.cpp both of which #include "employee.h", then all the methods on employee will be d...
c++ #include style differences So the other day, I was looking through some old C++ books and noticed a way of creating a C++ class I had never seen before. Everything I have seen up to that point had always used the #include "header.h" and compiled the implementation files separately. What I saw the author of this boo...
TITLE: c++ #include style differences QUESTION: So the other day, I was looking through some old C++ books and noticed a way of creating a C++ class I had never seen before. Everything I have seen up to that point had always used the #include "header.h" and compiled the implementation files separately. What I saw the ...
[ "c++", "coding-style", "include" ]
7
3
2,991
5
0
2011-06-03T16:23:30.380000
2011-06-03T16:31:35.677000
6,229,867
6,229,902
How can i check if page accessed directly?
Hi:) I want to forbid access of a page directly, what i mean is if some one try to access for example the page proccess.php He will get an error message. BUT! if the page is accessed via AJAX call, it will act normal. i've tried: if( preg_match( '/'. basename( __FILE__ ). '/', $_SERVER['REQUEST_URI'] ) ) { die("Error!"...
you can check the HTTP_X_REQUESTED_WITH header. if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { // ajax request } else { die('direct access is forbidden'); } also read Can the “x-requested-with” http header be spoofed? on stackoverflow
How can i check if page accessed directly? Hi:) I want to forbid access of a page directly, what i mean is if some one try to access for example the page proccess.php He will get an error message. BUT! if the page is accessed via AJAX call, it will act normal. i've tried: if( preg_match( '/'. basename( __FILE__ ). '/',...
TITLE: How can i check if page accessed directly? QUESTION: Hi:) I want to forbid access of a page directly, what i mean is if some one try to access for example the page proccess.php He will get an error message. BUT! if the page is accessed via AJAX call, it will act normal. i've tried: if( preg_match( '/'. basename...
[ "php" ]
1
5
3,751
3
0
2011-06-03T16:23:34.537000
2011-06-03T16:27:01.637000
6,229,869
6,232,046
Conditional joining
I'm working on some nested views to consolidate them into one view. in the consolidated view I have an opportunities table and a quotes table that I'm doing a full join on opportunity id so that I get all quotes, all opportunities, and the ones that are associated. Now, the interesting bit is that I've got a table call...
It seems to me that if you always have an account number you are working this backwards. You should be starting at the Acoount table and left joining to the others. SELECT a.accountid, OQ.somefield, OQ.someotherfield FROM (Select coalesce (o.AccountID, q.AccountID) as AccountID, q.somefield, o.someotherfield FROM Oppor...
Conditional joining I'm working on some nested views to consolidate them into one view. in the consolidated view I have an opportunities table and a quotes table that I'm doing a full join on opportunity id so that I get all quotes, all opportunities, and the ones that are associated. Now, the interesting bit is that I...
TITLE: Conditional joining QUESTION: I'm working on some nested views to consolidate them into one view. in the consolidated view I have an opportunities table and a quotes table that I'm doing a full join on opportunity id so that I get all quotes, all opportunities, and the ones that are associated. Now, the interes...
[ "sql", "sql-server-2005", "sql-server-2008", "join" ]
0
2
139
2
0
2011-06-03T16:23:36.200000
2011-06-03T20:01:33.237000