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,179,773 | 6,179,884 | Why does Interface Builder not show me class-specific attributes? | I am trying to implement Tim Keating's answer from here: Loading a Reusable UITableViewCell from a Nib I made a view XIB and assigned the view's Class to UITableViewCell. When I go to the Attributes Inspector though, all I see are the "Simulated User Interface Elements" and "View" sections. I do not see a "Table View C... | You can always select an empty XIB and pick a UITableViewCell element from the object library. | Why does Interface Builder not show me class-specific attributes? I am trying to implement Tim Keating's answer from here: Loading a Reusable UITableViewCell from a Nib I made a view XIB and assigned the view's Class to UITableViewCell. When I go to the Attributes Inspector though, all I see are the "Simulated User Int... | TITLE:
Why does Interface Builder not show me class-specific attributes?
QUESTION:
I am trying to implement Tim Keating's answer from here: Loading a Reusable UITableViewCell from a Nib I made a view XIB and assigned the view's Class to UITableViewCell. When I go to the Attributes Inspector though, all I see are the "... | [
"uitableview",
"interface-builder",
"nib"
] | 0 | 1 | 164 | 1 | 0 | 2011-05-30T18:50:09.377000 | 2011-05-30T19:05:29.527000 |
6,179,776 | 6,181,109 | Android Intent-Filter for http address | I am trying to intercept a couple different links with my app, and I am having trouble with the intent-filter data parameters to do it. Here are the 2 types of links that I want to intercept http://www.domain.com/#id=abcdef123346 http://www.domain.com/social/landing/abcdef123456 I have already decided to have a separat... | I think that the string that pathPattern is matching is "/", and "#id..." is omitted because it is part of the fragment. If you used http://www.domain.com/id/abcdef123456 instead, pathPattern could match "/id/.*" because it is part of the path. | Android Intent-Filter for http address I am trying to intercept a couple different links with my app, and I am having trouble with the intent-filter data parameters to do it. Here are the 2 types of links that I want to intercept http://www.domain.com/#id=abcdef123346 http://www.domain.com/social/landing/abcdef123456 I... | TITLE:
Android Intent-Filter for http address
QUESTION:
I am trying to intercept a couple different links with my app, and I am having trouble with the intent-filter data parameters to do it. Here are the 2 types of links that I want to intercept http://www.domain.com/#id=abcdef123346 http://www.domain.com/social/land... | [
"android",
"android-activity",
"android-intent",
"android-manifest",
"intentfilter"
] | 19 | 4 | 10,822 | 1 | 0 | 2011-05-30T18:50:15.743000 | 2011-05-30T22:04:36.267000 |
6,179,780 | 6,180,255 | Interactive movie / video processing with PyQT / OpenCV | I am starting out on a project in which I need to build a customized annotation tool for movies and video. Some person (not technically minded) will need to pop open a GUI that I create, open either a video file or a directory of frames that result from chopping up a video file, and then use a window (much like QuickTi... | Qt(PyQt) has a good multimedia support via Phonon module. You can easily use that module to achieve Video window, it can provide an easy-to-use video player and you can get playing position etc. | Interactive movie / video processing with PyQT / OpenCV I am starting out on a project in which I need to build a customized annotation tool for movies and video. Some person (not technically minded) will need to pop open a GUI that I create, open either a video file or a directory of frames that result from chopping u... | TITLE:
Interactive movie / video processing with PyQT / OpenCV
QUESTION:
I am starting out on a project in which I need to build a customized annotation tool for movies and video. Some person (not technically minded) will need to pop open a GUI that I create, open either a video file or a directory of frames that resu... | [
"python",
"opencv",
"pyqt",
"video-processing"
] | 1 | 1 | 2,672 | 1 | 0 | 2011-05-30T18:50:56.427000 | 2011-05-30T19:51:13.100000 |
6,179,781 | 6,179,809 | Django isn't finding my objects | I'm running through the django tutorial, and built the sample polls app. I've got 5 polls in the system, visible through the admin interface to me. However, my rudimentary index view and template don't seem to display them(instead, the template defaults to the else clause as if there were no polls). My index view is as... | It could be a simple typo: latest_poll_List should be latest_poll_list with a lower case L on the list. Otherwise maybe try: {% if latest_poll_list.count > 0 %}... {% endif %} Also try: {{ latest_poll_list }} in your template somewhere to see if it prints out the correct list of objects (i.e. the template is getting th... | Django isn't finding my objects I'm running through the django tutorial, and built the sample polls app. I've got 5 polls in the system, visible through the admin interface to me. However, my rudimentary index view and template don't seem to display them(instead, the template defaults to the else clause as if there wer... | TITLE:
Django isn't finding my objects
QUESTION:
I'm running through the django tutorial, and built the sample polls app. I've got 5 polls in the system, visible through the admin interface to me. However, my rudimentary index view and template don't seem to display them(instead, the template defaults to the else clau... | [
"django",
"django-templates",
"django-views"
] | 0 | 3 | 268 | 1 | 0 | 2011-05-30T18:50:57.710000 | 2011-05-30T18:54:22.793000 |
6,179,785 | 6,207,430 | ActionDispatch::ClosedError when testing Rails 3.1 model creation (RSpec/Cucumber) | I am creating a web application with Ruby on Rails 3.1 (RC1). I am using Factory Girl, RSpec and Cucumber (with Capybara ) for testing, but I am experiencing unexpected raised ActionDispatch::ClosedError s some of the times (not every time) when I am creating new users (through the User model's create action). Below is... | This is due to the way rails 3 streams the response now. They posted a fix in edge for the same issue in flash but not in cookies yet. For now I have turned off my request specs. I am going to look at the problem this weekend if no one gets to it before then. https://github.com/rails/rails/issues/1452 | ActionDispatch::ClosedError when testing Rails 3.1 model creation (RSpec/Cucumber) I am creating a web application with Ruby on Rails 3.1 (RC1). I am using Factory Girl, RSpec and Cucumber (with Capybara ) for testing, but I am experiencing unexpected raised ActionDispatch::ClosedError s some of the times (not every ti... | TITLE:
ActionDispatch::ClosedError when testing Rails 3.1 model creation (RSpec/Cucumber)
QUESTION:
I am creating a web application with Ruby on Rails 3.1 (RC1). I am using Factory Girl, RSpec and Cucumber (with Capybara ) for testing, but I am experiencing unexpected raised ActionDispatch::ClosedError s some of the t... | [
"cucumber",
"rspec2",
"factory-bot",
"ruby-on-rails-3.1",
"actiondispatch"
] | 3 | 2 | 857 | 3 | 0 | 2011-05-30T18:51:38.020000 | 2011-06-01T20:44:36.627000 |
6,179,786 | 6,179,815 | iPad loading local HTML into web view with images and javascript | Edit: So the answer was in this post: Loading javascript into a UIWebView from resources You'll find everything you need to know for loading an HTML5 app with directories there, just make sure you drop files on your Xcode project clicking the radio button that reads "Create folder references for any added folders". The... | Indeed, you can load a local HTML in a UIWebView by means of: – loadHTMLString:baseURL: The only thing you should be aware of is how to specify the baseURL so that it goes to your local resources directory. So, if you add in your HTML: this will be found among your project resources. It definitely works. Possibly there... | iPad loading local HTML into web view with images and javascript Edit: So the answer was in this post: Loading javascript into a UIWebView from resources You'll find everything you need to know for loading an HTML5 app with directories there, just make sure you drop files on your Xcode project clicking the radio button... | TITLE:
iPad loading local HTML into web view with images and javascript
QUESTION:
Edit: So the answer was in this post: Loading javascript into a UIWebView from resources You'll find everything you need to know for loading an HTML5 app with directories there, just make sure you drop files on your Xcode project clickin... | [
"iphone",
"ios",
"ipad",
"uiwebview"
] | 5 | 6 | 8,605 | 1 | 0 | 2011-05-30T18:51:45.447000 | 2011-05-30T18:55:52.057000 |
6,179,791 | 6,179,833 | Table join--multiple rows to/ from one column (/ cell) | I have searched for a solution for this problem, but haven't found it (yet), probably because I don't quite know how to explain it properly myself. If it is posted somewhere already, please let me know. What I have is three databases that are related to each other; main, pieces & groups. Basically, the main database co... | For a many-to-many relationship, you need to create a joining table. Rather than storing a list of groups in a single column, you should split that column out into multiple rows in a separate table. This will allow you to perform set based functions on them and will significantly speed up the database, as well as makin... | Table join--multiple rows to/ from one column (/ cell) I have searched for a solution for this problem, but haven't found it (yet), probably because I don't quite know how to explain it properly myself. If it is posted somewhere already, please let me know. What I have is three databases that are related to each other;... | TITLE:
Table join--multiple rows to/ from one column (/ cell)
QUESTION:
I have searched for a solution for this problem, but haven't found it (yet), probably because I don't quite know how to explain it properly myself. If it is posted somewhere already, please let me know. What I have is three databases that are rela... | [
"mysql",
"join",
"rows"
] | 0 | 0 | 581 | 1 | 0 | 2011-05-30T18:52:17.877000 | 2011-05-30T18:58:43.477000 |
6,179,808 | 6,254,751 | Vim(ruby):NoMethodError: undefined method `specifications' | I'm using Vim 7.3 on Windows 7. When I try to open a.rb File i get this error. Vim(ruby):NoMethodError: undefined method `specifications' for "C:/Ruby192/lib/ruby/gems/1.9.1":String The file opens after I press Enter, but with no syntax highlighting. I have the following vim plugins: rails.vim surround.vim nerd_tree.vi... | I'm not sure if the problem is with one of the vim plugins. I just installed all the plugins you mentioned in win7 and I have no such problem. However I had a similar error reproduced when I had rubygems 1.8.5, and I tried to run a rake task. Here is a link to a forum that talks about that same rubygems error link To f... | Vim(ruby):NoMethodError: undefined method `specifications' I'm using Vim 7.3 on Windows 7. When I try to open a.rb File i get this error. Vim(ruby):NoMethodError: undefined method `specifications' for "C:/Ruby192/lib/ruby/gems/1.9.1":String The file opens after I press Enter, but with no syntax highlighting. I have the... | TITLE:
Vim(ruby):NoMethodError: undefined method `specifications'
QUESTION:
I'm using Vim 7.3 on Windows 7. When I try to open a.rb File i get this error. Vim(ruby):NoMethodError: undefined method `specifications' for "C:/Ruby192/lib/ruby/gems/1.9.1":String The file opens after I press Enter, but with no syntax highli... | [
"ruby-on-rails",
"ruby",
"vim"
] | 2 | 5 | 1,213 | 2 | 0 | 2011-05-30T18:54:13.043000 | 2011-06-06T16:00:08.367000 |
6,179,810 | 6,179,822 | Alternate div background color | I have a structure like the following: blah stuff And it repeats throughout a dynamic page a few times. I would like to alternate the background colors of the div class "post" with two colors, but CSS's nth-child pseudo class only seems to work with items that are directly sequential. Is there a way (CSS, Javascript, j... | jQuery's:odd and:even selectors are pretty handy: $(".post:even").css("background-color","blue"); $(".post:odd").css("background-color","red"); HTML: blah stuff blah stuff... http://jsfiddle.net/thomas4g/uaYd9/2/ EDIT: The non-jQuery, quick JS way: var posts = document.getElementsByClassName("post"); for(var i=0;i | Alternate div background color I have a structure like the following: blah stuff And it repeats throughout a dynamic page a few times. I would like to alternate the background colors of the div class "post" with two colors, but CSS's nth-child pseudo class only seems to work with items that are directly sequential. Is ... | TITLE:
Alternate div background color
QUESTION:
I have a structure like the following: blah stuff And it repeats throughout a dynamic page a few times. I would like to alternate the background colors of the div class "post" with two colors, but CSS's nth-child pseudo class only seems to work with items that are direct... | [
"javascript",
"jquery",
"css",
"dom",
"pseudo-class"
] | 14 | 27 | 11,453 | 6 | 0 | 2011-05-30T18:54:52.653000 | 2011-05-30T18:57:41.043000 |
6,179,811 | 6,180,951 | How to automatically copy from clipboard when the extension icon is clicked? | I am creating a simple text box in my Google chrome extension popup: The textbox will be used to perform a search. I have already set the focus on the textbox document.getElementById('textbox').focus() How can I automatically copy the text on the system clipboard to the textbox, and select the copied text? | Sorry, it is not possible, not even with flash. Flash 9 was able to access the clipboard, but then in Flash 10 this was prohibited. Flash 10 now can only copy to clipboard, and only when you actually click it. There used to be experimental.clipboard.* API in Chrome (or something like that), but it is gone now. | How to automatically copy from clipboard when the extension icon is clicked? I am creating a simple text box in my Google chrome extension popup: The textbox will be used to perform a search. I have already set the focus on the textbox document.getElementById('textbox').focus() How can I automatically copy the text on ... | TITLE:
How to automatically copy from clipboard when the extension icon is clicked?
QUESTION:
I am creating a simple text box in my Google chrome extension popup: The textbox will be used to perform a search. I have already set the focus on the textbox document.getElementById('textbox').focus() How can I automatically... | [
"javascript",
"html",
"windows",
"google-chrome",
"google-chrome-extension"
] | 0 | 2 | 533 | 1 | 0 | 2011-05-30T18:55:16.313000 | 2011-05-30T21:35:39.997000 |
6,179,812 | 6,179,836 | C++ variadic constructor - pass to parent constructor | I have th following code: class A{
//Constructor public: A(int count,...){ va_list vl; va_start(vl,count); for(int i=0;i How can I do that? Note: I would prefer to have call the constructor in the initialization list and not in the constructor body. But if this is the only way, I am also interested to hear how this wo... | You cannot forward on to an ellipsis. The second constructor will have to take a va_list, I think it is. This would be possible with C++0x's base constructor forwarding, or variadic templates. | C++ variadic constructor - pass to parent constructor I have th following code: class A{
//Constructor public: A(int count,...){ va_list vl; va_start(vl,count); for(int i=0;i How can I do that? Note: I would prefer to have call the constructor in the initialization list and not in the constructor body. But if this is ... | TITLE:
C++ variadic constructor - pass to parent constructor
QUESTION:
I have th following code: class A{
//Constructor public: A(int count,...){ va_list vl; va_start(vl,count); for(int i=0;i How can I do that? Note: I would prefer to have call the constructor in the initialization list and not in the constructor bod... | [
"c++",
"inheritance",
"constructor",
"overriding"
] | 4 | 3 | 2,949 | 1 | 0 | 2011-05-30T18:55:24.303000 | 2011-05-30T18:58:47.300000 |
6,179,817 | 6,179,949 | How does the setter of a Core Date attribute manage memory? | Does a setter of a CoreData-attribute retains? or copies the value or what does the setter? I want to know if I have to (auto-)release the value that I am putting into the setter. I've done some quick tests on that. Assuming the following model: +----------+ | Class A | +----------+ | v:int32 | +----------+ The generat... | Firstly - Don't worry about how Core Data manages it's properties - As long as you release the objects that you own, that's what matters. Secondly - you're testing using NSNumber. NSNumber is a strange class that adopts the flyweight design pattern, so getting the retainCount of an NSNumber isn't going to tell you anyt... | How does the setter of a Core Date attribute manage memory? Does a setter of a CoreData-attribute retains? or copies the value or what does the setter? I want to know if I have to (auto-)release the value that I am putting into the setter. I've done some quick tests on that. Assuming the following model: +----------+ |... | TITLE:
How does the setter of a Core Date attribute manage memory?
QUESTION:
Does a setter of a CoreData-attribute retains? or copies the value or what does the setter? I want to know if I have to (auto-)release the value that I am putting into the setter. I've done some quick tests on that. Assuming the following mod... | [
"iphone",
"objective-c",
"core-data"
] | 1 | 3 | 199 | 3 | 0 | 2011-05-30T18:56:08.967000 | 2011-05-30T19:14:54.023000 |
6,179,838 | 6,179,885 | Setting width of table cells with CSS | I have a HTML table where I must set the overall width and want to make sure the label column doesn't get too wide. It works as expected in Firefox 4, but IE 9 seems to completely ignore the with property. Caption Label Stuff... Label Stuff... | Add as the very first line to get Standards Mode (not directly related to your problem, but you should definitely do it unless you like IE9 pretending to be IE5 - Quirks Mode ). Set the overall width of the table on table instead of th.caption. See: http://jsbin.com/icafo3 Caption Label Stuff... Label Stuff... | Setting width of table cells with CSS I have a HTML table where I must set the overall width and want to make sure the label column doesn't get too wide. It works as expected in Firefox 4, but IE 9 seems to completely ignore the with property. Caption Label Stuff... Label Stuff... | TITLE:
Setting width of table cells with CSS
QUESTION:
I have a HTML table where I must set the overall width and want to make sure the label column doesn't get too wide. It works as expected in Firefox 4, but IE 9 seems to completely ignore the with property. Caption Label Stuff... Label Stuff...
ANSWER:
Add as the ... | [
"html",
"css",
"internet-explorer",
"firefox",
"cross-browser"
] | 0 | 4 | 1,411 | 1 | 0 | 2011-05-30T18:59:25.393000 | 2011-05-30T19:05:29.903000 |
6,179,841 | 6,188,200 | How to manually click a Jquery multiselect box? | I have a few multi select boxes on a page. When the user clicks a certain checkbox, I would like one of the multiselect boxes on the page to automatically be clicked with a certain value. Do you have any idea of how to do this? Thank you! $("#select_country").multiselect({ multiple: false, header: "Select a country", n... | See if this helps (demo @ http://jsfiddle.net/ehynds/PKypd/ ): var second = $("#select_something").multiselect();
$("#select_country").multiselect({ multiple: false, header: "Select a country", noneSelectedText: "Select a country", selectedList: 1, click: function( event, ui ) {
// if the user clicks "usa", check the... | How to manually click a Jquery multiselect box? I have a few multi select boxes on a page. When the user clicks a certain checkbox, I would like one of the multiselect boxes on the page to automatically be clicked with a certain value. Do you have any idea of how to do this? Thank you! $("#select_country").multiselect(... | TITLE:
How to manually click a Jquery multiselect box?
QUESTION:
I have a few multi select boxes on a page. When the user clicks a certain checkbox, I would like one of the multiselect boxes on the page to automatically be clicked with a certain value. Do you have any idea of how to do this? Thank you! $("#select_coun... | [
"jquery"
] | 1 | 1 | 6,012 | 2 | 0 | 2011-05-30T18:59:38.003000 | 2011-05-31T13:17:50.443000 |
6,179,845 | 6,195,874 | CakePhp record is deleted,but it should be updated? | I have edit screen that should edit in several tables some data,problem is that,that data isn't edited,it is deleted after I submit it.Everything looks fine,what could be the problem? I didn't pass any code here,because code is huge,so can someone just give me a hint where to search to fix this problem. model relations... | It is hard to unstand what happening without any code example. The only thing i can think of that would cause something like this is a habtm relationship. If the relationship is has and belongs to many, the the existing records are deleted before save. You can change your model so that the relationship sets unique to f... | CakePhp record is deleted,but it should be updated? I have edit screen that should edit in several tables some data,problem is that,that data isn't edited,it is deleted after I submit it.Everything looks fine,what could be the problem? I didn't pass any code here,because code is huge,so can someone just give me a hint ... | TITLE:
CakePhp record is deleted,but it should be updated?
QUESTION:
I have edit screen that should edit in several tables some data,problem is that,that data isn't edited,it is deleted after I submit it.Everything looks fine,what could be the problem? I didn't pass any code here,because code is huge,so can someone ju... | [
"cakephp-1.3"
] | 0 | 1 | 105 | 1 | 0 | 2011-05-30T18:59:55.990000 | 2011-06-01T03:13:47.667000 |
6,179,846 | 6,188,422 | How to reconnect to running emulator? | When I connect the phone to a USB port, in order to be able to use the phone, I have to kill/start ADB server from the console via adb kill-server & adb start-server. After this, Intellij losts connection to the already running emulator. I know that if I restart an emulator, I will get the connection back. Is there a f... | You can attach to already running emulator via a "cloud" button in Android Logcat pane: Sometimes this button needs to be toggled several times to have effect. In IDEA 10.5 there is now a button that also attaches debugger to already running Android app: http://blogs.jetbrains.com/idea/2011/05/new-in-105-attach-debugge... | How to reconnect to running emulator? When I connect the phone to a USB port, in order to be able to use the phone, I have to kill/start ADB server from the console via adb kill-server & adb start-server. After this, Intellij losts connection to the already running emulator. I know that if I restart an emulator, I will... | TITLE:
How to reconnect to running emulator?
QUESTION:
When I connect the phone to a USB port, in order to be able to use the phone, I have to kill/start ADB server from the console via adb kill-server & adb start-server. After this, Intellij losts connection to the already running emulator. I know that if I restart a... | [
"android-emulator",
"intellij-idea"
] | 0 | 1 | 1,277 | 1 | 0 | 2011-05-30T18:59:59.043000 | 2011-05-31T13:36:20.423000 |
6,179,847 | 6,179,952 | OpenGL light not working | I am using this code to draw different cubes with different colors using the LWJGL: GL11.glBegin(GL11.GL_QUADS); GL11.glColor3f(rcol.x, rcol.y, rcol.z); // Color Vector GL11.glVertex3f(rpos.x + rsiz.x, rpos.y + rsiz.y, rpos.z - rsiz.z); // Top Right Of The Quad (Top) GL11.glVertex3f(rpos.x - rsiz.x, rpos.y + rsiz.y, rp... | You need to define the normal vector to your quads with glNormal3f. The normal vector is used for lighting calculations. The normal vector is perpendicular to your surface. So, for example, with your first quad: GL11.glVertex3f(rpos.x + rsiz.x, rpos.y + rsiz.y, rpos.z - rsiz.z); // Top Right Of The Quad (Top) GL11.glVe... | OpenGL light not working I am using this code to draw different cubes with different colors using the LWJGL: GL11.glBegin(GL11.GL_QUADS); GL11.glColor3f(rcol.x, rcol.y, rcol.z); // Color Vector GL11.glVertex3f(rpos.x + rsiz.x, rpos.y + rsiz.y, rpos.z - rsiz.z); // Top Right Of The Quad (Top) GL11.glVertex3f(rpos.x - rs... | TITLE:
OpenGL light not working
QUESTION:
I am using this code to draw different cubes with different colors using the LWJGL: GL11.glBegin(GL11.GL_QUADS); GL11.glColor3f(rcol.x, rcol.y, rcol.z); // Color Vector GL11.glVertex3f(rpos.x + rsiz.x, rpos.y + rsiz.y, rpos.z - rsiz.z); // Top Right Of The Quad (Top) GL11.glVe... | [
"java",
"opengl",
"lighting"
] | 2 | 6 | 534 | 1 | 0 | 2011-05-30T19:00:01.577000 | 2011-05-30T19:15:17.607000 |
6,179,848 | 6,179,857 | Where to find the documentation for malloc() and related C-functions in iOS? | The documentation Browser of Xcode is not aware of malloc. I want to read the documentation of these functions but can't find it. Where to look? | In Xcode 4, when you search the documentation browser for malloc, you will see a result under "System Guides" called "iOS Manual Pages". This links to manpages for various BSD functions, including malloc. Honestly, though, I would just go over to Terminal and type in man malloc, as the iOS environment is close enough t... | Where to find the documentation for malloc() and related C-functions in iOS? The documentation Browser of Xcode is not aware of malloc. I want to read the documentation of these functions but can't find it. Where to look? | TITLE:
Where to find the documentation for malloc() and related C-functions in iOS?
QUESTION:
The documentation Browser of Xcode is not aware of malloc. I want to read the documentation of these functions but can't find it. Where to look?
ANSWER:
In Xcode 4, when you search the documentation browser for malloc, you w... | [
"objective-c",
"ios",
"malloc"
] | 2 | 4 | 233 | 1 | 0 | 2011-05-30T19:00:16.223000 | 2011-05-30T19:02:29.960000 |
6,179,849 | 6,179,881 | Make sure a specific setInterval function instance is running only once | I'm working on a div (parent) that has two other divs (menu and content) as follow: The content loaded in content div is an html file that has a few javascript functions, such as an auto-refresh that reloads its content every 5 seconds. $(document).ready(function () { setInterval(function () { grid.reloadDefaultContent... | This should do it: var interval; // make sure that is defined outside of the loaded div content $(document).ready(function () { if (typeof interval!= "number"){ interval = setInterval(function () { grid.reloadDefaultContent(); }, 2000); } }); It will only initiate one instance of the interval timer. | Make sure a specific setInterval function instance is running only once I'm working on a div (parent) that has two other divs (menu and content) as follow: The content loaded in content div is an html file that has a few javascript functions, such as an auto-refresh that reloads its content every 5 seconds. $(document)... | TITLE:
Make sure a specific setInterval function instance is running only once
QUESTION:
I'm working on a div (parent) that has two other divs (menu and content) as follow: The content loaded in content div is an html file that has a few javascript functions, such as an auto-refresh that reloads its content every 5 se... | [
"javascript",
"jquery",
"setinterval"
] | 6 | 6 | 4,856 | 5 | 0 | 2011-05-30T19:00:39.467000 | 2011-05-30T19:05:23.690000 |
6,179,871 | 6,191,394 | MongoDB wildcard in the key of a query | Is it possible to wildcard the key in a query? For instance, given the following record, I'd like to do a.find({'a.*': 4}) This was discussed here https://jira.mongodb.org/browse/SERVER-267 but it looks like it's not been resolved. { 'a': { 'b': [1, 2], 'c': [3, 4] } } | As asked, this is not possible. The server issue you linked to is still under "issues we're not sure of". MongoDB has some intelligence surrounding the use of arrays, and I think that's part of the complexity surrounding such a feature. Take the following query db.foo.find({ 'a.b': 4 } ). This query will match the foll... | MongoDB wildcard in the key of a query Is it possible to wildcard the key in a query? For instance, given the following record, I'd like to do a.find({'a.*': 4}) This was discussed here https://jira.mongodb.org/browse/SERVER-267 but it looks like it's not been resolved. { 'a': { 'b': [1, 2], 'c': [3, 4] } } | TITLE:
MongoDB wildcard in the key of a query
QUESTION:
Is it possible to wildcard the key in a query? For instance, given the following record, I'd like to do a.find({'a.*': 4}) This was discussed here https://jira.mongodb.org/browse/SERVER-267 but it looks like it's not been resolved. { 'a': { 'b': [1, 2], 'c': [3, ... | [
"mongodb",
"mongodb-query",
"wildcard"
] | 41 | 14 | 36,041 | 3 | 0 | 2011-05-30T19:04:20.387000 | 2011-05-31T17:44:08.153000 |
6,179,878 | 6,179,930 | .NET Resource ANSI encoding | I have a.NET resource which is ANSI ISO 8859-1 encoding. But when I access my reosource in code like MyResource.Resource1 it is read in some default encoding (may be Encoding.Default or something else). I don't see a way to specify resource encoding. | It depends on how you are getting the resource. If you are using the GetManifestResoruceStream method on the Assembly class (if it is an embedded resource), then you are getting a Stream; the encoding is left to you to decide. If you are using the ResourceManager class then you should use the GetStream method; this wil... | .NET Resource ANSI encoding I have a.NET resource which is ANSI ISO 8859-1 encoding. But when I access my reosource in code like MyResource.Resource1 it is read in some default encoding (may be Encoding.Default or something else). I don't see a way to specify resource encoding. | TITLE:
.NET Resource ANSI encoding
QUESTION:
I have a.NET resource which is ANSI ISO 8859-1 encoding. But when I access my reosource in code like MyResource.Resource1 it is read in some default encoding (may be Encoding.Default or something else). I don't see a way to specify resource encoding.
ANSWER:
It depends on ... | [
".net",
"encoding",
"resources"
] | 0 | 2 | 558 | 2 | 0 | 2011-05-30T19:04:55.677000 | 2011-05-30T19:11:26.143000 |
6,179,888 | 6,180,049 | Target specifies product type 'com.apple.product-type.framework' | I'm trying to use a Soundcloud API wrapper for the iPhone following these instructions and now I'm getting this error: target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform Any ideas on how to solve this? | The SoundCloud API has two products: SoundCloudAPI.framework (a framework, for Mac OS X) libSoundCloudAPI.a (a static library, for iOS) If you're building an app for iOS you need to add libSoundCloudAPI.a only as a direct dependency. You've added the framework as a dependency too, which is why you're getting this error... | Target specifies product type 'com.apple.product-type.framework' I'm trying to use a Soundcloud API wrapper for the iPhone following these instructions and now I'm getting this error: target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform Any ideas... | TITLE:
Target specifies product type 'com.apple.product-type.framework'
QUESTION:
I'm trying to use a Soundcloud API wrapper for the iPhone following these instructions and now I'm getting this error: target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' ... | [
"ios",
"objective-c",
"xcode",
"soundcloud"
] | 3 | 3 | 11,777 | 1 | 0 | 2011-05-30T19:05:41.617000 | 2011-05-30T19:27:56.167000 |
6,179,889 | 6,179,901 | Google + Meta Description + Line break = Possible? | Is it possible to include line breaks in the description of a page shown in Google search results? | No. You can't use html; and HTML ignores whitespace (when it's not used inside a text tag) so it doesn't matter if there's a space (\n\r,etc) or not; google parser will just grab the string, strip any bad code and place the text alone. Take into consideration that Google will grab 150 characters from the description me... | Google + Meta Description + Line break = Possible? Is it possible to include line breaks in the description of a page shown in Google search results? | TITLE:
Google + Meta Description + Line break = Possible?
QUESTION:
Is it possible to include line breaks in the description of a page shown in Google search results?
ANSWER:
No. You can't use html; and HTML ignores whitespace (when it's not used inside a text tag) so it doesn't matter if there's a space (\n\r,etc) o... | [
"html",
"seo",
"meta-tags"
] | 14 | 9 | 13,608 | 2 | 0 | 2011-05-30T19:05:42.587000 | 2011-05-30T19:06:37.730000 |
6,179,892 | 6,179,915 | Checking if a stream is empty | I am trying to deserialize a XML-file. I need to check if the XML-file stream is empty before tying to deserialize it. IsolatedStorageFileStream isfs1 = new IsolatedStorageFileStream("test.xml", FileMode.Open, FileAccess.Read, isf);
// Deserialize the XML to an object Settings s = new Settings(); SoapFormatter SF= new... | Check the Length property of the stream. Length represents the number of bytes currently in the file. If it is 0, the file is empty. | Checking if a stream is empty I am trying to deserialize a XML-file. I need to check if the XML-file stream is empty before tying to deserialize it. IsolatedStorageFileStream isfs1 = new IsolatedStorageFileStream("test.xml", FileMode.Open, FileAccess.Read, isf);
// Deserialize the XML to an object Settings s = new Set... | TITLE:
Checking if a stream is empty
QUESTION:
I am trying to deserialize a XML-file. I need to check if the XML-file stream is empty before tying to deserialize it. IsolatedStorageFileStream isfs1 = new IsolatedStorageFileStream("test.xml", FileMode.Open, FileAccess.Read, isf);
// Deserialize the XML to an object Se... | [
"c#",
".net",
"stream",
"deserialization"
] | 36 | 57 | 48,746 | 5 | 0 | 2011-05-30T19:05:52.793000 | 2011-05-30T19:09:08.563000 |
6,179,896 | 6,179,924 | Null Reference Problem In Inherited Object | I am trying to code simple membership class. First class name is Customer and it has others classes like Silver_Customer, Gold_Customer which are inherited from Customer class. I use these classes in my simple windows application: public Customer customer; public Form_MURAT_TURAN() { InitializeComponent(); } private vo... | In btnCustomer_Click, you are not setting your global customer object. You are setting a local version of it. Change your code as follows: private void btnCustomer_Click(object sender, EventArgs e) { customer = new Standard_Customer(txtName.Text, txtSurname.Text, 0); | Null Reference Problem In Inherited Object I am trying to code simple membership class. First class name is Customer and it has others classes like Silver_Customer, Gold_Customer which are inherited from Customer class. I use these classes in my simple windows application: public Customer customer; public Form_MURAT_TU... | TITLE:
Null Reference Problem In Inherited Object
QUESTION:
I am trying to code simple membership class. First class name is Customer and it has others classes like Silver_Customer, Gold_Customer which are inherited from Customer class. I use these classes in my simple windows application: public Customer customer; pu... | [
"c#",
"inheritance",
"nullreferenceexception"
] | 0 | 1 | 551 | 2 | 0 | 2011-05-30T19:06:20.883000 | 2011-05-30T19:09:57.847000 |
6,179,898 | 6,180,502 | Django error only on MySQL database | Locally I use sqllite3 as a database, but in production I use MySQL. When I moved my project to production I encountered this error:... File "S:\Python27\lib\site-packages\django\templatetags\i18n.py", line 46, in render langs = self.languages.resolve(context) File "S:\Python27\lib\site-packages\django\template\base.py... | Is the traceback the same if you enable DEBUG temporarily? Error messages can be misleading when it is disabled. It could as well be a wrong database setting and Django bails out at a different stage. | Django error only on MySQL database Locally I use sqllite3 as a database, but in production I use MySQL. When I moved my project to production I encountered this error:... File "S:\Python27\lib\site-packages\django\templatetags\i18n.py", line 46, in render langs = self.languages.resolve(context) File "S:\Python27\lib\s... | TITLE:
Django error only on MySQL database
QUESTION:
Locally I use sqllite3 as a database, but in production I use MySQL. When I moved my project to production I encountered this error:... File "S:\Python27\lib\site-packages\django\templatetags\i18n.py", line 46, in render langs = self.languages.resolve(context) File ... | [
"mysql",
"django",
"django-templates",
"django-views",
"mysql-error-1242"
] | 0 | 2 | 637 | 2 | 0 | 2011-05-30T19:06:25.610000 | 2011-05-30T20:26:23.073000 |
6,179,903 | 6,186,851 | Automapper - concrete object to array | I need to map some values from a class to an array. For example: public class Employee { public string name; public int age; public int cars; } must be converted to [age, cars] I tried with this var employee = new Employee() { name = "test", age = 20, cars = 1 };
int[] array = new int[] {};
Mapper.CreateMap ().ForMem... | I found a good solution. Using the ConstructUsing feature is the way to go. [Test] public void CanConvertEmployeeToArray() {
var employee = new Employee() { name = "test", age = 20, cars = 1 };
Mapper.CreateMap ().ConstructUsing( x => new int[] { x.age, x.cars } );
var array = Mapper.Map (employee);
Assert.That(emp... | Automapper - concrete object to array I need to map some values from a class to an array. For example: public class Employee { public string name; public int age; public int cars; } must be converted to [age, cars] I tried with this var employee = new Employee() { name = "test", age = 20, cars = 1 };
int[] array = new... | TITLE:
Automapper - concrete object to array
QUESTION:
I need to map some values from a class to an array. For example: public class Employee { public string name; public int age; public int cars; } must be converted to [age, cars] I tried with this var employee = new Employee() { name = "test", age = 20, cars = 1 };
... | [
"automapper"
] | 4 | 7 | 3,875 | 1 | 0 | 2011-05-30T19:07:06.687000 | 2011-05-31T11:25:45.847000 |
6,179,910 | 6,179,997 | To add OpenID like SO, do I have to implement each OpenID separately | I see that most sites that allow you to login with OpenID have several OpenID providers listed, like Yahoo, Google, myopenID, etc. If I want to offer the same features to my site users (allow them to login with their Yahoo or Gmail, etc.) do I have to add each OpenID provider separately? What I mean is, do I have to go... | Yes, you would have to do provider-specific work to build each integration, test them and maintain them if those providers change their interfaces or APIs. Or, you could save yourself all the bother of building integrations with each service and instead use a "social login" service like Janrain or Gigya. They're not fr... | To add OpenID like SO, do I have to implement each OpenID separately I see that most sites that allow you to login with OpenID have several OpenID providers listed, like Yahoo, Google, myopenID, etc. If I want to offer the same features to my site users (allow them to login with their Yahoo or Gmail, etc.) do I have to... | TITLE:
To add OpenID like SO, do I have to implement each OpenID separately
QUESTION:
I see that most sites that allow you to login with OpenID have several OpenID providers listed, like Yahoo, Google, myopenID, etc. If I want to offer the same features to my site users (allow them to login with their Yahoo or Gmail, ... | [
"php",
"web-applications",
"authentication",
"openid"
] | 5 | 4 | 168 | 1 | 0 | 2011-05-30T19:08:08.713000 | 2011-05-30T19:20:25.077000 |
6,179,920 | 6,181,117 | CSS Positioning problem (understanding floats margin-left/right/auto) | Its not letting me post an image but here it is if you can see this: http://i49.photobucket.com/albums/f272/huntmur/DIV-QUES.gif I think this will be more clear, D2,D3 & D4 have be next to each other and centered on the screen at all times.(960px) D2-680px, D3-10px, D4-270px (all three together & must be centered on sc... | I don't think either of these ideas is exactly what you wanted, but hopefully one of them is close enough. Idea #2: http://jsfiddle.net/DXmLE/ HTML: d1 d2 d3 d4 CSS: html, body { margin: 0; padding: 0 } #container { width: 100%; display: table; table-layout: fixed } #container > div { display: table-cell; height:60px }... | CSS Positioning problem (understanding floats margin-left/right/auto) Its not letting me post an image but here it is if you can see this: http://i49.photobucket.com/albums/f272/huntmur/DIV-QUES.gif I think this will be more clear, D2,D3 & D4 have be next to each other and centered on the screen at all times.(960px) D2... | TITLE:
CSS Positioning problem (understanding floats margin-left/right/auto)
QUESTION:
Its not letting me post an image but here it is if you can see this: http://i49.photobucket.com/albums/f272/huntmur/DIV-QUES.gif I think this will be more clear, D2,D3 & D4 have be next to each other and centered on the screen at al... | [
"css"
] | 2 | 0 | 977 | 1 | 0 | 2011-05-30T19:09:32.757000 | 2011-05-30T22:06:04.847000 |
6,179,921 | 6,179,963 | Loading XmlDocument via HttpWebRequest | I need to load an XmlDocument from a URL. This has been working but it appears I may need to specify a user agent string. Since XmlDocument doesn't support this directly, I'm trying to do this via HttpWebRequest: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.UserAgent = "My User Agent"; xml.L... | GetRequestStream () is for request-data. Check out GetResponse ( ) instead. | Loading XmlDocument via HttpWebRequest I need to load an XmlDocument from a URL. This has been working but it appears I may need to specify a user agent string. Since XmlDocument doesn't support this directly, I'm trying to do this via HttpWebRequest: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); req... | TITLE:
Loading XmlDocument via HttpWebRequest
QUESTION:
I need to load an XmlDocument from a URL. This has been working but it appears I may need to specify a user agent string. Since XmlDocument doesn't support this directly, I'm trying to do this via HttpWebRequest: HttpWebRequest request = (HttpWebRequest)WebReques... | [
"c#",
".net",
"httpwebrequest",
"xmldocument",
"user-agent"
] | 0 | 2 | 4,886 | 2 | 0 | 2011-05-30T19:09:33.027000 | 2011-05-30T19:16:07.263000 |
6,179,931 | 6,180,988 | There is a GUI to manage OSGi services? (in Eclipse or another project) | I'm working with an application that uses and manages a large amount of OSGi services and implementations for each service, with properties, dynamism and so. Using the command line of the Equinox console is useful, with commands like services or list -c. However, it is difficult to see specific implementations of servi... | Eclipse has its Plug-in Registry view: Window > Show View > Other... > Plug-in Development -> Plug-in Registry This view comes with the Plug-in Development Environment (PDE), so you'll need to either use Eclipse Classic or Eclipse for Plug-in Developers or install it additionally through the standard Eclipse update mec... | There is a GUI to manage OSGi services? (in Eclipse or another project) I'm working with an application that uses and manages a large amount of OSGi services and implementations for each service, with properties, dynamism and so. Using the command line of the Equinox console is useful, with commands like services or li... | TITLE:
There is a GUI to manage OSGi services? (in Eclipse or another project)
QUESTION:
I'm working with an application that uses and manages a large amount of OSGi services and implementations for each service, with properties, dynamism and so. Using the command line of the Equinox console is useful, with commands l... | [
"user-interface",
"osgi",
"equinox"
] | 4 | 3 | 1,537 | 4 | 0 | 2011-05-30T19:11:32.180000 | 2011-05-30T21:42:41.123000 |
6,179,933 | 6,180,097 | Using iif clause in Ms Access for a column with "Yes/No" Data Type | I have a column called DayShift in a table which is of Yes/No data type (Boolean). The result Output I want is: if the value is true, display "Day" else display night. I have tried the following: SELECT iif(DayShift=Yes,"Day","Night") as Shift FROM table1;
SELECT iif(DayShift,"Day","Night") as Shift FROM table1;
SELE... | Your second one has it right SELECT iif(DayShift,"Day","Night") as Shift FROM table1; I suggest trying the following to see what's actually being evaluated SELECT iif(DayShift,"Day","Night") as Shift, DayShift FROM table1; You could equally do SELECT iif(DayShift = -1,"Day","Night") as Shift FROM table1; Since MS Acces... | Using iif clause in Ms Access for a column with "Yes/No" Data Type I have a column called DayShift in a table which is of Yes/No data type (Boolean). The result Output I want is: if the value is true, display "Day" else display night. I have tried the following: SELECT iif(DayShift=Yes,"Day","Night") as Shift FROM tabl... | TITLE:
Using iif clause in Ms Access for a column with "Yes/No" Data Type
QUESTION:
I have a column called DayShift in a table which is of Yes/No data type (Boolean). The result Output I want is: if the value is true, display "Day" else display night. I have tried the following: SELECT iif(DayShift=Yes,"Day","Night") ... | [
"sql",
"ms-access"
] | 3 | 3 | 10,853 | 5 | 0 | 2011-05-30T19:12:10.780000 | 2011-05-30T19:33:15.020000 |
6,179,936 | 6,181,615 | LuaLanes Unable to pass global variables between functions (in a single lane) | hope you're having a good day. I have been programming a IRC chatbot in Lua the past few days, and finally I want to start implementing multiple server support into it. So far, I have created the irc "object" to manage each server, and all that happy stuff - Now, I am having problems with threading. Lua, as you probabl... | Making sqr local does the trick. Since it becomes an upvalue of middleman, it is copied to the new lane. require 'lanes'
local function sqr() print(5*5) end
function middleman() sqr() end
gen = lanes.gen({globals = _G}, middleman)
print(gen()[1]) But definitely something strange is going on. I mean, even when passi... | LuaLanes Unable to pass global variables between functions (in a single lane) hope you're having a good day. I have been programming a IRC chatbot in Lua the past few days, and finally I want to start implementing multiple server support into it. So far, I have created the irc "object" to manage each server, and all th... | TITLE:
LuaLanes Unable to pass global variables between functions (in a single lane)
QUESTION:
hope you're having a good day. I have been programming a IRC chatbot in Lua the past few days, and finally I want to start implementing multiple server support into it. So far, I have created the irc "object" to manage each ... | [
"multithreading",
"lua",
"lua-lanes"
] | 3 | 4 | 889 | 1 | 0 | 2011-05-30T19:12:49.487000 | 2011-05-30T23:34:54.443000 |
6,179,939 | 6,180,127 | python list of dictionaries | I have a simple code to fetch users from db using sqlalchemy and return them as json. My problem is how to format the output to get something like this: {"results": [{"id":1, "username":"john"},{"id":2,"username":"doe"}]} my code outputs an error which I cant seem to fix being a newbie in python: d = []
for user in Us... | Ah, now that your code has been pasted, I can see that the fundamental problem is indeed coming from jsonify. The below workaround should be satisfactory. >>> import json >>> json.dumps({"results": [{"id":1, "username":"john"},{"id":2,"username":"doe"}]}) '{"results": [{"username": "john", "id": 1}, {"username": "doe",... | python list of dictionaries I have a simple code to fetch users from db using sqlalchemy and return them as json. My problem is how to format the output to get something like this: {"results": [{"id":1, "username":"john"},{"id":2,"username":"doe"}]} my code outputs an error which I cant seem to fix being a newbie in py... | TITLE:
python list of dictionaries
QUESTION:
I have a simple code to fetch users from db using sqlalchemy and return them as json. My problem is how to format the output to get something like this: {"results": [{"id":1, "username":"john"},{"id":2,"username":"doe"}]} my code outputs an error which I cant seem to fix be... | [
"python",
"list",
"dictionary"
] | 8 | 7 | 5,844 | 4 | 0 | 2011-05-30T19:13:31.060000 | 2011-05-30T19:36:24.927000 |
6,179,940 | 6,180,001 | PHP class scope | I have several classes in an application that I am currently building, and I want to have one access some of the other's member functions but i can't seem to do it. The first class is called MySQLDB: class MySQLDB{ public $connection;
function __construct(){ //connects to database }
function login($username, $passwor... | since you want to have acces on a globally set variable, you can either gain access to it with global: function processlogin($username, $password){ global $database; $database->login($username, $password); } or use the variable as a parameter for the contructor and remember the database object reference in the class Se... | PHP class scope I have several classes in an application that I am currently building, and I want to have one access some of the other's member functions but i can't seem to do it. The first class is called MySQLDB: class MySQLDB{ public $connection;
function __construct(){ //connects to database }
function login($us... | TITLE:
PHP class scope
QUESTION:
I have several classes in an application that I am currently building, and I want to have one access some of the other's member functions but i can't seem to do it. The first class is called MySQLDB: class MySQLDB{ public $connection;
function __construct(){ //connects to database }
... | [
"php",
"oop",
"class",
"scope"
] | 3 | 4 | 4,062 | 4 | 0 | 2011-05-30T19:13:49.557000 | 2011-05-30T19:20:48.210000 |
6,179,941 | 6,179,984 | Javascript setTimeout on Mouseleave event | I have a div that appears when the user's mouse leaves the document with a survey about my site. I don't want to ask them to do the survey if they move their mouse out in the first couple of minutes while browsing around, so I was wondering if I can set a timeout/sleep on when this mouseleave function would activate. H... | You can use window.setTimeout to enable the function after a certain time. Example: window.setTimeout(function(){ $(document).mouseleave(function () { console.log('mouse leave'); document.getElementById("Overlay1").style.display = ""; }); console.log('initiated'); },5000); | Javascript setTimeout on Mouseleave event I have a div that appears when the user's mouse leaves the document with a survey about my site. I don't want to ask them to do the survey if they move their mouse out in the first couple of minutes while browsing around, so I was wondering if I can set a timeout/sleep on when ... | TITLE:
Javascript setTimeout on Mouseleave event
QUESTION:
I have a div that appears when the user's mouse leaves the document with a survey about my site. I don't want to ask them to do the survey if they move their mouse out in the first couple of minutes while browsing around, so I was wondering if I can set a time... | [
"javascript",
"jquery",
"html",
"css"
] | 0 | 2 | 1,958 | 2 | 0 | 2011-05-30T19:13:59.200000 | 2011-05-30T19:18:34.533000 |
6,179,944 | 6,180,035 | Creating Bookmarklet: Append current URL with specific string | I am attempting to create a bookmarklet that will change the URL of the page I am currently on, and load a new page with the URL string changed. I have reviewed a number of other threads on bookmarklets, but I haven't found a solution that works for me. I would like to be able to change a URL that looks like this: http... | Try this: javascript: window.location = window.location.protocol + '//' + window.location.hostname + window.location.pathname + '?dog=Charlie&cat=Mittens'; | Creating Bookmarklet: Append current URL with specific string I am attempting to create a bookmarklet that will change the URL of the page I am currently on, and load a new page with the URL string changed. I have reviewed a number of other threads on bookmarklets, but I haven't found a solution that works for me. I wo... | TITLE:
Creating Bookmarklet: Append current URL with specific string
QUESTION:
I am attempting to create a bookmarklet that will change the URL of the page I am currently on, and load a new page with the URL string changed. I have reviewed a number of other threads on bookmarklets, but I haven't found a solution that ... | [
"javascript",
"browser",
"bookmarklet"
] | 7 | 10 | 5,573 | 1 | 0 | 2011-05-30T19:14:16.377000 | 2011-05-30T19:26:03.077000 |
6,179,958 | 6,180,306 | What difference does TransactionContext make when adding an object? | Does TransactionScope make any difference when there is just one insert in the table? Is MyObjectContext.Messages.Save( message, m => m.ID == message.ID); MyObjectContext.SaveChanges(); any different from using( var ts = new TransactionScope() ) { MyObjectContext.Messages.Save( message, m => m.ID == message.ID); MyObje... | There is a difference. If you use just SaveChanges you still have a transaction but it has default isolation level for database server - in case of SQL server it is Read committed. If you use TransactionScope with default configuration you have Serialized transaction isolation level but you can change it if you use oth... | What difference does TransactionContext make when adding an object? Does TransactionScope make any difference when there is just one insert in the table? Is MyObjectContext.Messages.Save( message, m => m.ID == message.ID); MyObjectContext.SaveChanges(); any different from using( var ts = new TransactionScope() ) { MyOb... | TITLE:
What difference does TransactionContext make when adding an object?
QUESTION:
Does TransactionScope make any difference when there is just one insert in the table? Is MyObjectContext.Messages.Save( message, m => m.ID == message.ID); MyObjectContext.SaveChanges(); any different from using( var ts = new Transacti... | [
"c#",
"database",
"entity-framework",
"entity-framework-4",
"transactionscope"
] | 1 | 1 | 429 | 3 | 0 | 2011-05-30T19:15:50.863000 | 2011-05-30T19:58:08.977000 |
6,179,970 | 6,180,811 | Add an extra interface using Castle Dynamic Proxy 2? | I would like to create a dynamic proxy to an existing type, but add an implementation of a new interface, that isn't already declared on the target type. I can't figure out how to achieve this. Any ideas? | You can use the overload of ProxyGenerator.CreateClassProxy() that has the additionalInterfacesToProxy parameter. For example, if you had a class with a string name property and wanted to add an IEnumerable to it that enumerates the name's characters, you could do it like this: public class Foo { public virtual string ... | Add an extra interface using Castle Dynamic Proxy 2? I would like to create a dynamic proxy to an existing type, but add an implementation of a new interface, that isn't already declared on the target type. I can't figure out how to achieve this. Any ideas? | TITLE:
Add an extra interface using Castle Dynamic Proxy 2?
QUESTION:
I would like to create a dynamic proxy to an existing type, but add an implementation of a new interface, that isn't already declared on the target type. I can't figure out how to achieve this. Any ideas?
ANSWER:
You can use the overload of ProxyGe... | [
"c#",
"castle-dynamicproxy"
] | 5 | 6 | 1,757 | 2 | 0 | 2011-05-30T19:17:00.980000 | 2011-05-30T21:14:26.173000 |
6,179,978 | 6,179,990 | Cocoa class for TAR archiving and unarchiving files | Has someone written a simple Cocoa wrapper class around tar archiving/unarchiving of files? I plan on doing it myself, unless someone out there has graciously already done it. EDIT: Are there any reasons I shouldn't just write a wrapper class around the "tar" terminal command? (via NSTask)? Unless there are any objecti... | Before doing it (at least the unarchiving, that is) yourself I'd recommend taking a look at The Unarchiver 's source. It supports Zip, Tar-GZip, Tar-BZip2, RAR, 7-zip, LhA, StuffIt, etc. Alternatively for full archiving/unarchiving support there is libarchive, which is BSD licensed and written in C: http://code.google.... | Cocoa class for TAR archiving and unarchiving files Has someone written a simple Cocoa wrapper class around tar archiving/unarchiving of files? I plan on doing it myself, unless someone out there has graciously already done it. EDIT: Are there any reasons I shouldn't just write a wrapper class around the "tar" terminal... | TITLE:
Cocoa class for TAR archiving and unarchiving files
QUESTION:
Has someone written a simple Cocoa wrapper class around tar archiving/unarchiving of files? I plan on doing it myself, unless someone out there has graciously already done it. EDIT: Are there any reasons I shouldn't just write a wrapper class around ... | [
"objective-c",
"cocoa"
] | 2 | 2 | 2,934 | 2 | 0 | 2011-05-30T19:17:40.830000 | 2011-05-30T19:19:08.247000 |
6,179,986 | 6,180,171 | Animating onDraw() section | I have the following class: public class MainActivity extends Activity { /** Called when the activity is first created. */
String value = "0";
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.... | Currently your loop is performed on the main thread and keeps it busy, so it will not actually update the UI until you finish. You should do the loop in a background thread (using Timer or AsyncTask ) and perform the paint on main thread. Note that without a short sleep, it will probably would look like an animation to... | Animating onDraw() section I have the following class: public class MainActivity extends Activity { /** Called when the activity is first created. */
String value = "0";
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG... | TITLE:
Animating onDraw() section
QUESTION:
I have the following class: public class MainActivity extends Activity { /** Called when the activity is first created. */
String value = "0";
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager... | [
"android",
"animation",
"ondraw"
] | 0 | 1 | 2,052 | 1 | 0 | 2011-05-30T19:18:50.570000 | 2011-05-30T19:40:49.197000 |
6,179,987 | 6,185,107 | subsonic 3 active records paging | I am trying to get the 10 latest rows in Subsonic 3.0 Active Records. I want to page, so I could really use a method like this: var blogcoll = blog.GetPaged(1, 10); The problem with the GetPaged() method is that you can't page in a descending order. Instead of the first 10 id's i want the last 10 id's Am I missing some... | I came up with this LINQ solution for my problem: (page is an integer parameter) var blogcoll = blog.All().OrderByDescending(x => x.idBlog).Skip((page - 1) * 10).Take(10).ToList (); | subsonic 3 active records paging I am trying to get the 10 latest rows in Subsonic 3.0 Active Records. I want to page, so I could really use a method like this: var blogcoll = blog.GetPaged(1, 10); The problem with the GetPaged() method is that you can't page in a descending order. Instead of the first 10 id's i want t... | TITLE:
subsonic 3 active records paging
QUESTION:
I am trying to get the 10 latest rows in Subsonic 3.0 Active Records. I want to page, so I could really use a method like this: var blogcoll = blog.GetPaged(1, 10); The problem with the GetPaged() method is that you can't page in a descending order. Instead of the firs... | [
"c#",
".net",
"orm",
"subsonic"
] | 0 | 1 | 128 | 1 | 0 | 2011-05-30T19:18:59.053000 | 2011-05-31T08:52:47.373000 |
6,179,991 | 6,180,022 | preg_match_all doesn't match when using a carat (^) | I'm using preg_match_all to find a URL in a HTML file. The URL always appears at the start of the line, with no leading space, like this: Next I used this to match it: preg_match_all('|^ Next |', $html, $url_matches); It didn't work until I removed the carat (^) character. I thought that the carat matched the start of ... | You have to add the m modifier: preg_match_all('|^ Next |m', $html, $url_matches); then ^ matches at start of a line, else it would only match at the start of the entire string. More Info: http://php.net/manual/en/reference.pcre.pattern.modifiers.php | preg_match_all doesn't match when using a carat (^) I'm using preg_match_all to find a URL in a HTML file. The URL always appears at the start of the line, with no leading space, like this: Next I used this to match it: preg_match_all('|^ Next |', $html, $url_matches); It didn't work until I removed the carat (^) chara... | TITLE:
preg_match_all doesn't match when using a carat (^)
QUESTION:
I'm using preg_match_all to find a URL in a HTML file. The URL always appears at the start of the line, with no leading space, like this: Next I used this to match it: preg_match_all('|^ Next |', $html, $url_matches); It didn't work until I removed t... | [
"php",
"regex",
"preg-match-all"
] | 2 | 4 | 775 | 2 | 0 | 2011-05-30T19:19:25.743000 | 2011-05-30T19:23:50.193000 |
6,180,000 | 6,201,459 | WP7 and Silverlight-> Does WiFi get disconnected when running your app under a locked screen and when idle is disabled? | My app is a GPS tracker and I want to keep it running while the screen is locked or idle. In order to do this I do the following: using Microsoft.Phone.Shell;...
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled; PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetect... | There isnt any way of preventing it from disconnecting when the screen locks. Its one of the behaviors of the os that isnt exposed to developers. | WP7 and Silverlight-> Does WiFi get disconnected when running your app under a locked screen and when idle is disabled? My app is a GPS tracker and I want to keep it running while the screen is locked or idle. In order to do this I do the following: using Microsoft.Phone.Shell;...
PhoneApplicationService.Current.Appli... | TITLE:
WP7 and Silverlight-> Does WiFi get disconnected when running your app under a locked screen and when idle is disabled?
QUESTION:
My app is a GPS tracker and I want to keep it running while the screen is locked or idle. In order to do this I do the following: using Microsoft.Phone.Shell;...
PhoneApplicationSer... | [
"c#",
"silverlight",
"windows-phone-7"
] | 0 | 1 | 431 | 2 | 0 | 2011-05-30T19:20:45.783000 | 2011-06-01T12:54:43.077000 |
6,180,002 | 6,180,132 | How to debug an empty '<a> </a>' that being shown in my markup in a Wordpress site? | In a lot of places in my code, is being shown an empty anchor tag. I've already searched for var_dump, print_r, error_log and such and couldn't find the source of this empty anchor. It's shown in my header, footer, everywhere. So, o started thinking about something more global like the_content filters or something like... | I found the answer here. Indeed, just because I forgot to close ONE SOMEWHERE in the code, everything was messed up. | How to debug an empty '<a> </a>' that being shown in my markup in a Wordpress site? In a lot of places in my code, is being shown an empty anchor tag. I've already searched for var_dump, print_r, error_log and such and couldn't find the source of this empty anchor. It's shown in my header, footer, everywhere. So, o sta... | TITLE:
How to debug an empty '<a> </a>' that being shown in my markup in a Wordpress site?
QUESTION:
In a lot of places in my code, is being shown an empty anchor tag. I've already searched for var_dump, print_r, error_log and such and couldn't find the source of this empty anchor. It's shown in my header, footer, eve... | [
"php",
"debugging",
"wordpress"
] | 1 | 1 | 59 | 2 | 0 | 2011-05-30T19:21:07.347000 | 2011-05-30T19:36:55.970000 |
6,180,007 | 6,180,088 | Problem with View on change of device orientation | When I go to landscape mode, the bottom two buttons for my activity are not visible.The screen should have automatically converted into scrollable.Do I have to add something to my xml or manifest file? | Where do you define your ScrollView? Try it like this:... other stuff... | Problem with View on change of device orientation When I go to landscape mode, the bottom two buttons for my activity are not visible.The screen should have automatically converted into scrollable.Do I have to add something to my xml or manifest file? | TITLE:
Problem with View on change of device orientation
QUESTION:
When I go to landscape mode, the bottom two buttons for my activity are not visible.The screen should have automatically converted into scrollable.Do I have to add something to my xml or manifest file?
ANSWER:
Where do you define your ScrollView? Try ... | [
"android",
"view",
"orientation"
] | 0 | 0 | 294 | 3 | 0 | 2011-05-30T19:22:06.073000 | 2011-05-30T19:31:59.140000 |
6,180,009 | 6,181,590 | Access of undefined property error in Flash using ExternalInterface | I am new to flash, so the solution to this problem may be simple. Unfortunately I have been unable to find a working solution, so I am hoping you guys can help. I am developing a site using 3rd party flash - Coverflow, for an album. It looks great and you can download it here: http://www.weberdesignlabs.com/blog/2009/1... | Putting the ExternalInterface call at the end of the Coverflow constructor should work as desired. The current line you have is not inside a function. I don't know what your javascript looks like, but this code requires a parameter for gotoCoverflowItem, so I am assuming you are passing the appropriate data. I haven't ... | Access of undefined property error in Flash using ExternalInterface I am new to flash, so the solution to this problem may be simple. Unfortunately I have been unable to find a working solution, so I am hoping you guys can help. I am developing a site using 3rd party flash - Coverflow, for an album. It looks great and ... | TITLE:
Access of undefined property error in Flash using ExternalInterface
QUESTION:
I am new to flash, so the solution to this problem may be simple. Unfortunately I have been unable to find a working solution, so I am hoping you guys can help. I am developing a site using 3rd party flash - Coverflow, for an album. I... | [
"javascript",
"html",
"actionscript-3"
] | 0 | 1 | 2,162 | 2 | 0 | 2011-05-30T19:22:19.607000 | 2011-05-30T23:29:01.983000 |
6,180,011 | 6,180,103 | Convert list of Function Arguments to an Array | I'm working on a CMS, and I'm looking for a way to convert a list of function arguments, into an array. For example: function testfunction($param1, $param2){ $string = "Param1: $param1 Param2: $param2"; return $string; }
$funcname = 'testfunction'; $params = "'this is, parameter 1', 'this is parameter2'";
//This does... | I guess if you really want to start from a string (instead of an array like others suggested), you could do: In PHP 5.3: $params = "'this is, parameter 1', 'this is parameter2'"; $paramsarray = str_getcsv($params, ',', "'"); In PHP 5.1/5.2: $fp = fopen('php://temp', 'w+'); fwrite($fp, $params); fseek($fp, 0); $paramsar... | Convert list of Function Arguments to an Array I'm working on a CMS, and I'm looking for a way to convert a list of function arguments, into an array. For example: function testfunction($param1, $param2){ $string = "Param1: $param1 Param2: $param2"; return $string; }
$funcname = 'testfunction'; $params = "'this is, pa... | TITLE:
Convert list of Function Arguments to an Array
QUESTION:
I'm working on a CMS, and I'm looking for a way to convert a list of function arguments, into an array. For example: function testfunction($param1, $param2){ $string = "Param1: $param1 Param2: $param2"; return $string; }
$funcname = 'testfunction'; $para... | [
"php",
"regex",
"preg-split"
] | 1 | 2 | 444 | 5 | 0 | 2011-05-30T19:22:36.763000 | 2011-05-30T19:33:58.663000 |
6,180,012 | 6,180,200 | Array with size 0 | Today I incidentally defined a two dimensional array with the size of one dimension being 0, however my compiler did not complain. I found the following which states that this is legal, at least in the case of gcc: 6.17 Arrays of Length Zero However, I have two questions on this usage: First, is this considered as good... | In C++ it is illegal to declare an array of zero length. As such it is not normally considered a good practice as you are tying your code to a particular compiler extension. Many uses of dynamically sized arrays are better replaced with a container class such as std::vector. ISO/IEC 14882:2003 8.3.4/1: If the constant-... | Array with size 0 Today I incidentally defined a two dimensional array with the size of one dimension being 0, however my compiler did not complain. I found the following which states that this is legal, at least in the case of gcc: 6.17 Arrays of Length Zero However, I have two questions on this usage: First, is this ... | TITLE:
Array with size 0
QUESTION:
Today I incidentally defined a two dimensional array with the size of one dimension being 0, however my compiler did not complain. I found the following which states that this is legal, at least in the case of gcc: 6.17 Arrays of Length Zero However, I have two questions on this usag... | [
"c++",
"c",
"arrays",
"gcc"
] | 42 | 38 | 45,043 | 4 | 0 | 2011-05-30T19:22:39.480000 | 2011-05-30T19:43:30.073000 |
6,180,013 | 6,180,194 | LINQ2SQL select rows based on large where | I'm searching for a bunch of int32's in a SQL (Compact edition) database using LINQ2SQL. My main problem is that I have a large list (thousands) of int32 and I want all records in the DB where id field in DB matches any of my int32's. Currently I'm selecting one row at the time, effectively searching the index thousand... | Insert your ints in a SQL table then do: var items = from row in table join intRow in intTable on row.TheIntColumn equals intRow.IntColumn select row; Edit 1 & 2: Changed the answer so he joins 2 tables, no collections. | LINQ2SQL select rows based on large where I'm searching for a bunch of int32's in a SQL (Compact edition) database using LINQ2SQL. My main problem is that I have a large list (thousands) of int32 and I want all records in the DB where id field in DB matches any of my int32's. Currently I'm selecting one row at the time... | TITLE:
LINQ2SQL select rows based on large where
QUESTION:
I'm searching for a bunch of int32's in a SQL (Compact edition) database using LINQ2SQL. My main problem is that I have a large list (thousands) of int32 and I want all records in the DB where id field in DB matches any of my int32's. Currently I'm selecting o... | [
"c#",
"sql",
"linq-to-sql",
"query-optimization"
] | 0 | 0 | 200 | 5 | 0 | 2011-05-30T19:22:40.707000 | 2011-05-30T19:42:58.577000 |
6,180,025 | 6,187,802 | ExtJS ComboBox dropdown width wider than input box width? | Is there any way to set the width of an ExtJS (version 4) ComboBox's dropdown menu to be wider than that of the actual input box? I have a comboxbox that i want to be around 200px but I have paging on the results dropdown and that width is not even big enough to show all the paging bar's controls. Here's my code to cre... | There are two parts to this. Firstly, you need to set matchFieldWidth: false in your combobox config. You can then specify width attributes in the listConfig section to style just the dropdown, while specifying the width of the combobox itself in the main config. This varies from the pervious version, which just let yo... | ExtJS ComboBox dropdown width wider than input box width? Is there any way to set the width of an ExtJS (version 4) ComboBox's dropdown menu to be wider than that of the actual input box? I have a comboxbox that i want to be around 200px but I have paging on the results dropdown and that width is not even big enough to... | TITLE:
ExtJS ComboBox dropdown width wider than input box width?
QUESTION:
Is there any way to set the width of an ExtJS (version 4) ComboBox's dropdown menu to be wider than that of the actual input box? I have a comboxbox that i want to be around 200px but I have paging on the results dropdown and that width is not ... | [
"javascript",
"user-interface",
"extjs",
"combobox",
"extjs4"
] | 23 | 39 | 26,772 | 3 | 0 | 2011-05-30T19:24:02.883000 | 2011-05-31T12:48:16.793000 |
6,180,026 | 6,184,406 | Literal control not updating | I am using a plugin called uploadify to show file upload progress to users. The uploadify script calls default.aspx (asynchronously). In the Page_Load method of the default.aspx I run validation checks on the other form data that was passed through it. If a validation check fails I like to display an error message usin... | Change the litValidationErrors control from Literal to the span with runat="server", remove Visible="false" and hide it by setting style="display: none;". Also, add the onComplete event handler to the uploadify: $(function () { $('#file_upload').uploadify({ 'uploader': '/Plugins/Uploadify/uploadify.swf', 'script': '/We... | Literal control not updating I am using a plugin called uploadify to show file upload progress to users. The uploadify script calls default.aspx (asynchronously). In the Page_Load method of the default.aspx I run validation checks on the other form data that was passed through it. If a validation check fails I like to ... | TITLE:
Literal control not updating
QUESTION:
I am using a plugin called uploadify to show file upload progress to users. The uploadify script calls default.aspx (asynchronously). In the Page_Load method of the default.aspx I run validation checks on the other form data that was passed through it. If a validation chec... | [
"c#",
"asp.net",
"file-upload",
"upload",
"uploadify"
] | 0 | 1 | 1,750 | 2 | 0 | 2011-05-30T19:24:15.060000 | 2011-05-31T07:40:50.757000 |
6,180,029 | 6,180,140 | Rails help pre-populate data - Token input field | I am trying to pre-populate data to a token input field. But nothing gets pre-populated in my edit view. I have followed this railscast: http://railscasts.com/episodes/258-token-fields My controller: class Admin::TagsController < Admin::AdminController layout 'admin' def index @title = 'asdsadas' @kategoris = Tag.where... | Try wrapping your data-pre with input_html in your edit view::input_html => {"data-pre" => @konkurrancer.tags.map(&:attributes).to_json } * You're using simple_form while the railscasts isn't. | Rails help pre-populate data - Token input field I am trying to pre-populate data to a token input field. But nothing gets pre-populated in my edit view. I have followed this railscast: http://railscasts.com/episodes/258-token-fields My controller: class Admin::TagsController < Admin::AdminController layout 'admin' def... | TITLE:
Rails help pre-populate data - Token input field
QUESTION:
I am trying to pre-populate data to a token input field. But nothing gets pre-populated in my edit view. I have followed this railscast: http://railscasts.com/episodes/258-token-fields My controller: class Admin::TagsController < Admin::AdminController ... | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3",
"ujs"
] | 1 | 3 | 2,675 | 1 | 0 | 2011-05-30T19:24:36.400000 | 2011-05-30T19:37:42.503000 |
6,180,033 | 6,180,400 | how can i use this fileupload in a form? | hi i found this fileupload today and it kinda fits like a glove for a form im doing, my only problem is how do i upload this file to server? i know it say to put it in a form but im still confused. the input script i use it like this, http://plugins.jquery.com/project/custom-file my setup looks like this. HTML ACTION f... | Start with a controller: public class HomeController: Controller { public ActionResult Index() { return View(); }
[HttpPost] public ActionResult Index(HttpPostedFileBase file) { if (file!= null && file.ContentLength > 0) { // If the user selected a file it will be stored // in the special App_Data folder var path = Se... | how can i use this fileupload in a form? hi i found this fileupload today and it kinda fits like a glove for a form im doing, my only problem is how do i upload this file to server? i know it say to put it in a form but im still confused. the input script i use it like this, http://plugins.jquery.com/project/custom-fil... | TITLE:
how can i use this fileupload in a form?
QUESTION:
hi i found this fileupload today and it kinda fits like a glove for a form im doing, my only problem is how do i upload this file to server? i know it say to put it in a form but im still confused. the input script i use it like this, http://plugins.jquery.com/... | [
"jquery",
"asp.net-mvc-2"
] | 0 | 0 | 310 | 2 | 0 | 2011-05-30T19:25:46.517000 | 2011-05-30T20:12:55.553000 |
6,180,054 | 6,180,321 | adding custom action won't start the activity when running it in the emulator | I have the following code in my Manifest: When I run the app in Eclipse it starts this activity in the emulator, as expected. But when I also add: right below the other action, and run the app, it only installs it to the emulator but doesn't run it. Why? What I wanted to achieve is this: I would like to be able to show... | If you want to specify another launch scenario, you should just add another whole intent-filter block rather than putting all of the action clauses in the same one. | adding custom action won't start the activity when running it in the emulator I have the following code in my Manifest: When I run the app in Eclipse it starts this activity in the emulator, as expected. But when I also add: right below the other action, and run the app, it only installs it to the emulator but doesn't ... | TITLE:
adding custom action won't start the activity when running it in the emulator
QUESTION:
I have the following code in my Manifest: When I run the app in Eclipse it starts this activity in the emulator, as expected. But when I also add: right below the other action, and run the app, it only installs it to the emu... | [
"android",
"action",
"manifest",
"intentfilter"
] | 0 | 3 | 769 | 1 | 0 | 2011-05-30T19:28:53.297000 | 2011-05-30T20:00:21.397000 |
6,180,057 | 6,180,102 | How can I check the usage of my iphone app in itunes connect? | How can I check the usage of my iPhone app in iTunes connect? For example, the number of times the application has been launched on the user's iPhone. | You can't see more info in iTunes connect then the number of downloads, by date and by country To see more, you'd need a third party analytics library built into your app, but I don't know what Apple's policies are. I've heard that Flurry is a decent analytics library, but I don't use it. | How can I check the usage of my iphone app in itunes connect? How can I check the usage of my iPhone app in iTunes connect? For example, the number of times the application has been launched on the user's iPhone. | TITLE:
How can I check the usage of my iphone app in itunes connect?
QUESTION:
How can I check the usage of my iPhone app in iTunes connect? For example, the number of times the application has been launched on the user's iPhone.
ANSWER:
You can't see more info in iTunes connect then the number of downloads, by date ... | [
"analytics",
"app-store-connect",
"app-store"
] | 0 | 0 | 456 | 1 | 0 | 2011-05-30T19:29:09.217000 | 2011-05-30T19:33:51.583000 |
6,180,066 | 6,180,117 | Socket Locking across Threads | Is it a good idea in my ReceiveCallBack of an asynchronous socket to Lock() the socket there? I'm asking because it's possible that another thread is sending data on the socket at the same time. private void ReceiveCallback(IAsyncResult ar) { StateObject state = (StateObject)ar.AsyncState; Socket client = state.workSoc... | If you want to make it thread-safe and be able to send and receive simultaneously you need to create two lock sync objects: private readonly object sendSyncRoot = new object(); private readonly object receiveSyncRoot = new object();
private void ReceiveCallback(IAsyncResult ar) { StateObject state = (StateObject)ar.As... | Socket Locking across Threads Is it a good idea in my ReceiveCallBack of an asynchronous socket to Lock() the socket there? I'm asking because it's possible that another thread is sending data on the socket at the same time. private void ReceiveCallback(IAsyncResult ar) { StateObject state = (StateObject)ar.AsyncState;... | TITLE:
Socket Locking across Threads
QUESTION:
Is it a good idea in my ReceiveCallBack of an asynchronous socket to Lock() the socket there? I'm asking because it's possible that another thread is sending data on the socket at the same time. private void ReceiveCallback(IAsyncResult ar) { StateObject state = (StateObj... | [
"c#",
".net",
"multithreading",
"sockets",
"parallel-processing"
] | 2 | 5 | 7,091 | 2 | 0 | 2011-05-30T19:29:59.257000 | 2011-05-30T19:35:28.093000 |
6,180,067 | 6,180,247 | Vim window padding along left edge | How can I add spacing along the left edge of my vim window? Text along the very left edge of a window makes it difficult to read. | I haven't seen that problem myself, but that's probably because all text already has a margin from the left side because I display line numbers. Perhaps that's an option for you.:set number | Vim window padding along left edge How can I add spacing along the left edge of my vim window? Text along the very left edge of a window makes it difficult to read. | TITLE:
Vim window padding along left edge
QUESTION:
How can I add spacing along the left edge of my vim window? Text along the very left edge of a window makes it difficult to read.
ANSWER:
I haven't seen that problem myself, but that's probably because all text already has a margin from the left side because I displ... | [
"linux",
"vim",
"ubuntu"
] | 6 | 4 | 2,136 | 1 | 0 | 2011-05-30T19:30:01.190000 | 2011-05-30T19:50:18.847000 |
6,180,068 | 6,180,081 | Chained dropdownbox not working in latest jquery version | I had an excellent function to populate a resort dropdown box after selecting the country. Now, with jquery 1.6 the resort dropdown box is not populated anymore. Does anyone knwo what is causing it. function populate_country() { $.getJSON('/v3/ajax/fetch_resort.php', {country:$('#country').val()}, function(data) { var ... | To me it seems like it has to do with the fact that attr changed. Try using prop instead. Check more about it here:.prop() vs.attr() | Chained dropdownbox not working in latest jquery version I had an excellent function to populate a resort dropdown box after selecting the country. Now, with jquery 1.6 the resort dropdown box is not populated anymore. Does anyone knwo what is causing it. function populate_country() { $.getJSON('/v3/ajax/fetch_resort.p... | TITLE:
Chained dropdownbox not working in latest jquery version
QUESTION:
I had an excellent function to populate a resort dropdown box after selecting the country. Now, with jquery 1.6 the resort dropdown box is not populated anymore. Does anyone knwo what is causing it. function populate_country() { $.getJSON('/v3/a... | [
"jquery",
"chained",
"jquery-selectbox"
] | 0 | 1 | 239 | 1 | 0 | 2011-05-30T19:30:07.260000 | 2011-05-30T19:31:34.677000 |
6,180,072 | 6,180,337 | PHP forward data post | I am trying to forward data from one page to another without using cURL, is this possible? At the moment i have tried header('HTTP/1.1 307 Temporary Redirect'); header('Location: new-location.php'); This works nicely but gives a stupid pop up box, any other methods? I have tried using curl but nothing happens, not sure... | I think following is the only possible way to achieve that, instead of redirecting with location header, send this html:- $val ):?> | PHP forward data post I am trying to forward data from one page to another without using cURL, is this possible? At the moment i have tried header('HTTP/1.1 307 Temporary Redirect'); header('Location: new-location.php'); This works nicely but gives a stupid pop up box, any other methods? I have tried using curl but not... | TITLE:
PHP forward data post
QUESTION:
I am trying to forward data from one page to another without using cURL, is this possible? At the moment i have tried header('HTTP/1.1 307 Temporary Redirect'); header('Location: new-location.php'); This works nicely but gives a stupid pop up box, any other methods? I have tried ... | [
"php"
] | 11 | 14 | 18,264 | 5 | 0 | 2011-05-30T19:30:28.147000 | 2011-05-30T20:03:15.273000 |
6,180,077 | 6,180,158 | jQuery save local variable for use later on in the code | Is there anyway that I can save or access a local variable outside of it's function? Consider the code below: $( "#droppable2" ).droppable({ activeClass: "ui-state-hover", hoverClass: "ui-state-active", accept: "#draggable3", drop: function( event, ui ) {
jdc = $(this).attr("id"); //I need to use this value later $( t... | try this: jQuery(element).data(key,value); // Store arbitrary data associated with the matched elements. or declare your variable outside the function. var example;
function abc(){ example = "12345"; }
abc();
console.log(example); | jQuery save local variable for use later on in the code Is there anyway that I can save or access a local variable outside of it's function? Consider the code below: $( "#droppable2" ).droppable({ activeClass: "ui-state-hover", hoverClass: "ui-state-active", accept: "#draggable3", drop: function( event, ui ) {
jdc = $... | TITLE:
jQuery save local variable for use later on in the code
QUESTION:
Is there anyway that I can save or access a local variable outside of it's function? Consider the code below: $( "#droppable2" ).droppable({ activeClass: "ui-state-hover", hoverClass: "ui-state-active", accept: "#draggable3", drop: function( even... | [
"javascript",
"jquery",
"variables",
"get",
"local"
] | 15 | 23 | 55,922 | 3 | 0 | 2011-05-30T19:30:58.967000 | 2011-05-30T19:39:16.830000 |
6,180,080 | 6,203,127 | hibernate and datawarehouse | is it logical to use an ORM layer like hibernate for huge data. We have a non-relational database with 100T data. Which is the best way to access data from a web application? JDBC, Hibernate,...? | In general, Hibernate is a poor fit to access data from the data warehouse. Hibernate is best suited to the tasks that need one-to-one representation of the database records as objects. Data warehouse data is usually too large to do that. Hibernate certainly can be used in some niches of such application. For example, ... | hibernate and datawarehouse is it logical to use an ORM layer like hibernate for huge data. We have a non-relational database with 100T data. Which is the best way to access data from a web application? JDBC, Hibernate,...? | TITLE:
hibernate and datawarehouse
QUESTION:
is it logical to use an ORM layer like hibernate for huge data. We have a non-relational database with 100T data. Which is the best way to access data from a web application? JDBC, Hibernate,...?
ANSWER:
In general, Hibernate is a poor fit to access data from the data ware... | [
"hibernate",
"orm",
"data-warehouse"
] | 3 | 6 | 1,475 | 1 | 0 | 2011-05-30T19:31:26.080000 | 2011-06-01T14:49:24.087000 |
6,180,086 | 6,180,323 | Apache historical connections log | Doe anyone know if it's possible to identify the number of connections that a server has had over a given period of time? are there any logs that keep that kind of information? Thanks | You can use "grep" to get all the lines from the access.log that contain a certain date/time (or range) (and other filter criteria) and pipe it to "wc -l" to count the number of lines, which will give you the number of requests. | Apache historical connections log Doe anyone know if it's possible to identify the number of connections that a server has had over a given period of time? are there any logs that keep that kind of information? Thanks | TITLE:
Apache historical connections log
QUESTION:
Doe anyone know if it's possible to identify the number of connections that a server has had over a given period of time? are there any logs that keep that kind of information? Thanks
ANSWER:
You can use "grep" to get all the lines from the access.log that contain a ... | [
"apache",
"connection",
"logging"
] | 7 | 7 | 5,397 | 2 | 0 | 2011-05-30T19:31:54.927000 | 2011-05-30T20:00:31.663000 |
6,180,089 | 6,180,105 | Want to know how to shift a UILabel | I'm sorry if there is a stupidly simple answer to this question, but I've been looking around on the internet for a straight, simple answer, and haven't really gotten one. All I want to do is shift a UILabel from one spot to another on an iPad screen. I don't want it to be instantaneous, I want it to be animated, so ho... | [UIView beginAnimations:@"myMoveAnimation" context:nil]; aUIButton.center = CGMakePoint(newX, newY); [UIView commitAnimations]; For the lambda lovers... [UIView animateWithDuration:secondsToTake delay:0 options: UIViewAnimationOptionCurveEaseIn animations:^{ aUIButton.center = CGPointMake(newX, newY); } completion:^(BO... | Want to know how to shift a UILabel I'm sorry if there is a stupidly simple answer to this question, but I've been looking around on the internet for a straight, simple answer, and haven't really gotten one. All I want to do is shift a UILabel from one spot to another on an iPad screen. I don't want it to be instantane... | TITLE:
Want to know how to shift a UILabel
QUESTION:
I'm sorry if there is a stupidly simple answer to this question, but I've been looking around on the internet for a straight, simple answer, and haven't really gotten one. All I want to do is shift a UILabel from one spot to another on an iPad screen. I don't want i... | [
"objective-c",
"xcode"
] | 1 | 5 | 138 | 1 | 0 | 2011-05-30T19:32:06.720000 | 2011-05-30T19:34:04.510000 |
6,180,090 | 6,180,288 | PHP merge array(s) and delete double values | WP outputs an array: $therapie = get_post_meta($post->ID, 'Therapieen', false); print_r($therapie);
//the output of print_r Array ( [0] => Massagetherapie ) Array ( [0] => Hot stone ) Array ( [0] => Massagetherapie ) How would I merge these arrays to one and delete all the exact double names? Resulting in something li... | The following should do the trick. $flattened = array_unique(call_user_func_array('array_merge', $therapie)); or the more efficient alternative (thanks to erisco 's comment): $flattened = array_keys(array_flip( call_user_func_array('array_merge', $therapie) )); If $therapie 's keys are strings you can drop array_unique... | PHP merge array(s) and delete double values WP outputs an array: $therapie = get_post_meta($post->ID, 'Therapieen', false); print_r($therapie);
//the output of print_r Array ( [0] => Massagetherapie ) Array ( [0] => Hot stone ) Array ( [0] => Massagetherapie ) How would I merge these arrays to one and delete all the e... | TITLE:
PHP merge array(s) and delete double values
QUESTION:
WP outputs an array: $therapie = get_post_meta($post->ID, 'Therapieen', false); print_r($therapie);
//the output of print_r Array ( [0] => Massagetherapie ) Array ( [0] => Hot stone ) Array ( [0] => Massagetherapie ) How would I merge these arrays to one an... | [
"php",
"arrays",
"wordpress"
] | 3 | 4 | 6,662 | 4 | 0 | 2011-05-30T19:32:06.840000 | 2011-05-30T19:55:01.043000 |
6,180,093 | 6,180,216 | Finding max value in multidimensional in mongodb | if I have this collection { "humidity": 96.5812, "temperature": 10.5006 } { "humidity": 97.1184, "temperature": 10.2808 } { "humidity": 96.2882, "temperature": 8.4493 } { "humidity": 97.8266, "temperature": 7.4481 } { "humidity": 98.9255, "temperature": 7.2772 } { "humidity": 99.4628, "temperature": 7.3993 } { "humidit... | // Simple map function - just returns the temperature value // for the record var map = function() { emit('temperature', this.temperature); };
// A reduce function to find the minimum value in the reduced set var reduce_min = function(key, values) { var min = values[0]; values.forEach(function(val) { if (val < min) mi... | Finding max value in multidimensional in mongodb if I have this collection { "humidity": 96.5812, "temperature": 10.5006 } { "humidity": 97.1184, "temperature": 10.2808 } { "humidity": 96.2882, "temperature": 8.4493 } { "humidity": 97.8266, "temperature": 7.4481 } { "humidity": 98.9255, "temperature": 7.2772 } { "humid... | TITLE:
Finding max value in multidimensional in mongodb
QUESTION:
if I have this collection { "humidity": 96.5812, "temperature": 10.5006 } { "humidity": 97.1184, "temperature": 10.2808 } { "humidity": 96.2882, "temperature": 8.4493 } { "humidity": 97.8266, "temperature": 7.4481 } { "humidity": 98.9255, "temperature":... | [
"mongodb",
"mapreduce"
] | 3 | 7 | 4,424 | 2 | 0 | 2011-05-30T19:32:45.817000 | 2011-05-30T19:45:43.747000 |
6,180,101 | 6,180,141 | Prefix increment in C++ preprocessor | Could somebody explain why b = 150? #define CUBE(X) ((X) * (X) * (X))
using namespace std;
int main( void ) { int a = 3,b = 0;
cout << "before "<< endl; cout << "a = " << a; cout << endl; cout << "b = " << b; cout << endl; cout << "after"<< endl; b = CUBE( ++a ); cout << "a = " << a; cout << endl; cout << "b = " << ... | Because you're using a macro. Macros are not functions. The line: b = CUBE( ++a ); gets re-written as: b = ((++a) * (++a) * (++a)) before your code compiles. The code then invokes Undefined Behaviour because you increment a several times between sequence points. It would be better if you used a function instead. | Prefix increment in C++ preprocessor Could somebody explain why b = 150? #define CUBE(X) ((X) * (X) * (X))
using namespace std;
int main( void ) { int a = 3,b = 0;
cout << "before "<< endl; cout << "a = " << a; cout << endl; cout << "b = " << b; cout << endl; cout << "after"<< endl; b = CUBE( ++a ); cout << "a = " <... | TITLE:
Prefix increment in C++ preprocessor
QUESTION:
Could somebody explain why b = 150? #define CUBE(X) ((X) * (X) * (X))
using namespace std;
int main( void ) { int a = 3,b = 0;
cout << "before "<< endl; cout << "a = " << a; cout << endl; cout << "b = " << b; cout << endl; cout << "after"<< endl; b = CUBE( ++a )... | [
"c++",
"c-preprocessor",
"increment",
"prefix"
] | 1 | 10 | 650 | 3 | 0 | 2011-05-30T19:33:48.597000 | 2011-05-30T19:37:43.490000 |
6,180,107 | 6,229,295 | Magento cache problem | I have a weird problem with Magento cache. I have an extension that have a Block output. If I change anything in the Block/* code it is not reflected in the front-end. If I delete anything in the Block/* it is not reflected at the front end. If I disable the module or delete etc/config.xml it does reflected at the fron... | Ok, it turned out to be quite a dumb but I agree with Joseph Mastey and maybe it will help anyone else ran into this issue. The problem was solved by another extension overriding the same class. So either disable rival extension, edit it or modify tags. | Magento cache problem I have a weird problem with Magento cache. I have an extension that have a Block output. If I change anything in the Block/* code it is not reflected in the front-end. If I delete anything in the Block/* it is not reflected at the front end. If I disable the module or delete etc/config.xml it does... | TITLE:
Magento cache problem
QUESTION:
I have a weird problem with Magento cache. I have an extension that have a Block output. If I change anything in the Block/* code it is not reflected in the front-end. If I delete anything in the Block/* it is not reflected at the front end. If I disable the module or delete etc/... | [
"caching",
"magento",
"conflict"
] | 2 | 1 | 3,321 | 3 | 0 | 2011-05-30T19:34:07.210000 | 2011-06-03T15:39:01.243000 |
6,180,110 | 6,180,245 | Calculating the maximum free store memory consumed by a process | I would like to compare the maximum amount of heap a set of processes dynamically allocate. Is there any system command in Linux or any application that automatically does that? Something like a monitoring tool that runs a process and watches for how much memory is consumed by the process. Unfortunately, the size(1) co... | pmap is not bad, but it only gives you a snapshot, not the maximum. You might want to take a look at getrusage(). On new-ish kernels (2.6.32; not sure the exact cut-off), the ru_*rss fields are actually populated. (On older kernels, they always get set to zero...) Also try "cat /proc/ /status" and look at VmPeak (which... | Calculating the maximum free store memory consumed by a process I would like to compare the maximum amount of heap a set of processes dynamically allocate. Is there any system command in Linux or any application that automatically does that? Something like a monitoring tool that runs a process and watches for how much ... | TITLE:
Calculating the maximum free store memory consumed by a process
QUESTION:
I would like to compare the maximum amount of heap a set of processes dynamically allocate. Is there any system command in Linux or any application that automatically does that? Something like a monitoring tool that runs a process and wat... | [
"linux",
"unix",
"memory-management"
] | 2 | 1 | 203 | 2 | 0 | 2011-05-30T19:34:21.057000 | 2011-05-30T19:50:07.053000 |
6,180,119 | 6,180,238 | What to return after a django form has failed validation? | How shall I return to my page after a django form has failed validation? This is what I have at the moment, I return a render_to_response after it has failed with my form objects and all the other objects I need to pass back in. But The url in the browser has the value of the form action and so this seems to me as if I... | Sessions would be good for this, or if you use AJAX you can validate the form, then return your object or some sort of error message or whatever you want after a failure. One or the other would probably be best. You could also pass params from the POST request along as GET query params to the redirected view, or pass a... | What to return after a django form has failed validation? How shall I return to my page after a django form has failed validation? This is what I have at the moment, I return a render_to_response after it has failed with my form objects and all the other objects I need to pass back in. But The url in the browser has th... | TITLE:
What to return after a django form has failed validation?
QUESTION:
How shall I return to my page after a django form has failed validation? This is what I have at the moment, I return a render_to_response after it has failed with my form objects and all the other objects I need to pass back in. But The url in ... | [
"python",
"django",
"django-forms",
"django-validation"
] | 1 | 0 | 841 | 1 | 0 | 2011-05-30T19:35:40.767000 | 2011-05-30T19:49:17.117000 |
6,180,122 | 6,180,260 | Big Theta problem | I have two functions: f(n) = 2; g(n) = 10 ^ 100; I have to justify if f(n) = BigTheta(g(n)) or not. My guess is that f(n) is BigTheta(g(n)), since both functions are constants (wich means the functions are proportional), but a my teacher insists that I am wrong. Am I right? Is there any way I could rest my case? Sorry ... | f(n) <= g(n) * 1 2 <= 10^100 for all n >= 0 Thus f(n) = O(g(n)). f(n) >= g(n) * 2/(10^100) 2 >= 10^100 * 2/(10^100) = 2 for all n >= 0 And so f(n) = Ω(g(n)). Both f(n)=O(g(n)) and f(n)=Ω(g(n)) imply f(n) = Θ(g(n)). Yes, you are right. | Big Theta problem I have two functions: f(n) = 2; g(n) = 10 ^ 100; I have to justify if f(n) = BigTheta(g(n)) or not. My guess is that f(n) is BigTheta(g(n)), since both functions are constants (wich means the functions are proportional), but a my teacher insists that I am wrong. Am I right? Is there any way I could re... | TITLE:
Big Theta problem
QUESTION:
I have two functions: f(n) = 2; g(n) = 10 ^ 100; I have to justify if f(n) = BigTheta(g(n)) or not. My guess is that f(n) is BigTheta(g(n)), since both functions are constants (wich means the functions are proportional), but a my teacher insists that I am wrong. Am I right? Is there ... | [
"big-o"
] | 1 | 0 | 771 | 2 | 0 | 2011-05-30T19:35:50.170000 | 2011-05-30T19:51:47.760000 |
6,180,123 | 6,180,541 | Ruby: XmlSimple strange behavior or doing it wrong? | require 'rubygems' require 'xmlsimple'
data = XmlSimple.xml_in(" 12341234 Some text here, 11234. and here, 234. and here ") puts data['Title'].is_a? Array Why it's an array instead of string? O_o Thanks;) | Use: data = XmlSimple.xml_in yourxml, { 'ForceArray' => false} The options is true by default because normally you want nested elements be folded into hashes. | Ruby: XmlSimple strange behavior or doing it wrong? require 'rubygems' require 'xmlsimple'
data = XmlSimple.xml_in(" 12341234 Some text here, 11234. and here, 234. and here ") puts data['Title'].is_a? Array Why it's an array instead of string? O_o Thanks;) | TITLE:
Ruby: XmlSimple strange behavior or doing it wrong?
QUESTION:
require 'rubygems' require 'xmlsimple'
data = XmlSimple.xml_in(" 12341234 Some text here, 11234. and here, 234. and here ") puts data['Title'].is_a? Array Why it's an array instead of string? O_o Thanks;)
ANSWER:
Use: data = XmlSimple.xml_in yourxm... | [
"ruby"
] | 2 | 2 | 109 | 1 | 0 | 2011-05-30T19:36:06.743000 | 2011-05-30T20:32:00.850000 |
6,180,128 | 6,185,204 | Warping an image based on lines given with different orientations | I would like to warp an image based on lines given with different orientations: for each line on the input image, I can get the coordinates of the pixels on the line then I would map these pixels to the warped image so that each line is now a column. I would use interp2 since I already have X, Y and Z, and I would make... | Your main problem (I think) is constructing matrices XI and YI needed for interp2. You construct these by realising that in your new image the horizontal axis represents the angle of the line, and the vertical axis represents the distance from the centre of the circle so to construct those: %% angle from 360 to 0, radi... | Warping an image based on lines given with different orientations I would like to warp an image based on lines given with different orientations: for each line on the input image, I can get the coordinates of the pixels on the line then I would map these pixels to the warped image so that each line is now a column. I w... | TITLE:
Warping an image based on lines given with different orientations
QUESTION:
I would like to warp an image based on lines given with different orientations: for each line on the input image, I can get the coordinates of the pixels on the line then I would map these pixels to the warped image so that each line is... | [
"matlab",
"line",
"computer-vision",
"interpolation",
"geometry"
] | 4 | 3 | 2,744 | 2 | 0 | 2011-05-30T19:36:25.940000 | 2011-05-31T08:58:37.830000 |
6,180,138 | 6,250,619 | What's the maximum length of a youtube video id? | I'm developing an application that displays youtube videos. I want to store the video id's in a database, but because there are going to be a lot of videos, I want to minimize the required space, so does anyone know the maximum length of a video id on youtube? | It's almost certainly going to stay at 11 characters. The individual characters come from a set of 64 possibilities (A-Za-z0-9_-). 64^11 is somewhat more than 2^64. (10 characters would not be enough.) So basically each youtube ID is actually a 64bit number. And I quite doubt they will ever run out of those. If you wan... | What's the maximum length of a youtube video id? I'm developing an application that displays youtube videos. I want to store the video id's in a database, but because there are going to be a lot of videos, I want to minimize the required space, so does anyone know the maximum length of a video id on youtube? | TITLE:
What's the maximum length of a youtube video id?
QUESTION:
I'm developing an application that displays youtube videos. I want to store the video id's in a database, but because there are going to be a lot of videos, I want to minimize the required space, so does anyone know the maximum length of a video id on y... | [
"video",
"youtube"
] | 68 | 95 | 43,155 | 3 | 0 | 2011-05-30T19:37:33.413000 | 2011-06-06T10:20:52.290000 |
6,180,142 | 6,180,325 | Querying Web API With Key? | I have been tasked with querying a webservice API to get info for an application, and have an authentication key that I will be using. I don't know very much at all about NSULConnections and what not, so I was hoping that someone could point me in the right direction for learning about how to do this. | Use ASIHTTPRequest, then you don't have to know much about NSURLConnection. It has a method to globally set authentication parameters for requests. | Querying Web API With Key? I have been tasked with querying a webservice API to get info for an application, and have an authentication key that I will be using. I don't know very much at all about NSULConnections and what not, so I was hoping that someone could point me in the right direction for learning about how to... | TITLE:
Querying Web API With Key?
QUESTION:
I have been tasked with querying a webservice API to get info for an application, and have an authentication key that I will be using. I don't know very much at all about NSULConnections and what not, so I was hoping that someone could point me in the right direction for lea... | [
"ios",
"objective-c"
] | 0 | 0 | 71 | 1 | 0 | 2011-05-30T19:37:54.303000 | 2011-05-30T20:01:09.377000 |
6,180,143 | 6,180,474 | Unable to install .apk from app | I have an app hosted on SourceForge (https://sourceforge.net/projects/pokedroid/). I decided to add a button to download the newest version of the app straight from the CVS server. The.apk downloads fine, but when I try to install it, the package installer gives a "cannot parse package" error. The code I'm using: priva... | I can see one issue in your code: startActivity(intent); deleteFile("PokeDroid.apk"); This code sends intent and then deletes the file. Note that startActivity is asynchronous function. I.e. it sends the request, but does not wait for completion of that request. So when the intent is actually received by Application In... | Unable to install .apk from app I have an app hosted on SourceForge (https://sourceforge.net/projects/pokedroid/). I decided to add a button to download the newest version of the app straight from the CVS server. The.apk downloads fine, but when I try to install it, the package installer gives a "cannot parse package" ... | TITLE:
Unable to install .apk from app
QUESTION:
I have an app hosted on SourceForge (https://sourceforge.net/projects/pokedroid/). I decided to add a button to download the newest version of the app straight from the CVS server. The.apk downloads fine, but when I try to install it, the package installer gives a "cann... | [
"android",
"download",
"installation",
"apk"
] | 0 | 3 | 2,099 | 2 | 0 | 2011-05-30T19:38:01.700000 | 2011-05-30T20:22:23.463000 |
6,180,144 | 6,185,960 | Declaring @Resource and @EJB at the class level in Java EE6 | Is there any situation still ( given that Java EE6 has java:global/, app/, module/ naming standards) that necessitates declaring EJBs or Resources like the example below? @EJB (name = "ejb/PlaceBid", beanInterface = PlaceBid.class) public class ActionBazaarBidControllerServlet extends HttpServlet {
} Looking up PlaceB... | The java:comp/env/ namespace is sometimes a little understood feature. This namespace corresponds to what is called the Enterprise Naming Context (ENC). It's like a private "hashmap" associated with each component, with the entire web module being treated as one component and individual EJB beans each being components ... | Declaring @Resource and @EJB at the class level in Java EE6 Is there any situation still ( given that Java EE6 has java:global/, app/, module/ naming standards) that necessitates declaring EJBs or Resources like the example below? @EJB (name = "ejb/PlaceBid", beanInterface = PlaceBid.class) public class ActionBazaarBid... | TITLE:
Declaring @Resource and @EJB at the class level in Java EE6
QUESTION:
Is there any situation still ( given that Java EE6 has java:global/, app/, module/ naming standards) that necessitates declaring EJBs or Resources like the example below? @EJB (name = "ejb/PlaceBid", beanInterface = PlaceBid.class) public cla... | [
"java",
"jakarta-ee",
"ejb-3.0",
"jndi"
] | 3 | 18 | 6,736 | 2 | 0 | 2011-05-30T19:38:03.003000 | 2011-05-31T10:04:26.303000 |
6,180,161 | 6,180,435 | IE won't pause Flash SWF file when switching tabs | I have a simple HTML page that contains two tabs that show/hide content in the same space. The first tab contains an SWF file that is embedded using SWFObject.js. When switching between tabs, I would like the SWF file to pause or stop. This works fine on all browsers except IE7+, which is a known problem. What could be... | Easy: document.getElementById("movieName").StopPlay(); then document.getElementById("movieName").Play(); Note: Never used SWFObject.js nor do I know anything about it but this should work for all normal embedding techniques, see this post for specific on how I normally embed swf files. | IE won't pause Flash SWF file when switching tabs I have a simple HTML page that contains two tabs that show/hide content in the same space. The first tab contains an SWF file that is embedded using SWFObject.js. When switching between tabs, I would like the SWF file to pause or stop. This works fine on all browsers ex... | TITLE:
IE won't pause Flash SWF file when switching tabs
QUESTION:
I have a simple HTML page that contains two tabs that show/hide content in the same space. The first tab contains an SWF file that is embedded using SWFObject.js. When switching between tabs, I would like the SWF file to pause or stop. This works fine ... | [
"javascript",
"internet-explorer",
"flash",
"swfobject"
] | 0 | 1 | 1,577 | 2 | 0 | 2011-05-30T19:39:33.680000 | 2011-05-30T20:17:01.093000 |
6,180,162 | 6,180,485 | Echo curl request header & body without sending it? | With the curl command line tool, is it possible to echo, print, or view the request, and not send it? Sort of like a -n option? I would like to see the request header & body, and anything else that's included. Is there anything else that's sent besides header & body? | Let me second the suggestion to use 'nc' (netcat) to get to see all the details without sending anything offsite to anywhere. But you can also get all the details for any curl command line request by using the --trace or --trace-ascii commands that can dump all incoming and outgoing data and requests for inspection. Th... | Echo curl request header & body without sending it? With the curl command line tool, is it possible to echo, print, or view the request, and not send it? Sort of like a -n option? I would like to see the request header & body, and anything else that's included. Is there anything else that's sent besides header & body? | TITLE:
Echo curl request header & body without sending it?
QUESTION:
With the curl command line tool, is it possible to echo, print, or view the request, and not send it? Sort of like a -n option? I would like to see the request header & body, and anything else that's included. Is there anything else that's sent besid... | [
"curl",
"http-headers",
"request",
"httprequest",
"echo"
] | 56 | 31 | 42,586 | 2 | 0 | 2011-05-30T19:39:37.470000 | 2011-05-30T20:24:04.873000 |
6,180,167 | 6,180,519 | MySQL defining column as UNIQUE with AUTO_INCREMENT instead of as Primary Key | I'm working with a contract developer who is starting to create tables (MySQL) without define a Primary Key. Instead, he is defining a column with a UNIQUE constraint with an AUTO_INCREMENT. I've never seen this done before, so I wanted to understand the implications of defining tables this way. One downside would be n... | Defining MySQL without explicit primary keys is a very very bad idea. If a PK is missing, MySQL will create an implicit (but very real) integer autoincrementing primary key. This PK will be included in every secondary key in InnoDB and will determine your primary sort order in MyISAM. Consequence You have just slowed d... | MySQL defining column as UNIQUE with AUTO_INCREMENT instead of as Primary Key I'm working with a contract developer who is starting to create tables (MySQL) without define a Primary Key. Instead, he is defining a column with a UNIQUE constraint with an AUTO_INCREMENT. I've never seen this done before, so I wanted to un... | TITLE:
MySQL defining column as UNIQUE with AUTO_INCREMENT instead of as Primary Key
QUESTION:
I'm working with a contract developer who is starting to create tables (MySQL) without define a Primary Key. Instead, he is defining a column with a UNIQUE constraint with an AUTO_INCREMENT. I've never seen this done before,... | [
"mysql"
] | 3 | 6 | 2,147 | 3 | 0 | 2011-05-30T19:40:14.813000 | 2011-05-30T20:28:52.190000 |
6,180,168 | 6,180,597 | My widget sometimes doesn't receive the ACTION_BATTERY_CHANGED intent | Good evening, I wrote a tutorial on how to write a widget to display the battery level on the Android but I've found that my widget doesn't always keep in sync with what's shown in the "About Phone>Status" screen. I've installed a closed source widget to see if it was always in sync with the "official" value and it doe... | That ACTION_BATTERY_CHANGED receivers only receive notifications when they are running is unexpectedly documented in Intent.ACTION_POWER_DISCONNECTED, but not mentioned in the ACTION_BATTERY_CHANGED section. So, if your receiver isn't attached to a running process, it won't receive the broadcasts. If you don't want to ... | My widget sometimes doesn't receive the ACTION_BATTERY_CHANGED intent Good evening, I wrote a tutorial on how to write a widget to display the battery level on the Android but I've found that my widget doesn't always keep in sync with what's shown in the "About Phone>Status" screen. I've installed a closed source widge... | TITLE:
My widget sometimes doesn't receive the ACTION_BATTERY_CHANGED intent
QUESTION:
Good evening, I wrote a tutorial on how to write a widget to display the battery level on the Android but I've found that my widget doesn't always keep in sync with what's shown in the "About Phone>Status" screen. I've installed a c... | [
"java",
"android",
"android-widget"
] | 3 | 2 | 1,003 | 1 | 0 | 2011-05-30T19:40:18.733000 | 2011-05-30T20:42:10.343000 |
6,180,173 | 6,180,641 | how can I store diffrent value types in an array using c++? | I'm having trouble with some features I want to implement in my config class, I have some values with diffrent types and I want to store them in an map. formerly i used ExtendedString class to store all data and convert them using a template function to the wanted type whenever I needed. and then had a map > in my conf... | I'd recommend using boost::any, as it sounds like it does what you are looking for. However, if you really don't want to use it, you might be able to handle it something like this. It may not be the best way to do it (its the first thing that came into my head) - basically its storing the value in the type you had it a... | how can I store diffrent value types in an array using c++? I'm having trouble with some features I want to implement in my config class, I have some values with diffrent types and I want to store them in an map. formerly i used ExtendedString class to store all data and convert them using a template function to the wa... | TITLE:
how can I store diffrent value types in an array using c++?
QUESTION:
I'm having trouble with some features I want to implement in my config class, I have some values with diffrent types and I want to store them in an map. formerly i used ExtendedString class to store all data and convert them using a template ... | [
"c++",
"arrays",
"class",
"templates",
"generic-type-argument"
] | 1 | 1 | 379 | 3 | 0 | 2011-05-30T19:41:08.077000 | 2011-05-30T20:48:13.290000 |
6,180,175 | 6,180,197 | What is the proper place to release a NSURLConnection in the following example? | I have the following statement in my viewWillAppear controller: connectionInprogress = [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES]; What is the proper place to release it? That is can I just do it in viewDidUnload or does it make more sense to do it in viewDidDissapear? I guess t... | No viewDidUnload is paired with viewDidLoad and may never get called, which is why you should also release your instance variables in dealloc. viewDidUnload is called if the view controller is sent a memory warning. You should release the NSURLConnection in the callback functions: connectionDidFinishLoading: and connec... | What is the proper place to release a NSURLConnection in the following example? I have the following statement in my viewWillAppear controller: connectionInprogress = [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES]; What is the proper place to release it? That is can I just do it in ... | TITLE:
What is the proper place to release a NSURLConnection in the following example?
QUESTION:
I have the following statement in my viewWillAppear controller: connectionInprogress = [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES]; What is the proper place to release it? That is ca... | [
"iphone",
"ios",
"memory-management"
] | 0 | 2 | 93 | 2 | 0 | 2011-05-30T19:41:17.360000 | 2011-05-30T19:43:06.063000 |
6,180,178 | 6,180,887 | Users group table schema | I am creating a system where users can join and create groups. Within these groups, members can create topics and respond to topics already created, so I'd like to know your opinion on which of the following methods is best: Create two tables, groups_posts and group_topics: --group_topics id PK group_id int FK user_id ... | Based on your description, seems to me that a bit more may be needed. Maybe something something like: One group can have many users. One user can belong to many groups. Within a group users create topics (topic = subject; theme; a category or general area of interest.) Within a topic users create new posts or reply to ... | Users group table schema I am creating a system where users can join and create groups. Within these groups, members can create topics and respond to topics already created, so I'd like to know your opinion on which of the following methods is best: Create two tables, groups_posts and group_topics: --group_topics id PK... | TITLE:
Users group table schema
QUESTION:
I am creating a system where users can join and create groups. Within these groups, members can create topics and respond to topics already created, so I'd like to know your opinion on which of the following methods is best: Create two tables, groups_posts and group_topics: --... | [
"mysql",
"database-design",
"schema",
"database-schema",
"db-schema"
] | 4 | 11 | 5,320 | 3 | 0 | 2011-05-30T19:41:33.523000 | 2011-05-30T21:26:00.323000 |
6,180,179 | 6,180,640 | Window shown in background | At some users of my application, some WPF Windows will be shown behind the Shellwindow. This occurs only on some places. The Shellwindow does not has set Topmost. I hope someone could give me a tip, what I can do to prevent this. Thanks. Best Regards, thomas | There are only three scenarios that I know of where one of your windows could lose the focus and disappear behind the window of another app: a program calling SetForegroundWindow() to shove one of its windows into the foreground. Windows has specific counter-measures against this since ~Win98, a user interface crime th... | Window shown in background At some users of my application, some WPF Windows will be shown behind the Shellwindow. This occurs only on some places. The Shellwindow does not has set Topmost. I hope someone could give me a tip, what I can do to prevent this. Thanks. Best Regards, thomas | TITLE:
Window shown in background
QUESTION:
At some users of my application, some WPF Windows will be shown behind the Shellwindow. This occurs only on some places. The Shellwindow does not has set Topmost. I hope someone could give me a tip, what I can do to prevent this. Thanks. Best Regards, thomas
ANSWER:
There a... | [
"c#",
"wpf",
"view",
"window"
] | 0 | 3 | 196 | 2 | 0 | 2011-05-30T19:41:33.700000 | 2011-05-30T20:48:06.580000 |
6,180,185 | 6,180,231 | Custom Python Exceptions with Error Codes and Error Messages | class AppError(Exception): pass
class MissingInputError(AppError): pass
class ValidationError(AppError): pass... def validate(self): """ Validate Input and save it """
params = self.__params
if 'key' in params: self.__validateKey(escape(params['key'][0])) else: raise MissingInputError
if 'svc' in params: self.__va... | Here's a quick example of a custom Exception class with special codes: class ErrorWithCode(Exception): def __init__(self, code): self.code = code def __str__(self): return repr(self.code)
try: raise ErrorWithCode(1000) except ErrorWithCode as e: print("Received error with code:", e.code) Since you were asking about ho... | Custom Python Exceptions with Error Codes and Error Messages class AppError(Exception): pass
class MissingInputError(AppError): pass
class ValidationError(AppError): pass... def validate(self): """ Validate Input and save it """
params = self.__params
if 'key' in params: self.__validateKey(escape(params['key'][0]))... | TITLE:
Custom Python Exceptions with Error Codes and Error Messages
QUESTION:
class AppError(Exception): pass
class MissingInputError(AppError): pass
class ValidationError(AppError): pass... def validate(self): """ Validate Input and save it """
params = self.__params
if 'key' in params: self.__validateKey(escape(... | [
"python",
"error-handling",
"custom-exceptions"
] | 52 | 87 | 98,443 | 2 | 0 | 2011-05-30T19:41:59.403000 | 2011-05-30T19:47:59.560000 |
6,180,186 | 6,180,268 | Disadvantages of using a value object in construction and initialisation | I want to know if there are any disadvantages/ drawbacks of using value objects in initializing an object, for example: public class MonsterVO { public var tenticles: Boolean; public var growl: GrowlType; public var damage: int; public var health: int;
}
public class Monster { private var tenticles: Boolean; private ... | If you plan to use and initialize your Monster domain object the only way (from DTO MonsterVO ) — there is no problem. But how you can be sure if there won't any other usages in the future? You can't overload constructor in ActionScript (like in Java). What if you'll need to create a clone? You'll have to create some f... | Disadvantages of using a value object in construction and initialisation I want to know if there are any disadvantages/ drawbacks of using value objects in initializing an object, for example: public class MonsterVO { public var tenticles: Boolean; public var growl: GrowlType; public var damage: int; public var health:... | TITLE:
Disadvantages of using a value object in construction and initialisation
QUESTION:
I want to know if there are any disadvantages/ drawbacks of using value objects in initializing an object, for example: public class MonsterVO { public var tenticles: Boolean; public var growl: GrowlType; public var damage: int; ... | [
"apache-flex",
"actionscript-3",
"actionscript"
] | 3 | 2 | 206 | 2 | 0 | 2011-05-30T19:41:59.680000 | 2011-05-30T19:52:25.657000 |
6,180,193 | 6,180,346 | Alternate between showing two images in a Rails view | Firstly I apologize for this as I am not a Rails programmer.. I just need to figure this out so that I can get back to productive work. I have inherited a RoR site and need to have an image that rotates randomly on page load. Simple, right? My solution was to generate a random number between 0 and 2. If the number is a... | First, you would need to calculate the random number in your controller and put it in an instance variable like: @image_random = rand(2) Then, in your view: <% if @image_random == 1 %> <%= image_tag "foo.png" %> <% else %> <%= image_tag "bar.png" %> <% end %> You can safely lose - after <% in Rails 3:) It's been done a... | Alternate between showing two images in a Rails view Firstly I apologize for this as I am not a Rails programmer.. I just need to figure this out so that I can get back to productive work. I have inherited a RoR site and need to have an image that rotates randomly on page load. Simple, right? My solution was to generat... | TITLE:
Alternate between showing two images in a Rails view
QUESTION:
Firstly I apologize for this as I am not a Rails programmer.. I just need to figure this out so that I can get back to productive work. I have inherited a RoR site and need to have an image that rotates randomly on page load. Simple, right? My solut... | [
"ruby-on-rails",
"erb"
] | 1 | 5 | 662 | 1 | 0 | 2011-05-30T19:42:54.623000 | 2011-05-30T20:04:40.847000 |
6,180,199 | 6,185,511 | please explain cakephp acl parent id and foreign key | I try to understand of acl component but difficult for newbie but i try to insert data to table and capture screen and make arrow for to make myself understand and I can' understand foriegn key and parent id in aro and aco table and other I need example in the case of many role and many aro and aco I'm student and use ... | Since I find a a bit difficult to understand your question I'm trying to help with these links which explain ACL in CakePHP very good: Tutorial für ACL controlled app Explanation of the ACL Component API-Entry for the ACL Component But just to explain what the two keys "foreign_key" and "parent_id" are for: foreign_key... | please explain cakephp acl parent id and foreign key I try to understand of acl component but difficult for newbie but i try to insert data to table and capture screen and make arrow for to make myself understand and I can' understand foriegn key and parent id in aro and aco table and other I need example in the case o... | TITLE:
please explain cakephp acl parent id and foreign key
QUESTION:
I try to understand of acl component but difficult for newbie but i try to insert data to table and capture screen and make arrow for to make myself understand and I can' understand foriegn key and parent id in aro and aco table and other I need exa... | [
"cakephp",
"acl"
] | 1 | 1 | 640 | 1 | 0 | 2011-05-30T19:43:25.487000 | 2011-05-31T09:24:29.290000 |
6,180,207 | 6,195,026 | DisplayTemplate code need fix/feedback | I have a DisplayTemplate called _FooterMenu in which below dynamic footer menu is coded. Few things to ask Is there any way to simplify DisplayTemplate code? Should I used HtmlHelper to hide logic? Code in layout page @Html.DisplayForModel("_FooterMenu") //DisplayTemplate code. @model HomeViewModel
@{var distMenu = Mo... | I think the key to optimizing your code is to use a "GroupBy" for your Footer Menu Items, this will alleviate the need for 2 ForEach loops. I mocked up your MVC app, here is the code snippet I came up with: @{ var distMenu = Model.FooterMenu.GroupBy(q => q.Title); }
@foreach (var grp in distMenu) { @grp.Key @foreach(v... | DisplayTemplate code need fix/feedback I have a DisplayTemplate called _FooterMenu in which below dynamic footer menu is coded. Few things to ask Is there any way to simplify DisplayTemplate code? Should I used HtmlHelper to hide logic? Code in layout page @Html.DisplayForModel("_FooterMenu") //DisplayTemplate code. @m... | TITLE:
DisplayTemplate code need fix/feedback
QUESTION:
I have a DisplayTemplate called _FooterMenu in which below dynamic footer menu is coded. Few things to ask Is there any way to simplify DisplayTemplate code? Should I used HtmlHelper to hide logic? Code in layout page @Html.DisplayForModel("_FooterMenu") //Displa... | [
"asp.net-mvc-3"
] | 1 | 1 | 133 | 1 | 0 | 2011-05-30T19:44:10.493000 | 2011-06-01T00:30:36.543000 |
6,180,214 | 6,180,807 | How to select multiple columns with the same name using JPA native query? | I'm having some troubles while selecting some data using sql native query through JPA. That's because I have 3 columns with the same name, "descricao". When I execute the select operation through the createNativeQuery method of the EntityManager interface the first column value found overrides the others. (eg. the valu... | Scalar Column Mappings in Entity Bean: @SqlResultSetMapping( name="DescricaoColumnAlias", columns={@ColumnResult(name="B_DESCRICAO"), @ColumnResult(name="CA_DESCRICAO"), @ColumnResult(name="PRD_DESCRICAO")} ) Now using alias for the columns in the native query as specified in column mappings. "select p.id, p.datapedido... | How to select multiple columns with the same name using JPA native query? I'm having some troubles while selecting some data using sql native query through JPA. That's because I have 3 columns with the same name, "descricao". When I execute the select operation through the createNativeQuery method of the EntityManager ... | TITLE:
How to select multiple columns with the same name using JPA native query?
QUESTION:
I'm having some troubles while selecting some data using sql native query through JPA. That's because I have 3 columns with the same name, "descricao". When I execute the select operation through the createNativeQuery method of ... | [
"java",
"mysql",
"jpa",
"jdbc"
] | 8 | 5 | 11,976 | 4 | 0 | 2011-05-30T19:45:25.197000 | 2011-05-30T21:13:55.647000 |
6,180,218 | 6,180,234 | Shortcut to print only 1 item from list of dictionaries | l = [ {'bob':'hello','jim':'thanks'}, {'bob':'world','jim':'for'}, {'bob':'hey','jim':'the'}, {'bob':'mundo','jim':'help'} ]
for dict in l: print dict['jim'] Is there a one liner or pythonic way of doing this? I'm trying to retrieve a list of just 1 item in a list of dictionaries | [d['jim'] for d in l] And don't use dict as a variable name. It masks the dict() built-in. | Shortcut to print only 1 item from list of dictionaries l = [ {'bob':'hello','jim':'thanks'}, {'bob':'world','jim':'for'}, {'bob':'hey','jim':'the'}, {'bob':'mundo','jim':'help'} ]
for dict in l: print dict['jim'] Is there a one liner or pythonic way of doing this? I'm trying to retrieve a list of just 1 item in a lis... | TITLE:
Shortcut to print only 1 item from list of dictionaries
QUESTION:
l = [ {'bob':'hello','jim':'thanks'}, {'bob':'world','jim':'for'}, {'bob':'hey','jim':'the'}, {'bob':'mundo','jim':'help'} ]
for dict in l: print dict['jim'] Is there a one liner or pythonic way of doing this? I'm trying to retrieve a list of ju... | [
"python"
] | 1 | 5 | 238 | 3 | 0 | 2011-05-30T19:46:01.103000 | 2011-05-30T19:48:46.903000 |
6,180,219 | 6,180,235 | How does function overloading work in the following case? | The following code compiles and runs but I'm not sure what exactly is going on at a lower level. Doesn't a reference just store the address of the object being referenced? If so, both test functions are receiving an address as a parameter? Or is the C++ implementation able to differentiate between these types in some o... | As int& and int* are distinct types and i can be treated as a int& but not as a int*, overload resolution is absolutely unambiguous here. It doesn't matter at this point that references are just a somewhat cloaked kind of pointer. From a language point of view they are distinct types. | How does function overloading work in the following case? The following code compiles and runs but I'm not sure what exactly is going on at a lower level. Doesn't a reference just store the address of the object being referenced? If so, both test functions are receiving an address as a parameter? Or is the C++ implemen... | TITLE:
How does function overloading work in the following case?
QUESTION:
The following code compiles and runs but I'm not sure what exactly is going on at a lower level. Doesn't a reference just store the address of the object being referenced? If so, both test functions are receiving an address as a parameter? Or i... | [
"c++"
] | 2 | 7 | 292 | 3 | 0 | 2011-05-30T19:46:09.440000 | 2011-05-30T19:48:58.553000 |
6,180,228 | 6,180,463 | Heroku logs reveal no errors yet most of my URLs read "We're sorry, but something went wrong." | My app works wonderfully on my local machine but when I create my first post after pushing the app to Heroku I get "We're sorry, but something went wrong." on every page except /posts/new The heroku logs command reveals: 2011-05-30T19:24:02+00:00 heroku[api]: Set maintenance mode off by myemailaddress@blah.com 2011-05-... | If nothing appears in the logs it is likely that your app has some sort of issue starting up. Try running it in production mode locally, see if anything generates an exception when starting up the server. rails server -e production | Heroku logs reveal no errors yet most of my URLs read "We're sorry, but something went wrong." My app works wonderfully on my local machine but when I create my first post after pushing the app to Heroku I get "We're sorry, but something went wrong." on every page except /posts/new The heroku logs command reveals: 2011... | TITLE:
Heroku logs reveal no errors yet most of my URLs read "We're sorry, but something went wrong."
QUESTION:
My app works wonderfully on my local machine but when I create my first post after pushing the app to Heroku I get "We're sorry, but something went wrong." on every page except /posts/new The heroku logs com... | [
"heroku",
"logging"
] | 3 | 2 | 1,342 | 2 | 0 | 2011-05-30T19:47:41.407000 | 2011-05-30T20:20:11.690000 |
6,180,239 | 6,181,105 | API for plugin framework in Lua | I am implementing a plugin system with Lua scripts for an application. Basically it will allow the users to extend the functionality by defining one or more functions in Lua. The plugin function will be called in response to an application event. Are there some good open source plugin frameworks in Lua that can serve a... | Lua's first-class functions make this kind of thing so simple that I think you won't find much in the way of frameworks. Remember that Lua's mantra is to provide minimal mechanism and let individual programmers work out policy for themselves. Your question is very general, but here's what I recommend for your API: A si... | API for plugin framework in Lua I am implementing a plugin system with Lua scripts for an application. Basically it will allow the users to extend the functionality by defining one or more functions in Lua. The plugin function will be called in response to an application event. Are there some good open source plugin fr... | TITLE:
API for plugin framework in Lua
QUESTION:
I am implementing a plugin system with Lua scripts for an application. Basically it will allow the users to extend the functionality by defining one or more functions in Lua. The plugin function will be called in response to an application event. Are there some good ope... | [
"plugins",
"lua"
] | 6 | 4 | 2,288 | 2 | 0 | 2011-05-30T19:49:24.473000 | 2011-05-30T22:03:16.653000 |
6,180,242 | 6,180,309 | Generating a unique cache key based on method arguments | I have a basic repository framework that eventually executes a query and maps the results back into a object: For Example: public SomeEntity Get(id) { return base.GetItem ("select * from SomeEntities where id = @idParam", new { idParam = id}); } If this looks like Dapper, it is because under the hood GetItem is wrappin... | I use the following extension methods to make cached versions of delegates: public static Func AsCached (this Func function) { var cachedResults = new Dictionary (); return (argument) => { TResult result; lock (cachedResults) { if (!cachedResults.TryGetValue(argument, out result)) { result = function(argument); cachedR... | Generating a unique cache key based on method arguments I have a basic repository framework that eventually executes a query and maps the results back into a object: For Example: public SomeEntity Get(id) { return base.GetItem ("select * from SomeEntities where id = @idParam", new { idParam = id}); } If this looks like... | TITLE:
Generating a unique cache key based on method arguments
QUESTION:
I have a basic repository framework that eventually executes a query and maps the results back into a object: For Example: public SomeEntity Get(id) { return base.GetItem ("select * from SomeEntities where id = @idParam", new { idParam = id}); } ... | [
"c#",
".net",
"asp.net",
"caching"
] | 7 | 6 | 6,078 | 2 | 0 | 2011-05-30T19:49:38.660000 | 2011-05-30T19:58:40.977000 |
6,180,256 | 6,180,269 | POST from an <A> tag | Is it possible to do a POST from just an tag? I know anchor tags are usually just for GETs, and I know I can use javascript to do this (like in JavaScript post request like a form submit ) but to me that seems a little messy. Is there a way to do this with straight HTML? | There is no way to POST an a element using only HTML. As can be seen from this DTD fragment ( HTML 4.01 spec ): There is no attribute that controls whether to use POST or GET with an a element. You have to script it, if you want to abuse the semantics. | POST from an <A> tag Is it possible to do a POST from just an tag? I know anchor tags are usually just for GETs, and I know I can use javascript to do this (like in JavaScript post request like a form submit ) but to me that seems a little messy. Is there a way to do this with straight HTML? | TITLE:
POST from an <A> tag
QUESTION:
Is it possible to do a POST from just an tag? I know anchor tags are usually just for GETs, and I know I can use javascript to do this (like in JavaScript post request like a form submit ) but to me that seems a little messy. Is there a way to do this with straight HTML?
ANSWER:
... | [
"html",
"post"
] | 61 | 33 | 97,567 | 11 | 0 | 2011-05-30T19:51:17.997000 | 2011-05-30T19:52:33.403000 |
6,180,258 | 6,180,442 | binding to items self (this) for a button in a itemtemplate/datatemplate? | I've found similar examples for this but nothing that solves my exact issue:( I'm using silverlight on Phone7, and I have a itemslist that I bind a List to the ItemsSource. In my dataTemplate, I have a button, and what I really want to do is set the button.tag property to give me back the original instance of the myCla... | I figured it out for anyone that needs it in the future - What you need is Tag="{Binding BindsDirectlyToSource=True}" That will bind to the source of that itemtemplate | binding to items self (this) for a button in a itemtemplate/datatemplate? I've found similar examples for this but nothing that solves my exact issue:( I'm using silverlight on Phone7, and I have a itemslist that I bind a List to the ItemsSource. In my dataTemplate, I have a button, and what I really want to do is set ... | TITLE:
binding to items self (this) for a button in a itemtemplate/datatemplate?
QUESTION:
I've found similar examples for this but nothing that solves my exact issue:( I'm using silverlight on Phone7, and I have a itemslist that I bind a List to the ItemsSource. In my dataTemplate, I have a button, and what I really ... | [
"c#",
"silverlight",
"windows-phone-7"
] | 0 | 0 | 344 | 1 | 0 | 2011-05-30T19:51:21.770000 | 2011-05-30T20:17:50.650000 |
6,180,264 | 6,185,653 | Wordpress theme options cannot be read nor saved from/to database | We have installed this theme http://www.freshthemes.com/demo/weekly/ with WordPress 3.1.3. When saving theme options the options are saved in the frontend, but not pushed through to the database. On the front end, one can clearly see that the theme is still loading the correct values from the database. That might have ... | Here is the solution: http://wordpress.org/support/topic/get_theme_mod-seems-not-returning-any-value-after-upgrading-tp-wordpress-31 More: If your lost your theme options just have a look in the table wp_options and search for LIKE '%theme_mods_%' on option_name In our case names changes like that: OLD: theme_mods_week... | Wordpress theme options cannot be read nor saved from/to database We have installed this theme http://www.freshthemes.com/demo/weekly/ with WordPress 3.1.3. When saving theme options the options are saved in the frontend, but not pushed through to the database. On the front end, one can clearly see that the theme is st... | TITLE:
Wordpress theme options cannot be read nor saved from/to database
QUESTION:
We have installed this theme http://www.freshthemes.com/demo/weekly/ with WordPress 3.1.3. When saving theme options the options are saved in the frontend, but not pushed through to the database. On the front end, one can clearly see th... | [
"wordpress",
"themes"
] | 1 | 0 | 800 | 1 | 0 | 2011-05-30T19:52:07.370000 | 2011-05-31T09:36:40.410000 |
6,180,280 | 6,181,731 | Ninject: give the parent instance to a child being resolved | I have this class hierarchy: public interface ISR { } public interface ICU { } public interface IFI { }
public class CU: ICU { }
public class SR: ISR { public SR(IFI fi) { FI = fi; }
public IFI FI { get; set; } }
public class FI: IFI { public FI(ISR sr, ICU cu) { SR = sr; CU = cu; }
public ISR SR { get; set; } pub... | The best way to handle this problem is to refactor your design to remove the cyclic dependency. Almost all cyclic dependencies can be removed with a proper design. If you have cyclic dependencies there is usually a design flaw. Most likely you do not fulfill the Single Responsibility Principle. Otherwise you have to do... | Ninject: give the parent instance to a child being resolved I have this class hierarchy: public interface ISR { } public interface ICU { } public interface IFI { }
public class CU: ICU { }
public class SR: ISR { public SR(IFI fi) { FI = fi; }
public IFI FI { get; set; } }
public class FI: IFI { public FI(ISR sr, IC... | TITLE:
Ninject: give the parent instance to a child being resolved
QUESTION:
I have this class hierarchy: public interface ISR { } public interface ICU { } public interface IFI { }
public class CU: ICU { }
public class SR: ISR { public SR(IFI fi) { FI = fi; }
public IFI FI { get; set; } }
public class FI: IFI { pu... | [
"c#",
"dependency-injection",
"scope",
"ninject",
"parent-child"
] | 4 | 5 | 1,679 | 1 | 0 | 2011-05-30T19:53:54.017000 | 2011-05-31T00:03:09.873000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.