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,181,295
6,181,577
Benefits of migrating from MySQL to Oracle for Amazon RDS. Worth it? [A: no]
Amazon recently announced support for Oracle in their RDS product line: http://aws.amazon.com/rds/oracle/ I was wondering if anyone has used this, or if there would be a compelling reason to migrate my data from MySQL to Oracle. I don't run a super-massive data installation, and previously, the cost / hassle of getting...
My opinion is, if you have MySQL skills then go with MySQL. If you have Oracle skills, go with Oracle (as long as you can wear the expense). If you don't have either, MySQL skills will probably be cheaper to hire in when you need them. For most purposes, especially for an app you are developing to run on the cloud, the...
Benefits of migrating from MySQL to Oracle for Amazon RDS. Worth it? [A: no] Amazon recently announced support for Oracle in their RDS product line: http://aws.amazon.com/rds/oracle/ I was wondering if anyone has used this, or if there would be a compelling reason to migrate my data from MySQL to Oracle. I don't run a ...
TITLE: Benefits of migrating from MySQL to Oracle for Amazon RDS. Worth it? [A: no] QUESTION: Amazon recently announced support for Oracle in their RDS product line: http://aws.amazon.com/rds/oracle/ I was wondering if anyone has used this, or if there would be a compelling reason to migrate my data from MySQL to Orac...
[ "mysql", "oracle", "amazon-web-services", "amazon-rds" ]
7
12
1,579
1
0
2011-05-30T22:36:04.517000
2011-05-30T23:26:40.497000
6,181,299
6,206,252
let htmlspecialchars use UTF-8 as default charset?
Is there a way to tell PHP to use UTF-8 as default for functions like htmlspecialchars? I have already setted this: ini_set('mbstring.internal_encoding','UTF-8'); ini_set('mbstring.func_overload',7); If not, please can you post a list of all functions where I need to specify the charset? (I need this because I am re-fa...
Just use htmlspecialchars() instead of htmlentities(). Because it doesn't touch the non-ASCII characters, it doesn't matter whether you use 'utf8' charset or the default 'latin1' (*), the results are the same. As a bonus your output is smaller. (Though it does mean you have to ensure you're actually serving your page w...
let htmlspecialchars use UTF-8 as default charset? Is there a way to tell PHP to use UTF-8 as default for functions like htmlspecialchars? I have already setted this: ini_set('mbstring.internal_encoding','UTF-8'); ini_set('mbstring.func_overload',7); If not, please can you post a list of all functions where I need to s...
TITLE: let htmlspecialchars use UTF-8 as default charset? QUESTION: Is there a way to tell PHP to use UTF-8 as default for functions like htmlspecialchars? I have already setted this: ini_set('mbstring.internal_encoding','UTF-8'); ini_set('mbstring.func_overload',7); If not, please can you post a list of all functions...
[ "php", "unicode", "character-encoding" ]
1
2
1,928
2
0
2011-05-30T22:37:32.893000
2011-06-01T18:56:19.343000
6,181,301
6,181,331
Passing pointers with space allocated by malloc
I've just written a function that returns a pointer to a block of memory allocated by malloc. If I call free() on the returned pointer, will this free the memory? I tried reading up on this, but I can't find anything that says whether you can call a different pointer pointing to the same location and whether that will ...
Yes calling free will free the memory. Its not the pointer that get freed but the memory that the pointer points to that is freed.
Passing pointers with space allocated by malloc I've just written a function that returns a pointer to a block of memory allocated by malloc. If I call free() on the returned pointer, will this free the memory? I tried reading up on this, but I can't find anything that says whether you can call a different pointer poin...
TITLE: Passing pointers with space allocated by malloc QUESTION: I've just written a function that returns a pointer to a block of memory allocated by malloc. If I call free() on the returned pointer, will this free the memory? I tried reading up on this, but I can't find anything that says whether you can call a diff...
[ "c", "memory", "malloc", "free", "parameter-passing" ]
0
3
499
3
0
2011-05-30T22:38:11.490000
2011-05-30T22:42:39.723000
6,181,304
6,181,343
Are there any ways to scramble strings in python?
I'm writing a program and I need to scramble the letters of string s from a list in python. For instance I have a list of string s like: l = ['foo', 'biology', 'sequence'] And I want something like this: l = ['ofo', 'lbyoogil', 'qceeenus'] What is the best way to do it? Thanks for your help!
Python has batteries included.. >>> from random import shuffle >>> def shuffle_word(word):... word = list(word)... shuffle(word)... return ''.join(word) A list comprehension is an easy way to create a new list: >>> L = ['foo', 'biology', 'sequence'] >>> [shuffle_word(word) for word in L] ['ofo', 'lbyooil', 'qceaenes']
Are there any ways to scramble strings in python? I'm writing a program and I need to scramble the letters of string s from a list in python. For instance I have a list of string s like: l = ['foo', 'biology', 'sequence'] And I want something like this: l = ['ofo', 'lbyoogil', 'qceeenus'] What is the best way to do it?...
TITLE: Are there any ways to scramble strings in python? QUESTION: I'm writing a program and I need to scramble the letters of string s from a list in python. For instance I have a list of string s like: l = ['foo', 'biology', 'sequence'] And I want something like this: l = ['ofo', 'lbyoogil', 'qceeenus'] What is the ...
[ "python", "string", "list", "scramble" ]
15
32
53,350
5
0
2011-05-30T22:39:00.677000
2011-05-30T22:45:03.963000
6,181,306
6,181,449
Initializing a AS 3.0 vector with type array - Vector.<Array>? (plus C++ equivelant)
I have a quick question for you all. I'm trying to convert over some ActionScript code to C++ and am having a difficult time with this one line: private var edges:Vector. What is this exactly? Is this essentially a multidimensional vector then? Or is this simply declaring the vector as a container? I understand from re...
From Mike Chambers (adobe evangelist): "Essentially, the Vector class is a typed Array, and in addition to ensuring your collection is type safe, can also provide (sometimes significant) performance improvements over using an Array." http://www.mikechambers.com/blog/2008/08/19/using-vectors-in-actionscript-3-and-flash-...
Initializing a AS 3.0 vector with type array - Vector.<Array>? (plus C++ equivelant) I have a quick question for you all. I'm trying to convert over some ActionScript code to C++ and am having a difficult time with this one line: private var edges:Vector. What is this exactly? Is this essentially a multidimensional vec...
TITLE: Initializing a AS 3.0 vector with type array - Vector.<Array>? (plus C++ equivelant) QUESTION: I have a quick question for you all. I'm trying to convert over some ActionScript code to C++ and am having a difficult time with this one line: private var edges:Vector. What is this exactly? Is this essentially a mu...
[ "c++", "actionscript-3", "porting" ]
1
1
241
1
0
2011-05-30T22:39:04.403000
2011-05-30T23:00:50.353000
6,181,312
6,263,256
How to fix the uninitialized constant Rake::DSL problem on Heroku?
I am getting errors similar to the ones in these questions, except mine are occuring on Heroku: 2011-05-30T09:03:29+00:00 heroku[worker.1]: Starting process with command: `rake jobs:work` 2011-05-30T09:03:30+00:00 app[worker.1]: (in /app) 2011-05-30T09:03:30+00:00 heroku[worker.1]: State changed from starting to up 201...
Put this in your Rakefile above require 'rake': require 'rake/dsl_definition'
How to fix the uninitialized constant Rake::DSL problem on Heroku? I am getting errors similar to the ones in these questions, except mine are occuring on Heroku: 2011-05-30T09:03:29+00:00 heroku[worker.1]: Starting process with command: `rake jobs:work` 2011-05-30T09:03:30+00:00 app[worker.1]: (in /app) 2011-05-30T09:...
TITLE: How to fix the uninitialized constant Rake::DSL problem on Heroku? QUESTION: I am getting errors similar to the ones in these questions, except mine are occuring on Heroku: 2011-05-30T09:03:29+00:00 heroku[worker.1]: Starting process with command: `rake jobs:work` 2011-05-30T09:03:30+00:00 app[worker.1]: (in /a...
[ "ruby-on-rails", "ruby-on-rails-3", "heroku", "rake" ]
102
205
45,193
5
0
2011-05-30T22:40:02.703000
2011-06-07T09:31:24.900000
6,181,313
6,182,295
ms-access transfertext not functioning
i have already saved a recent import in data tasks and now i am trying to call it automatically: DoCmd.TransferText acImportDelim, "import1", "temp", "C:\Documents and Settings\agordon\Desktop\ACTIVITYEX.csv" the error that i am getting is: the text file specification "import1" does not exist does anyone know what this...
It's expecting the parameter "Import1" to be a specification name. If "import1" is not an actual file, then you can just leave this parameter empty and the file should import into table temp (assuming temp is has the same number of fields as your CSV)
ms-access transfertext not functioning i have already saved a recent import in data tasks and now i am trying to call it automatically: DoCmd.TransferText acImportDelim, "import1", "temp", "C:\Documents and Settings\agordon\Desktop\ACTIVITYEX.csv" the error that i am getting is: the text file specification "import1" do...
TITLE: ms-access transfertext not functioning QUESTION: i have already saved a recent import in data tasks and now i am trying to call it automatically: DoCmd.TransferText acImportDelim, "import1", "temp", "C:\Documents and Settings\agordon\Desktop\ACTIVITYEX.csv" the error that i am getting is: the text file specific...
[ "ms-access", "vba" ]
1
1
769
1
0
2011-05-30T22:40:02.613000
2011-05-31T02:05:04.307000
6,181,316
6,182,214
"32 bit float mono audio" in Jack
I was playing with Jack, and I noticed that the default audio type JACK_DEFAULT_AUDIO_TYPE is set to "32 bit float mono audio". I'm a bit confused: IEEE defines 32-bit C float range approximately from 3.4E–38 to 3.4E+38, and I was wondering what is the maximum and minimum "undistorted" amplitude that a jack_default_aud...
It's pretty common to do signal processing operations in floating point, then scale and cast the results to 16-bit or 24-bit integers before sending them to the ADC. Implementing an IIR filter, for instance, in floating point means you can reduce your sensitivity to coefficient quantization. Or if you're doing FFTs, yo...
"32 bit float mono audio" in Jack I was playing with Jack, and I noticed that the default audio type JACK_DEFAULT_AUDIO_TYPE is set to "32 bit float mono audio". I'm a bit confused: IEEE defines 32-bit C float range approximately from 3.4E–38 to 3.4E+38, and I was wondering what is the maximum and minimum "undistorted"...
TITLE: "32 bit float mono audio" in Jack QUESTION: I was playing with Jack, and I noticed that the default audio type JACK_DEFAULT_AUDIO_TYPE is set to "32 bit float mono audio". I'm a bit confused: IEEE defines 32-bit C float range approximately from 3.4E–38 to 3.4E+38, and I was wondering what is the maximum and min...
[ "c", "audio", "signal-processing", "jack" ]
4
4
1,727
1
0
2011-05-30T22:40:46.500000
2011-05-31T01:50:27.153000
6,181,324
6,181,376
Counting regex pattern matches in one line using sed or grep?
I want to count the number of matches there is on one single line (or all lines as there always will be only one line). I want to count not just one match per line as in echo "123 123 123" | grep -c -E "123" # Result: 1 Better example: echo "1 1 2 2 2 5" | grep -c -E '([^ ])( \1){1}' # Result: 1, expected: 2 or 3
You could use grep -o then pipe through wc -l: $ echo "123 123 123" | grep -o 123 | wc -l 3
Counting regex pattern matches in one line using sed or grep? I want to count the number of matches there is on one single line (or all lines as there always will be only one line). I want to count not just one match per line as in echo "123 123 123" | grep -c -E "123" # Result: 1 Better example: echo "1 1 2 2 2 5" | g...
TITLE: Counting regex pattern matches in one line using sed or grep? QUESTION: I want to count the number of matches there is on one single line (or all lines as there always will be only one line). I want to count not just one match per line as in echo "123 123 123" | grep -c -E "123" # Result: 1 Better example: echo...
[ "regex", "bash", "sed", "grep", "counting" ]
32
53
28,121
5
0
2011-05-30T22:41:45.387000
2011-05-30T22:49:39.847000
6,181,332
6,181,362
open source software to control computer fan speed
So I asked a similar question here but it was considered a duplicate: https://stackoverflow.com/q/6181191/319862 This time I will be a little bit more specific... Are there any open source projects that can control the pwm frequency of a motherboard fan header. Please share links. The only software I can find is Speedf...
lm-sensors provides a fancontrol tool that can change the speed of your fans, along with some nice calibration tools to help you maintain reasonable temperatures with minimum energy and noise. Excellent tools.
open source software to control computer fan speed So I asked a similar question here but it was considered a duplicate: https://stackoverflow.com/q/6181191/319862 This time I will be a little bit more specific... Are there any open source projects that can control the pwm frequency of a motherboard fan header. Please ...
TITLE: open source software to control computer fan speed QUESTION: So I asked a similar question here but it was considered a duplicate: https://stackoverflow.com/q/6181191/319862 This time I will be a little bit more specific... Are there any open source projects that can control the pwm frequency of a motherboard f...
[ "c#", "c++", "c", "windows", "motherboard" ]
6
5
5,721
1
0
2011-05-30T22:42:40.083000
2011-05-30T22:47:12.607000
6,181,338
6,181,451
Open Socket, Send Data, Close Socket = Truncated data
I am having trouble sending data on a socket from an iphone application I am developing. In short, i want to connect to a tcp server on a specific port, send a data payload and then close the socket. It seem like if the socket does not flush data waiting on the buffer before closing. Here is my code: int port = 1234; C...
You could try waiting until CFWriteStreamGetStatus returns kCFStreamStatusAtEnd before closing it. I think that the problem is the CFWriteStreamClose automatically releases the string from everywhere that uses it, including where the data is actually being pushed to the network, meaning it leaves unpushed data in the b...
Open Socket, Send Data, Close Socket = Truncated data I am having trouble sending data on a socket from an iphone application I am developing. In short, i want to connect to a tcp server on a specific port, send a data payload and then close the socket. It seem like if the socket does not flush data waiting on the buff...
TITLE: Open Socket, Send Data, Close Socket = Truncated data QUESTION: I am having trouble sending data on a socket from an iphone application I am developing. In short, i want to connect to a tcp server on a specific port, send a data payload and then close the socket. It seem like if the socket does not flush data w...
[ "objective-c", "sockets", "ios4", "flush" ]
1
0
4,715
1
0
2011-05-30T22:43:55.603000
2011-05-30T23:00:56.453000
6,181,340
6,181,389
Possible to apply some CSS only to users with Javascript disabled?
The title pretty much says what I'm looking to do, but to elaborate a little more, I want to apply some CSS to a class called prochart-colitem for users who do not have javascript enabled. The reason? I am using percentages for column widths to equal 100%, then using javascript to subtract 2 pixels from each div for a ...
One way to approach it is by always adding a CSS class to the elements you wish to have a specific style and then, once loaded, run some JavaScript to remove those classes from the elements with that class. As an example (I use jQuery here for simplicity's sake but this can obviously be done without a JS library): $(do...
Possible to apply some CSS only to users with Javascript disabled? The title pretty much says what I'm looking to do, but to elaborate a little more, I want to apply some CSS to a class called prochart-colitem for users who do not have javascript enabled. The reason? I am using percentages for column widths to equal 10...
TITLE: Possible to apply some CSS only to users with Javascript disabled? QUESTION: The title pretty much says what I'm looking to do, but to elaborate a little more, I want to apply some CSS to a class called prochart-colitem for users who do not have javascript enabled. The reason? I am using percentages for column ...
[ "css", "border", "column-width", "javascript" ]
0
6
1,136
4
0
2011-05-30T22:44:29.223000
2011-05-30T22:51:19.407000
6,181,344
6,205,707
Galleria theme occasionally not loading
I am using the Galleria slideshow on my site, but I've noticed an error that seems to happen very randomly. Most of the time the slideshow loads correctrly but once in a while I get this error: Uncaught Error: Fatal error: Theme at javascript/themes/classic/galleria.classic.js could not load, check theme path. When I r...
1 Try the latest build at gihub: https://github.com/aino/galleria/blob/master/src/galleria.js 2 Try loading the theme using a script tag instead:
Galleria theme occasionally not loading I am using the Galleria slideshow on my site, but I've noticed an error that seems to happen very randomly. Most of the time the slideshow loads correctrly but once in a while I get this error: Uncaught Error: Fatal error: Theme at javascript/themes/classic/galleria.classic.js co...
TITLE: Galleria theme occasionally not loading QUESTION: I am using the Galleria slideshow on my site, but I've noticed an error that seems to happen very randomly. Most of the time the slideshow loads correctrly but once in a while I get this error: Uncaught Error: Fatal error: Theme at javascript/themes/classic/gall...
[ "javascript", "reload", "galleria" ]
11
14
17,991
6
0
2011-05-30T22:45:30.377000
2011-06-01T18:05:56.500000
6,181,351
6,181,385
What is the correct way to pass multiple arguments to a ruby == operator?
I'm a noob trying to do this: <% if @page[:title] == "Portraits" %> <%= render:partial => "/shared/slideshow" %> <% elsif @page[:title] == "Escapes" %> <%= render:partial => "/shared/slideshow" %> <% elsif @page[:title] == "Articulos pa Web" %> <%= render:partial => "/shared/slideshow" %> <% end %> There has to be a co...
Avoid putting the logic you currently have, in a view. Put this in a helper method instead and use it in the view: def get_partial_to_render if ["Portraits","Escapes","Articulos pa Web"].include? @page[:title] "shared/slideshow" else "some_other_template" end end #Note that the partial should not have a leading `/` in ...
What is the correct way to pass multiple arguments to a ruby == operator? I'm a noob trying to do this: <% if @page[:title] == "Portraits" %> <%= render:partial => "/shared/slideshow" %> <% elsif @page[:title] == "Escapes" %> <%= render:partial => "/shared/slideshow" %> <% elsif @page[:title] == "Articulos pa Web" %> <...
TITLE: What is the correct way to pass multiple arguments to a ruby == operator? QUESTION: I'm a noob trying to do this: <% if @page[:title] == "Portraits" %> <%= render:partial => "/shared/slideshow" %> <% elsif @page[:title] == "Escapes" %> <%= render:partial => "/shared/slideshow" %> <% elsif @page[:title] == "Arti...
[ "ruby" ]
0
4
116
2
0
2011-05-30T22:46:03.343000
2011-05-30T22:50:45.313000
6,181,354
6,233,817
How to implement a flowlayout in ExtJS 4?
I want to use a layout where components are added horizontally like hbox but where upon adding if the component exceed the bounds of the container it is moved to the next line. This is similar to what FlowLayout is in swing and flex. I couldn't find any layout in ExtJS 4.0 that would achieve this. So I am wondering how...
Have you tried using ColumnLayout? If you don't specify the "columnWidth" properties, the child elements are css-floated from left to right: Ext.create('Ext.Panel', { width: 500, height: 280, title: "ColumnLayout Panel", layout: 'column', renderTo: document.body, items: [{ xtype: 'panel', title: 'First Inner Panel', wi...
How to implement a flowlayout in ExtJS 4? I want to use a layout where components are added horizontally like hbox but where upon adding if the component exceed the bounds of the container it is moved to the next line. This is similar to what FlowLayout is in swing and flex. I couldn't find any layout in ExtJS 4.0 that...
TITLE: How to implement a flowlayout in ExtJS 4? QUESTION: I want to use a layout where components are added horizontally like hbox but where upon adding if the component exceed the bounds of the container it is moved to the next line. This is similar to what FlowLayout is in swing and flex. I couldn't find any layout...
[ "layout", "extjs", "extjs4", "flowlayout" ]
7
20
4,047
1
0
2011-05-30T22:46:33.327000
2011-06-04T00:15:59.743000
6,181,361
6,182,075
Server side WCF (.svc) service stops working after exception
I'm using a duplex ReliableSecureProfile in WCF and the server will stop listening to new requests if an exception occurs on any client. How can I make the server more resilient to failures that happen to any single client? Everything works again if I restart the server or redeploy My client code looks like this: Custo...
I can't reproduce this issue anymore (where the server simply stops responding). I think the issue is related to VS2010's desire to catch handled exceptions and stop all threads as explained here: Getting an Unhandled Exception in VS2010 debugger even though the exception IS handled
Server side WCF (.svc) service stops working after exception I'm using a duplex ReliableSecureProfile in WCF and the server will stop listening to new requests if an exception occurs on any client. How can I make the server more resilient to failures that happen to any single client? Everything works again if I restart...
TITLE: Server side WCF (.svc) service stops working after exception QUESTION: I'm using a duplex ReliableSecureProfile in WCF and the server will stop listening to new requests if an exception occurs on any client. How can I make the server more resilient to failures that happen to any single client? Everything works ...
[ "wcf", "exception", "web-config", "svc", "reliable-secure-profile" ]
2
0
651
1
0
2011-05-30T22:47:09.627000
2011-05-31T01:20:25.323000
6,181,366
6,181,424
Image Absolute source path with jQuery
This code gives something like../movies/1.png, the exact src attribute: $("img").attr("src"); How do I get absolute path of an image with jQuery? I want to get something like http://site.com/movies/1.png, not../movies/1.png
This can easily be done by accessing the.src property directly on the: $('img')[0].src; example: http://jsfiddle.net/9mKz2/ ( I didn't test it on all browser right now )
Image Absolute source path with jQuery This code gives something like../movies/1.png, the exact src attribute: $("img").attr("src"); How do I get absolute path of an image with jQuery? I want to get something like http://site.com/movies/1.png, not../movies/1.png
TITLE: Image Absolute source path with jQuery QUESTION: This code gives something like../movies/1.png, the exact src attribute: $("img").attr("src"); How do I get absolute path of an image with jQuery? I want to get something like http://site.com/movies/1.png, not../movies/1.png ANSWER: This can easily be done by acc...
[ "javascript", "jquery", "html", "css", "image" ]
13
14
10,830
1
0
2011-05-30T22:47:46.493000
2011-05-30T22:57:19.297000
6,181,367
6,181,911
How to change the image on the ApplicationBar from C#?
I have a small C# project that has an ApplicationBar. But I have a small problem: I want 8 icons on the bar, and the ApplicationBar only supports 4. I came up with a solution (in C#): add a small CheckBox to ask if the user wants to use the first or second set of tools. But I'm still not able to change the icons on the...
I don't understand what you mean by changing it from "C#, not Silverlight". C# is a programming language and Silverlight is a framework. Nevertheless, the link you posted to explains exactly how you do it. The ApplicationBar is not a Silverlight control, it's part of the native OS. You can use the code in the link or d...
How to change the image on the ApplicationBar from C#? I have a small C# project that has an ApplicationBar. But I have a small problem: I want 8 icons on the bar, and the ApplicationBar only supports 4. I came up with a solution (in C#): add a small CheckBox to ask if the user wants to use the first or second set of t...
TITLE: How to change the image on the ApplicationBar from C#? QUESTION: I have a small C# project that has an ApplicationBar. But I have a small problem: I want 8 icons on the bar, and the ApplicationBar only supports 4. I came up with a solution (in C#): add a small CheckBox to ask if the user wants to use the first ...
[ "c#", "visual-studio", "visual-studio-2010", "windows-phone-7", "icons" ]
2
4
1,531
3
0
2011-05-30T22:47:58.630000
2011-05-31T00:47:55.740000
6,181,370
6,181,471
Jquery show and hide causing form submit
Ok, so i have a form and it has several groups of fields, like a facebook account settings edit, to show when you click it. Show Hello Show Hello Show Hello When i click one of the shows, it causes the form to be submitted... why? I can fix this problem by returning false on the button click event, BUT, i feel that thi...
I believe the problem is that by default (in browsers other than IE) the type of the button is submit - for your use case, you want it to be button. Adding an attribute type="button", should fix it. Here's a working example showing the effect of [the lack of] the type attribute for s. You'll have to see the network act...
Jquery show and hide causing form submit Ok, so i have a form and it has several groups of fields, like a facebook account settings edit, to show when you click it. Show Hello Show Hello Show Hello When i click one of the shows, it causes the form to be submitted... why? I can fix this problem by returning false on the...
TITLE: Jquery show and hide causing form submit QUESTION: Ok, so i have a form and it has several groups of fields, like a facebook account settings edit, to show when you click it. Show Hello Show Hello Show Hello When i click one of the shows, it causes the form to be submitted... why? I can fix this problem by retu...
[ "jquery", "events", "form-submit" ]
2
3
1,176
4
0
2011-05-30T22:48:34.027000
2011-05-30T23:04:21.780000
6,181,373
6,181,452
images with radio buttons in a list display diagonally
I'm trying to get all images to be in a horizontal scroller with radio button (preferably) under the images. I keep running into a problem where the next image wants to start at the bottom of a radio button. an example of the problem with the code, http://jsfiddle.net/zVrq8/ I don't understand what's going on here.
I made it for the first two items. For the rest it's the same: link What I did, added a float: left to the li: div#lasteventimg ul li{ float:left; } this way li will go next to the previous li, as long as there is space in the ul Second thing I changed is in the HTML, added to a single li both the image and the input, ...
images with radio buttons in a list display diagonally I'm trying to get all images to be in a horizontal scroller with radio button (preferably) under the images. I keep running into a problem where the next image wants to start at the bottom of a radio button. an example of the problem with the code, http://jsfiddle....
TITLE: images with radio buttons in a list display diagonally QUESTION: I'm trying to get all images to be in a horizontal scroller with radio button (preferably) under the images. I keep running into a problem where the next image wants to start at the bottom of a radio button. an example of the problem with the code...
[ "html", "css", "radio-button" ]
0
2
528
1
0
2011-05-30T22:49:33.073000
2011-05-30T23:01:01.120000
6,181,377
6,181,506
Thickbox firefox problems
In firefox, if the user clicks the below link before the page loads, it opens in a new window instead of in the thickbox dialog. Any way to prevent this? I cannot make this happen on IE/safari Thickbox works by setting a class "thickbox" on a link: Open Then in thickbox //on page load call tb_init $(document).ready(fun...
Make sure you are loading the various script resources in the correct order. For example This can be in either the or preferably, just before the closing tag. As Pointy, err, pointed out, Thickbox is no longer under active development. You might consider one of the following alternatives ColorBox DOMWindow from the sam...
Thickbox firefox problems In firefox, if the user clicks the below link before the page loads, it opens in a new window instead of in the thickbox dialog. Any way to prevent this? I cannot make this happen on IE/safari Thickbox works by setting a class "thickbox" on a link: Open Then in thickbox //on page load call tb_...
TITLE: Thickbox firefox problems QUESTION: In firefox, if the user clicks the below link before the page loads, it opens in a new window instead of in the thickbox dialog. Any way to prevent this? I cannot make this happen on IE/safari Thickbox works by setting a class "thickbox" on a link: Open Then in thickbox //on ...
[ "jquery", "firefox", "thickbox" ]
0
0
672
2
0
2011-05-30T22:49:39.943000
2011-05-30T23:09:39.440000
6,181,379
6,181,566
W3C Geolocation API not working in Chrome
The below code works in Firefox but not in Google Chrome: title Testing What's going on? I thought Google Chrome was supposed to support the W3C Geolocation API.
Works perfectly for me - with both Chrome 11 and Firefox 4.0.1 on Win 7 Make sure you've not disabled location tracking in Chrome: Options > Under the Hood > Content Settings > Location Because of security restrictions, resources loaded with the file:/// scheme are not allowed access to location. See HTML 5 Geo Locatio...
W3C Geolocation API not working in Chrome The below code works in Firefox but not in Google Chrome: title Testing What's going on? I thought Google Chrome was supposed to support the W3C Geolocation API.
TITLE: W3C Geolocation API not working in Chrome QUESTION: The below code works in Firefox but not in Google Chrome: title Testing What's going on? I thought Google Chrome was supposed to support the W3C Geolocation API. ANSWER: Works perfectly for me - with both Chrome 11 and Firefox 4.0.1 on Win 7 Make sure you've ...
[ "javascript", "firefox", "google-chrome", "geolocation" ]
18
21
36,365
5
0
2011-05-30T22:49:54.763000
2011-05-30T23:24:43.727000
6,181,381
6,181,435
How to print variables in Perl
I have some code that looks like my ($ids,$nIds); while ( ){ chomp; $ids.= $_. " "; $nIds++; } This should concatenate every line in my myFile, and nIds should be my number of lines. How do I print out my $ids and $nIds? I tried simply print $ids, but Perl complains. my ($ids, $nIds) is a list, right? With two elements...
print "Number of lines: $nids\n"; print "Content: $ids\n"; How did Perl complain? print $ids should work, though you probably want a newline at the end, either explicitly with print as above or implicitly by using say or -l / $\. If you want to interpolate a variable in a string and have something immediately after it ...
How to print variables in Perl I have some code that looks like my ($ids,$nIds); while ( ){ chomp; $ids.= $_. " "; $nIds++; } This should concatenate every line in my myFile, and nIds should be my number of lines. How do I print out my $ids and $nIds? I tried simply print $ids, but Perl complains. my ($ids, $nIds) is a...
TITLE: How to print variables in Perl QUESTION: I have some code that looks like my ($ids,$nIds); while ( ){ chomp; $ids.= $_. " "; $nIds++; } This should concatenate every line in my myFile, and nIds should be my number of lines. How do I print out my $ids and $nIds? I tried simply print $ids, but Perl complains. my ...
[ "perl" ]
34
45
195,628
3
0
2011-05-30T22:50:22.380000
2011-05-30T22:58:32.517000
6,181,382
6,181,406
What's the easiest way to download the source of a webpage in python? (After javascript has been applied)
In python: I want to download the source of a webpage, after the javascript has been applied. What's the easiest way to do that?
splinter is the easiest way to do this: from splinter.browser import Browser browser = Browser() browser.visit('http://google.com') splinter is a tool that makes using several mature products much easier to use. Things like Selenium require lots of getting used to. splinter allows you to learn one API to use the webdri...
What's the easiest way to download the source of a webpage in python? (After javascript has been applied) In python: I want to download the source of a webpage, after the javascript has been applied. What's the easiest way to do that?
TITLE: What's the easiest way to download the source of a webpage in python? (After javascript has been applied) QUESTION: In python: I want to download the source of a webpage, after the javascript has been applied. What's the easiest way to do that? ANSWER: splinter is the easiest way to do this: from splinter.brow...
[ "javascript", "python", "html", "http", "rest" ]
1
6
219
1
0
2011-05-30T22:50:35.767000
2011-05-30T22:54:22.480000
6,181,383
6,283,051
Sinatra session not preserved with Rack::FiberPool
The session is not preserved between requests, though I can't see what I'm doing wrong. Code! require 'sinatra' require 'rack/fiber_pool' class SessionTest < Sinatra::Base use Rack::FiberPool enable:sessions set:session_secret, "foobar" get '/' do body { session.inspect } #This is always '{}'! end get '/a' do sessio...
Try this instead: require 'sinatra' require 'rack/fiber_pool' class SessionTest < Sinatra::Base enable:sessions set:session_secret, "foobar" get '/' do body { session.inspect } #This is always '{}'! end get '/a' do session['user'] = "bob" redirect '/' end end use Rack::FiberPool run SessionTest.new Otherwise Sinatr...
Sinatra session not preserved with Rack::FiberPool The session is not preserved between requests, though I can't see what I'm doing wrong. Code! require 'sinatra' require 'rack/fiber_pool' class SessionTest < Sinatra::Base use Rack::FiberPool enable:sessions set:session_secret, "foobar" get '/' do body { session.insp...
TITLE: Sinatra session not preserved with Rack::FiberPool QUESTION: The session is not preserved between requests, though I can't see what I'm doing wrong. Code! require 'sinatra' require 'rack/fiber_pool' class SessionTest < Sinatra::Base use Rack::FiberPool enable:sessions set:session_secret, "foobar" get '/' do b...
[ "ruby", "sinatra", "rack", "thin", "fiber" ]
2
1
743
2
0
2011-05-30T22:50:38.150000
2011-06-08T17:49:55.290000
6,181,388
6,181,601
Is it possible to run several QWidgets in separate threads
I am learning Qt and trying to create application that open documents in tabs of QTabWidget. And I need to have each tab running in separate thread. Is it possible? And if it is, can you please show a simple example.
No, this is not possible. Widgets needs to be always drawn and handled by the main thread, where the event loop is executed. What you can do is defining some slots for each tab which open a document and connect to to some signals in your threads. This way you can emit a signal if a document should be opened in a tab fr...
Is it possible to run several QWidgets in separate threads I am learning Qt and trying to create application that open documents in tabs of QTabWidget. And I need to have each tab running in separate thread. Is it possible? And if it is, can you please show a simple example.
TITLE: Is it possible to run several QWidgets in separate threads QUESTION: I am learning Qt and trying to create application that open documents in tabs of QTabWidget. And I need to have each tab running in separate thread. Is it possible? And if it is, can you please show a simple example. ANSWER: No, this is not p...
[ "qt" ]
1
2
344
1
0
2011-05-30T22:51:14.413000
2011-05-30T23:30:49.377000
6,181,390
6,181,938
Storing data attributes in 'class' vs in HTML5 data-attributes
Can anyone offer an opinion on whether it's better to use the Rails conventions provided in the dom_class and dom_id attributes for semantic helpers like div_for rather than HTML5 data-attributes like 'data-class' or 'data-id'? ie: vs
Just one opinion... If you're doing css formatting, use div.class. But if you're doing javascript stuff, then I think the html5 attributes make sense. That way, your presentation stuff is one place, and your data stuff another. You can always mix/match too in your selectors if needed.
Storing data attributes in 'class' vs in HTML5 data-attributes Can anyone offer an opinion on whether it's better to use the Rails conventions provided in the dom_class and dom_id attributes for semantic helpers like div_for rather than HTML5 data-attributes like 'data-class' or 'data-id'? ie: vs
TITLE: Storing data attributes in 'class' vs in HTML5 data-attributes QUESTION: Can anyone offer an opinion on whether it's better to use the Rails conventions provided in the dom_class and dom_id attributes for semantic helpers like div_for rather than HTML5 data-attributes like 'data-class' or 'data-id'? ie: vs ANS...
[ "html", "ruby-on-rails", "semantics" ]
5
4
505
1
0
2011-05-30T22:51:35.447000
2011-05-31T00:54:48.557000
6,181,391
6,181,635
manage.py runserver fails
OS X, Python 2.7, a fresh virtualenv: virtualenv bar source bar/bin/activate pip install django --upgrade django-admin.py startproject foo cd foo python manage.py runserver Then I immediately get this: Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) File "/Users/xyz/.virtualen...
This issue seems somehow related to virtualenvwrapper, and my own stupidity; creating a virtualenv manually has resolved it.
manage.py runserver fails OS X, Python 2.7, a fresh virtualenv: virtualenv bar source bar/bin/activate pip install django --upgrade django-admin.py startproject foo cd foo python manage.py runserver Then I immediately get this: Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) F...
TITLE: manage.py runserver fails QUESTION: OS X, Python 2.7, a fresh virtualenv: virtualenv bar source bar/bin/activate pip install django --upgrade django-admin.py startproject foo cd foo python manage.py runserver Then I immediately get this: Traceback (most recent call last): File "manage.py", line 14, in execute_m...
[ "python", "django", "macos" ]
1
0
1,067
1
0
2011-05-30T22:51:46.880000
2011-05-30T23:40:24.050000
6,181,393
6,181,775
ASP.NET MVC 3 - Select Items Using Check Boxes
I've got an MVC 3 application with a page where users can request more information about our service. When the user selects their state from a dropdown list, I want to use jQuery ajax to fetch a list of Products we offer in that state. For each Product, I'd like to display a check box next to the Product name. Then the...
If you prefix the name of the fields in your product object with the name of the list and their index in square brackets, then MVC will bind the list for you E.g. In this case the Product object needs a bool property called InterestedInCheckbox You should have sequencial indexes starting at 0 for this method to work (y...
ASP.NET MVC 3 - Select Items Using Check Boxes I've got an MVC 3 application with a page where users can request more information about our service. When the user selects their state from a dropdown list, I want to use jQuery ajax to fetch a list of Products we offer in that state. For each Product, I'd like to display...
TITLE: ASP.NET MVC 3 - Select Items Using Check Boxes QUESTION: I've got an MVC 3 application with a page where users can request more information about our service. When the user selects their state from a dropdown list, I want to use jQuery ajax to fetch a list of Products we offer in that state. For each Product, I...
[ "c#", "asp.net-mvc", "data-binding", "asp.net-mvc-3", "model-binding" ]
1
2
920
2
0
2011-05-30T22:51:50.263000
2011-05-31T00:11:42.157000
6,181,394
6,181,500
Going to a different view once photo selected from camera/library
I am writing an app that has an initial view containing 2 buttons - one that allows the user to take a photo with the camera and the other that allows him to select a picture from the library. I've written the code that allows that to happen, but after selecting the picture, I want to go to another view that allows, sa...
Implement the UIImagePickerControllerDelegate in your ViewController. To do that add to your ViewController's interface declaration (in the.h file) like so: @interface YourViewController: UIViewController { // instance variable declarations etc. } Then in your ViewController's.m file you actually implement the method -...
Going to a different view once photo selected from camera/library I am writing an app that has an initial view containing 2 buttons - one that allows the user to take a photo with the camera and the other that allows him to select a picture from the library. I've written the code that allows that to happen, but after s...
TITLE: Going to a different view once photo selected from camera/library QUESTION: I am writing an app that has an initial view containing 2 buttons - one that allows the user to take a photo with the camera and the other that allows him to select a picture from the library. I've written the code that allows that to h...
[ "iphone", "objective-c", "ios4" ]
0
1
291
1
0
2011-05-30T22:51:54.793000
2011-05-30T23:09:06.607000
6,181,399
6,181,520
How to translate this C#-like code to an SQL Server stored proc
Below is pseudo-code for SQL Server stored procedure I need to write: int[] followers = (select FollowerID from StoreFollower where StoreId = @storeId) insert into Message (senderId, recipientId) values (@senderId, followers[0]) int rootMessageId = last_id() foreach (int follower in followers.Skip(1)) insert into Me...
My stab at it in T-SQL. I assume that (a) FollowerID is int, (b) @storeId and @senderID ar parameters of the stored procedure. DECLARE @FirstFollower int DECLARE @FirstMessage int --Get the first follower (i.e. smallest FollowerID, hopefully that's what you mean --otherwise you need an appropriate ORDER BY clause here...
How to translate this C#-like code to an SQL Server stored proc Below is pseudo-code for SQL Server stored procedure I need to write: int[] followers = (select FollowerID from StoreFollower where StoreId = @storeId) insert into Message (senderId, recipientId) values (@senderId, followers[0]) int rootMessageId = last_...
TITLE: How to translate this C#-like code to an SQL Server stored proc QUESTION: Below is pseudo-code for SQL Server stored procedure I need to write: int[] followers = (select FollowerID from StoreFollower where StoreId = @storeId) insert into Message (senderId, recipientId) values (@senderId, followers[0]) int roo...
[ "sql-server-2008", "stored-procedures", "enumeration", "pseudocode" ]
0
2
230
1
0
2011-05-30T22:52:54.790000
2011-05-30T23:12:49.360000
6,181,420
6,181,869
In Java, is it possible to execute a method for a period of time and stop after it reaches the time limit?
I have this code that downloads a web page: HttpURLConnection connection; private String downloadContent() { InputStream content; Source parser; try { content = connection.getInputStream(); //<--here is the download parser = new Source(content); content.close(); return parser.toString(); } catch (Exception e) { return...
The proper way to achieve this is the following: public class TimeOut { public static class MyJob implements Callable { @Override public String call() throws Exception { // Do something return "result"; } } public static void main(String[] args) { Future control = Executors.newSingleThreadExecutor().submit(new MyJ...
In Java, is it possible to execute a method for a period of time and stop after it reaches the time limit? I have this code that downloads a web page: HttpURLConnection connection; private String downloadContent() { InputStream content; Source parser; try { content = connection.getInputStream(); //<--here is the downl...
TITLE: In Java, is it possible to execute a method for a period of time and stop after it reaches the time limit? QUESTION: I have this code that downloads a web page: HttpURLConnection connection; private String downloadContent() { InputStream content; Source parser; try { content = connection.getInputStream(); //<-...
[ "java", "time", "execution" ]
3
2
7,871
5
0
2011-05-30T22:56:33.200000
2011-05-31T00:35:25.227000
6,181,426
6,181,440
How is it possible to have an array of strings in C++?
When you access elements of an array using array[i], I thought that C++ would take the starting position of the array in memory and add i*sizeof(one array element) and then dereference that address (or do something equivalent to what I just described). However, it seems to me that if you have an array of strings (std::...
The string size is constant, but it (at some level) has a pointer to some non-constant-sized data. The pointer size is constant, the pointee size is not.
How is it possible to have an array of strings in C++? When you access elements of an array using array[i], I thought that C++ would take the starting position of the array in memory and add i*sizeof(one array element) and then dereference that address (or do something equivalent to what I just described). However, it ...
TITLE: How is it possible to have an array of strings in C++? QUESTION: When you access elements of an array using array[i], I thought that C++ would take the starting position of the array in memory and add i*sizeof(one array element) and then dereference that address (or do something equivalent to what I just descri...
[ "c++", "arrays", "string" ]
5
7
686
7
0
2011-05-30T22:57:30.273000
2011-05-30T22:59:05.033000
6,181,432
6,181,501
Why is there no strtoi in stdlib.h?
I have grown accustomed to strtod and variants. I am wondering why there is no strtoi shipped with. Why is it that the integer type is left out of this party? Specifically I am asking why there is not a version of atoi with the safety features of strtod?
strtol() converts a string to an integer, a long integer but an integer nevertheless. There is atoi() but it should be avoided in most cases due to the fact that it lacks a mechanism for error reporting from invalid input.
Why is there no strtoi in stdlib.h? I have grown accustomed to strtod and variants. I am wondering why there is no strtoi shipped with. Why is it that the integer type is left out of this party? Specifically I am asking why there is not a version of atoi with the safety features of strtod?
TITLE: Why is there no strtoi in stdlib.h? QUESTION: I have grown accustomed to strtod and variants. I am wondering why there is no strtoi shipped with. Why is it that the integer type is left out of this party? Specifically I am asking why there is not a version of atoi with the safety features of strtod? ANSWER: st...
[ "c", "libc" ]
82
50
75,815
6
0
2011-05-30T22:58:19.433000
2011-05-30T23:09:18.570000
6,181,437
6,217,930
Flash FaceBook Infinite Session
Anyone have any idea of how to create a infinite session so the user just logs in one time once the application has loaded and they remain logged in? I've tried storing e reseting this informations: var sessionData: Object = { access_token: "", expires: "", secret: "", session_key: "", sig: "", uid: "" }; Facebook.ini...
I solved it, you just need to init it with right values on the keys and dont call the login again and then you have a infinite session. Before all that also, you have to ask permission with the key "offline_access"
Flash FaceBook Infinite Session Anyone have any idea of how to create a infinite session so the user just logs in one time once the application has loaded and they remain logged in? I've tried storing e reseting this informations: var sessionData: Object = { access_token: "", expires: "", secret: "", session_key: "", s...
TITLE: Flash FaceBook Infinite Session QUESTION: Anyone have any idea of how to create a infinite session so the user just logs in one time once the application has loaded and they remain logged in? I've tried storing e reseting this informations: var sessionData: Object = { access_token: "", expires: "", secret: "", ...
[ "flash", "facebook", "session" ]
0
0
137
1
0
2011-05-30T22:58:52.773000
2011-06-02T17:25:40.083000
6,181,453
6,181,490
Not sure why a JS error is happening
I have this page of US states: http://www.comehike.com/outdoors/country.php?country_id=1&country_name=United%20States if you click on any link for hiking in a state, as far as I can tell, the map on the right side loads. But if you click on "Guam" for some reason that is the only place where the map does not load. Any ...
Error: missing ) after argument list Source File: http://www.comehike.com/outdoors/state.php?country_id=1&state_id=13&state_name=Guam&country_name= Line: 1, Column: 23 Source Code: initialize( 13.444304 144.793732 ); placeParkMarkers ( ); this error showed up you need to separate the two values of co-ordinates with, in...
Not sure why a JS error is happening I have this page of US states: http://www.comehike.com/outdoors/country.php?country_id=1&country_name=United%20States if you click on any link for hiking in a state, as far as I can tell, the map on the right side loads. But if you click on "Guam" for some reason that is the only pl...
TITLE: Not sure why a JS error is happening QUESTION: I have this page of US states: http://www.comehike.com/outdoors/country.php?country_id=1&country_name=United%20States if you click on any link for hiking in a state, as far as I can tell, the map on the right side loads. But if you click on "Guam" for some reason t...
[ "google-maps", "maps" ]
1
3
30
1
0
2011-05-30T23:01:02.373000
2011-05-30T23:07:24.793000
6,181,456
6,181,541
Overhead of using structs as wrappers for primitives for type-checking?
Let's say I want to get extra type-checking for working with primitives that mean different things semantically: public struct Apple { readonly int value; // Add constructor + operator overloads } public struct Orange { readonly int value; // Add constructor + operator overloads } The point is we can't compare "appl...
In memory there is no overhead using a struct which you can verify using Marshal.SizeOf(): struct testStruct { public readonly int value; }.. int size = Marshal.SizeOf(typeof(testStruct)); //returns 4 This also is the same as returned by sizeof(testStruct): unsafe { int size = sizeof(testStruct); //returns 4 } Accordi...
Overhead of using structs as wrappers for primitives for type-checking? Let's say I want to get extra type-checking for working with primitives that mean different things semantically: public struct Apple { readonly int value; // Add constructor + operator overloads } public struct Orange { readonly int value; // Ad...
TITLE: Overhead of using structs as wrappers for primitives for type-checking? QUESTION: Let's say I want to get extra type-checking for working with primitives that mean different things semantically: public struct Apple { readonly int value; // Add constructor + operator overloads } public struct Orange { readonly...
[ "c#" ]
22
9
1,455
2
0
2011-05-30T23:01:34.357000
2011-05-30T23:18:49.753000
6,181,463
6,182,088
Speed-up and best practices: Using ets for per-module pre-computed data
((Please forgive me that I ask more than one question in a single thread. I think they are related.)) Hello, I wanted to know, what best practices exist in Erlang in regards to per-module precompiled data. Example: I have a module that heavily operates on a priory know, veeery complex regular expressions. re:compile/2'...
mochiglobal implements this by compiling a new module to store your constant(s). The advantage here is that the memory is shared across processes, where in ets it's copied and in the process dictionary it's just local to that one process. https://github.com/mochi/mochiweb/blob/master/src/mochiglobal.erl
Speed-up and best practices: Using ets for per-module pre-computed data ((Please forgive me that I ask more than one question in a single thread. I think they are related.)) Hello, I wanted to know, what best practices exist in Erlang in regards to per-module precompiled data. Example: I have a module that heavily oper...
TITLE: Speed-up and best practices: Using ets for per-module pre-computed data QUESTION: ((Please forgive me that I ask more than one question in a single thread. I think they are related.)) Hello, I wanted to know, what best practices exist in Erlang in regards to per-module precompiled data. Example: I have a module...
[ "erlang", "big-o", "memoization", "ets" ]
10
3
2,652
3
0
2011-05-30T23:02:25.303000
2011-05-31T01:23:16.310000
6,181,464
6,181,507
Do c++11 lambdas capture variables they don't use?
When I use [=] to indicate that I would like all local variables to be captured by value in a lambda, will that result in all local variables in the function being copied, or just all local variables that are used by the lambda? So, for example, if i I have: vector my_huge_vector(100000); int my_measly_int; some_functi...
Each variable expressly named in the capture list is captured. The default capture will only capture variables that are both (a) not expressly named in the capture list and (b) used in the body of the lambda expression. If a variable is not expressly named and you don't use the variable in the lambda expression, then t...
Do c++11 lambdas capture variables they don't use? When I use [=] to indicate that I would like all local variables to be captured by value in a lambda, will that result in all local variables in the function being copied, or just all local variables that are used by the lambda? So, for example, if i I have: vector my_...
TITLE: Do c++11 lambdas capture variables they don't use? QUESTION: When I use [=] to indicate that I would like all local variables to be captured by value in a lambda, will that result in all local variables in the function being copied, or just all local variables that are used by the lambda? So, for example, if i ...
[ "c++", "lambda", "c++11" ]
141
130
28,037
2
0
2011-05-30T23:02:44.607000
2011-05-30T23:09:46.223000
6,181,479
6,182,102
method that stores inputs into an array
I am trying to write a method that prompts the user to input 20 numbers and stores the numbers in an alpha array. For some reason it is not working. Below is a sample of my method: public void inputArray(int a,int[]b){ b=new int[20]; int n=0;//int a; while(n<5){ for(int i=0;i
You must use Scanner or BufferReader as you wish, I thinks thats the simple way of doing I hope I can help import java.util.Scanner; public class Prueba { static int alpha[] = new int[20]; static Scanner scan = new Scanner(System.in); public static void main(String args[]) { int array[] = new int[20]; array = input...
method that stores inputs into an array I am trying to write a method that prompts the user to input 20 numbers and stores the numbers in an alpha array. For some reason it is not working. Below is a sample of my method: public void inputArray(int a,int[]b){ b=new int[20]; int n=0;//int a; while(n<5){ for(int i=0;i
TITLE: method that stores inputs into an array QUESTION: I am trying to write a method that prompts the user to input 20 numbers and stores the numbers in an alpha array. For some reason it is not working. Below is a sample of my method: public void inputArray(int a,int[]b){ b=new int[20]; int n=0;//int a; while(n<5){...
[ "java" ]
0
0
2,333
2
0
2011-05-30T23:05:32.237000
2011-05-31T01:26:44.823000
6,181,484
6,181,690
Is there a proper way to instantiate strongly typed objects in DAOs?
I'm trying to determine which is the right way to code a DAO for a class that contains a few primitive data types, and three strongly typed objects which have DAOs of their own. Here's the class I'm implementing the DAO for, minus the getters/setters: public class Course { private int id; private int number; private St...
You should definitelly use the method with joins. Doing query for each property is highly inefficient, and if you have a lot of data it will cause miserable performance due to n+1 select type of problem (3n+1 in your case).
Is there a proper way to instantiate strongly typed objects in DAOs? I'm trying to determine which is the right way to code a DAO for a class that contains a few primitive data types, and three strongly typed objects which have DAOs of their own. Here's the class I'm implementing the DAO for, minus the getters/setters:...
TITLE: Is there a proper way to instantiate strongly typed objects in DAOs? QUESTION: I'm trying to determine which is the right way to code a DAO for a class that contains a few primitive data types, and three strongly typed objects which have DAOs of their own. Here's the class I'm implementing the DAO for, minus th...
[ "java", "mysql", "dao" ]
0
2
295
1
0
2011-05-30T23:07:00.190000
2011-05-30T23:53:35.707000
6,181,485
6,184,137
How to use a foreign key as a part of a composite primary key in Entity Framework?
I've got an entity which is identified by no own id but an unique combination of properties, each of which is a foreign key. But Entity Framework designer does not seem to allow to make a foreign key (a "navigation property") a part of a primary key. Am I misunderstanding something or is it just unsupported? Example: h...
Navigation properties cannot be part of primary key. Composite primary key (entity key) can consists only from scalar properties -> only foreign properties related to these navigation properties can be part of FK - here is the example of the model which uses such relation.
How to use a foreign key as a part of a composite primary key in Entity Framework? I've got an entity which is identified by no own id but an unique combination of properties, each of which is a foreign key. But Entity Framework designer does not seem to allow to make a foreign key (a "navigation property") a part of a...
TITLE: How to use a foreign key as a part of a composite primary key in Entity Framework? QUESTION: I've got an entity which is identified by no own id but an unique combination of properties, each of which is a foreign key. But Entity Framework designer does not seem to allow to make a foreign key (a "navigation prop...
[ ".net", "sql-server", "entity-framework", "database-design", "composite-key" ]
2
3
1,681
1
0
2011-05-30T23:07:08.417000
2011-05-31T07:12:33.077000
6,181,504
6,199,104
SymmetricDS bi-directional
I try to understand if is possible: Central: table1 On local nodes table1_1 table1_2 table1_3 table1_4... I have made propagation from table1 to tables table1_1, table1_2, table1_3, table1_4... It is working. But now need to make opposite. E.g. in table table1_1 happen changes - change have be passed to table1 (central...
Yes, it is possible. As wrote in documentation "A node will always push and pull data to other node groups according to the node group link configuration. A node can only pull and push data to other nodes that are represented node table in its database and having sync_enabled = 1." So need configure table NODE_GROUP_LI...
SymmetricDS bi-directional I try to understand if is possible: Central: table1 On local nodes table1_1 table1_2 table1_3 table1_4... I have made propagation from table1 to tables table1_1, table1_2, table1_3, table1_4... It is working. But now need to make opposite. E.g. in table table1_1 happen changes - change have b...
TITLE: SymmetricDS bi-directional QUESTION: I try to understand if is possible: Central: table1 On local nodes table1_1 table1_2 table1_3 table1_4... I have made propagation from table1 to tables table1_1, table1_2, table1_3, table1_4... It is working. But now need to make opposite. E.g. in table table1_1 happen chang...
[ "database-replication", "symmetricds" ]
1
1
1,075
1
0
2011-05-30T23:09:26.620000
2011-06-01T09:35:47.837000
6,181,513
6,181,557
Setting up a SQL injection honeypot
I just stumbled on a website vulnerable to an SQL injection attack by mistake ( Is this site vulnerable to an SQL injection attack? ). That made me curious about what is tried and how often an attack attempt comes by on some website. So I'm thinking it would be cool to setup a honeypot on my server to see if / how ofte...
See this article if you want to setup a honey pot, it's got sample data that's injectable. http://www.webappsec.org/projects/articles/091007.shtml You can download the installation files here: http://www.webappsec.org/projects/articles/091007.zip
Setting up a SQL injection honeypot I just stumbled on a website vulnerable to an SQL injection attack by mistake ( Is this site vulnerable to an SQL injection attack? ). That made me curious about what is tried and how often an attack attempt comes by on some website. So I'm thinking it would be cool to setup a honeyp...
TITLE: Setting up a SQL injection honeypot QUESTION: I just stumbled on a website vulnerable to an SQL injection attack by mistake ( Is this site vulnerable to an SQL injection attack? ). That made me curious about what is tried and how often an attack attempt comes by on some website. So I'm thinking it would be cool...
[ "sql-injection", "honeypot" ]
1
1
3,509
2
0
2011-05-30T23:10:46.713000
2011-05-30T23:23:38.707000
6,181,515
6,181,522
Why is $_SESSION not carrying data to separate PHP file?
I have a login page that sets a $_SESSION['usertype'] when I log in. I have a separate PHP file that contains a menu that loads on the side. That file is loaded on every PHP file through But when I check for $_SESSION['usertype'] in menu.php, it is not set. Why is this?
Just checking whether you're using session_start() before you include the file which needs to access $_SESSION['usertype']? Have a check through this tutorial.
Why is $_SESSION not carrying data to separate PHP file? I have a login page that sets a $_SESSION['usertype'] when I log in. I have a separate PHP file that contains a menu that loads on the side. That file is loaded on every PHP file through But when I check for $_SESSION['usertype'] in menu.php, it is not set. Why i...
TITLE: Why is $_SESSION not carrying data to separate PHP file? QUESTION: I have a login page that sets a $_SESSION['usertype'] when I log in. I have a separate PHP file that contains a menu that loads on the side. That file is loaded on every PHP file through But when I check for $_SESSION['usertype'] in menu.php, it...
[ "php", "mysql", "session", "authentication" ]
2
5
149
2
0
2011-05-30T23:11:31.433000
2011-05-30T23:13:37.740000
6,181,518
6,186,620
How to create a PDF document from languages of Unicode char set regarding using third party Fonts
I'm using PDFBox and iText to create a simple (just paragraphs) pdf document from various languages. Something like: pdfBox: private static void createPdfBoxDocument(File from, File to) { PDDocument document = null; try { document = new TextToPDF().createPDFFromText(new FileReader(from)); document.save(new FileOutputSt...
If you are using iText, it has quite good support. In iText in Action (chapter 2.2.2) you can read more. You have to download some unicode Fonts like arialuni.ttf and do it like this: public static File fontFile = new File("fonts/arialuni.ttf"); public static void createITextDocument(File from, File to) throws Documen...
How to create a PDF document from languages of Unicode char set regarding using third party Fonts I'm using PDFBox and iText to create a simple (just paragraphs) pdf document from various languages. Something like: pdfBox: private static void createPdfBoxDocument(File from, File to) { PDDocument document = null; try { ...
TITLE: How to create a PDF document from languages of Unicode char set regarding using third party Fonts QUESTION: I'm using PDFBox and iText to create a simple (just paragraphs) pdf document from various languages. Something like: pdfBox: private static void createPdfBoxDocument(File from, File to) { PDDocument docum...
[ "java", "fonts", "itext", "pdfbox" ]
1
5
14,440
4
0
2011-05-30T23:12:07.120000
2011-05-31T11:05:52.140000
6,181,524
6,181,602
Getting nearly double the length when reading byte[] from postgres with jpa
I have an Image class that has a byte[] to contain the actual image data. I'm able to upload and insert the image just fine in my webapp. When I attempt to display the image after reading it from JPA the length of my byte[] is always either 2x-1 or 2x-2, where x is the length of the bytea field in postgres 9. Obviously...
In PostgreSQL 9 byte[] is sent to client using hex encoding. If this is reason for error you have to find update for JPA. Or you may change config of DB server but previous is better.
Getting nearly double the length when reading byte[] from postgres with jpa I have an Image class that has a byte[] to contain the actual image data. I'm able to upload and insert the image just fine in my webapp. When I attempt to display the image after reading it from JPA the length of my byte[] is always either 2x-...
TITLE: Getting nearly double the length when reading byte[] from postgres with jpa QUESTION: I have an Image class that has a byte[] to contain the actual image data. I'm able to upload and insert the image just fine in my webapp. When I attempt to display the image after reading it from JPA the length of my byte[] is...
[ "java", "postgresql", "jpa", "blob", "eclipselink" ]
3
3
2,974
5
0
2011-05-30T23:14:17.147000
2011-05-30T23:31:06.037000
6,181,531
6,181,774
Socket error after Django site deployed using apache and mod_wsgi?
There is a backend function in my site that will call urllib.urlopen(url)) to retrieve data from url. After deploying, all other functions worked well except this one. Calling this function results in [Errno socket error] [Errno -2] Name or service not known. It seems that it can't find the host. But if I use python ma...
It's possible that this could be a permission issue or something else with your Apache environment. Try using a simple WSGI script as a baseline to test URL fetching: import sys import urllib def application(environ, start_response): page_text = urllib.urlopen("http://www.google.com/").read() start_response('200 OK', ...
Socket error after Django site deployed using apache and mod_wsgi? There is a backend function in my site that will call urllib.urlopen(url)) to retrieve data from url. After deploying, all other functions worked well except this one. Calling this function results in [Errno socket error] [Errno -2] Name or service not ...
TITLE: Socket error after Django site deployed using apache and mod_wsgi? QUESTION: There is a backend function in my site that will call urllib.urlopen(url)) to retrieve data from url. After deploying, all other functions worked well except this one. Calling this function results in [Errno socket error] [Errno -2] Na...
[ "python", "django", "apache", "mod-wsgi" ]
0
0
2,172
1
0
2011-05-30T23:16:23.013000
2011-05-31T00:11:36.873000
6,181,532
6,181,537
Initialize Python variable from possible missing dict value
What is the Pythonic way to do this? value = (mydict.has_key('index') and mydict['index']) or 1024 Initialize from a dict's value, if present, otherwise use default value. Got some answers on LBYL and EAFP, but too verbose code:p I want some one-line-initialize. PS: python-2.4 only (running CentOS5)
value = mydict.get('index', 1024) (Note that this is not exactly equivalent to your code, since it will use 1024 only if the key index is not present, while your code also uses 1024 when the value corresponding to key index is falsy. From your explanation I infer the former is what you actually want.)
Initialize Python variable from possible missing dict value What is the Pythonic way to do this? value = (mydict.has_key('index') and mydict['index']) or 1024 Initialize from a dict's value, if present, otherwise use default value. Got some answers on LBYL and EAFP, but too verbose code:p I want some one-line-initializ...
TITLE: Initialize Python variable from possible missing dict value QUESTION: What is the Pythonic way to do this? value = (mydict.has_key('index') and mydict['index']) or 1024 Initialize from a dict's value, if present, otherwise use default value. Got some answers on LBYL and EAFP, but too verbose code:p I want some ...
[ "python", "dictionary", "initialization", "indexing" ]
1
11
1,990
4
0
2011-05-30T23:16:26.463000
2011-05-30T23:17:16.073000
6,181,533
6,188,563
Howto debug URL Rewrite Configurations on IIS
Is there an easier way to debug IIS Url Rewrite configurations than this?: Debug and troubleshoot rewrite rules easily One of the very cool features of URL Rewrite Module is its integration with IIS Failed Request Tracing. When you have rewrite rules that do not work the way you expect them to work - enable Failed Requ...
Whilst some may say "that's as good as it gets", I'd say that's a pretty neat way to debug rewrite rules. You have full visibility into the pipeline and can see exactly what is happening at each step. I have used this many times to resolve rewrite rule problems. It just takes practice to get familiar with the FRT tool.
Howto debug URL Rewrite Configurations on IIS Is there an easier way to debug IIS Url Rewrite configurations than this?: Debug and troubleshoot rewrite rules easily One of the very cool features of URL Rewrite Module is its integration with IIS Failed Request Tracing. When you have rewrite rules that do not work the wa...
TITLE: Howto debug URL Rewrite Configurations on IIS QUESTION: Is there an easier way to debug IIS Url Rewrite configurations than this?: Debug and troubleshoot rewrite rules easily One of the very cool features of URL Rewrite Module is its integration with IIS Failed Request Tracing. When you have rewrite rules that ...
[ "debugging", "iis", "url-rewriting" ]
9
5
15,196
2
0
2011-05-30T23:16:36.270000
2011-05-31T13:47:36.133000
6,181,546
6,181,604
CGAffineTransformation set the anchor?
I'm curious about something. In my app I'm running an animation where a view is resized a little bit. I'm creating the transform like this: CGAffineTransform resize = CGAffineTransformMakeScale(0.8, 0.8); However, when I apply this transformation to my view and watch it run, it resizes from the top and shrinks towards ...
First apply a CGAffineTransformMakeTranslation to move the origin to the center -- composite them into a single transform with CGAffineTransformConcat
CGAffineTransformation set the anchor? I'm curious about something. In my app I'm running an animation where a view is resized a little bit. I'm creating the transform like this: CGAffineTransform resize = CGAffineTransformMakeScale(0.8, 0.8); However, when I apply this transformation to my view and watch it run, it re...
TITLE: CGAffineTransformation set the anchor? QUESTION: I'm curious about something. In my app I'm running an animation where a view is resized a little bit. I'm creating the transform like this: CGAffineTransform resize = CGAffineTransformMakeScale(0.8, 0.8); However, when I apply this transformation to my view and w...
[ "iphone", "cgaffinetransform" ]
1
1
4,699
2
0
2011-05-30T23:19:50.960000
2011-05-30T23:31:28.343000
6,181,548
6,181,580
Compacting arrays in JavaScript
What is JavaScript equivalent to Ruby's Array#compact? Long version.... I followed the examples at blog.nemikor.com. His last example closes out old requests, but then pendings continues to be filled with obsolete requests. This looks like a memory leak to me. My solution is to iterate over pendings with filter as belo...
You have no threads in JavaScript, so there can be no race condition. All code is sequenced and will transfer control only after it's done running. So your interval function will run till completion before any other function is going to touch pendings. This holds for things like setTimeout and setInterval. As an experi...
Compacting arrays in JavaScript What is JavaScript equivalent to Ruby's Array#compact? Long version.... I followed the examples at blog.nemikor.com. His last example closes out old requests, but then pendings continues to be filled with obsolete requests. This looks like a memory leak to me. My solution is to iterate o...
TITLE: Compacting arrays in JavaScript QUESTION: What is JavaScript equivalent to Ruby's Array#compact? Long version.... I followed the examples at blog.nemikor.com. His last example closes out old requests, but then pendings continues to be filled with obsolete requests. This looks like a memory leak to me. My soluti...
[ "javascript", "ruby", "arrays", "node.js" ]
6
2
2,820
4
0
2011-05-30T23:20:23.090000
2011-05-30T23:27:21.900000
6,181,550
6,182,516
Can I "profile" using Instruments for memory leaks using a Test Case? (i.e. focused run on a defined area of code)
Can I "profile" for memory leaks using a Test Case? (i.e. focused run on a defined area of code) I tried changing my profile for my iPhone app to Unit Tests and then noted the "profile" option disappeared. My goal (requirement) I guess is to be able to isolate a specific method, and then run the Instruments memory leak...
The easiest way to accomplish this is to launch your application in Instrument, wait a little and tap a button that will run the specific method you're looking for. You can then select the timespan where the method ran by dragging the time bar with the option key.
Can I "profile" using Instruments for memory leaks using a Test Case? (i.e. focused run on a defined area of code) Can I "profile" for memory leaks using a Test Case? (i.e. focused run on a defined area of code) I tried changing my profile for my iPhone app to Unit Tests and then noted the "profile" option disappeared....
TITLE: Can I "profile" using Instruments for memory leaks using a Test Case? (i.e. focused run on a defined area of code) QUESTION: Can I "profile" for memory leaks using a Test Case? (i.e. focused run on a defined area of code) I tried changing my profile for my iPhone app to Unit Tests and then noted the "profile" o...
[ "iphone", "xcode", "ios", "memory-leaks", "instruments" ]
0
1
582
2
0
2011-05-30T23:22:12.157000
2011-05-31T02:45:50.230000
6,181,555
6,181,656
Pass a Python unittest if an exception isn't raised
In the Python unittest framework, is there a way to pass a unit test if an exception wasn't raised, and fail with an AssertRaise otherwise?
If I understand your question correctly, you could do something like this: def test_does_not_raise_on_valid_input(self): raised = False try: do_something(42) except: raised = True self.assertFalse(raised, 'Exception raised')...assuming that you have a corresponding test that the correct Exception gets raised on invalid...
Pass a Python unittest if an exception isn't raised In the Python unittest framework, is there a way to pass a unit test if an exception wasn't raised, and fail with an AssertRaise otherwise?
TITLE: Pass a Python unittest if an exception isn't raised QUESTION: In the Python unittest framework, is there a way to pass a unit test if an exception wasn't raised, and fail with an AssertRaise otherwise? ANSWER: If I understand your question correctly, you could do something like this: def test_does_not_raise_on...
[ "python", "unit-testing" ]
29
34
38,115
4
0
2011-05-30T23:23:01.310000
2011-05-30T23:45:05.013000
6,181,567
6,181,754
Complex Background Textures with CSS
I have a bit of a complex issue with a CSS background. Check out my attempt here: http://beveragebros.com/bbnew/scroll.html The background I'm talking about is the "parchment" where the copy is. This parchment is not a simple texture that I'm used to dealing with. Normally, I would identify a "top" and "bottom" portion...
Instead of setting the texture as the background of the content, how about setting it as the background of a container div and leave the top_scroll.png as part of the body text itself? I.E. #container { background:url(images/repeat_scroll.png) center top repeat-y; } #body-text { background:url(images/images/top_scroll....
Complex Background Textures with CSS I have a bit of a complex issue with a CSS background. Check out my attempt here: http://beveragebros.com/bbnew/scroll.html The background I'm talking about is the "parchment" where the copy is. This parchment is not a simple texture that I'm used to dealing with. Normally, I would ...
TITLE: Complex Background Textures with CSS QUESTION: I have a bit of a complex issue with a CSS background. Check out my attempt here: http://beveragebros.com/bbnew/scroll.html The background I'm talking about is the "parchment" where the copy is. This parchment is not a simple texture that I'm used to dealing with. ...
[ "css", "background" ]
5
3
4,231
2
0
2011-05-30T23:24:44.150000
2011-05-31T00:08:10.197000
6,181,578
6,183,645
How to implement push and pop in LLVM assembly?
I want to implement push and pop operations in LLVM assembly. The alloca instruction does not follow the concept of stack, push and pop. Examples: PUSH x86 subl $4, %esp movl %eax, 0(%esp) or pushl %eax mips addi $sp, $sp, -4 sw $t2, 0($sp) POP x86 movl 0(%esp), %eax addl $4, %esp or popl %eax mips lw $t2, 0($sp) addi ...
If you want "just" push and pop - then you should definitely use inline assembler. If you want to extend LLVM IR this way, you should define the clean semantics first. E.g. how this should interact with the stack movements inserted by backend, what will happen if you will have push in the middle of the basic block w/o ...
How to implement push and pop in LLVM assembly? I want to implement push and pop operations in LLVM assembly. The alloca instruction does not follow the concept of stack, push and pop. Examples: PUSH x86 subl $4, %esp movl %eax, 0(%esp) or pushl %eax mips addi $sp, $sp, -4 sw $t2, 0($sp) POP x86 movl 0(%esp), %eax addl...
TITLE: How to implement push and pop in LLVM assembly? QUESTION: I want to implement push and pop operations in LLVM assembly. The alloca instruction does not follow the concept of stack, push and pop. Examples: PUSH x86 subl $4, %esp movl %eax, 0(%esp) or pushl %eax mips addi $sp, $sp, -4 sw $t2, 0($sp) POP x86 movl ...
[ "assembly", "stack", "llvm", "instructions" ]
3
2
2,199
1
0
2011-05-30T23:26:59.047000
2011-05-31T06:11:42.877000
6,181,581
6,181,610
custom Jquery plugin bug
I've created a simple plugin following tuts+ and modified it to do what I want. It basically creates a "tooltip" that I am trying to leave visible for a certain amount of time but also allow the user to click on the block so more of a notification than a tool tip. What I have so far is below, but when it doesn't auto h...
I think you want setTimeout and clearTimeout instead of the...Interval versions you have. The former fire their callbacks once, whereas the latter do it repeatedly. Some tips: Don't pass a string to setTimeout or setInterval for the code to run - use a function pointer. I find it's much less error prone and scoping is ...
custom Jquery plugin bug I've created a simple plugin following tuts+ and modified it to do what I want. It basically creates a "tooltip" that I am trying to leave visible for a certain amount of time but also allow the user to click on the block so more of a notification than a tool tip. What I have so far is below, b...
TITLE: custom Jquery plugin bug QUESTION: I've created a simple plugin following tuts+ and modified it to do what I want. It basically creates a "tooltip" that I am trying to leave visible for a certain amount of time but also allow the user to click on the block so more of a notification than a tool tip. What I have ...
[ "jquery", "jquery-plugins", "notifications", "tooltip" ]
0
2
137
1
0
2011-05-30T23:27:53.103000
2011-05-30T23:33:21.463000
6,181,585
6,186,316
Token type depends on following token
I am stuck with a pretty simple grammar. Googling and books reading did not help. I started to use ANTLR quite recently, so probably this is a very simple question. I am trying to write a very simple Lexer using ANTLR v3. grammar TestLexer; options { language = Java; } TEST_COMMENT: '/*' WS? TEST WS? '*/'; ML_COMMEN...
ANTLR tokenizes the character stream starting from the top rule downwards and tries to match as much as possible. So, yes, I would also have expected a TEST_COMMENT to be created for both "/* TEST */" and "/* TEST */ ". You can always have a look at the generated source code of the lexer to see why it chooses to create...
Token type depends on following token I am stuck with a pretty simple grammar. Googling and books reading did not help. I started to use ANTLR quite recently, so probably this is a very simple question. I am trying to write a very simple Lexer using ANTLR v3. grammar TestLexer; options { language = Java; } TEST_COMME...
TITLE: Token type depends on following token QUESTION: I am stuck with a pretty simple grammar. Googling and books reading did not help. I started to use ANTLR quite recently, so probably this is a very simple question. I am trying to write a very simple Lexer using ANTLR v3. grammar TestLexer; options { language = J...
[ "java", "antlr" ]
1
1
698
1
0
2011-05-30T23:28:31.060000
2011-05-31T10:39:25.020000
6,181,586
6,182,789
No "droidgap" file in PhoneGap download?
When I download the latest PhoneGap zip there are several files and folders (including an Android folder), but there is no droidgap file (normally bin/droidgap ). Don't I need a droidgap file to run from the command line?
droidgap is not in the install zip from http://www.phonegap.com/download, but it is in now on svn. droidgap makes some things easier from the command line, but it is not absolutely necessary.
No "droidgap" file in PhoneGap download? When I download the latest PhoneGap zip there are several files and folders (including an Android folder), but there is no droidgap file (normally bin/droidgap ). Don't I need a droidgap file to run from the command line?
TITLE: No "droidgap" file in PhoneGap download? QUESTION: When I download the latest PhoneGap zip there are several files and folders (including an Android folder), but there is no droidgap file (normally bin/droidgap ). Don't I need a droidgap file to run from the command line? ANSWER: droidgap is not in the install...
[ "android", "cordova" ]
1
2
4,184
3
0
2011-05-30T23:28:33.790000
2011-05-31T03:41:34.500000
6,181,591
6,181,665
AS3 Curious structure question
I'm (I think) quite good at structuring my application classes and packages, but lately I've been weighing something up that I could use some advice on: Classes that contain only static constants, like this: package //? { public class Elements { public static const FIRE:String = "fire"; public static const WATER:String...
I think your existing method is correct as it is the most logical. Typically you don't see (in common architectures) classes that contain ONLY static/constant variables. You'd typically see them bundled with a class where the functionality that most utilizes these statics exists. For example, any of the Events classes ...
AS3 Curious structure question I'm (I think) quite good at structuring my application classes and packages, but lately I've been weighing something up that I could use some advice on: Classes that contain only static constants, like this: package //? { public class Elements { public static const FIRE:String = "fire"; p...
TITLE: AS3 Curious structure question QUESTION: I'm (I think) quite good at structuring my application classes and packages, but lately I've been weighing something up that I could use some advice on: Classes that contain only static constants, like this: package //? { public class Elements { public static const FIRE:...
[ "actionscript-3", "oop", "structure" ]
0
1
109
2
0
2011-05-30T23:29:11.230000
2011-05-30T23:46:22.313000
6,181,593
6,181,609
Finding & Replacing a Word within a Div Using Good Ole JavaScript
I know this is quite easy to do in jQuery, but I am trying to do it in JavaScript. I have this: window.addEventListener('load', function() { function replaceName() { var oldText= "Mobile"; var newText = "Stackoverflow"; var oldString= document.getElementById('replace').innerHTML; var newString = oldString.replace(/old...
The problem is here: var newString = oldString.replace(/oldText/g, newText); It's actually searching for oldText and not "Mobile" As kb said, you can solve this by: var newString = oldString.replace(new RegExp(oldText, "g"), newText);
Finding & Replacing a Word within a Div Using Good Ole JavaScript I know this is quite easy to do in jQuery, but I am trying to do it in JavaScript. I have this: window.addEventListener('load', function() { function replaceName() { var oldText= "Mobile"; var newText = "Stackoverflow"; var oldString= document.getElemen...
TITLE: Finding & Replacing a Word within a Div Using Good Ole JavaScript QUESTION: I know this is quite easy to do in jQuery, but I am trying to do it in JavaScript. I have this: window.addEventListener('load', function() { function replaceName() { var oldText= "Mobile"; var newText = "Stackoverflow"; var oldString= ...
[ "javascript", "replace" ]
1
4
1,295
4
0
2011-05-30T23:29:36.193000
2011-05-30T23:32:56.610000
6,181,595
6,182,077
Filter problem: sprite does not dispatch MouseEvents anymore
I am dealing with a relly simple problem: after applying a BevelFilter to a sprite, it does not seem to dispatch MouseEvents anymore. I have tried to re-enable buttonMode, but with no luck. Am I missing something really elementary, or this is a Flash bug? It also occurs with the DropShadowFilter. Edit: here is some cod...
I tried running your code and got the same result. Strange. Anyway, I was able to make it work by creating a "container" sprite and applying the filter there: var c:Sprite = new Sprite(); this.addChild(c); var s:Sprite = new Sprite(); s.graphics.beginFill(0xff0000,1); s.graphics.drawRect(0,0,50,50); s.buttonMode = tru...
Filter problem: sprite does not dispatch MouseEvents anymore I am dealing with a relly simple problem: after applying a BevelFilter to a sprite, it does not seem to dispatch MouseEvents anymore. I have tried to re-enable buttonMode, but with no luck. Am I missing something really elementary, or this is a Flash bug? It ...
TITLE: Filter problem: sprite does not dispatch MouseEvents anymore QUESTION: I am dealing with a relly simple problem: after applying a BevelFilter to a sprite, it does not seem to dispatch MouseEvents anymore. I have tried to re-enable buttonMode, but with no luck. Am I missing something really elementary, or this i...
[ "actionscript-3", "filter", "mouseevent", "sprite" ]
2
3
934
3
0
2011-05-30T23:29:44.880000
2011-05-31T01:20:39.247000
6,181,600
6,181,624
PHP/MySQL having trouble UPDATING a double value
So I'm using PHP/MySQL and I have a tbl_profile table with the following fields: loginid, venueTitle, description, address, long, lat. You'll have to trust me when I say that I've tested and had no problem updating and retrieving data from every field except long and lat. The long and lat fields are of type double and ...
long is a reserved word in MySQL. Using mysql_error() would have pointed you to a problem at long=' '. Either change your column names or wrap them in backticks in your queries, eg UPDATE tbl_profile SET `long` = something... Also, your code appears open to SQL injection. I'd seriously consider switching to PDO and usi...
PHP/MySQL having trouble UPDATING a double value So I'm using PHP/MySQL and I have a tbl_profile table with the following fields: loginid, venueTitle, description, address, long, lat. You'll have to trust me when I say that I've tested and had no problem updating and retrieving data from every field except long and lat...
TITLE: PHP/MySQL having trouble UPDATING a double value QUESTION: So I'm using PHP/MySQL and I have a tbl_profile table with the following fields: loginid, venueTitle, description, address, long, lat. You'll have to trust me when I say that I've tested and had no problem updating and retrieving data from every field e...
[ "php", "mysql" ]
1
1
2,264
1
0
2011-05-30T23:30:41.527000
2011-05-30T23:36:48.783000
6,181,603
6,181,737
PHP is handling incorrectly my static call
I'm havinh a problem on PHP 5.3. I need to call a method by using __callStatic, but if I use it in a instancied object, PHP call __call instead. Above a real life example: c}"; } static function __callStatic($method, $args){ echo 'Fine!'; } } class B extends A { public $c = 'Real Ops!'; function useCallStatic(){ sta...
After thinking about it, it's not really a bug. But it's definitely unintuitive. foo(); This is valid, and calls bar(). It does not mean call bar statically. It means to look up the current class name and call function bar if it exists, whether or not it's a static function. To clarify a bit more: do you think parent::...
PHP is handling incorrectly my static call I'm havinh a problem on PHP 5.3. I need to call a method by using __callStatic, but if I use it in a instancied object, PHP call __call instead. Above a real life example: c}"; } static function __callStatic($method, $args){ echo 'Fine!'; } } class B extends A { public $c = ...
TITLE: PHP is handling incorrectly my static call QUESTION: I'm havinh a problem on PHP 5.3. I need to call a method by using __callStatic, but if I use it in a instancied object, PHP call __call instead. Above a real life example: c}"; } static function __callStatic($method, $args){ echo 'Fine!'; } } class B extend...
[ "php", "class", "methods", "static", "php-5.3" ]
3
7
1,002
5
0
2011-05-30T23:31:06.933000
2011-05-31T00:04:33.477000
6,181,606
6,181,646
C++ Overloading a Function Based on shared_ptr Derived Class
There are a lot of SO questions which are similar to this, but I couldn't find precisely what I was looking for. I'm sorry if this is a duplicate. I have a Parent class and two derived classes which inherit from it: class Son: public Parent {... }; class Daughter: public Parent {... }; I then declare two shared_ptr to ...
It isn't possible to overload like that, you would need a switch statement to achieve something similar with dispatch within one method on Director. Maybe you should move the process() method to the Parent class (and override it in Son and Daughter ), that way you can use normal virtual function resolution to call the ...
C++ Overloading a Function Based on shared_ptr Derived Class There are a lot of SO questions which are similar to this, but I couldn't find precisely what I was looking for. I'm sorry if this is a duplicate. I have a Parent class and two derived classes which inherit from it: class Son: public Parent {... }; class Daug...
TITLE: C++ Overloading a Function Based on shared_ptr Derived Class QUESTION: There are a lot of SO questions which are similar to this, but I couldn't find precisely what I was looking for. I'm sorry if this is a duplicate. I have a Parent class and two derived classes which inherit from it: class Son: public Parent ...
[ "c++", "inheritance", "polymorphism", "overloading", "shared-ptr" ]
7
7
1,728
3
0
2011-05-30T23:32:24.773000
2011-05-30T23:42:38.547000
6,181,614
6,182,640
Calling lifecycle template methods in ExtJS 4
In the sample code below I created a custom component which uses some lifecycle callback methods like onRender Ext.onReady (function() { Ext.define("Person", { extend: "Ext.Component", constructor: function (config) { this.initConfig(config), this.callParent(); console.log("inside constructor"); return this }, onRend...
i don't know what exactly the answer.. but i try to answer it, please correct me if i wrong.. as far as i know, callparent() is used for call a function in its parent, that function could need parameter to pass and in this case constructor need a array to pass... Ext.onReady (function() { Ext.define("Person", { extend:...
Calling lifecycle template methods in ExtJS 4 In the sample code below I created a custom component which uses some lifecycle callback methods like onRender Ext.onReady (function() { Ext.define("Person", { extend: "Ext.Component", constructor: function (config) { this.initConfig(config), this.callParent(); console.log...
TITLE: Calling lifecycle template methods in ExtJS 4 QUESTION: In the sample code below I created a custom component which uses some lifecycle callback methods like onRender Ext.onReady (function() { Ext.define("Person", { extend: "Ext.Component", constructor: function (config) { this.initConfig(config), this.callPar...
[ "extjs", "extjs4" ]
0
1
2,821
1
0
2011-05-30T23:34:26.377000
2011-05-31T03:08:53.007000
6,181,627
6,181,657
Saving files and listing them in default directory
When I want to save a file I use: FileStream fs = new FileStream(fileName + ".asdf", FileMode.OpenOrCreateOrReadOrBlah); which will save the file in: C:\Users\ME\Documents\Visual Studio 2010\Projects\Project A\Project A\Project A\bin\x86\Debug which is fine but how do i list the files in that particular folder? it will...
In your save, you are not specifying a directory, so it defaults to the current directory. var di = new DirectoryInfo(Directory.GetCurrentDirectory());
Saving files and listing them in default directory When I want to save a file I use: FileStream fs = new FileStream(fileName + ".asdf", FileMode.OpenOrCreateOrReadOrBlah); which will save the file in: C:\Users\ME\Documents\Visual Studio 2010\Projects\Project A\Project A\Project A\bin\x86\Debug which is fine but how do ...
TITLE: Saving files and listing them in default directory QUESTION: When I want to save a file I use: FileStream fs = new FileStream(fileName + ".asdf", FileMode.OpenOrCreateOrReadOrBlah); which will save the file in: C:\Users\ME\Documents\Visual Studio 2010\Projects\Project A\Project A\Project A\bin\x86\Debug which i...
[ "c#", "file", "directory" ]
1
4
3,810
3
0
2011-05-30T23:37:19.770000
2011-05-30T23:45:05.420000
6,181,661
6,197,014
Generating the edit path for a nested resource referenced by multiple models
In routes.rb: resources:cars do resources:reviews end resources:motorcycles do resources:reviews end In ReviewsController: before_filter:find_parent def show @review = Review.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render:xml => @review } end end def edit @review = Review.fi...
It turns out the answer I am looking for can be found with the URL helper "edit_polymorphic_path" (see: http://rubydoc.info/github/rails/rails/master/ActionDispatch/Routing/PolymorphicRoutes ). In order to get the link I am attempting above I was able to accomplish this with: edit_polymorphic_path([@parent, @review])
Generating the edit path for a nested resource referenced by multiple models In routes.rb: resources:cars do resources:reviews end resources:motorcycles do resources:reviews end In ReviewsController: before_filter:find_parent def show @review = Review.find(params[:id]) respond_to do |format| format.html # show.html.e...
TITLE: Generating the edit path for a nested resource referenced by multiple models QUESTION: In routes.rb: resources:cars do resources:reviews end resources:motorcycles do resources:reviews end In ReviewsController: before_filter:find_parent def show @review = Review.find(params[:id]) respond_to do |format| format....
[ "ruby-on-rails", "resources", "routes", "nested" ]
10
16
11,729
3
0
2011-05-30T23:45:57.557000
2011-06-01T06:15:25.513000
6,181,668
6,181,749
Can this perl wrapper function be extended to work with any input function?
Consider the following wrapper function that retrys a given function some given number of times if the function throws (not sure why the formatting is wonky): sub tryit{ my $fun = shift; my $times = shift; my @args = @_; my $ret; do{ $times--; eval{ $ret = $fun->(@args); }; if($@){ print "Error attemping cmd: $@\n"; } ...
You can do this with wantarray. (It is formatting wonky for me, too; sorry) sub tryit{ my $fun = shift; my $times = shift; my @args = @_; my $array_wanted = wantarray; my $ret; my @ret; do{ $times--; eval{ if ($array_wanted) { @ret = $fun->(@args); } else { $ret = $fun->(@args); } }; if($@){ print "Error attemping cmd:...
Can this perl wrapper function be extended to work with any input function? Consider the following wrapper function that retrys a given function some given number of times if the function throws (not sure why the formatting is wonky): sub tryit{ my $fun = shift; my $times = shift; my @args = @_; my $ret; do{ $times--; ...
TITLE: Can this perl wrapper function be extended to work with any input function? QUESTION: Consider the following wrapper function that retrys a given function some given number of times if the function throws (not sure why the formatting is wonky): sub tryit{ my $fun = shift; my $times = shift; my @args = @_; my $r...
[ "perl", "eval" ]
3
5
623
2
0
2011-05-30T23:46:50.083000
2011-05-31T00:06:26.080000
6,181,673
6,181,682
saving contents with file put contents
i'm trying to get google steetview tiles and save them. But file_get_contents doesn't like my url: here's my code: $img = "http://cbk0.google.com/cbk?output=tile&panoid="+$panorama_id+"&zoom=3&x="+$i+"&y='"+$x+"'"; $url = ""+$panorama_id+"Xval"+$i.+"Yval"+$x+".jpg"; file_put_contents($url, file_get_contents($img));
You're using + for concatenation. That's not PHP. You need the dot. operator instead: $img = "http://cbk0.google.com/cbk?output=tile&panoid=". $panorama_id. "&zoom=3&x=". $i. "&y='". $x. "'"; $url = $panorama_id. "Xval". $i. "Yval". $x. ".jpg"; See string operators in the PHP manual. Alternatively, with double quoted s...
saving contents with file put contents i'm trying to get google steetview tiles and save them. But file_get_contents doesn't like my url: here's my code: $img = "http://cbk0.google.com/cbk?output=tile&panoid="+$panorama_id+"&zoom=3&x="+$i+"&y='"+$x+"'"; $url = ""+$panorama_id+"Xval"+$i.+"Yval"+$x+".jpg"; file_put_cont...
TITLE: saving contents with file put contents QUESTION: i'm trying to get google steetview tiles and save them. But file_get_contents doesn't like my url: here's my code: $img = "http://cbk0.google.com/cbk?output=tile&panoid="+$panorama_id+"&zoom=3&x="+$i+"&y='"+$x+"'"; $url = ""+$panorama_id+"Xval"+$i.+"Yval"+$x+".jp...
[ "php", "image", "save" ]
1
1
1,857
1
0
2011-05-30T23:48:11.313000
2011-05-30T23:51:43.373000
6,181,677
6,181,742
order by alphabet PHP, MySql but list the letter before each group
Say I had a table with: First | Last ------------------- Bob Dylan Ashley Scott Lol Cats black cake It would order them but do A: Ashley Scott B: Bob Dylan Black Cake L: lol cats I know how to list by abc from MySql. but i want to have it put the letter before each group of names. So i can make a nice looking interface...
Untested code but something like this should work: $currentleter = substr($name, 0, 1); if ($lastletter!= $currentleter){ echo ' '. $currentleter. ' '; $lastletter = $currentleter; } echo $name;
order by alphabet PHP, MySql but list the letter before each group Say I had a table with: First | Last ------------------- Bob Dylan Ashley Scott Lol Cats black cake It would order them but do A: Ashley Scott B: Bob Dylan Black Cake L: lol cats I know how to list by abc from MySql. but i want to have it put the letter...
TITLE: order by alphabet PHP, MySql but list the letter before each group QUESTION: Say I had a table with: First | Last ------------------- Bob Dylan Ashley Scott Lol Cats black cake It would order them but do A: Ashley Scott B: Bob Dylan Black Cake L: lol cats I know how to list by abc from MySql. but i want to have...
[ "php" ]
2
1
2,317
3
0
2011-05-30T23:49:42.657000
2011-05-31T00:04:46.300000
6,181,683
6,181,729
C++ Strange File Output
I'm trying to read from a simple text file. Whenever I run the program it prints out the file, but not before printing out a bunch of garble. Any suggestions? Garble: Φ#· ├ï Uï∞ Φ╖ ≈╪←└≈╪YH]├ 5tδ╝ abc Buffer.cc //----------------------------------------------------- // TextInputBuffer - Constructor for TextInputBuffer....
I don't think it's reading the first line after opening the file, so it's fetching junk characters from the uninitialised line storage until one happens to be the newline character, at which point it actually reads the first line.
C++ Strange File Output I'm trying to read from a simple text file. Whenever I run the program it prints out the file, but not before printing out a bunch of garble. Any suggestions? Garble: Φ#· ├ï Uï∞ Φ╖ ≈╪←└≈╪YH]├ 5tδ╝ abc Buffer.cc //----------------------------------------------------- // TextInputBuffer - Construc...
TITLE: C++ Strange File Output QUESTION: I'm trying to read from a simple text file. Whenever I run the program it prints out the file, but not before printing out a bunch of garble. Any suggestions? Garble: Φ#· ├ï Uï∞ Φ╖ ≈╪←└≈╪YH]├ 5tδ╝ abc Buffer.cc //----------------------------------------------------- // TextInpu...
[ "c++" ]
2
1
305
2
0
2011-05-30T23:51:44.613000
2011-05-31T00:02:37.263000
6,181,684
6,182,387
How does require rubygems help find rubygem files?
While trying to solve Gem found in irb, not in Ruby, I tried seeing what effect require 'rubygems' had on my own installation: $ irb irb(main):001:0> RUBY_VERSION => "1.8.7" irb(main):002:0> $: ["/usr/local/lib/site_ruby/1.8", "/usr/local/lib/site_ruby/1.8/x86_64-linux", "/usr/local/lib/site_ruby", "/usr/lib/ruby/vendo...
Here's the current version of the relevant source: https://github.com/rubygems/rubygems/blob/02ead548e38ff90923444fa7c0ff9f6a5dbd87b0/lib/rubygems/custom_require.rb. (Edit: here's an earlier version (1.5.2) that more clearly expresses what happens.) The docs say: When RubyGems is required, Kernel#require is replaced wi...
How does require rubygems help find rubygem files? While trying to solve Gem found in irb, not in Ruby, I tried seeing what effect require 'rubygems' had on my own installation: $ irb irb(main):001:0> RUBY_VERSION => "1.8.7" irb(main):002:0> $: ["/usr/local/lib/site_ruby/1.8", "/usr/local/lib/site_ruby/1.8/x86_64-linux...
TITLE: How does require rubygems help find rubygem files? QUESTION: While trying to solve Gem found in irb, not in Ruby, I tried seeing what effect require 'rubygems' had on my own installation: $ irb irb(main):001:0> RUBY_VERSION => "1.8.7" irb(main):002:0> $: ["/usr/local/lib/site_ruby/1.8", "/usr/local/lib/site_rub...
[ "ruby", "rubygems" ]
9
13
2,138
1
0
2011-05-30T23:52:04.823000
2011-05-31T02:21:22.027000
6,181,687
6,181,859
Why redirect_to in around_filter or after_filter won't work?
How to make redirect_to works in those filters? I'm trying to change def start.... redirect_to index end def end... redirect_to index end to around_filter:around def around... yield redirect_to index end def start.. end def stop... end
After the action is complete it renders the template automatically, thus you cannot render / redirect after the request is complete. You could solve this by putting the redirect_to at the end of the actions that you need it for. This is not what around_filters were designed to do.
Why redirect_to in around_filter or after_filter won't work? How to make redirect_to works in those filters? I'm trying to change def start.... redirect_to index end def end... redirect_to index end to around_filter:around def around... yield redirect_to index end def start.. end def stop... end
TITLE: Why redirect_to in around_filter or after_filter won't work? QUESTION: How to make redirect_to works in those filters? I'm trying to change def start.... redirect_to index end def end... redirect_to index end to around_filter:around def around... yield redirect_to index end def start.. end def stop... end ...
[ "ruby-on-rails", "redirect", "filter" ]
1
6
2,393
3
0
2011-05-30T23:52:40.003000
2011-05-31T00:32:57.847000
6,181,688
6,181,753
Create a 20px left padding when this function loops
How can I format this code block so that every time this loop happens, it moves each hyperlink element 20px from the left? It's working at the moment but for the whole div not single items. Example: - LINK 1 -- LINK 2 --- LINK 3 Any help would be appreciated! $linkArray = array(); $thisDir = ''; $baseDir = ($htmlRoot =...
Well hmmm. You are already counting your iterations with the $n variable. SO: EG. for ($n=0; $n '.$thisText.' ': $thisText; if ($thisLink!= '') $linkArray[] = $thisLink; } Note: the first iteration will have a padding of 0px. Not sure if thats how you want it?
Create a 20px left padding when this function loops How can I format this code block so that every time this loop happens, it moves each hyperlink element 20px from the left? It's working at the moment but for the whole div not single items. Example: - LINK 1 -- LINK 2 --- LINK 3 Any help would be appreciated! $linkArr...
TITLE: Create a 20px left padding when this function loops QUESTION: How can I format this code block so that every time this loop happens, it moves each hyperlink element 20px from the left? It's working at the moment but for the whole div not single items. Example: - LINK 1 -- LINK 2 --- LINK 3 Any help would be app...
[ "php", "css", "loops" ]
0
0
145
1
0
2011-05-30T23:53:15.303000
2011-05-31T00:07:46.100000
6,181,689
6,181,701
Help with php regex for limiting allowed characters
I'm working in php and want to set some rules for a submitted text field. I want to allow letters, numbers, spaces, and the symbols # ', - This is what I have: /^(a-z,0-9+# )+$/i That seems to work but when I add the ' or - symbols I get errors.
Almost there. What you're looking for is called character classes. These are denoted by the use of square brackets. For example /^[-a-z0-9+#,' ]+$/i To include the hyphen character, it needs to be the first or last character in the class. Edit As you want to include the single quote and you're using PHP where regular e...
Help with php regex for limiting allowed characters I'm working in php and want to set some rules for a submitted text field. I want to allow letters, numbers, spaces, and the symbols # ', - This is what I have: /^(a-z,0-9+# )+$/i That seems to work but when I add the ' or - symbols I get errors.
TITLE: Help with php regex for limiting allowed characters QUESTION: I'm working in php and want to set some rules for a submitted text field. I want to allow letters, numbers, spaces, and the symbols # ', - This is what I have: /^(a-z,0-9+# )+$/i That seems to work but when I add the ' or - symbols I get errors. ANS...
[ "php", "regex" ]
0
4
426
5
0
2011-05-30T23:53:35.573000
2011-05-30T23:56:48.703000
6,181,695
6,181,916
Rounded corners in MS IE 7 - on Intranet with no access to the outside world - and no JS/HTC
I got a good answer to my previous question Rounded corners in MS IE 7... it was my own stupid fault for forgetting to mention that it is for an intranet which can't access the outside world, and that JS is forbidden, so I can't use HTC. So, here's the question again.. Can I (and, if so, what's the simplest way to) get...
There are a few ways to do it - SpiffyCorners - http://spiffycorners.com/ With images - http://modxcms.com/about/team/rthrash/simple-rounded-corner-css-boxes.html MS VML - http://www.notgeeklycorrect.com/web-development/2010/01/21/easy-rounded-corners-working-in-ie7ie8 Google around there are tons of ways to do this wi...
Rounded corners in MS IE 7 - on Intranet with no access to the outside world - and no JS/HTC I got a good answer to my previous question Rounded corners in MS IE 7... it was my own stupid fault for forgetting to mention that it is for an intranet which can't access the outside world, and that JS is forbidden, so I can'...
TITLE: Rounded corners in MS IE 7 - on Intranet with no access to the outside world - and no JS/HTC QUESTION: I got a good answer to my previous question Rounded corners in MS IE 7... it was my own stupid fault for forgetting to mention that it is for an intranet which can't access the outside world, and that JS is fo...
[ "css", "internet-explorer", "internet-explorer-7", "rounded-corners" ]
1
2
210
1
0
2011-05-30T23:53:54.573000
2011-05-31T00:49:31.347000
6,181,700
6,181,739
what is the best way to convert one dictionary to another
i have one dictionary that has entries that looks like this: dictionary["ABC.123"] = "Test" dictionary["DEF.123"] = "Test2" dictionary["EFG.123"] = "Test3" dictionary["EFG.343"] = "Test3" dictionary["ABC.456"] = "Test" and i want to create a new dictionary that looks like this: (basically parse out the beginning string...
var newDict = dictionary.GroupBy(kvp => kvp.Key.Remove(kvp.Key.IndexOf('.'))).ToDictionary(grp => grp.Key, grp => grp.First().Value); Although a plain foreach is probably going to be more readable and efficient: var newDict = new Dictionary (); foreach (var kvp in dictionary) { newDict[kvp.Key.Remove(kvp.Key.IndexOf('....
what is the best way to convert one dictionary to another i have one dictionary that has entries that looks like this: dictionary["ABC.123"] = "Test" dictionary["DEF.123"] = "Test2" dictionary["EFG.123"] = "Test3" dictionary["EFG.343"] = "Test3" dictionary["ABC.456"] = "Test" and i want to create a new dictionary that ...
TITLE: what is the best way to convert one dictionary to another QUESTION: i have one dictionary that has entries that looks like this: dictionary["ABC.123"] = "Test" dictionary["DEF.123"] = "Test2" dictionary["EFG.123"] = "Test3" dictionary["EFG.343"] = "Test3" dictionary["ABC.456"] = "Test" and i want to create a ne...
[ "c#", "linq", "string", "parsing", "dictionary" ]
6
10
6,498
3
0
2011-05-30T23:54:40.917000
2011-05-31T00:04:40.767000
6,181,705
6,181,735
mySQL select differences between two tables in different databases
I have two databases: old and new. Both have a comments table. There are 100 comments in the old table that are not in the new. Comments have been added to the new table and there is a conflict in IDs so querying by ID will not be an option. I need so isolate the 100 comments that that they can be exported and inserted...
Assuming the tables aren't very large you can run something like this: SELECT * FROM OldDatabase.CommentTable WHERE COMMENT NOT IN (SELECT COMMENT FROM NewDatabase.CommentTable)
mySQL select differences between two tables in different databases I have two databases: old and new. Both have a comments table. There are 100 comments in the old table that are not in the new. Comments have been added to the new table and there is a conflict in IDs so querying by ID will not be an option. I need so i...
TITLE: mySQL select differences between two tables in different databases QUESTION: I have two databases: old and new. Both have a comments table. There are 100 comments in the old table that are not in the new. Comments have been added to the new table and there is a conflict in IDs so querying by ID will not be an o...
[ "mysql", "sql", "data-comparison" ]
10
18
18,622
1
0
2011-05-30T23:57:32.713000
2011-05-31T00:04:18.403000
6,181,706
6,197,735
Sample star schema dataset
I'm looking for some OLAP data preferably in star schema (or snowflake) for testing a new tool. I've already got the Foodmart database that Mondrian provides. Type of data is not important as long as it has dimensions and associated facts. The larger the size the better for load testing. Anybody knows where I can downl...
Apologies for being MS SQL focussed, but the Adventure Works DWH is not bad as far as an snowflake schema design. Not not huge as far as data volumes. With some clever SQL you would be able to generate extra rows in the database. Alternatively try Project Real - a larger DWH project that put together by MS on 2005
Sample star schema dataset I'm looking for some OLAP data preferably in star schema (or snowflake) for testing a new tool. I've already got the Foodmart database that Mondrian provides. Type of data is not important as long as it has dimensions and associated facts. The larger the size the better for load testing. Anyb...
TITLE: Sample star schema dataset QUESTION: I'm looking for some OLAP data preferably in star schema (or snowflake) for testing a new tool. I've already got the Foodmart database that Mondrian provides. Type of data is not important as long as it has dimensions and associated facts. The larger the size the better for ...
[ "database", "sample", "star-schema" ]
5
2
5,695
1
0
2011-05-30T23:57:37.833000
2011-06-01T07:34:11.967000
6,181,720
6,181,875
onItemSelected event fired only by user interaction
I have a viewflipper that contains several layouts. I set an onItemSelected event for spinners that are present on every layout. There's a validation stage after clicking a button where I set the focus to the troubling component after I do a viewflipper.setDisplayedChild(layout_id) to go to the layout that contains it ...
I had a similar problem a while back. What I did was before calling setDisplayedChild unregister the onItemSelected listener (set it to null) then do setDisplayedChild then re-register the onItemSelected listener.
onItemSelected event fired only by user interaction I have a viewflipper that contains several layouts. I set an onItemSelected event for spinners that are present on every layout. There's a validation stage after clicking a button where I set the focus to the troubling component after I do a viewflipper.setDisplayedCh...
TITLE: onItemSelected event fired only by user interaction QUESTION: I have a viewflipper that contains several layouts. I set an onItemSelected event for spinners that are present on every layout. There's a validation stage after clicking a button where I set the focus to the troubling component after I do a viewflip...
[ "android", "events", "android-layout" ]
1
1
480
1
0
2011-05-31T00:01:29.457000
2011-05-31T00:36:49.977000
6,181,728
6,183,838
What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters?
What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters? I wrote these helper classes: public class ExtFilterInfo { public string Field { get; set; } public ExtFilterData Data { get; set; } } public class ExtFilterData { public string Type { get; set; } public string Value { get; set; } }...
A custom model binder looks like it could fit the bill: public class ExtFilterInfoModelBinder: DefaultModelBinder { public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var filter = (ExtFilterInfo)base.BindModel(controllerContext, bindingContext); var field = bind...
What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters? What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters? I wrote these helper classes: public class ExtFilterInfo { public string Field { get; set; } public ExtFilterData Data { get; set; } } public cla...
TITLE: What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters? QUESTION: What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters? I wrote these helper classes: public class ExtFilterInfo { public string Field { get; set; } public ExtFilterData Data { get; se...
[ "asp.net-mvc", "grid", "extjs4" ]
5
4
1,221
1
0
2011-05-31T00:02:37.033000
2011-05-31T06:36:16.200000
6,181,730
6,191,289
Optional Password Confirmation Authlogic
Is it possible to have AuthLogic validate a password confirmation if present, but otherwise ignore it? So, if my params are as following I'd like a failure: { user: { password: "abcd", password_confirmation: "defg" } However if the parameters are instead as following I'd like a success: { user: { password: "abcdefgh" }...
it's not an AuthLogic's matter, this code should do the trick: class User < ActiveRecord::Base... def update_without_password_confirmation(params={}) params.delete(:password) if params[:password_confirmation].blank? params.delete(:password_confirmation) if params[:password].blank? update_attributes(params) end end th...
Optional Password Confirmation Authlogic Is it possible to have AuthLogic validate a password confirmation if present, but otherwise ignore it? So, if my params are as following I'd like a failure: { user: { password: "abcd", password_confirmation: "defg" } However if the parameters are instead as following I'd like a ...
TITLE: Optional Password Confirmation Authlogic QUESTION: Is it possible to have AuthLogic validate a password confirmation if present, but otherwise ignore it? So, if my params are as following I'd like a failure: { user: { password: "abcd", password_confirmation: "defg" } However if the parameters are instead as fol...
[ "ruby-on-rails", "authlogic" ]
3
2
1,092
2
0
2011-05-31T00:02:45.527000
2011-05-31T17:34:23.367000
6,181,734
6,181,793
How to print DateTime variable in the RAISERROR method?
My Stored Procedure accepts two params @EffectiveStartDate DATETIME @EffectiveEndDate DATETIME I wrote the validation code as this: IF(@EffectiveStartDate > @EffectiveEndDate) BEGIN RAISERROR ('SPName: InsertUpdateLiquidityDateRule: Start Date: %s cannot be greater than End Date %s',11,1,CAST(@EffectiveStartDate AS var...
The supplied value must be a constant or a variable. You cannot specify a function name as a parameter value. (from MSDN Executing Stored Procedures ). You need to do something like this: declare @EffectiveStartDateText varchar(30) set @EffectiveStartDateText = cast(@EffectiveStartDate as varchar) declare @EffectiveEn...
How to print DateTime variable in the RAISERROR method? My Stored Procedure accepts two params @EffectiveStartDate DATETIME @EffectiveEndDate DATETIME I wrote the validation code as this: IF(@EffectiveStartDate > @EffectiveEndDate) BEGIN RAISERROR ('SPName: InsertUpdateLiquidityDateRule: Start Date: %s cannot be greate...
TITLE: How to print DateTime variable in the RAISERROR method? QUESTION: My Stored Procedure accepts two params @EffectiveStartDate DATETIME @EffectiveEndDate DATETIME I wrote the validation code as this: IF(@EffectiveStartDate > @EffectiveEndDate) BEGIN RAISERROR ('SPName: InsertUpdateLiquidityDateRule: Start Date: %...
[ "sql", "sql-server", "sql-server-2005", "stored-procedures", "raiserror" ]
37
38
28,526
3
0
2011-05-31T00:04:01.400000
2011-05-31T00:15:35.627000
6,181,744
6,181,898
Limitations of the conditional operator ?:
I am using GCC 4.5 and have observed very peculiar behavior. I am wondering if there is something with this operator that I do not completely understand. I thought I was proficient in C++. I have a thin C++ wrapper class Wnd for Windows HWND objects with an implemented cast operator operator HWND.... If I use the condi...
I suspect that your Wnd has non-explicit conversion constructor too that takes HWND or even int? If so then make it explicit. Your Wnd probably does not have copy constructor and operator= declared? declare these private and don't define them. Also remove operator HWND and add member function HWND hwnd() const; to your...
Limitations of the conditional operator ?: I am using GCC 4.5 and have observed very peculiar behavior. I am wondering if there is something with this operator that I do not completely understand. I thought I was proficient in C++. I have a thin C++ wrapper class Wnd for Windows HWND objects with an implemented cast op...
TITLE: Limitations of the conditional operator ?: QUESTION: I am using GCC 4.5 and have observed very peculiar behavior. I am wondering if there is something with this operator that I do not completely understand. I thought I was proficient in C++. I have a thin C++ wrapper class Wnd for Windows HWND objects with an i...
[ "c++", "conditional-statements", "destructor", "operator-keyword", "conditional-operator" ]
6
4
1,039
3
0
2011-05-31T00:05:17.657000
2011-05-31T00:44:37.310000
6,181,751
6,181,786
Classroom management software; storing data?
So I am working on a mini-project for the summer to keep my coding skills sharp. I will be using the Qt4 and C++ to make a classroom management system for college professors. I just came up with the idea like 10 minutes ago so I don't have much. One question I have is what is the best way to store student/class/assignm...
Since different sites have different database preferences you might wish to use a layer such as ActiveRecord or PDO or ODBC to abstract out the specific database that your end users want to use. This would allow people to deploy onto PostgreSQL or MySQL or whatever they prefer. A good choice for single-process server s...
Classroom management software; storing data? So I am working on a mini-project for the summer to keep my coding skills sharp. I will be using the Qt4 and C++ to make a classroom management system for college professors. I just came up with the idea like 10 minutes ago so I don't have much. One question I have is what i...
TITLE: Classroom management software; storing data? QUESTION: So I am working on a mini-project for the summer to keep my coding skills sharp. I will be using the Qt4 and C++ to make a classroom management system for college professors. I just came up with the idea like 10 minutes ago so I don't have much. One questio...
[ "database", "content-management-system" ]
1
0
244
2
0
2011-05-31T00:06:46.860000
2011-05-31T00:14:38.840000
6,181,757
6,181,770
How do I get the name of a variable variable?
So, I need the actual variable name " varName " from global space. This function is actually a method inside a class. Code is arbitrary for simplicity $varName = 'what ever'; public function save($var) { $i[varName goes here] = $var; } I don't know if this is even possible, but I think maybe with a callback?
If it's a global variable, you might be able to find out the original name with: $varname = array_search($var, $GLOBALS); But that's not overly reliable; a best guess. If two global variables would contain the same value, you would just receive the name of either of them.
How do I get the name of a variable variable? So, I need the actual variable name " varName " from global space. This function is actually a method inside a class. Code is arbitrary for simplicity $varName = 'what ever'; public function save($var) { $i[varName goes here] = $var; } I don't know if this is even possible...
TITLE: How do I get the name of a variable variable? QUESTION: So, I need the actual variable name " varName " from global space. This function is actually a method inside a class. Code is arbitrary for simplicity $varName = 'what ever'; public function save($var) { $i[varName goes here] = $var; } I don't know if thi...
[ "php", "variables" ]
1
1
96
4
0
2011-05-31T00:08:33.287000
2011-05-31T00:10:47.693000
6,181,761
6,182,101
How to measure SQL query cost to appease requirements of SQL Governor?
On a shared hosting provider I am getting an error like: The query has been canceled because the estimated cost of this query (1660) exceeds the configured threshold of 1500. Contact the system administrator. I understand that this is because the SQL Server 2008 instance being used has SQL Governor enabled, and consequ...
Grab a copy of SQL Developer Edition. It's dirt cheap and has all the features of full blown enterprise. With our corporate license we got a license for like $30. If you don't want to buy it you can typically download a 60 day (or longer) trial and at least use it long enough to troubleshoot your situation. http://www....
How to measure SQL query cost to appease requirements of SQL Governor? On a shared hosting provider I am getting an error like: The query has been canceled because the estimated cost of this query (1660) exceeds the configured threshold of 1500. Contact the system administrator. I understand that this is because the SQ...
TITLE: How to measure SQL query cost to appease requirements of SQL Governor? QUESTION: On a shared hosting provider I am getting an error like: The query has been canceled because the estimated cost of this query (1660) exceeds the configured threshold of 1500. Contact the system administrator. I understand that this...
[ "sql-server", "sql-server-2008" ]
3
2
846
1
0
2011-05-31T00:09:21.073000
2011-05-31T01:26:41.520000
6,181,763
6,181,784
Converting a String to a List of Words?
I'm trying to convert a string to a list of words using python. I want to take something like the following: string = 'This is a string, with words!' Then convert to something like this: list = ['This', 'is', 'a', 'string', 'with', 'words'] Notice the omission of punctuation and spaces. What would be the fastest way of...
Try this: import re mystr = 'This is a string, with words!' wordList = re.sub("[^\w]", " ", mystr).split() How it works: From the docs: re.sub(pattern, repl, string, count=0, flags=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. If the p...
Converting a String to a List of Words? I'm trying to convert a string to a list of words using python. I want to take something like the following: string = 'This is a string, with words!' Then convert to something like this: list = ['This', 'is', 'a', 'string', 'with', 'words'] Notice the omission of punctuation and ...
TITLE: Converting a String to a List of Words? QUESTION: I'm trying to convert a string to a list of words using python. I want to take something like the following: string = 'This is a string, with words!' Then convert to something like this: list = ['This', 'is', 'a', 'string', 'with', 'words'] Notice the omission o...
[ "python", "string", "list", "text-segmentation" ]
95
107
263,373
16
0
2011-05-31T00:09:24.393000
2011-05-31T00:13:53.553000
6,181,767
6,181,788
Reusing variables when working with PDO
I have to pull data from at least 3 databases, is there anything wrong with reusing my PDO objects? $dbh = new PDO('mysql:host='. $host. ';dbname='. $db_name, $user, $password); $sth = $dbh->prepare($query1); // do something $dbh = new PDO('mysql:host='. $host2. ';dbname='. $db_name2, $user2, $password2); $sth = $dbh...
When you assign $dbh to a new PDO() you are not technically reusing your pdo object. You are creating a new PDO instance and assigning it to a variable that you have previously used. There is nothing wrong with doing this as long as you understand what is occurring in your program. EDIT: I'm editing my answer to addres...
Reusing variables when working with PDO I have to pull data from at least 3 databases, is there anything wrong with reusing my PDO objects? $dbh = new PDO('mysql:host='. $host. ';dbname='. $db_name, $user, $password); $sth = $dbh->prepare($query1); // do something $dbh = new PDO('mysql:host='. $host2. ';dbname='. $db...
TITLE: Reusing variables when working with PDO QUESTION: I have to pull data from at least 3 databases, is there anything wrong with reusing my PDO objects? $dbh = new PDO('mysql:host='. $host. ';dbname='. $db_name, $user, $password); $sth = $dbh->prepare($query1); // do something $dbh = new PDO('mysql:host='. $host...
[ "php", "mysql", "pdo" ]
3
4
1,036
2
0
2011-05-31T00:10:19.857000
2011-05-31T00:14:47.667000
6,181,773
6,181,945
How to make a decent UI
Please I need help on how to create a nice looking UI. Now I suppose that people looking at this question have an android, if so go to the market. Download a app called, "Quick Settings". It has a great UI and I want to learn how to make mine look as good as that one, if you have any kind of help, it would be appreciat...
A quick Google search brings up lots of good tips, tricks and tools for designing Android UIs. Here are a few: http://www.droiddraw.org/ http://www.androiduipatterns.com/ http://phandroid.com/2011/05/11/10-tips-for-android-ui-design/
How to make a decent UI Please I need help on how to create a nice looking UI. Now I suppose that people looking at this question have an android, if so go to the market. Download a app called, "Quick Settings". It has a great UI and I want to learn how to make mine look as good as that one, if you have any kind of hel...
TITLE: How to make a decent UI QUESTION: Please I need help on how to create a nice looking UI. Now I suppose that people looking at this question have an android, if so go to the market. Download a app called, "Quick Settings". It has a great UI and I want to learn how to make mine look as good as that one, if you ha...
[ "android-layout", "android" ]
6
6
10,551
1
0
2011-05-31T00:11:28.713000
2011-05-31T00:56:06.367000
6,181,777
6,188,732
Android: Query sort rule for Contacts application
Is it possible to query for the sorting rule in Contacts application? I need to know what is the selected rule: "First name" or "Last name" Thank you
OK, for anybody interested in this question here's the solution: The sorting rule of Contacts application is stored in the ContactsContract.Preferences class. However, this class is marked with the @hide annotation. Therefore, you cannot access it. But if you really want it - use reflection!:)
Android: Query sort rule for Contacts application Is it possible to query for the sorting rule in Contacts application? I need to know what is the selected rule: "First name" or "Last name" Thank you
TITLE: Android: Query sort rule for Contacts application QUESTION: Is it possible to query for the sorting rule in Contacts application? I need to know what is the selected rule: "First name" or "Last name" Thank you ANSWER: OK, for anybody interested in this question here's the solution: The sorting rule of Contacts...
[ "android", "android-contacts" ]
1
0
622
2
0
2011-05-31T00:12:00.523000
2011-05-31T14:00:29.580000
6,181,783
6,181,832
How do I construct query strings for ajax url with jquery or javascript?
I'm currently using ajax and jquery to update search results with a form that has different categories for filtering. My problem is that I want to be able to pass different variables to the url I'm using for my ajax from checkboxes and other form elements from the current page. I have the url of " http://example.com/se...
url: 'http://example.com/search/results/?' + $('form').serialize(), or url: 'http://example.com/search/results/?' + $('form').serialize().replace(/&=/, '/'),
How do I construct query strings for ajax url with jquery or javascript? I'm currently using ajax and jquery to update search results with a form that has different categories for filtering. My problem is that I want to be able to pass different variables to the url I'm using for my ajax from checkboxes and other form ...
TITLE: How do I construct query strings for ajax url with jquery or javascript? QUESTION: I'm currently using ajax and jquery to update search results with a form that has different categories for filtering. My problem is that I want to be able to pass different variables to the url I'm using for my ajax from checkbox...
[ "php", "javascript", "jquery", "ajax", "search" ]
3
2
5,914
4
0
2011-05-31T00:13:49.370000
2011-05-31T00:24:16.310000
6,181,785
6,181,835
How do I concatenate one word with all elements of a list in R barplot title?
This is the code I'm currently running: n <- 7 N <- 52 r <- 13 reps <- 1000000 deck <- rep(c('h','d','c','s'), each = r) diamonds <- rep(NA, length.out = reps) pos <- sample(x = 1:52, size = 7, replace = FALSE) for(i in 1:reps) { hand <- sample(x = deck, replace = FALSE)[pos] diamonds[i] <- sum(ifelse(hand == 'd', 1, ...
Use collapse in paste to collapse the multiple elements in a vector containing the base test and pos, paste(c('Positions:', pos), collapse=" ") Otherwise, when you paste "Positions:" to pos you get the former recycled to the length of pos.
How do I concatenate one word with all elements of a list in R barplot title? This is the code I'm currently running: n <- 7 N <- 52 r <- 13 reps <- 1000000 deck <- rep(c('h','d','c','s'), each = r) diamonds <- rep(NA, length.out = reps) pos <- sample(x = 1:52, size = 7, replace = FALSE) for(i in 1:reps) { hand <- sam...
TITLE: How do I concatenate one word with all elements of a list in R barplot title? QUESTION: This is the code I'm currently running: n <- 7 N <- 52 r <- 13 reps <- 1000000 deck <- rep(c('h','d','c','s'), each = r) diamonds <- rep(NA, length.out = reps) pos <- sample(x = 1:52, size = 7, replace = FALSE) for(i in 1:r...
[ "r" ]
1
3
1,127
1
0
2011-05-31T00:14:12.587000
2011-05-31T00:25:48.910000
6,181,789
6,181,838
Do I need to encrypt Paypal Add to Cart buttons?
I've been reading through some of the documentation on Paypal's site regarding the Website Payments Standard option. Unfortunately, some pages are not being found. I know I can use the Paypal Tool for creating encrypted buttons, but these are saved on Paypal's site, and they have to be 'physically' created for each ind...
There is a good tutorial on button encryption here: Encrypted Website Payments—Java Developers Do you really need to encrypt the buttons? I don't think you do, it's just an extra precaution. The tutorial has some good reasons why you'd want to encrypt the contents of your buttons: Encrypted Website Payments
Do I need to encrypt Paypal Add to Cart buttons? I've been reading through some of the documentation on Paypal's site regarding the Website Payments Standard option. Unfortunately, some pages are not being found. I know I can use the Paypal Tool for creating encrypted buttons, but these are saved on Paypal's site, and ...
TITLE: Do I need to encrypt Paypal Add to Cart buttons? QUESTION: I've been reading through some of the documentation on Paypal's site regarding the Website Payments Standard option. Unfortunately, some pages are not being found. I know I can use the Paypal Tool for creating encrypted buttons, but these are saved on P...
[ "java", "encryption", "shopping-cart", "paypal" ]
2
4
866
2
0
2011-05-31T00:14:58.260000
2011-05-31T00:26:18.613000
6,181,794
6,181,816
How can I add a parameter to a HyperLink in WPF?
I have a column in a gridview that has a hyperlink defined in each row. I would like the hyperlink to execute different code depending on some parameters I bind to it. ie. the user clicks the link and in the code behind it looks at a parameter and opens one of four dialog windows. How can I add a parameter? Should I be...
Edit: So apparently Hyperlinks also have commanding, which makes this quite straightforward. See the commanding overview if you are new to commands in WPF. You could wrap it in a lookless Button and only handle the Button.Click, then you can bind a Command to it and utilize the CommandParameter. To make a button lookle...
How can I add a parameter to a HyperLink in WPF? I have a column in a gridview that has a hyperlink defined in each row. I would like the hyperlink to execute different code depending on some parameters I bind to it. ie. the user clicks the link and in the code behind it looks at a parameter and opens one of four dialo...
TITLE: How can I add a parameter to a HyperLink in WPF? QUESTION: I have a column in a gridview that has a hyperlink defined in each row. I would like the hyperlink to execute different code depending on some parameters I bind to it. ie. the user clicks the link and in the code behind it looks at a parameter and opens...
[ "wpf", "parameters", "hyperlink" ]
0
1
2,411
1
0
2011-05-31T00:15:50.590000
2011-05-31T00:20:46.813000
6,181,798
6,181,948
c# winform - using timer to animate drop down menu
I am trying to make an animated drop down menu in winforms. The form would expand when there is a mouse_enter event and contract back to original size when there is a mouse_leave event. I use a timer to control the rate of "animation" to achieve the desired result. upon running the first few times, the "animation" is a...
Based upon what you want to do, here is what I would do. First, create two timers. Call one enterTimer and the other leaveTimer. Hook up their event handlers once (in the setup code like on form_load). Set their intervals also but don't start them. Then, when the Mouse enters, start the enterTimer. When the mouse leave...
c# winform - using timer to animate drop down menu I am trying to make an animated drop down menu in winforms. The form would expand when there is a mouse_enter event and contract back to original size when there is a mouse_leave event. I use a timer to control the rate of "animation" to achieve the desired result. upo...
TITLE: c# winform - using timer to animate drop down menu QUESTION: I am trying to make an animated drop down menu in winforms. The form would expand when there is a mouse_enter event and contract back to original size when there is a mouse_leave event. I use a timer to control the rate of "animation" to achieve the d...
[ "c#", "winforms" ]
1
0
2,583
3
0
2011-05-31T00:17:15.077000
2011-05-31T00:56:43.467000
6,181,801
6,181,852
How do I use MVC jQuery and Ajax together in order to return Json objects
I want to be able to click a button, have a function in my controller return a JSON object that can be used on my page without the page reloading. My controller: //Dont know if HttpPost is right [HttpPost] public ActionResult GetPinPoints() { return jsonobject; } I want to be able to call this and have it return a JSON...
Two Parts: 1) The Controller public JsonResult GetPinPoints() { var stuff = DoStuff(); return Json(stuff); } 2) The View (via JQuery) $('#SomeButtonId').click(function () { $.ajax({ url: '/Controller/GetPinPoints', type: "POST", dataType: "json", success: function(data) { $('#someSuccessDiv').html(data).fadeIn(); //Do...
How do I use MVC jQuery and Ajax together in order to return Json objects I want to be able to click a button, have a function in my controller return a JSON object that can be used on my page without the page reloading. My controller: //Dont know if HttpPost is right [HttpPost] public ActionResult GetPinPoints() { ret...
TITLE: How do I use MVC jQuery and Ajax together in order to return Json objects QUESTION: I want to be able to click a button, have a function in my controller return a JSON object that can be used on my page without the page reloading. My controller: //Dont know if HttpPost is right [HttpPost] public ActionResult Ge...
[ "c#", "asp.net", "asp.net-mvc-3", "razor" ]
1
1
1,183
3
0
2011-05-31T00:17:34.093000
2011-05-31T00:31:23.213000
6,181,807
6,182,015
Are string functions ASCII-safe in PHP?
Some PHP string functions (like strtoupper, etc) are locale dependent. But it is still not clear whether locale is important when I do really know that particular string is made of ASCII (0-127) characters only. Can I be guaranteed that strtoupper('abc..xyz') will always return ABC..XYZ independently of locale. Do PHP ...
Do PHP string functions work the same in ASCII range independent from locale? No, I'm afraid not. The primary counterexample is the dreaded Turkish dotted-I: setlocale(LC_CTYPE, "tr_TR"); echo strtoupper('hi!'); -> 'H\xDD!' ('Hİ!' in ISO-8859-9) In the worst case you may have to provide your own locale-independent str...
Are string functions ASCII-safe in PHP? Some PHP string functions (like strtoupper, etc) are locale dependent. But it is still not clear whether locale is important when I do really know that particular string is made of ASCII (0-127) characters only. Can I be guaranteed that strtoupper('abc..xyz') will always return A...
TITLE: Are string functions ASCII-safe in PHP? QUESTION: Some PHP string functions (like strtoupper, etc) are locale dependent. But it is still not clear whether locale is important when I do really know that particular string is made of ASCII (0-127) characters only. Can I be guaranteed that strtoupper('abc..xyz') wi...
[ "php", "string", "internationalization", "ascii", "locale" ]
7
7
412
2
0
2011-05-31T00:18:15.137000
2011-05-31T01:10:56.253000
6,181,812
6,201,892
Get list of places surrounding user's current location
So, I've seen many questions about this here on SO and in other forums, but no definite answer. It seems like such a basic process, so I don't understand why I can't find any answers for it. In the Android Developer documentation - http://developer.android.com/guide/topics/location/obtaining-user-location.html#Adjustin...
Google APIs Client Library for Java (for HTTP-based APIs) and Google Places API (for Places Data) is the way to go. Using Google Places API
Get list of places surrounding user's current location So, I've seen many questions about this here on SO and in other forums, but no definite answer. It seems like such a basic process, so I don't understand why I can't find any answers for it. In the Android Developer documentation - http://developer.android.com/guid...
TITLE: Get list of places surrounding user's current location QUESTION: So, I've seen many questions about this here on SO and in other forums, but no definite answer. It seems like such a basic process, so I don't understand why I can't find any answers for it. In the Android Developer documentation - http://develope...
[ "android", "search", "google-maps", "location" ]
16
3
33,929
1
0
2011-05-31T00:19:30.123000
2011-06-01T13:26:08.837000