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,300,811
6,300,903
jQuery: Animate Removal of CSS Property
I'm visually "collapsing" some DOM elements using jQuery (by shrinking their width to 0px and fading them out) like this: $(".slideoutmenu").animate({ width: 0, opacity: 0 }, function() { $(this).hide(); }); The width of these elements can vary, but the document is properly laid out through CSS without setting a specif...
You could store the width of the element pre-animation using jQuery data: $(".slideoutmenu").each(function(){ $(this).data('width', $(this).css('width')); $(this).animate({ width: 0, opacity: 0 }); }); $(".slideoutmenu").each(function(){ $(this).children(".slideoutmenu").stop().animate({ width: $(this).data('width'), ...
jQuery: Animate Removal of CSS Property I'm visually "collapsing" some DOM elements using jQuery (by shrinking their width to 0px and fading them out) like this: $(".slideoutmenu").animate({ width: 0, opacity: 0 }, function() { $(this).hide(); }); The width of these elements can vary, but the document is properly laid ...
TITLE: jQuery: Animate Removal of CSS Property QUESTION: I'm visually "collapsing" some DOM elements using jQuery (by shrinking their width to 0px and fading them out) like this: $(".slideoutmenu").animate({ width: 0, opacity: 0 }, function() { $(this).hide(); }); The width of these elements can vary, but the document...
[ "jquery", "css" ]
13
21
11,611
1
0
2011-06-10T00:36:27.347000
2011-06-10T00:55:50.210000
6,300,812
6,301,038
Get the Servlet Request object in a POJO class
I need to get the current page URL in a POJO that is being called from an Acegi class (need to add some custom logic for the app I'm working on) and need to retrieve the HttpServletRequest so that I can get the subdomain of the URL (on which the logic is based). I've tried to add: @Autowired private HttpServletRequest ...
If the bean is request scoped you can autowire the HttpServletRequest like you are doing. @Component @Scope("request") public class Foo { @Autowired private HttpServletRequest request; // } Otherwise you can get the current request as follows: ServletRequestAttributes sra = (ServletRequestAttributes)RequestContextHold...
Get the Servlet Request object in a POJO class I need to get the current page URL in a POJO that is being called from an Acegi class (need to add some custom logic for the app I'm working on) and need to retrieve the HttpServletRequest so that I can get the subdomain of the URL (on which the logic is based). I've tried...
TITLE: Get the Servlet Request object in a POJO class QUESTION: I need to get the current page URL in a POJO that is being called from an Acegi class (need to add some custom logic for the app I'm working on) and need to retrieve the HttpServletRequest so that I can get the subdomain of the URL (on which the logic is ...
[ "spring", "jakarta-ee" ]
27
49
30,362
1
0
2011-06-10T00:36:44.317000
2011-06-10T01:19:21.637000
6,300,814
6,300,995
JSP/JSTL: Passing a Collection to a Custom Tag
I'm trying to implement a custom JSP tag that accepts as an attribute a Collection of objects and outputs them as a JSON-formatted array (each object in the Collection provides a getJsonString() method that returns a JSON-formatted representation of that object). I have my tag implemented as such: <%@ taglib uri="http:...
I found the solution, I needed to add type="java.util.Collection" to the attribute declaration, as in: <%@ attribute name="objects" required="true" rtexprvalue="true" type="java.util.Collection" %>...I would have thought Java would be smart enough to figure that out on its own, but apparently not.
JSP/JSTL: Passing a Collection to a Custom Tag I'm trying to implement a custom JSP tag that accepts as an attribute a Collection of objects and outputs them as a JSON-formatted array (each object in the Collection provides a getJsonString() method that returns a JSON-formatted representation of that object). I have my...
TITLE: JSP/JSTL: Passing a Collection to a Custom Tag QUESTION: I'm trying to implement a custom JSP tag that accepts as an attribute a Collection of objects and outputs them as a JSON-formatted array (each object in the Collection provides a getJsonString() method that returns a JSON-formatted representation of that ...
[ "jsp", "jstl", "jsp-tags", "custom-tag" ]
6
6
7,027
1
0
2011-06-10T00:37:05.910000
2011-06-10T01:12:17.050000
6,300,817
6,300,887
Event Handler Called With Wrong Context
In the SomeObj object, the onkeydown event handler this.doSomething is called in the wrong context (that of the textbox element) but it needs to be called in the context of this. How can this be done? function SomeObj(elem1, elem2) { this.textboxElem = elem1; this.someElem = elem2; this.registerEvent(); } SomeObj.prot...
Copy the reference to a local variable, so that you can use it in a closure: registerEvent: function() { var t = this; this.textboxElem.onkeydown = function() { t.doSomething(); }; },
Event Handler Called With Wrong Context In the SomeObj object, the onkeydown event handler this.doSomething is called in the wrong context (that of the textbox element) but it needs to be called in the context of this. How can this be done? function SomeObj(elem1, elem2) { this.textboxElem = elem1; this.someElem = elem...
TITLE: Event Handler Called With Wrong Context QUESTION: In the SomeObj object, the onkeydown event handler this.doSomething is called in the wrong context (that of the textbox element) but it needs to be called in the context of this. How can this be done? function SomeObj(elem1, elem2) { this.textboxElem = elem1; th...
[ "javascript", "dom-events" ]
0
2
375
1
0
2011-06-10T00:37:28.527000
2011-06-10T00:52:07.143000
6,300,833
6,300,893
Searching for consecutive values in an array
What's the best way to search for consecutive values in an array? For example, searching for array('a', 'b') in array('x', 'a', 'b', 'c') would yield 1, because the values first appear consecutively at that index.
Haven't tested this, but something like this should do: function consecutive_values(array $needle, array $haystack) { $i_max = count($haystack)-count($needle); $j_max = count($needle); for($i=0; $i<$i_max; ++$i) { $match = true; for($j=0; $j<$j_max; ++$j) { if($needle[$j]!=$haystack[$i+$j]) { $match = false; break; } }...
Searching for consecutive values in an array What's the best way to search for consecutive values in an array? For example, searching for array('a', 'b') in array('x', 'a', 'b', 'c') would yield 1, because the values first appear consecutively at that index.
TITLE: Searching for consecutive values in an array QUESTION: What's the best way to search for consecutive values in an array? For example, searching for array('a', 'b') in array('x', 'a', 'b', 'c') would yield 1, because the values first appear consecutively at that index. ANSWER: Haven't tested this, but something...
[ "php", "arrays" ]
1
0
1,355
3
0
2011-06-10T00:41:11.367000
2011-06-10T00:53:03.593000
6,300,835
6,300,868
Variadic functions and type-hinting in PHP
Quick one: Is there any way to enforce types for variadic functions in PHP? I'm assuming not, however maybe I've missed something. As of now, I'm just forcing a single required argument of the needed type, and iterating to check the rest. public function myFunction(MyClass $object){ foreach(func_get_args() as $object){...
Well I would say it depends on the number of arguments:) There is nothing like a list (all arguments 1-n as MyClass [before PHP 5.6, for PHP 5.6+ see Variadic functions ]), it's more that you need to write each argument (as in your question) and it's allowed to send more but only the ones defined will be checked. Howev...
Variadic functions and type-hinting in PHP Quick one: Is there any way to enforce types for variadic functions in PHP? I'm assuming not, however maybe I've missed something. As of now, I'm just forcing a single required argument of the needed type, and iterating to check the rest. public function myFunction(MyClass $ob...
TITLE: Variadic functions and type-hinting in PHP QUESTION: Quick one: Is there any way to enforce types for variadic functions in PHP? I'm assuming not, however maybe I've missed something. As of now, I'm just forcing a single required argument of the needed type, and iterating to check the rest. public function myFu...
[ "php", "types", "variadic-functions", "type-hinting" ]
6
2
8,013
2
0
2011-06-10T00:42:12.220000
2011-06-10T00:49:38.157000
6,300,840
6,300,932
Why prototypes manually initialized to null still inherit from Object
If I write this var o = Object.create(null) alert(o instanceof Object) // this is false How come this ends up being true function o() { } o.prototype = null alert(new o() instanceof Object) // this is true Shouldn't manually setting the prototype to null cause it to inherit from nothing as Object.create does. Thanks i...
Briefly, if a constructor's prototype isn't an Object, then instances are given Object.prototype as their [[prototype]]. The detail is in ECMA-262, §13.2.2 [[Construct]]: When the [[Construct]] internal method for a Function object F is called with a possibly empty list of arguments, the following steps are taken: Let ...
Why prototypes manually initialized to null still inherit from Object If I write this var o = Object.create(null) alert(o instanceof Object) // this is false How come this ends up being true function o() { } o.prototype = null alert(new o() instanceof Object) // this is true Shouldn't manually setting the prototype to...
TITLE: Why prototypes manually initialized to null still inherit from Object QUESTION: If I write this var o = Object.create(null) alert(o instanceof Object) // this is false How come this ends up being true function o() { } o.prototype = null alert(new o() instanceof Object) // this is true Shouldn't manually settin...
[ "javascript", "prototype-programming" ]
4
4
219
2
0
2011-06-10T00:43:18.790000
2011-06-10T01:00:14.657000
6,300,859
6,303,198
Is there a function in Django / Python similar to PHP flush() that lets me send part of the HTTP response to clients?
According to the performance tip from Yahoo: When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page. During this time, the browser is idle as it waits for the data to arrive. In PHP you have the function flush(). It allows you to send your partially rea...
No. Is the short answer. The long answer depends what you're using between the webserver and python: You could implement it with WSGI but it wouldn't be a whimsical task. Maybe start here? http://www.python.org/dev/peps/pep-0333/#the-start-response-callable
Is there a function in Django / Python similar to PHP flush() that lets me send part of the HTTP response to clients? According to the performance tip from Yahoo: When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page. During this time, the browser is i...
TITLE: Is there a function in Django / Python similar to PHP flush() that lets me send part of the HTTP response to clients? QUESTION: According to the performance tip from Yahoo: When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page. During this time...
[ "php", "python", "django", "performance", "http" ]
7
2
901
3
0
2011-06-10T00:47:20.253000
2011-06-10T07:22:53.620000
6,300,863
6,300,878
Communication between a widget, a service, and the model (singleton) of an application (MVC like architecture)
I got a complex question involving many different components of an application. I hope to be clear enough. In my app, the application object, a singleton, provides a model (singleton too) to many activities. The main activity, presents a list of timed data to the user. These data come from the model. I also have a widg...
You can use the Observer pattern to have the engine fire off events to whichever components in the app are interested whenever things are updated, without the event-producing component having any real knowledge of the event-consumers. The Event object sent as a parameter should contain all of the relevant info about th...
Communication between a widget, a service, and the model (singleton) of an application (MVC like architecture) I got a complex question involving many different components of an application. I hope to be clear enough. In my app, the application object, a singleton, provides a model (singleton too) to many activities. T...
TITLE: Communication between a widget, a service, and the model (singleton) of an application (MVC like architecture) QUESTION: I got a complex question involving many different components of an application. I hope to be clear enough. In my app, the application object, a singleton, provides a model (singleton too) to ...
[ "java", "android", "design-patterns", "service", "widget" ]
0
1
864
1
0
2011-06-10T00:48:05.467000
2011-06-10T00:51:18.463000
6,300,866
6,308,704
Why is setter of dataprovider not called after filtering an arraycollection using filter function
I am using this: private var _hrInfoView:ArrayCollection; [Bindable] public function get HRInfoView():ArrayCollection { return _hrInfoView; } public function set HRInfoView(value:ArrayCollection):void { _hrInfoView = value; } private function onFilterByContent(event:ContextMenuEvent):void { HRInfoView.filterFunction =...
EDIT: After reading the question again, I think I see your problem. When you apply a filter function to an ArrayCollection, you're not actually affecting the ArrayCollection. Flex creates a copy of the ArrayCollection and puts it in a "wrapper" and only includes the records that match your filter. This is why your sett...
Why is setter of dataprovider not called after filtering an arraycollection using filter function I am using this: private var _hrInfoView:ArrayCollection; [Bindable] public function get HRInfoView():ArrayCollection { return _hrInfoView; } public function set HRInfoView(value:ArrayCollection):void { _hrInfoView = value...
TITLE: Why is setter of dataprovider not called after filtering an arraycollection using filter function QUESTION: I am using this: private var _hrInfoView:ArrayCollection; [Bindable] public function get HRInfoView():ArrayCollection { return _hrInfoView; } public function set HRInfoView(value:ArrayCollection):void { _...
[ "apache-flex", "actionscript-3", "flex3" ]
1
1
981
3
0
2011-06-10T00:48:28.293000
2011-06-10T15:37:36.827000
6,300,883
6,300,948
Why don't UISupportedInterfaceOrientations settings affect UIViewController behavior?
Xcode (4) highlights the UISupportedInterfaceOrientations settings, but no matter how I set them, it does not appear to affect a basic app's functionality. The Xcode templates insert commented out implementation for programmatically reporting support in: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrient...
I think there is a distinction here. The info.plist value indicates the orientations that the app supports whereas the shouldAutorotateToInterfaceOrientation: indicates the orientations a particular view is available in. If you look here, it is clearly mentioned that the info.plist values help iOS choose the initial or...
Why don't UISupportedInterfaceOrientations settings affect UIViewController behavior? Xcode (4) highlights the UISupportedInterfaceOrientations settings, but no matter how I set them, it does not appear to affect a basic app's functionality. The Xcode templates insert commented out implementation for programmatically r...
TITLE: Why don't UISupportedInterfaceOrientations settings affect UIViewController behavior? QUESTION: Xcode (4) highlights the UISupportedInterfaceOrientations settings, but no matter how I set them, it does not appear to affect a basic app's functionality. The Xcode templates insert commented out implementation for ...
[ "ios", "uiviewcontroller", "bundle", "resourcebundle" ]
1
1
3,734
1
0
2011-06-10T00:51:57.977000
2011-06-10T01:03:36.527000
6,300,896
6,300,914
Django template and XML question
I have this Django view that does render_to_response(rss.xml, {"list":list}) with this list: description description2 description3 the rss.xml template is the following: {% for item in list%} {{item}} {% endfor %} This works, however the <'s and "'s get replaced by their special html charactervalues like: <a href="link...
Replace {{item}} with {{item|safe}} in your code. It will avoid escaping HTML characters. For more information, see this doc page.
Django template and XML question I have this Django view that does render_to_response(rss.xml, {"list":list}) with this list: description description2 description3 the rss.xml template is the following: {% for item in list%} {{item}} {% endfor %} This works, however the <'s and "'s get replaced by their special html ch...
TITLE: Django template and XML question QUESTION: I have this Django view that does render_to_response(rss.xml, {"list":list}) with this list: description description2 description3 the rss.xml template is the following: {% for item in list%} {{item}} {% endfor %} This works, however the <'s and "'s get replaced by the...
[ "python", "xml", "django" ]
3
3
4,776
2
0
2011-06-10T00:53:54.217000
2011-06-10T00:57:34.770000
6,300,915
6,300,951
How to prevent nil from being returned when using try
I have the following line of code: truncate(blog.comments.first.try(:content),:length => 125) Problem here is, where content is empty, this returns nil. How can I prevent rails from outputting nil?
Assuming you want an empty string instead truncate(blog.comments.first.try(:content) || "",:length => 125)
How to prevent nil from being returned when using try I have the following line of code: truncate(blog.comments.first.try(:content),:length => 125) Problem here is, where content is empty, this returns nil. How can I prevent rails from outputting nil?
TITLE: How to prevent nil from being returned when using try QUESTION: I have the following line of code: truncate(blog.comments.first.try(:content),:length => 125) Problem here is, where content is empty, this returns nil. How can I prevent rails from outputting nil? ANSWER: Assuming you want an empty string instead...
[ "ruby-on-rails", "ruby", "ruby-on-rails-3" ]
0
2
624
2
0
2011-06-10T00:57:48.620000
2011-06-10T01:04:15.527000
6,300,917
6,300,982
Inheritance problem: calling parent construct function in subclass
I have a class named Display which extends class Layout, which extends class DOMDocument. I get: Fatal error: Call to a member function loadHTMLFile() on a non-object. Code as follows: In index.php: $dom = new Display(); $dom->displayData(); In Display.php: class Display extends Layout { public function displayData(){...
If you have the loadHTMLfile function in your parent class, the subclass will inherit it. So you should be able to do: class Display extends Layout { public function displayData(){ $this->loadHTMLfile("afile.html"); echo $this->saveHTML(); } }
Inheritance problem: calling parent construct function in subclass I have a class named Display which extends class Layout, which extends class DOMDocument. I get: Fatal error: Call to a member function loadHTMLFile() on a non-object. Code as follows: In index.php: $dom = new Display(); $dom->displayData(); In Display....
TITLE: Inheritance problem: calling parent construct function in subclass QUESTION: I have a class named Display which extends class Layout, which extends class DOMDocument. I get: Fatal error: Call to a member function loadHTMLFile() on a non-object. Code as follows: In index.php: $dom = new Display(); $dom->displayD...
[ "php", "inheritance", "domdocument", "extends", "construct" ]
2
2
820
4
0
2011-06-10T00:58:17.993000
2011-06-10T01:09:53.287000
6,300,919
6,301,089
How to receive socket information if you don't know how much data is coming through?
I am working on a GUI interface based on Python to interact with a robot running Python and an Arduino Mega as a motor controller and sensor controller. Originally, I was going to use a remote desktop to load my GUI from the robot. This turned out to be very slow because of the remote desktop. I decided that a server a...
I think I found three problems in this code; the first is wasteful, and the second is probably why you came here today, and the third is why you think you came in today.:) Busy Waiting This code is busy waiting for data to come in on the connection: connection.setblocking(0) print "Connected by", addr[0] while(1): try:...
How to receive socket information if you don't know how much data is coming through? I am working on a GUI interface based on Python to interact with a robot running Python and an Arduino Mega as a motor controller and sensor controller. Originally, I was going to use a remote desktop to load my GUI from the robot. Thi...
TITLE: How to receive socket information if you don't know how much data is coming through? QUESTION: I am working on a GUI interface based on Python to interact with a robot running Python and an Arduino Mega as a motor controller and sensor controller. Originally, I was going to use a remote desktop to load my GUI f...
[ "python", "arduino", "beagleboard" ]
3
5
1,096
1
0
2011-06-10T00:58:42.940000
2011-06-10T01:31:18.483000
6,300,920
6,303,085
Json to Gson - Modeling
I'm trying to convert a JSON to GSON, but I can not model. Can anyone give me an example with this one. [ { "id": "1", "name": "lalala", "object1": [ "string1", "string1", "string1" ], "object2": [ "anotherString1", "anotherString2" ] }, { "id": "2", "name": "laaaaalala", "object1": [ "string1", "string1", "string1" ],...
Here you go. import java.io.FileReader; import java.util.List; import com.google.gson.Gson; public class Foo { public static void main(String[] args) throws Exception { Gson gson = new Gson(); Thing[] things = gson.fromJson(new FileReader("input.json"), Thing[].class); System.out.println(gson.toJson(things)); } } cl...
Json to Gson - Modeling I'm trying to convert a JSON to GSON, but I can not model. Can anyone give me an example with this one. [ { "id": "1", "name": "lalala", "object1": [ "string1", "string1", "string1" ], "object2": [ "anotherString1", "anotherString2" ] }, { "id": "2", "name": "laaaaalala", "object1": [ "string1",...
TITLE: Json to Gson - Modeling QUESTION: I'm trying to convert a JSON to GSON, but I can not model. Can anyone give me an example with this one. [ { "id": "1", "name": "lalala", "object1": [ "string1", "string1", "string1" ], "object2": [ "anotherString1", "anotherString2" ] }, { "id": "2", "name": "laaaaalala", "obje...
[ "json", "model", "gson" ]
2
3
1,064
1
0
2011-06-10T00:58:46.307000
2011-06-10T07:06:43.923000
6,300,936
6,301,019
Streaming media using flash with a cross-domain proxy
Lets say I have a PHP application using very cheap shared hosting. What is the best way to stream audio/video (mp3/mpeg) that is tens of megabytes to hundreds of megabytes in size. I am thinking of a PHP based cross-domain proxy that uses caching. Is there something wrong with this approach? Has someone already done th...
Check out Amazon Cloudfront - it's a CDN that offers streaming using Flash Media Server. I recently setup a project using it and it was pretty easy to get up and running (I had no prior CDN or streaming experience). Of course, you'll have to see if the cost compares to your existing setup. I think by using a CDN you co...
Streaming media using flash with a cross-domain proxy Lets say I have a PHP application using very cheap shared hosting. What is the best way to stream audio/video (mp3/mpeg) that is tens of megabytes to hundreds of megabytes in size. I am thinking of a PHP based cross-domain proxy that uses caching. Is there something...
TITLE: Streaming media using flash with a cross-domain proxy QUESTION: Lets say I have a PHP application using very cheap shared hosting. What is the best way to stream audio/video (mp3/mpeg) that is tens of megabytes to hundreds of megabytes in size. I am thinking of a PHP based cross-domain proxy that uses caching. ...
[ "php", "flash", "actionscript-3", "apache", "same-origin-policy" ]
0
1
391
1
0
2011-06-10T01:00:35.020000
2011-06-10T01:15:50.770000
6,300,940
6,300,958
Need to format my json output a little better
I'm trying to make a nice representation of the console.log onto the page itself. I have the following: window.PRINT = function() { if(this.console) { console.log( Array.prototype.slice.call(arguments) ); } var X = $('#PRINT'); if (!X) { $('body').append(' '); X = $('#PRINT'); } $.each(arguments, function(Index, Value...
Try one of these: JSON2HTML Bloopletech Demo page Zach Hunter's JSON to HTML Demo project (download)
Need to format my json output a little better I'm trying to make a nice representation of the console.log onto the page itself. I have the following: window.PRINT = function() { if(this.console) { console.log( Array.prototype.slice.call(arguments) ); } var X = $('#PRINT'); if (!X) { $('body').append(' '); X = $('#PRIN...
TITLE: Need to format my json output a little better QUESTION: I'm trying to make a nice representation of the console.log onto the page itself. I have the following: window.PRINT = function() { if(this.console) { console.log( Array.prototype.slice.call(arguments) ); } var X = $('#PRINT'); if (!X) { $('body').append(...
[ "json", "console" ]
0
0
252
2
0
2011-06-10T01:01:20.647000
2011-06-10T01:05:47.567000
6,300,941
6,300,950
How to call a PHP function from JS that is invoked when clicking a link?
I have this test page: http://www.comehike.com/hikes/uncancel_hike.php?hike_id=30 When clicking "yes" I am able to get the JavaScript function invoked named uncancelHike, but I don't really know how to call the PHP function. I do import a php script with a function named uncancelHike() but I am not certain how to call ...
You need to use AJAX here, this tutorial should helpful for you: Beginning AJAX Using The YUI Library
How to call a PHP function from JS that is invoked when clicking a link? I have this test page: http://www.comehike.com/hikes/uncancel_hike.php?hike_id=30 When clicking "yes" I am able to get the JavaScript function invoked named uncancelHike, but I don't really know how to call the PHP function. I do import a php scri...
TITLE: How to call a PHP function from JS that is invoked when clicking a link? QUESTION: I have this test page: http://www.comehike.com/hikes/uncancel_hike.php?hike_id=30 When clicking "yes" I am able to get the JavaScript function invoked named uncancelHike, but I don't really know how to call the PHP function. I do...
[ "php", "javascript", "ajax", "yui" ]
0
1
668
2
0
2011-06-10T01:01:21.237000
2011-06-10T01:03:40.747000
6,300,957
6,301,043
MYSQL Query Optimization (need to increase speed)
I have a MySQL Table that holds Google Analytics data: CREATE TABLE IF NOT EXISTS `analytics_data` ( `ga_profile_id` int(11) NOT NULL, `page` varchar(200) NOT NULL, `source` varchar(150) NOT NULL, `medium` varchar(50) NOT NULL, `keyword` varchar(200) NOT NULL, `bounces` int(11) NOT NULL, `entrances` int(11) NOT NULL, `...
You need to create composite index ga_profile_id + date in this particular order. And you'll get the best you could get with such query. Further possible optimization is to pre-calculate sum of visits per date and use that for fast calculations.
MYSQL Query Optimization (need to increase speed) I have a MySQL Table that holds Google Analytics data: CREATE TABLE IF NOT EXISTS `analytics_data` ( `ga_profile_id` int(11) NOT NULL, `page` varchar(200) NOT NULL, `source` varchar(150) NOT NULL, `medium` varchar(50) NOT NULL, `keyword` varchar(200) NOT NULL, `bounces`...
TITLE: MYSQL Query Optimization (need to increase speed) QUESTION: I have a MySQL Table that holds Google Analytics data: CREATE TABLE IF NOT EXISTS `analytics_data` ( `ga_profile_id` int(11) NOT NULL, `page` varchar(200) NOT NULL, `source` varchar(150) NOT NULL, `medium` varchar(50) NOT NULL, `keyword` varchar(200) N...
[ "mysql", "query-optimization" ]
4
4
266
5
0
2011-06-10T01:05:32.360000
2011-06-10T01:20:00.253000
6,300,963
6,301,017
ASP.NET: When and how to dynamically change Gridview's headerText's in code behind?
I have a gridview with 2 columns. I want to learn coding behind and do NOT want to do this in the aspx file. How do I set the header text for my columns dynamically? At what point do I do so? After the adapter has filled the gridview with data? Right now, I have the header text but it is exactly the same as the datafie...
Try putting it in the GridView1.RowDataBound handler. Evaluate e.Row.RowType to determine if it is a header row, then then replace the HeaderText. protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { GridView1.Columns[...
ASP.NET: When and how to dynamically change Gridview's headerText's in code behind? I have a gridview with 2 columns. I want to learn coding behind and do NOT want to do this in the aspx file. How do I set the header text for my columns dynamically? At what point do I do so? After the adapter has filled the gridview wi...
TITLE: ASP.NET: When and how to dynamically change Gridview's headerText's in code behind? QUESTION: I have a gridview with 2 columns. I want to learn coding behind and do NOT want to do this in the aspx file. How do I set the header text for my columns dynamically? At what point do I do so? After the adapter has fill...
[ "c#", "asp.net", "gridview" ]
4
14
34,034
4
0
2011-06-10T01:06:47.707000
2011-06-10T01:15:41.513000
6,300,999
6,301,030
How do I validate that a question has at least one answer?
My question model has_many:answers in Rails 3. I want to be able to validate that each question has at least one answer. I tried the following code: validate:must_have_answer def must_have_answer if answers.empty? or answers.all?{ |example| example.marked_for_destruction? } errors.add_to_base{ "Must provide at least o...
Try passing a string instead of a block to errors.add_to_base errors.add_to_base "Must provide at least one answer"
How do I validate that a question has at least one answer? My question model has_many:answers in Rails 3. I want to be able to validate that each question has at least one answer. I tried the following code: validate:must_have_answer def must_have_answer if answers.empty? or answers.all?{ |example| example.marked_for_...
TITLE: How do I validate that a question has at least one answer? QUESTION: My question model has_many:answers in Rails 3. I want to be able to validate that each question has at least one answer. I tried the following code: validate:must_have_answer def must_have_answer if answers.empty? or answers.all?{ |example| e...
[ "ruby-on-rails-3", "validation" ]
1
2
221
1
0
2011-06-10T01:13:22.017000
2011-06-10T01:17:22.347000
6,301,014
6,301,075
Print Out 16 Decimal Digits
I'm looking to print the immediate 16 digits following the decimal point. I have this: "%.16f" % rand => "0.3179239550385533" However, this prints out a decimal point and a leading zero. Any way to do a string format that will just do the decimal digits? Thanks!
You don't need to use % to get a string, you can get away with just to_s. Then subscript the string to throw away the first two characters: rand.to_s[2..-1] This can run into a problem if you need 16 characters but rand gives you something that fits in less. If you need to worry about that, go back to % but keep the su...
Print Out 16 Decimal Digits I'm looking to print the immediate 16 digits following the decimal point. I have this: "%.16f" % rand => "0.3179239550385533" However, this prints out a decimal point and a leading zero. Any way to do a string format that will just do the decimal digits? Thanks!
TITLE: Print Out 16 Decimal Digits QUESTION: I'm looking to print the immediate 16 digits following the decimal point. I have this: "%.16f" % rand => "0.3179239550385533" However, this prints out a decimal point and a leading zero. Any way to do a string format that will just do the decimal digits? Thanks! ANSWER: Yo...
[ "ruby" ]
1
3
235
3
0
2011-06-10T01:15:26.383000
2011-06-10T01:29:12.103000
6,301,031
6,301,056
java threading - Daemon thread?
What will happen to a thread treated as Daemon? What will be the effect of this to the thread? What are the "can and can'ts" on the thread?
The main difference between a daemon thread and a non-daemon thread is that a program terminates when all non-daemon threads have terminated. So if you've got an active daemon thread and end your first thread, the program terminates. So you'd want to use a daemon thread for something you want to keep doing as long as t...
java threading - Daemon thread? What will happen to a thread treated as Daemon? What will be the effect of this to the thread? What are the "can and can'ts" on the thread?
TITLE: java threading - Daemon thread? QUESTION: What will happen to a thread treated as Daemon? What will be the effect of this to the thread? What are the "can and can'ts" on the thread? ANSWER: The main difference between a daemon thread and a non-daemon thread is that a program terminates when all non-daemon thre...
[ "java", "multithreading" ]
3
4
1,345
5
0
2011-06-10T01:17:27.833000
2011-06-10T01:22:41.500000
6,301,042
6,301,052
Can MySQL properly sort DATETIME columns when the values have been formatted with DATE_FORMAT?
Pretty much self-explanatory. Can MySQL sort dates (i.e. not alphabetically but like a date) when the dates have been formatted with DATE_FORMAT? Specifically, in my case, only the DATE part has been extracted from the DATETIME values.
Yes. ORDER BY DATE(`date_time`) DESC If you have already calculated this when selecting columns, just use its alias. SELECT DATE(`date_time`) AS `date` FROM `table` ORDER BY `date` DESC
Can MySQL properly sort DATETIME columns when the values have been formatted with DATE_FORMAT? Pretty much self-explanatory. Can MySQL sort dates (i.e. not alphabetically but like a date) when the dates have been formatted with DATE_FORMAT? Specifically, in my case, only the DATE part has been extracted from the DATETI...
TITLE: Can MySQL properly sort DATETIME columns when the values have been formatted with DATE_FORMAT? QUESTION: Pretty much self-explanatory. Can MySQL sort dates (i.e. not alphabetically but like a date) when the dates have been formatted with DATE_FORMAT? Specifically, in my case, only the DATE part has been extract...
[ "mysql", "datetime", "date" ]
2
7
4,351
1
0
2011-06-10T01:19:53.653000
2011-06-10T01:21:58.677000
6,301,046
6,303,049
Iterating over properties of an object in Script#
What Script# code would generate the following JavaScript? var obj = eval('(' + jsonText + ')'); for (key in obj) // what C# code translates to this iteration? { //... } thanks.
You can come close with: Object obj = Script.Eval("(" + json + ")"); foreach (DictionaryEntry entry in Dictionary.GetDictionary(obj)) { } which generates (in Script# 0.7.2): var obj = eval('(' + json + ')'); var $dict1 = obj; for (var $key2 in $dict1) { var entry = { key: $key2, value: $dict1[$key2] }; } Side Note: Th...
Iterating over properties of an object in Script# What Script# code would generate the following JavaScript? var obj = eval('(' + jsonText + ')'); for (key in obj) // what C# code translates to this iteration? { //... } thanks.
TITLE: Iterating over properties of an object in Script# QUESTION: What Script# code would generate the following JavaScript? var obj = eval('(' + jsonText + ')'); for (key in obj) // what C# code translates to this iteration? { //... } thanks. ANSWER: You can come close with: Object obj = Script.Eval("(" + json + "...
[ "c#", "javascript", "iteration", "script#" ]
1
5
454
1
0
2011-06-10T01:21:12.637000
2011-06-10T07:03:38.060000
6,301,081
6,308,128
How to deal with different gem dependencies within Bundler for scripts within a single Rails project?
Our Rails application pulls feeds from multiple sources. The workers that pull these feeds need gem dependencies for rmagick, oracle databases, and many other gems. In short, they have very different dependency needs than the main web application. Until Rails 3 and Bundler, life was good. These worker gem dependencies ...
I've been contemplating a similar problem, and although I don't have a solution in use anywhere yet, your question did make me think it out some more. I think you should be able to use a group to accomplish this. You can add something like this to your Gemfile: group:workers do gem "extra_gem_1" gem "extra_gem_2" end T...
How to deal with different gem dependencies within Bundler for scripts within a single Rails project? Our Rails application pulls feeds from multiple sources. The workers that pull these feeds need gem dependencies for rmagick, oracle databases, and many other gems. In short, they have very different dependency needs t...
TITLE: How to deal with different gem dependencies within Bundler for scripts within a single Rails project? QUESTION: Our Rails application pulls feeds from multiple sources. The workers that pull these feeds need gem dependencies for rmagick, oracle databases, and many other gems. In short, they have very different ...
[ "ruby-on-rails-3", "rubygems", "bundler" ]
1
3
315
1
0
2011-06-10T01:30:17.397000
2011-06-10T14:56:58.503000
6,302,899
6,303,005
Using std::copy - error C2679: can't find correct binary '=' operator
I am trying to use a solution from this question: How do I iterate over cin line by line in C++? The error message c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2144): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const Line' (or there is no acceptable co...
Here is correct version that compiles fine: class Line { std::string data; public: friend std::istream& operator>>(std::istream& inputStream, Line& line) { std::getline(inputStream, line.data); return inputStream; } operator std::string() const { return data; } }; The conversion operator needs to be const.
Using std::copy - error C2679: can't find correct binary '=' operator I am trying to use a solution from this question: How do I iterate over cin line by line in C++? The error message c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2144): error C2679: binary '=': no operator found which takes a...
TITLE: Using std::copy - error C2679: can't find correct binary '=' operator QUESTION: I am trying to use a solution from this question: How do I iterate over cin line by line in C++? The error message c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(2144): error C2679: binary '=': no operator f...
[ "c++", "copy", "compiler-errors", "iostream" ]
1
2
2,018
2
0
2011-06-10T06:48:39.173000
2011-06-10T06:59:40.297000
6,302,901
6,302,929
split a list by a lambda function in python
Is there any version of split that works on generic list types? For example, in Haskell Prelude> import Data.List.Split Prelude Data.List.Split> splitWhen (==2) [1, 2, 3] [[1],[3]]
Nope. But you can use itertools.groupby() to mimic it. >>> [list(x[1]) for x in itertools.groupby([1, 2, 3], lambda x: x == 2) if not x[0]] [[1], [3]]
split a list by a lambda function in python Is there any version of split that works on generic list types? For example, in Haskell Prelude> import Data.List.Split Prelude Data.List.Split> splitWhen (==2) [1, 2, 3] [[1],[3]]
TITLE: split a list by a lambda function in python QUESTION: Is there any version of split that works on generic list types? For example, in Haskell Prelude> import Data.List.Split Prelude Data.List.Split> splitWhen (==2) [1, 2, 3] [[1],[3]] ANSWER: Nope. But you can use itertools.groupby() to mimic it. >>> [list(x[1...
[ "python", "list" ]
9
18
7,882
4
0
2011-06-10T06:48:52.403000
2011-06-10T06:52:18.583000
6,302,907
6,303,017
Given a class name, how to identify where it is loaded from in JBoss AS 5.1.0?
I am looking for a JMX kind of option in JBoss 5.1.0 to find the jar file/location of the jar file/class loader for given a fully qualified class name at run time. This is to understand what class loader configuration are in place across applications in a deployment.
It's not really a "JMX kind of option" but maybe this can help you? Following Java code can be executed to find out where your classes are loaded from: ProtectionDomain protectionDomain = YourClass.class.getProtectionDomain(); File codeLoc = new File(protectionDomain.getCodeSource().getLocation().getFile()); See this d...
Given a class name, how to identify where it is loaded from in JBoss AS 5.1.0? I am looking for a JMX kind of option in JBoss 5.1.0 to find the jar file/location of the jar file/class loader for given a fully qualified class name at run time. This is to understand what class loader configuration are in place across app...
TITLE: Given a class name, how to identify where it is loaded from in JBoss AS 5.1.0? QUESTION: I am looking for a JMX kind of option in JBoss 5.1.0 to find the jar file/location of the jar file/class loader for given a fully qualified class name at run time. This is to understand what class loader configuration are i...
[ "java", "jboss5.x", "classloader" ]
1
1
139
1
0
2011-06-10T06:49:13.483000
2011-06-10T07:00:41.403000
6,302,908
6,302,984
howto disable compile of modules when tests are skipepd
In our "big build" (40+ modules), we have several modules that contain only tests. When I give -DskiptTests to mvn, the tests are not executed. But they are compiled, which costs up to a minute of build time. How can I selectively turn off such modules when the option skipTests is set?
You'd have to organize your root pom such that the test modules are activated via a profile, and instead of using -Dmaven.test.skip to turn use -P!testProfile to deactivate them and hence skipping them. Another thought is that you could just do: org.apache.maven.plugins maven-compiler-plugin ${maven.test.skip} I haven'...
howto disable compile of modules when tests are skipepd In our "big build" (40+ modules), we have several modules that contain only tests. When I give -DskiptTests to mvn, the tests are not executed. But they are compiled, which costs up to a minute of build time. How can I selectively turn off such modules when the op...
TITLE: howto disable compile of modules when tests are skipepd QUESTION: In our "big build" (40+ modules), we have several modules that contain only tests. When I give -DskiptTests to mvn, the tests are not executed. But they are compiled, which costs up to a minute of build time. How can I selectively turn off such m...
[ "maven-2", "build" ]
4
2
346
2
0
2011-06-10T06:49:22.827000
2011-06-10T06:57:19.313000
6,302,913
6,302,945
c write the string to file line by line
fwrite don't work, what's wrong with my code? void printTree (struct recordNode* tree) { char* report1; FILE *fp = fopen("test.txt","w"); if (tree == NULL) { return; } //if(fp) { counter2++; printTree(tree->right); fwrite(fp,"%d\n", tree->pop); //putc(tree->pop, fp); //report1 = printf("%s = %d\n"); printTree(tree...
fwrite does not do formatted output like that, you need fprintf: fprintf (fp, "%d\n", tree->pop); fwrite has the following prototype: size_t fwrite (const void *restrict buff, size_t sz, size_t num, FILE *restrict hndl); and, since you're not even giving it that all-important fourth parameter (the file handle) in your ...
c write the string to file line by line fwrite don't work, what's wrong with my code? void printTree (struct recordNode* tree) { char* report1; FILE *fp = fopen("test.txt","w"); if (tree == NULL) { return; } //if(fp) { counter2++; printTree(tree->right); fwrite(fp,"%d\n", tree->pop); //putc(tree->pop, fp); //repor...
TITLE: c write the string to file line by line QUESTION: fwrite don't work, what's wrong with my code? void printTree (struct recordNode* tree) { char* report1; FILE *fp = fopen("test.txt","w"); if (tree == NULL) { return; } //if(fp) { counter2++; printTree(tree->right); fwrite(fp,"%d\n", tree->pop); //putc(tree->...
[ "c" ]
1
12
21,223
1
0
2011-06-10T06:50:17.443000
2011-06-10T06:53:42.060000
6,302,930
6,302,952
How to use window.scroll to automatically scroll on pageload?
function Scrolldown() { window.scroll(0,300); } How can I use this function (or a similar one) to automatically scroll down when the page loads? (without clicking a link) Regards, taylor
Give this a try: function Scrolldown() { window.scroll(0,300); } window.onload = Scrolldown;
How to use window.scroll to automatically scroll on pageload? function Scrolldown() { window.scroll(0,300); } How can I use this function (or a similar one) to automatically scroll down when the page loads? (without clicking a link) Regards, taylor
TITLE: How to use window.scroll to automatically scroll on pageload? QUESTION: function Scrolldown() { window.scroll(0,300); } How can I use this function (or a similar one) to automatically scroll down when the page loads? (without clicking a link) Regards, taylor ANSWER: Give this a try: function Scrolldown() { win...
[ "javascript" ]
14
14
52,598
5
0
2011-06-10T06:52:22.250000
2011-06-10T06:54:08.207000
6,302,957
6,303,104
How to find out the simulator orientations?
iam developing one app.In that i want to find out the iphone orientations.I written the code for that one.Is there any way to find out the simulator orientations.
Jeremy's answer is missing an exceedingly important piece of information about [[UIDevice currentDevice] orientation] - as per the Apple documents: The value of this property always returns 0 unless orientation notifications have been enabled by calling beginGeneratingDeviceOrientationNotifications. Before you call [[U...
How to find out the simulator orientations? iam developing one app.In that i want to find out the iphone orientations.I written the code for that one.Is there any way to find out the simulator orientations.
TITLE: How to find out the simulator orientations? QUESTION: iam developing one app.In that i want to find out the iphone orientations.I written the code for that one.Is there any way to find out the simulator orientations. ANSWER: Jeremy's answer is missing an exceedingly important piece of information about [[UIDev...
[ "iphone", "cocoa-touch" ]
0
2
211
2
0
2011-06-10T06:54:26.287000
2011-06-10T07:09:16.117000
6,302,961
6,302,993
Arithmetic operation in Assembly
I am learning assembly language. I find that arithmetic in assembly can be either signed or unsigned. Rules are different for both type of arithmetic and I find it is programmer's headache to decide which rules to apply. So a programmer should know beforehand if arithmetic involves the negative numbers or not. if yes, ...
If you are the programmer, you are in control of your data representation within the bounds of the requirements of your software's target domain. This means you need to know well before you actually start touching code what type of data you are going to be dealing with, how it is going to be arranged (in the case of co...
Arithmetic operation in Assembly I am learning assembly language. I find that arithmetic in assembly can be either signed or unsigned. Rules are different for both type of arithmetic and I find it is programmer's headache to decide which rules to apply. So a programmer should know beforehand if arithmetic involves the ...
TITLE: Arithmetic operation in Assembly QUESTION: I am learning assembly language. I find that arithmetic in assembly can be either signed or unsigned. Rules are different for both type of arithmetic and I find it is programmer's headache to decide which rules to apply. So a programmer should know beforehand if arithm...
[ "math", "assembly" ]
2
9
1,902
2
0
2011-06-10T06:54:42.743000
2011-06-10T06:58:00.283000
6,302,966
6,302,980
how to extract value from variable in PHP function?
This is probably a silly question but how do you extract the value of a variable inside a PHP function? I found this code on stackoverflow on how to find the title of the webpage: function page_title($url) { $fp = file_get_contents($url); if (!$fp) return null; $res = preg_match("/ (.*)<\/title>/", $fp, $title_matches...
$extract = page_title($url); place that outside the function and you should be good to go
how to extract value from variable in PHP function? This is probably a silly question but how do you extract the value of a variable inside a PHP function? I found this code on stackoverflow on how to find the title of the webpage: function page_title($url) { $fp = file_get_contents($url); if (!$fp) return null; $res ...
TITLE: how to extract value from variable in PHP function? QUESTION: This is probably a silly question but how do you extract the value of a variable inside a PHP function? I found this code on stackoverflow on how to find the title of the webpage: function page_title($url) { $fp = file_get_contents($url); if (!$fp) r...
[ "php", "function", "variables", "extract" ]
0
4
1,133
3
0
2011-06-10T06:55:21.827000
2011-06-10T06:56:53.060000
6,302,968
6,303,172
Can Entity Framework 4.1 designer "update model from database" for selected entities only?
The situation: Sometimes a database schema is not what you would consider an ideal representation of the system's information and you may not be able to change it. We have been using Entity Framework to create a nicer conceptual model to code against in situations like this. This means updating the model from the datab...
No there is no way to make selective updates with built-in designer. Also the designer doesn't throw away all your changes. It usually doesn't touch conceptual model (except some rare occasions where it continuously renames some associations) and mapping but it always deletes storage model and override it with new defi...
Can Entity Framework 4.1 designer "update model from database" for selected entities only? The situation: Sometimes a database schema is not what you would consider an ideal representation of the system's information and you may not be able to change it. We have been using Entity Framework to create a nicer conceptual ...
TITLE: Can Entity Framework 4.1 designer "update model from database" for selected entities only? QUESTION: The situation: Sometimes a database schema is not what you would consider an ideal representation of the system's information and you may not be able to change it. We have been using Entity Framework to create a...
[ "c#", "entity-framework", "entity-framework-4.1", "edmx", "edmx-designer" ]
7
5
3,142
2
0
2011-06-10T06:55:26.303000
2011-06-10T07:20:09.207000
6,302,971
6,303,090
Enable radiobuttonlist in grid on checkbox check
My problem is: I got data in the front end in this format: Username: xxxx First name: xxx Last Name: XXX Authorizations \this is a grid, with chheckbox and radiobtns Domain Role xyz User bnv Admin asd User_1 now I need to insert this data back to my table. 1 suggestion i got was: Use XML... right track? or is there som...
If I understood correctly, you want to insert bulk data to the database. Apart from XML you can also use SqlBulCopy class which is very efficient in inserting millions of records to the SQL database. You can find more details on this at MSDN http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx
Enable radiobuttonlist in grid on checkbox check My problem is: I got data in the front end in this format: Username: xxxx First name: xxx Last Name: XXX Authorizations \this is a grid, with chheckbox and radiobtns Domain Role xyz User bnv Admin asd User_1 now I need to insert this data back to my table. 1 suggestion i...
TITLE: Enable radiobuttonlist in grid on checkbox check QUESTION: My problem is: I got data in the front end in this format: Username: xxxx First name: xxx Last Name: XXX Authorizations \this is a grid, with chheckbox and radiobtns Domain Role xyz User bnv Admin asd User_1 now I need to insert this data back to my tab...
[ "c#", "xml", "ado.net" ]
1
0
103
1
0
2011-06-10T06:56:00.283000
2011-06-10T07:07:07.463000
6,302,973
6,303,051
mounting a git http repository using davfs
I'm trying to convert some projects at work from subversion to git. The projects are websites and our current subversion setup uses davfs to mount the repository and point apache's document root there. This way apache in dev runs the code currently checked-into the svn repository. mount: mount.davfs http://code.reposit...
If you want to be able to browse the code, you should be using something like gitweb. If you want to push/pull from the repo, then the internals should be showing up as the docroot. In a bare repository (the kind that you would use for such a central repo, since you generally don't want to push to non-bare repos), ther...
mounting a git http repository using davfs I'm trying to convert some projects at work from subversion to git. The projects are websites and our current subversion setup uses davfs to mount the repository and point apache's document root there. This way apache in dev runs the code currently checked-into the svn reposit...
TITLE: mounting a git http repository using davfs QUESTION: I'm trying to convert some projects at work from subversion to git. The projects are websites and our current subversion setup uses davfs to mount the repository and point apache's document root there. This way apache in dev runs the code currently checked-in...
[ "apache", "svn", "git" ]
0
0
779
2
0
2011-06-10T06:56:07.393000
2011-06-10T07:03:54.870000
6,302,975
6,303,018
How does this function self-executes?
I have the following code (which is the initialization of the facebook API), I don't understand why this snippet runs on-load without being called anywhere else in the code! The funny thing is that when i remove the fbAsyncInit function "wrapper" it works the same! so how does the FB.init is called without calling fbAs...
For this to work, you need to include a script from Facebook (perhaps connect.facebook.net/en_US/all.js ) in your page. The script runs window.fbAsyncInit from a window.setTimeout(..., 0), causing your code to be run after the Facebook script has been completely loaded and initialized.
How does this function self-executes? I have the following code (which is the initialization of the facebook API), I don't understand why this snippet runs on-load without being called anywhere else in the code! The funny thing is that when i remove the fbAsyncInit function "wrapper" it works the same! so how does the ...
TITLE: How does this function self-executes? QUESTION: I have the following code (which is the initialization of the facebook API), I don't understand why this snippet runs on-load without being called anywhere else in the code! The funny thing is that when i remove the fbAsyncInit function "wrapper" it works the same...
[ "javascript", "function", "execution" ]
4
3
94
1
0
2011-06-10T06:56:16.100000
2011-06-10T07:00:46.430000
6,302,983
6,303,089
Not able to write proper function in asp.net mvc 3.0
i have one method and it will return IQueryable value public IQueryable Query(Expression > whereCondition) { IQueryable tabmasters = _tabmasterRepository.GetQueryable().Where(whereCondition); IQueryable tabmasterview; AutoMapper.Mapper.CreateMap ().ForMember(dest => dest.colID, opt => opt.MapFrom(src => src.colID)); ta...
To fix the compiler error all you have to do is IQueryable tabmasterview = null; But the second argument you are passing to AutoMapper.Mapper.Map(tabmasters, tabmasterview) is always null as tabMasterview has not been intialized. If that is intended you could as well pass "null". public IQueryable Query(Expression > wh...
Not able to write proper function in asp.net mvc 3.0 i have one method and it will return IQueryable value public IQueryable Query(Expression > whereCondition) { IQueryable tabmasters = _tabmasterRepository.GetQueryable().Where(whereCondition); IQueryable tabmasterview; AutoMapper.Mapper.CreateMap ().ForMember(dest => ...
TITLE: Not able to write proper function in asp.net mvc 3.0 QUESTION: i have one method and it will return IQueryable value public IQueryable Query(Expression > whereCondition) { IQueryable tabmasters = _tabmasterRepository.GetQueryable().Where(whereCondition); IQueryable tabmasterview; AutoMapper.Mapper.CreateMap ()....
[ "c#" ]
0
1
223
1
0
2011-06-10T06:57:13.617000
2011-06-10T07:06:58.260000
6,303,007
6,303,042
how to get sum() from alise column in SQL
I'd like the sum of TotalVisitedTime time but it is alias column so how can I gtt it? Select CONVERT(varchar(6), DATEDIFF(second, [Start], [End])/3600) + ':' + RIGHT('0' + CONVERT(varchar(2), (DATEDIFF(second, [Start], [End]) % 3600) / 60), 2) + ':' + RIGHT('0' + CONVERT(varchar(2), DATEDIFF(second, [Start], [End]) % 6...
SELECT SUM(TotalVisitedTime) FROM ( -- AS PER @Alex Aza, @Andriy M SELECT 1234 AS TotalVisitedTime ) AS OuterTable
how to get sum() from alise column in SQL I'd like the sum of TotalVisitedTime time but it is alias column so how can I gtt it? Select CONVERT(varchar(6), DATEDIFF(second, [Start], [End])/3600) + ':' + RIGHT('0' + CONVERT(varchar(2), (DATEDIFF(second, [Start], [End]) % 3600) / 60), 2) + ':' + RIGHT('0' + CONVERT(varcha...
TITLE: how to get sum() from alise column in SQL QUESTION: I'd like the sum of TotalVisitedTime time but it is alias column so how can I gtt it? Select CONVERT(varchar(6), DATEDIFF(second, [Start], [End])/3600) + ':' + RIGHT('0' + CONVERT(varchar(2), (DATEDIFF(second, [Start], [End]) % 3600) / 60), 2) + ':' + RIGHT('0...
[ "sql", "sql-server-2005", "t-sql", "sum" ]
1
1
545
2
0
2011-06-10T06:59:50.823000
2011-06-10T07:02:49.963000
6,303,011
6,303,030
A c++ syntax question: class for method
in the code below, it has the following line base_list(const base_list &tmp):memory::SqlAlloc() base_list is a method, memory is a namespace, SqlAlloc is a class, so what does it mean when combine them together? class base_list:public memory::SqlAlloc { public: base_list(const base_list &tmp):memory::SqlAlloc() { eleme...
base_list(const base_list &tmp):memory::SqlAlloc() Uses Initializer list to call constructor of class SqlAlloc inside namespace memory. For more information on advantages of using Initializer List in C++, See this.
A c++ syntax question: class for method in the code below, it has the following line base_list(const base_list &tmp):memory::SqlAlloc() base_list is a method, memory is a namespace, SqlAlloc is a class, so what does it mean when combine them together? class base_list:public memory::SqlAlloc { public: base_list(const ba...
TITLE: A c++ syntax question: class for method QUESTION: in the code below, it has the following line base_list(const base_list &tmp):memory::SqlAlloc() base_list is a method, memory is a namespace, SqlAlloc is a class, so what does it mean when combine them together? class base_list:public memory::SqlAlloc { public: ...
[ "c++", "namespaces" ]
0
3
99
5
0
2011-06-10T06:59:52.593000
2011-06-10T07:01:51.873000
6,303,022
6,303,087
How to compare string in PL/SQL?
i just want to know that, there is any way through which i can Compare a column value with Some String value.Something like this... suppose column name is SHIPMENT_EXPEDITE_HAWB then can i have like this in plsql SHIPMENT_EXPEDITE_HAWB=='PD' Thaanks in advance!!!
You just need one equals, not two. IF shipment_expedite_hawb = 'PD' THEN dbms_output.put_line('Same'); END IF;
How to compare string in PL/SQL? i just want to know that, there is any way through which i can Compare a column value with Some String value.Something like this... suppose column name is SHIPMENT_EXPEDITE_HAWB then can i have like this in plsql SHIPMENT_EXPEDITE_HAWB=='PD' Thaanks in advance!!!
TITLE: How to compare string in PL/SQL? QUESTION: i just want to know that, there is any way through which i can Compare a column value with Some String value.Something like this... suppose column name is SHIPMENT_EXPEDITE_HAWB then can i have like this in plsql SHIPMENT_EXPEDITE_HAWB=='PD' Thaanks in advance!!! ANSW...
[ "oracle", "plsql" ]
20
39
115,625
2
0
2011-06-10T07:01:11.573000
2011-06-10T07:06:51.763000
6,303,023
6,303,158
To create a directory in Sd card inside an application
I want to create a directory on sd card keeping it as a separate activity in one of my application. I wrote the following code in the onCreate() of the application. It is not creating the directory though this code works fine if I try to implement it as an independent application. Please suggest a solution for this pro...
The SD card might be mounted at /mnt/sdcard instead of /sdcard. But the safest technique to get the external storage directory is like in the following code File myDirectory = new File(Environment.getExternalStorageDirectory(), "my directory"); if(!myDirectory.exists()) { myDirectory.mkdirs(); }
To create a directory in Sd card inside an application I want to create a directory on sd card keeping it as a separate activity in one of my application. I wrote the following code in the onCreate() of the application. It is not creating the directory though this code works fine if I try to implement it as an independ...
TITLE: To create a directory in Sd card inside an application QUESTION: I want to create a directory on sd card keeping it as a separate activity in one of my application. I wrote the following code in the onCreate() of the application. It is not creating the directory though this code works fine if I try to implement...
[ "android", "directory" ]
0
4
1,153
2
0
2011-06-10T07:01:17.983000
2011-06-10T07:18:27.130000
6,303,032
6,303,066
Problem in using WebView?
I have created a page which has link to a page of a website. So for showing that on I have used a WebView and it works fine. My Problem is that when I click on any link given on that webpage, the link opens in phone's default browser view. But I want all the links to be opened in my created WebView. Have I made any mis...
Try specifying your own WebViewClient: WebView webView = (WebView)findViewById( R.id.terms_of_use_webview ); webView.setWebViewClient( new WebViewClient() { @Override public boolean shouldOverrideUrlLoading( WebView view, String url ) { view.loadUrl( url ); return true; } }); To further understand why this is necessary...
Problem in using WebView? I have created a page which has link to a page of a website. So for showing that on I have used a WebView and it works fine. My Problem is that when I click on any link given on that webpage, the link opens in phone's default browser view. But I want all the links to be opened in my created We...
TITLE: Problem in using WebView? QUESTION: I have created a page which has link to a page of a website. So for showing that on I have used a WebView and it works fine. My Problem is that when I click on any link given on that webpage, the link opens in phone's default browser view. But I want all the links to be opene...
[ "android", "webview" ]
0
3
234
2
0
2011-06-10T07:01:57.863000
2011-06-10T07:05:37.183000
6,303,053
6,303,068
CSS is not being applied after changes
I have problem where I can't apply the style in CSS in my ASP.NET MVC application. The behavior is it applies for the first time and then the subsequent changes to the CSS is not getting reflected in my _Layout.cshtml. I am not sure what I am missing here. CSS file body { font-size:.85em; font-family: "Trebuchet MS", V...
Hit the Ctrl-F5 for reloading the page without using the cached contents
CSS is not being applied after changes I have problem where I can't apply the style in CSS in my ASP.NET MVC application. The behavior is it applies for the first time and then the subsequent changes to the CSS is not getting reflected in my _Layout.cshtml. I am not sure what I am missing here. CSS file body { font-siz...
TITLE: CSS is not being applied after changes QUESTION: I have problem where I can't apply the style in CSS in my ASP.NET MVC application. The behavior is it applies for the first time and then the subsequent changes to the CSS is not getting reflected in my _Layout.cshtml. I am not sure what I am missing here. CSS fi...
[ "asp.net", "asp.net-mvc", "asp.net-mvc-2", "asp.net-mvc-3" ]
38
109
51,156
5
0
2011-06-10T07:04:00.783000
2011-06-10T07:05:47.753000
6,303,056
6,303,084
Is $0x1a a register here?
Dump of assembler code for function read@plt: 0x0000000000402458: jmpq *0x2b4f72(%rip) # 0x6b73d0 <_GLOBAL_OFFSET_TABLE_+232> 0x000000000040245e: pushq $0x1a 0x0000000000402463: jmpq 0x4022a8 Anyone knows? BTW,how does read knows he comes to the end of file?
No, it's a immediate value. pushq pushes a value onto the stack, which may be a register, but you'll find they're denoted by operands like %rbx. The $0x1a is an immediate value - you can tell this also by the length of that instruction (five bytes, from x+6 to x+10 ). The pushq instruction is capable of pushing a regis...
Is $0x1a a register here? Dump of assembler code for function read@plt: 0x0000000000402458: jmpq *0x2b4f72(%rip) # 0x6b73d0 <_GLOBAL_OFFSET_TABLE_+232> 0x000000000040245e: pushq $0x1a 0x0000000000402463: jmpq 0x4022a8 Anyone knows? BTW,how does read knows he comes to the end of file?
TITLE: Is $0x1a a register here? QUESTION: Dump of assembler code for function read@plt: 0x0000000000402458: jmpq *0x2b4f72(%rip) # 0x6b73d0 <_GLOBAL_OFFSET_TABLE_+232> 0x000000000040245e: pushq $0x1a 0x0000000000402463: jmpq 0x4022a8 Anyone knows? BTW,how does read knows he comes to the end of file? ANSWER: No, it's...
[ "x86", "disassembly" ]
0
2
311
3
0
2011-06-10T07:04:08.990000
2011-06-10T07:06:43.713000
6,303,059
6,303,094
Makefile related
I have a Makefile where the first line is of the type: all:client.so simulator LD_PRELOAD=/path/to/shared/lib/client.so./simulator and the other lines to above follows Now, I have another program say xyz.c whose executable is called from within simulator using execve(). How can I include the compilation linking etc of ...
Can't you just make all depend on the executable for xyc as well? And then add targets to build that from xyc.c?
Makefile related I have a Makefile where the first line is of the type: all:client.so simulator LD_PRELOAD=/path/to/shared/lib/client.so./simulator and the other lines to above follows Now, I have another program say xyz.c whose executable is called from within simulator using execve(). How can I include the compilatio...
TITLE: Makefile related QUESTION: I have a Makefile where the first line is of the type: all:client.so simulator LD_PRELOAD=/path/to/shared/lib/client.so./simulator and the other lines to above follows Now, I have another program say xyz.c whose executable is called from within simulator using execve(). How can I incl...
[ "c", "linux", "makefile" ]
0
1
70
2
0
2011-06-10T07:04:26.773000
2011-06-10T07:07:43.620000
6,303,111
6,303,165
Interface for 4 interfaces?
I'm having a quite large database app and trying to be using the repository pattern. I have 4 interfaces: IProductRepository, IFileRepository...., and I want to have an combined interface for all 4 which I want to act like an API to other parts of the application. Must I have a class and type in all the methods of the ...
Yes. This is possible downside to using interfaces. Only good way to make this bearable is to use some kind of code generation tool. Something like T4.
Interface for 4 interfaces? I'm having a quite large database app and trying to be using the repository pattern. I have 4 interfaces: IProductRepository, IFileRepository...., and I want to have an combined interface for all 4 which I want to act like an API to other parts of the application. Must I have a class and typ...
TITLE: Interface for 4 interfaces? QUESTION: I'm having a quite large database app and trying to be using the repository pattern. I have 4 interfaces: IProductRepository, IFileRepository...., and I want to have an combined interface for all 4 which I want to act like an API to other parts of the application. Must I ha...
[ "c#", ".net", "design-patterns", "repository-pattern" ]
2
1
147
5
0
2011-06-10T07:10:18.520000
2011-06-10T07:19:01.300000
6,303,116
6,303,144
ListView color repetation problem?
I use the following code to set the ListView, the data and buttons are set properly,when I scroll also there is no problem in data repetition, but when i scroll the color is set for all text fields, how can I resolve it?. private class EfficientAdapter extends BaseAdapter { public EfficientAdapter(Context context) { m...
holder.albumName.setTextColor(Color.BLACK); //or whatever the original color is holder.albumName.setText(albumData[position][0]); if((albumData[position][2].length()==0)){ holder.albumName.setTextColor(Color.RED); } you should first reset the original color of the view before you make your move. Listview only recycle...
ListView color repetation problem? I use the following code to set the ListView, the data and buttons are set properly,when I scroll also there is no problem in data repetition, but when i scroll the color is set for all text fields, how can I resolve it?. private class EfficientAdapter extends BaseAdapter { public Ef...
TITLE: ListView color repetation problem? QUESTION: I use the following code to set the ListView, the data and buttons are set properly,when I scroll also there is no problem in data repetition, but when i scroll the color is set for all text fields, how can I resolve it?. private class EfficientAdapter extends BaseAd...
[ "android", "android-layout" ]
0
1
111
1
0
2011-06-10T07:11:16.190000
2011-06-10T07:17:10.730000
6,303,147
6,303,171
comparing string in C# vs a static Regex?
I was wondering, is there any easy way for those who are really unfamiliar with regex to find out how to match a string with the regex format for the specified string? For example, this string, which is generated from another function i have: 3A5AE0F4-EB22-434E-80C2-273E315CD1B0 I have no clue what so ever what the pro...
In this case, it looks like this is a Guid - if you're using.NET 4, the simplest approach is probably to use Guid.TryParse... but if you need to use a regex, it would probably be: ^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$ In other words, start of string, 8 hex digits, dash, 4 hex digits, dash, 4 he...
comparing string in C# vs a static Regex? I was wondering, is there any easy way for those who are really unfamiliar with regex to find out how to match a string with the regex format for the specified string? For example, this string, which is generated from another function i have: 3A5AE0F4-EB22-434E-80C2-273E315CD1B...
TITLE: comparing string in C# vs a static Regex? QUESTION: I was wondering, is there any easy way for those who are really unfamiliar with regex to find out how to match a string with the regex format for the specified string? For example, this string, which is generated from another function i have: 3A5AE0F4-EB22-434...
[ "c#", "regex", "string" ]
1
9
327
4
0
2011-06-10T07:17:29.397000
2011-06-10T07:20:06.853000
6,306,444
6,306,502
How can this object reference itself
I've been tinkering with some code in a effort to understand OOP using c. I really like this style and want to use it. The code sample works great if another class creates an instance of FooOBJ. How can FooOBJ reference itself to change its own variables? Do I need to make a copy of foo in the constructor or something ...
Well, any function operating on an instance of your "class" will have to take a pointer to the instance. This happens automatically and implicitly in C++, but in C you'll have to pass a "this" pointer everywhere. What this means is that your setFooNumber has the right signature for a "member function", whereas setmysel...
How can this object reference itself I've been tinkering with some code in a effort to understand OOP using c. I really like this style and want to use it. The code sample works great if another class creates an instance of FooOBJ. How can FooOBJ reference itself to change its own variables? Do I need to make a copy of...
TITLE: How can this object reference itself QUESTION: I've been tinkering with some code in a effort to understand OOP using c. I really like this style and want to use it. The code sample works great if another class creates an instance of FooOBJ. How can FooOBJ reference itself to change its own variables? Do I need...
[ "c" ]
2
6
124
2
0
2011-06-10T12:37:03.480000
2011-06-10T12:42:32.830000
6,306,451
6,306,603
Why I can't disassemble this user space address?
Dump of assembler code for function foo@plt: 0x0000000000400528: jmpq *0x2004d2(%rip) # 0x600a00 <_GLOBAL_OFFSET_TABLE_+40> 0x000000000040052e: pushq $0x2 0x0000000000400533: jmpq 0x4004f8 (gdb) disas 0x4004f8 No function contains specified address. I knwo 0x4004f8 is the entry point of procedure linkage table,but why ...
disas with one address needs to find the function the address is contained within to know how much to disassemble. Either with disas with two arguments, or x/i. Also see: How can I force GDB to disassemble?
Why I can't disassemble this user space address? Dump of assembler code for function foo@plt: 0x0000000000400528: jmpq *0x2004d2(%rip) # 0x600a00 <_GLOBAL_OFFSET_TABLE_+40> 0x000000000040052e: pushq $0x2 0x0000000000400533: jmpq 0x4004f8 (gdb) disas 0x4004f8 No function contains specified address. I knwo 0x4004f8 is th...
TITLE: Why I can't disassemble this user space address? QUESTION: Dump of assembler code for function foo@plt: 0x0000000000400528: jmpq *0x2004d2(%rip) # 0x600a00 <_GLOBAL_OFFSET_TABLE_+40> 0x000000000040052e: pushq $0x2 0x0000000000400533: jmpq 0x4004f8 (gdb) disas 0x4004f8 No function contains specified address. I k...
[ "gdb", "shared-libraries" ]
2
6
2,152
1
0
2011-06-10T12:37:46.113000
2011-06-10T12:50:36.490000
6,306,454
6,306,635
Detect if app is running in development mode or not
does anyone know a good way to, in code, detect if the app is running in development mode or production mode?
That depends entirely on how you choose between development and production mode. Xcode 4, by default, sets the DEBUG flag when you are running the app under debug. You can create conditional code like so: #ifdef DEBUG NSLog(@"Only log when in debug"); #endif
Detect if app is running in development mode or not does anyone know a good way to, in code, detect if the app is running in development mode or production mode?
TITLE: Detect if app is running in development mode or not QUESTION: does anyone know a good way to, in code, detect if the app is running in development mode or production mode? ANSWER: That depends entirely on how you choose between development and production mode. Xcode 4, by default, sets the DEBUG flag when you ...
[ "iphone", "ios", "apple-push-notifications" ]
3
9
2,125
1
0
2011-06-10T12:37:58.963000
2011-06-10T12:53:03.887000
6,306,459
6,306,538
How to use array_push to multidimensional arrays?
I was wondering how to use array_push to multidimensional arrays? I have a multidimensional array, in which i'm trying to push more values from another array. The multidimensional you can see below. $userList[] = array( "aid" => $searchrow['aid'], "name" => $searchrow['name'], "info" => $searchrow['info'], "rental" => ...
You can use the following, $userList[$i]["inUse"] = "$inuse[$i]"; Remember array_push — Push one or more elements onto the end of array and not create an index.
How to use array_push to multidimensional arrays? I was wondering how to use array_push to multidimensional arrays? I have a multidimensional array, in which i'm trying to push more values from another array. The multidimensional you can see below. $userList[] = array( "aid" => $searchrow['aid'], "name" => $searchrow['...
TITLE: How to use array_push to multidimensional arrays? QUESTION: I was wondering how to use array_push to multidimensional arrays? I have a multidimensional array, in which i'm trying to push more values from another array. The multidimensional you can see below. $userList[] = array( "aid" => $searchrow['aid'], "nam...
[ "php" ]
0
1
726
1
0
2011-06-10T12:38:22.347000
2011-06-10T12:45:27.377000
6,306,470
6,306,482
Only show row with highest ID? (SQL)
I would like a one line row on my site where that reads: Latest registered person: x And the person x is the person with highest ID (which is auto_increment).. How would that code look like? SELECT * FROM characters LIMIT 1 ORDER BY id
You were very close: SELECT * FROM characters ORDER BY id DESC LIMIT 1 The syntax requires the ORDER BY to come before LIMIT, and you should have added a DESC to the ORDER BY, to get the last, not the furst user.
Only show row with highest ID? (SQL) I would like a one line row on my site where that reads: Latest registered person: x And the person x is the person with highest ID (which is auto_increment).. How would that code look like? SELECT * FROM characters LIMIT 1 ORDER BY id
TITLE: Only show row with highest ID? (SQL) QUESTION: I would like a one line row on my site where that reads: Latest registered person: x And the person x is the person with highest ID (which is auto_increment).. How would that code look like? SELECT * FROM characters LIMIT 1 ORDER BY id ANSWER: You were very close:...
[ "php", "mysql", "auto-increment" ]
2
6
385
2
0
2011-06-10T12:39:26.253000
2011-06-10T12:41:22.747000
6,306,472
6,306,555
do something before collection changes in observablecollection in wpf
I am not sure what i am trying to achieve is actually achievable or not. I have an observablecollection with me and its collectionchanged event is already been handled. What i want to do is I want to make some changes in the existing list of objects in the observablecollection just before the collectionchanged event of...
Since you need to take action before the user changes the collection, I believe your CollectionChangedEvent is happening too late (the collection has already changed). Instead, consider creating your own collection class which derives from ObservableCollection and then override the Add(), Insert(), and Remove() methods...
do something before collection changes in observablecollection in wpf I am not sure what i am trying to achieve is actually achievable or not. I have an observablecollection with me and its collectionchanged event is already been handled. What i want to do is I want to make some changes in the existing list of objects ...
TITLE: do something before collection changes in observablecollection in wpf QUESTION: I am not sure what i am trying to achieve is actually achievable or not. I have an observablecollection with me and its collectionchanged event is already been handled. What i want to do is I want to make some changes in the existin...
[ "c#", ".net", "wpf", "observablecollection" ]
3
4
3,285
5
0
2011-06-10T12:39:53.487000
2011-06-10T12:46:55.683000
6,306,475
6,308,147
How to store many item flags in core data
I am trying to do the following in my iPad app. I have a structure that allows people to create grouped lists which we call "Templates". So The top level CoreOffer(has Title) which can have many groups(has grouptitle/displayorder) which can have many items(has ItemTitle, DisplayOrder). As shown below. This works great,...
The first thing you want to do is clean up the naming in your data model. Remember, you are dealing with unique objects here and not the names of tables, columns, rows, joins etc in SQL. So, you don't need to prefix everything with "Core" (unless you have multiple kinds of Offer, Group and Item entities.) Names of enti...
How to store many item flags in core data I am trying to do the following in my iPad app. I have a structure that allows people to create grouped lists which we call "Templates". So The top level CoreOffer(has Title) which can have many groups(has grouptitle/displayorder) which can have many items(has ItemTitle, Displa...
TITLE: How to store many item flags in core data QUESTION: I am trying to do the following in my iPad app. I have a structure that allows people to create grouped lists which we call "Templates". So The top level CoreOffer(has Title) which can have many groups(has grouptitle/displayorder) which can have many items(has...
[ "ios", "core-data" ]
0
0
149
1
0
2011-06-10T12:40:42.630000
2011-06-10T14:58:17.890000
6,306,476
6,306,542
inApp Purchase in iPhone application to get book from iBook store
I am working in one iPhone application in which I need to add inApp Purchase functionality. Now in the inApp Purchase I need to add around 20 books which are already listed in iBook store. Now when I pay using inApp purchase, the purchased book from iBook store can be directly come in my application. Is it possible to ...
No, that's not possible. In App Purchase is for creating your own store within your own application. It's not designed to add other people's stores in your apps.
inApp Purchase in iPhone application to get book from iBook store I am working in one iPhone application in which I need to add inApp Purchase functionality. Now in the inApp Purchase I need to add around 20 books which are already listed in iBook store. Now when I pay using inApp purchase, the purchased book from iBoo...
TITLE: inApp Purchase in iPhone application to get book from iBook store QUESTION: I am working in one iPhone application in which I need to add inApp Purchase functionality. Now in the inApp Purchase I need to add around 20 books which are already listed in iBook store. Now when I pay using inApp purchase, the purcha...
[ "iphone", "ipad", "in-app-purchase", "storekit", "ibooks" ]
2
5
497
1
0
2011-06-10T12:40:44.880000
2011-06-10T12:45:50.403000
6,306,489
6,306,539
Jquery UI sortable have no e.target on children
I have a sortable list of folders using JQuery UI. The thing is that the folders have a child-element that is a delete button. I try to get that element and with jquery get the name of that folder. But I found out that the sortable function destroys all e.target. Below is the code of deleting a folder Hello Delete
You'll be much better off using jQuery to bind your event handler instead of an "onclick" attribute: When you bind the event handler with an old-fashioned "onclick" attribute, jQuery can't help you. When you do something like the above, then the library can normalize the "event" object, establish this properly, etc. If...
Jquery UI sortable have no e.target on children I have a sortable list of folders using JQuery UI. The thing is that the folders have a child-element that is a delete button. I try to get that element and with jquery get the name of that folder. But I found out that the sortable function destroys all e.target. Below is...
TITLE: Jquery UI sortable have no e.target on children QUESTION: I have a sortable list of folders using JQuery UI. The thing is that the folders have a child-element that is a delete button. I try to get that element and with jquery get the name of that folder. But I found out that the sortable function destroys all ...
[ "javascript", "jquery", "jquery-ui" ]
1
2
230
2
0
2011-06-10T12:41:38.343000
2011-06-10T12:45:39.353000
6,306,494
6,306,553
sed circular replacements
In my file input.txt, I want to replace A->B, B->C, and C->A i.e. I want to run s/A/B/g; s/B/C/g; s/C/A/g; However, I don't want the patterns to operate on the new text i.e. if I run the above sed script, A becomes unchanged A->B->C->A, and B goes to A (B->C->A) Is there a way to do the replacements I want? Thanks
There might be a better way, but if there are suitable X and Y not in your input.txt you could try: s/A/X/g; s/B/Y/g; s/C/A/g; s/X/B/g; s/Y/C/g;
sed circular replacements In my file input.txt, I want to replace A->B, B->C, and C->A i.e. I want to run s/A/B/g; s/B/C/g; s/C/A/g; However, I don't want the patterns to operate on the new text i.e. if I run the above sed script, A becomes unchanged A->B->C->A, and B goes to A (B->C->A) Is there a way to do the replac...
TITLE: sed circular replacements QUESTION: In my file input.txt, I want to replace A->B, B->C, and C->A i.e. I want to run s/A/B/g; s/B/C/g; s/C/A/g; However, I don't want the patterns to operate on the new text i.e. if I run the above sed script, A becomes unchanged A->B->C->A, and B goes to A (B->C->A) Is there a wa...
[ "regex", "sed" ]
1
2
229
4
0
2011-06-10T12:41:57.030000
2011-06-10T12:46:35.710000
6,306,503
6,306,633
Handling multiple operations using BackgroundWorker
I have a DataGridView on a winform. I am dynamically adding DatagridViewButtonColumn in the load method of form with button name as btnAction and text displayed on it as "Process". So, every row in the grid would have this Process button in the last column. On click event of this button, I am using a BackgroundWorker t...
The short answer is that the same BackgroundWorker cannot be called again while it is running. If you do that you will get an error: This BackgroundWorker is currently busy and cannot run multiple tasks concurrently. This issue has been discussed here on StackOverflow: This BackgroundWorker is currently busy and cannot...
Handling multiple operations using BackgroundWorker I have a DataGridView on a winform. I am dynamically adding DatagridViewButtonColumn in the load method of form with button name as btnAction and text displayed on it as "Process". So, every row in the grid would have this Process button in the last column. On click e...
TITLE: Handling multiple operations using BackgroundWorker QUESTION: I have a DataGridView on a winform. I am dynamically adding DatagridViewButtonColumn in the load method of form with button name as btnAction and text displayed on it as "Process". So, every row in the grid would have this Process button in the last ...
[ "c#", "winforms", "multithreading", "datagridview", "backgroundworker" ]
2
2
10,184
3
0
2011-06-10T12:42:40.327000
2011-06-10T12:52:56.367000
6,306,504
6,306,615
change font size in ListView
I have made a ListView in my android application. But the problem is that the font size is larger then the requirements of application. I have tried to solve this but I can't find any property or any other method of setting the font of ListView. Does anybody have any idea how to change font size of list view?
You should make custom layout of row then you are able to set font size of the list view according to your requirement here i am giving some link for creating custom layout for listview. http://www.androidpeople.com/android-custom-listview-tutorial-part-1 i hope this is help.
change font size in ListView I have made a ListView in my android application. But the problem is that the font size is larger then the requirements of application. I have tried to solve this but I can't find any property or any other method of setting the font of ListView. Does anybody have any idea how to change font...
TITLE: change font size in ListView QUESTION: I have made a ListView in my android application. But the problem is that the font size is larger then the requirements of application. I have tried to solve this but I can't find any property or any other method of setting the font of ListView. Does anybody have any idea ...
[ "android", "listview", "android-listview", "android-2.2-froyo" ]
2
3
7,134
2
0
2011-06-10T12:42:41.027000
2011-06-10T12:51:36.503000
6,306,510
6,306,595
button below other button programmatically android
i have in xml tis code: I want to create these buttons programmatically and i use: RelativeLayout mainLayout; mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); for (int i=0; i<1; i++) { Button new_button = new Button(this); new_button.setText("blabla"); new_button.setId(i); new_button.setLayoutParams(new La...
Use RelativeLayout.LayoutParams. Use addRule(), for your example use it with RelativeLayout.BELOW and the id (R.id.examp1)
button below other button programmatically android i have in xml tis code: I want to create these buttons programmatically and i use: RelativeLayout mainLayout; mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); for (int i=0; i<1; i++) { Button new_button = new Button(this); new_button.setText("blabla"); new...
TITLE: button below other button programmatically android QUESTION: i have in xml tis code: I want to create these buttons programmatically and i use: RelativeLayout mainLayout; mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); for (int i=0; i<1; i++) { Button new_button = new Button(this); new_button.setT...
[ "android", "button", "position" ]
1
3
8,790
1
0
2011-06-10T12:43:21.770000
2011-06-10T12:49:27.127000
6,306,517
6,306,590
Problem with removing index.php on Codeigniter didn`t load my css and js
Currently I tried to remove index.php on codeigniter url. I installed my codeigniter on localhost/jqm/withci. Then I write.htaccess to remove index.php and it worked well..htaccess file: RewriteEngine on RewriteCond $1!^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /jqm/withci/index.php/$1 [L] But I m having some ...
In your.htaccess file add the folder which contains the JavaScript and CSS to the rewrite condition, something like: RewriteCond $1!^(index\.php|images|jquery\.mobile|robots\.txt) Currently those files aren't loading, instead they're pointing to your index.php file.
Problem with removing index.php on Codeigniter didn`t load my css and js Currently I tried to remove index.php on codeigniter url. I installed my codeigniter on localhost/jqm/withci. Then I write.htaccess to remove index.php and it worked well..htaccess file: RewriteEngine on RewriteCond $1!^(index\.php|images|robots\....
TITLE: Problem with removing index.php on Codeigniter didn`t load my css and js QUESTION: Currently I tried to remove index.php on codeigniter url. I installed my codeigniter on localhost/jqm/withci. Then I write.htaccess to remove index.php and it worked well..htaccess file: RewriteEngine on RewriteCond $1!^(index\.p...
[ "php", "codeigniter", "mod-rewrite" ]
2
5
2,751
3
0
2011-06-10T12:44:00.573000
2011-06-10T12:48:56.837000
6,306,523
6,306,646
Is it possible to add a column in mmssms.db?
I have written code for receiving WAP push messages in mms application. I am able to receive the WAP push message and stores that into sms table in mmssms.db. The problem is while showing the wap push message in inbox.I am planning to give a separate icon for WAP push. There is no way to identify wap push message from ...
you could create another database conatining the IDs of the SMS which are WAP push messages. That could be a workaround if it is not possible to add a custom column to that table
Is it possible to add a column in mmssms.db? I have written code for receiving WAP push messages in mms application. I am able to receive the WAP push message and stores that into sms table in mmssms.db. The problem is while showing the wap push message in inbox.I am planning to give a separate icon for WAP push. There...
TITLE: Is it possible to add a column in mmssms.db? QUESTION: I have written code for receiving WAP push messages in mms application. I am able to receive the WAP push message and stores that into sms table in mmssms.db. The problem is while showing the wap push message in inbox.I am planning to give a separate icon f...
[ "android", "database", "sms" ]
1
1
419
1
0
2011-06-10T12:44:25.113000
2011-06-10T12:54:12.473000
6,306,533
6,306,598
Android - trouble with R class
I am trying to code some basic stuff (listView and the like) in Android. My problem is as follows: 1. Any resource that I write (eg. an xml file specifying the content of a listView or a button), gets registered in the R class but eclipse flags it as an error when I try to use it. Example: Relative Layout xml file: Cod...
You should ensure you've imported your R java class, not android.R.
Android - trouble with R class I am trying to code some basic stuff (listView and the like) in Android. My problem is as follows: 1. Any resource that I write (eg. an xml file specifying the content of a listView or a button), gets registered in the R class but eclipse flags it as an error when I try to use it. Example...
TITLE: Android - trouble with R class QUESTION: I am trying to code some basic stuff (listView and the like) in Android. My problem is as follows: 1. Any resource that I write (eg. an xml file specifying the content of a listView or a button), gets registered in the R class but eclipse flags it as an error when I try ...
[ "android", "android-layout" ]
5
5
3,782
2
0
2011-06-10T12:45:07.750000
2011-06-10T12:49:43.240000
6,306,536
6,306,625
Serialization of internal class to xml
I ran into problems when trying to xml serialize a class to xml after I changed it from public to internal. Before I changed protection level it was working fine, so I am looking for a way to get around the public only restriction. The reason I want it to be internal is that I moved the class into a library and it's no...
Hackish but you could make your class public and mark it with EditorBrowsable attribute to hide it from intellisense. [EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] [Serializable] public class InternalSerializable In C#, EditorBrowsable work only on compiled assemblies: Hiding GetHashCode/Equals/To...
Serialization of internal class to xml I ran into problems when trying to xml serialize a class to xml after I changed it from public to internal. Before I changed protection level it was working fine, so I am looking for a way to get around the public only restriction. The reason I want it to be internal is that I mov...
TITLE: Serialization of internal class to xml QUESTION: I ran into problems when trying to xml serialize a class to xml after I changed it from public to internal. Before I changed protection level it was working fine, so I am looking for a way to get around the public only restriction. The reason I want it to be inte...
[ "c#", ".net", "serialization", "sgen" ]
2
0
3,405
1
0
2011-06-10T12:45:11.520000
2011-06-10T12:52:13.673000
6,306,540
6,306,999
Hibernate good practice when detaching Objects
After I construct a hibernate query, my code goes as follows: @SuppressWarnings("unchecked") List list = query.list(); session.evict( list ); if( list.isEmpty() ) return null; SendCommands dst = list.get( 0 ); return dst; What is the "good" practice for this example: 1) detaching (evicting) the entire result set, then ...
You don't need to detach the objects. Hibernate entities are POJOs, and are not lost at the end of the transaction. When the session is closed, they become detached automatically. But you can still use then and access their data, unless the data is marked as lazy-loaded and has not been fetched while the entities were ...
Hibernate good practice when detaching Objects After I construct a hibernate query, my code goes as follows: @SuppressWarnings("unchecked") List list = query.list(); session.evict( list ); if( list.isEmpty() ) return null; SendCommands dst = list.get( 0 ); return dst; What is the "good" practice for this example: 1) de...
TITLE: Hibernate good practice when detaching Objects QUESTION: After I construct a hibernate query, my code goes as follows: @SuppressWarnings("unchecked") List list = query.list(); session.evict( list ); if( list.isEmpty() ) return null; SendCommands dst = list.get( 0 ); return dst; What is the "good" practice for t...
[ "hibernate", "coding-style", "persistence" ]
0
2
6,563
1
0
2011-06-10T12:45:41.787000
2011-06-10T13:27:20.963000
6,306,549
6,306,596
override OnStartup in WPF
For some reason I can't get this to work at all. I have read from various sources that I can override OnStartup in a WPF application and it will fire off as the App is created. However, no matter what I do, nothing is happening. Here is the code. public partial class App: Application { protected override void OnStartu...
I think what you really want to do is to subscribe to the Startup event. You can do this in your XAML file:
override OnStartup in WPF For some reason I can't get this to work at all. I have read from various sources that I can override OnStartup in a WPF application and it will fire off as the App is created. However, no matter what I do, nothing is happening. Here is the code. public partial class App: Application { protec...
TITLE: override OnStartup in WPF QUESTION: For some reason I can't get this to work at all. I have read from various sources that I can override OnStartup in a WPF application and it will fire off as the App is created. However, no matter what I do, nothing is happening. Here is the code. public partial class App: App...
[ "c#", "wpf", "startup" ]
15
15
35,962
4
0
2011-06-10T12:46:23.967000
2011-06-10T12:49:28.667000
6,306,568
6,306,712
Django Reverse Query in Template
I have models like this class Blog(models.Model): name = models.CharField(max_length=100) tagline = models.TextField() def __unicode__(self): return self.name class Entry(models.Model): blog = models.ForeignKey(Blog) headline = models.CharField(max_length=255) I want to list all blogs in a page. I have written a view...
To access blog entries ( Related Manager ): blog.entry_set.all To do other actions if blog have no entries, you have the {% empty %} tag that is executed when the set is empty. {% block content %} {% for blog in blog_list %} {{ blog.tagline }} {% for entry in blog.entry_set.all %} {{entry.name}} {% empty %} {% endfor %...
Django Reverse Query in Template I have models like this class Blog(models.Model): name = models.CharField(max_length=100) tagline = models.TextField() def __unicode__(self): return self.name class Entry(models.Model): blog = models.ForeignKey(Blog) headline = models.CharField(max_length=255) I want to list all blogs...
TITLE: Django Reverse Query in Template QUESTION: I have models like this class Blog(models.Model): name = models.CharField(max_length=100) tagline = models.TextField() def __unicode__(self): return self.name class Entry(models.Model): blog = models.ForeignKey(Blog) headline = models.CharField(max_length=255) I want...
[ "django", "reverse" ]
25
41
16,705
2
0
2011-06-10T12:47:33.813000
2011-06-10T12:59:39.770000
6,306,569
6,306,859
Error in object declaration when inheritance is used
I have been using three classes. Two classes extends the third class db. But the problem is when I declare objects of these classes the second object is created as clone of the first object. Thanks in advance for any help. class db extends PDO { public function __construct() { echo "DB constructor called\n";.. } class ...
I see no problems at all -- the output is exactly as expected. So it must be an error somewhere else in the files you are including. Here is the standalone test code: And this is the output: Admin constructor called DB constructor called Movie constructor called DB constructor called object(Admin)#1 (6) { ["uid":"Admin...
Error in object declaration when inheritance is used I have been using three classes. Two classes extends the third class db. But the problem is when I declare objects of these classes the second object is created as clone of the first object. Thanks in advance for any help. class db extends PDO { public function __con...
TITLE: Error in object declaration when inheritance is used QUESTION: I have been using three classes. Two classes extends the third class db. But the problem is when I declare objects of these classes the second object is created as clone of the first object. Thanks in advance for any help. class db extends PDO { pub...
[ "php", "oop", "class", "constructor" ]
0
0
212
3
0
2011-06-10T12:47:40.527000
2011-06-10T13:14:49.310000
6,306,570
6,308,536
.getResponseCode() hangs when trying to connect java(blackberry project) to webservice
I am trying to connect to a webservice from my blackberry project in eclipse. My code for URLConnector is the following import java.io.InputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import net.rim.device.api.ui.component.Dialog; public class URLConnector { HttpConnect...
James, I'm assuming after you turned the MDS Simulator on, you discovered that you also had a problem because you never opened the connection? Anyway just to give a final working solution: HttpConnection con = null; InputStream is = null; try { System.out.println("1"); String url = new String("http://myserver.com/index...
.getResponseCode() hangs when trying to connect java(blackberry project) to webservice I am trying to connect to a webservice from my blackberry project in eclipse. My code for URLConnector is the following import java.io.InputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; ...
TITLE: .getResponseCode() hangs when trying to connect java(blackberry project) to webservice QUESTION: I am trying to connect to a webservice from my blackberry project in eclipse. My code for URLConnector is the following import java.io.InputStream; import javax.microedition.io.Connector; import javax.microedition.i...
[ "java", "blackberry", "blackberry-eclipse-plugin", "httpconnection" ]
1
0
2,180
3
0
2011-06-10T12:47:42.023000
2011-06-10T15:27:15.427000
6,306,585
6,306,616
Creating procedure inside IF section
I need some help with simple SQL code: DECLARE @procExists int SET @procExists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'dbo' AND ROUTINE_NAME = 'Table_Exists' AND ROUTINE_TYPE = 'PROCEDURE') IF NOT @procExists > 0 BEGIN -- test query -- SELECT 'Something' = @procExists; -- error thro...
CREATE PROCEDURE has to be in it's own batch So, dynamic SQL is one way: IF OBJECT_ID('Table_Exists') IS NULL BEGIN EXEC ('CREATE PROCEDURE Table_Exists @schemaName varchar(50), @tableName varchar(50) AS RETURN (SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = @schemaName AND TABLE_NAME = @tableName)...
Creating procedure inside IF section I need some help with simple SQL code: DECLARE @procExists int SET @procExists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'dbo' AND ROUTINE_NAME = 'Table_Exists' AND ROUTINE_TYPE = 'PROCEDURE') IF NOT @procExists > 0 BEGIN -- test query -- SELECT 'Som...
TITLE: Creating procedure inside IF section QUESTION: I need some help with simple SQL code: DECLARE @procExists int SET @procExists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'dbo' AND ROUTINE_NAME = 'Table_Exists' AND ROUTINE_TYPE = 'PROCEDURE') IF NOT @procExists > 0 BEGIN -- test qu...
[ "sql-server", "t-sql" ]
14
26
12,568
4
0
2011-06-10T12:48:22.733000
2011-06-10T12:51:43.383000
6,306,592
6,307,884
MERGE INTO table containing AUTO_INCREMENT columns
I've declared the following table for use by audit triggers: CREATE TABLE audit_transaction_ids (id IDENTITY PRIMARY KEY, uuid VARCHAR UNIQUE NOT NULL, `time` TIMESTAMP NOT NULL); The trigger will get invoked multiple times in the same transaction. The first time the trigger is invoked, I want it to insert a new row wi...
MERGE is analogous to java.util.Map.put(key, value): it will insert the row if it doesn't exist, and update the row if it does. That being said, you can still merge into a table containing AUTO_INCREMENT columns so long as you use another column as the key. Given customer[id identity, email varchar(30), count int] you ...
MERGE INTO table containing AUTO_INCREMENT columns I've declared the following table for use by audit triggers: CREATE TABLE audit_transaction_ids (id IDENTITY PRIMARY KEY, uuid VARCHAR UNIQUE NOT NULL, `time` TIMESTAMP NOT NULL); The trigger will get invoked multiple times in the same transaction. The first time the t...
TITLE: MERGE INTO table containing AUTO_INCREMENT columns QUESTION: I've declared the following table for use by audit triggers: CREATE TABLE audit_transaction_ids (id IDENTITY PRIMARY KEY, uuid VARCHAR UNIQUE NOT NULL, `time` TIMESTAMP NOT NULL); The trigger will get invoked multiple times in the same transaction. Th...
[ "sql", "h2", "sql-merge" ]
1
2
8,068
2
0
2011-06-10T12:48:59.337000
2011-06-10T14:38:00.077000
6,306,621
6,306,702
What time format is this & how to convert to readable format?
This is one of those questions that I'm sure will have a quick answer but I can't seem to find it. Using the Facebook Graph API, the opening hours for a business are returned in JSON using this format: "hours": { "mon_1_open": 406800, "mon_1_close": 437400, "tue_1_open": 493200, "tue_1_close": 523800, "wed_1_open": 579...
I'm not sure what TimeZone you're in, but looking at it, hey all seem to be exact second counts originating from 00:00:00Z Thursday morning. I'd say that puts you at about the PST timezone.
What time format is this & how to convert to readable format? This is one of those questions that I'm sure will have a quick answer but I can't seem to find it. Using the Facebook Graph API, the opening hours for a business are returned in JSON using this format: "hours": { "mon_1_open": 406800, "mon_1_close": 437400, ...
TITLE: What time format is this & how to convert to readable format? QUESTION: This is one of those questions that I'm sure will have a quick answer but I can't seem to find it. Using the Facebook Graph API, the opening hours for a business are returned in JSON using this format: "hours": { "mon_1_open": 406800, "mon_...
[ "php", "time", "facebook-graph-api", "timestamp" ]
0
2
315
1
0
2011-06-10T12:52:00.070000
2011-06-10T12:58:40.350000
6,306,624
6,306,758
Get Drawables out of RelativeLayout or Group Drawables
what I want to do is as following: I have a set of Drawables (eg. 16) that I have to combine in different ways (Icon with 1, 2, 3 or 4 Drawables), depending on buisness logic. My idea was to define RelativeLayouts with ImageViews inside. Unfortunately I planned to take these Layouts as an OverlayItem (needs a Drawable)...
in spite of any View could be drawn, it is not a drawable. You should use Layer List to operate several pictures as one drawable.
Get Drawables out of RelativeLayout or Group Drawables what I want to do is as following: I have a set of Drawables (eg. 16) that I have to combine in different ways (Icon with 1, 2, 3 or 4 Drawables), depending on buisness logic. My idea was to define RelativeLayouts with ImageViews inside. Unfortunately I planned to ...
TITLE: Get Drawables out of RelativeLayout or Group Drawables QUESTION: what I want to do is as following: I have a set of Drawables (eg. 16) that I have to combine in different ways (Icon with 1, 2, 3 or 4 Drawables), depending on buisness logic. My idea was to define RelativeLayouts with ImageViews inside. Unfortuna...
[ "android", "layout", "graphics", "view", "drawable" ]
2
1
1,060
1
0
2011-06-10T12:52:11.553000
2011-06-10T13:04:47.797000
6,306,629
6,306,653
Is bool ConcurrentDictionary<TKey, TValue>.TryGetValue(TKey, out TValue) method thread-safe?
It's not quite clear from this post: https://devblogs.microsoft.com/pfxteam/concurrentdictionarys-support-for-adding-and-updating/
Sure. Otherwise it would be useless, as this is a thread safe alternative to Dictionary. See the documentation: http://msdn.microsoft.com/en-us/library/dd287191.aspx: Thread Safety All public and protected members of ConcurrentDictionary are thread-safe and may be used concurrently from multiple threads.
Is bool ConcurrentDictionary<TKey, TValue>.TryGetValue(TKey, out TValue) method thread-safe? It's not quite clear from this post: https://devblogs.microsoft.com/pfxteam/concurrentdictionarys-support-for-adding-and-updating/
TITLE: Is bool ConcurrentDictionary<TKey, TValue>.TryGetValue(TKey, out TValue) method thread-safe? QUESTION: It's not quite clear from this post: https://devblogs.microsoft.com/pfxteam/concurrentdictionarys-support-for-adding-and-updating/ ANSWER: Sure. Otherwise it would be useless, as this is a thread safe alterna...
[ "c#-4.0", "concurrency", "dictionary", "trygetvalue" ]
1
4
535
1
0
2011-06-10T12:52:38.340000
2011-06-10T12:54:34.733000
6,306,631
6,306,732
Check internet connection in iPhone - not just to router
I use the normal Reachability tools to check if there is an internet connection available. It works in most cases, but if I unplug the WAN cable to the wifi-router, for some reason it still say it can find the host by wifi. If I change the web address to something that doesn't exists, it will say "The internet is down"...
For internet checking I send an http request to one site(most probably google.com) if it does not return true, it means no internet. This case works even the connection is so slow. Here is the method. - (BOOL) connectedToInternet { NSString *URLString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://ww...
Check internet connection in iPhone - not just to router I use the normal Reachability tools to check if there is an internet connection available. It works in most cases, but if I unplug the WAN cable to the wifi-router, for some reason it still say it can find the host by wifi. If I change the web address to somethin...
TITLE: Check internet connection in iPhone - not just to router QUESTION: I use the normal Reachability tools to check if there is an internet connection available. It works in most cases, but if I unplug the WAN cable to the wifi-router, for some reason it still say it can find the host by wifi. If I change the web a...
[ "objective-c", "connection", "reachability" ]
0
0
2,881
2
0
2011-06-10T12:52:51.350000
2011-06-10T13:01:17.587000
6,306,636
6,306,735
Read ID3 Tags of an MP3 file
I am trying to read ID3 from a mp3 file thats locally stored in the SD card. I want to basically fetch Title Artist Album Track Length Album Art
You can get all of this using MediaMetadataRetriever MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.setDataSource(filePath); String albumName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
Read ID3 Tags of an MP3 file I am trying to read ID3 from a mp3 file thats locally stored in the SD card. I want to basically fetch Title Artist Album Track Length Album Art
TITLE: Read ID3 Tags of an MP3 file QUESTION: I am trying to read ID3 from a mp3 file thats locally stored in the SD card. I want to basically fetch Title Artist Album Track Length Album Art ANSWER: You can get all of this using MediaMetadataRetriever MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.set...
[ "android", "mp3", "id3", "id3-tag" ]
11
30
24,439
3
0
2011-06-10T12:53:05.797000
2011-06-10T13:01:31.160000
6,306,638
6,306,669
JSON object recognized as String by jQuery
I'm trying to parse some JSON coming from an AJAX request using jQuery. Basically, the JSON is encoded by PHP and looks like: {"1":{"key1":"value1","key2":"value2"},"0":{"key1":"value1","key2":"value2"}} The callback function of $.ajax looks like: $.each(data, function(item) { console.log($.type(item)); myfunction(item...
The item is a String. The first argument of the callback of $.each() is the key. In your example, your JSON object is an Object with numerical indexes, except in strings. You are attempting to access the property from the property name. Instead, you'd want to use data[item] in your example. You want to access the prope...
JSON object recognized as String by jQuery I'm trying to parse some JSON coming from an AJAX request using jQuery. Basically, the JSON is encoded by PHP and looks like: {"1":{"key1":"value1","key2":"value2"},"0":{"key1":"value1","key2":"value2"}} The callback function of $.ajax looks like: $.each(data, function(item) {...
TITLE: JSON object recognized as String by jQuery QUESTION: I'm trying to parse some JSON coming from an AJAX request using jQuery. Basically, the JSON is encoded by PHP and looks like: {"1":{"key1":"value1","key2":"value2"},"0":{"key1":"value1","key2":"value2"}} The callback function of $.ajax looks like: $.each(data...
[ "jquery", "json", "parsing" ]
1
0
950
4
0
2011-06-10T12:53:17.640000
2011-06-10T12:55:32.670000
6,306,644
6,306,696
PHP - Extract value from string
I have several strings that have been pulled using cURL from another website. The string itself contains the entire pages HTML structure, however inside each page there is a paragraph as outlined below: Displaying 1-15 of 15 items beginning with A Displaying 1-20 of 33 items beginning with B What I need to do is just e...
A brute force approach: http://php.net/manual/en/function.preg-match-all.php preg_match_all('/ Displaying (\d+)-(\d+) of (\d+) items beginning with ([A-Z]+) /', $subject, $matches);
PHP - Extract value from string I have several strings that have been pulled using cURL from another website. The string itself contains the entire pages HTML structure, however inside each page there is a paragraph as outlined below: Displaying 1-15 of 15 items beginning with A Displaying 1-20 of 33 items beginning wi...
TITLE: PHP - Extract value from string QUESTION: I have several strings that have been pulled using cURL from another website. The string itself contains the entire pages HTML structure, however inside each page there is a paragraph as outlined below: Displaying 1-15 of 15 items beginning with A Displaying 1-20 of 33 ...
[ "php" ]
1
7
3,582
3
0
2011-06-10T12:54:03.203000
2011-06-10T12:57:49.240000
6,306,661
6,306,740
Subtracting two NSDate objects
Possible Duplicate: How to Get time difference in iPhone I´m getting date and time from a JSON feed. I need to find the difference between the date I´m getting from the feed and today´s date and time. Any suggestions how I can do this? I know I need to subtract the current date with the date I get from the feed, but I ...
Create two NSDate objects from the strings using NSDate's -dateWithString:, then get the difference of the two NSdate objects using NSTimeInterval diff = [date2 timeIntervalSinceDate:date1];
Subtracting two NSDate objects Possible Duplicate: How to Get time difference in iPhone I´m getting date and time from a JSON feed. I need to find the difference between the date I´m getting from the feed and today´s date and time. Any suggestions how I can do this? I know I need to subtract the current date with the d...
TITLE: Subtracting two NSDate objects QUESTION: Possible Duplicate: How to Get time difference in iPhone I´m getting date and time from a JSON feed. I need to find the difference between the date I´m getting from the feed and today´s date and time. Any suggestions how I can do this? I know I need to subtract the curre...
[ "iphone", "xcode", "json", "nsdate", "nstimeinterval" ]
25
56
26,104
3
0
2011-06-10T12:55:14.193000
2011-06-10T13:01:54.140000
6,306,672
6,306,710
Should I use publishDate or datePublished for schema.org Review markup?
I'm using schema.org’s Review and I would like to know if I should use publishDate or datePublished properties. According to the doc ( http://schema.org/Review ), it seems to be datePublished but in the example they use publishDate.
I would lean towards 'datePublished', as I can't find 'publishDate' in their full documentation.
Should I use publishDate or datePublished for schema.org Review markup? I'm using schema.org’s Review and I would like to know if I should use publishDate or datePublished properties. According to the doc ( http://schema.org/Review ), it seems to be datePublished but in the example they use publishDate.
TITLE: Should I use publishDate or datePublished for schema.org Review markup? QUESTION: I'm using schema.org’s Review and I would like to know if I should use publishDate or datePublished properties. According to the doc ( http://schema.org/Review ), it seems to be datePublished but in the example they use publishDat...
[ "schema.org" ]
5
5
1,669
1
0
2011-06-10T12:55:52.347000
2011-06-10T12:59:24.797000
6,306,688
6,307,039
How to develop jQuery drag and drop with sound effect?
I need to create jQuery drag and drop. when I drop item should make sound, dose anyone know how to do it? I know we can do it with HTML5 audio tag with CSS and jQuery to make it happen but I need a sample code in order to modify it. $(function() { $( "#draggable" ).draggable(); // need sound in my droppable $( "#droppa...
I may not be perfectly right but here is some thing that can help you maybe: var myAudio = document.createElement('audio'); myAudio.controls = true; myAudio.src = 'Your File'; myAudio.play(); To make it works when you drop, you can create the audio tag before and just hit play() every drop. I would initialise the audio...
How to develop jQuery drag and drop with sound effect? I need to create jQuery drag and drop. when I drop item should make sound, dose anyone know how to do it? I know we can do it with HTML5 audio tag with CSS and jQuery to make it happen but I need a sample code in order to modify it. $(function() { $( "#draggable" )...
TITLE: How to develop jQuery drag and drop with sound effect? QUESTION: I need to create jQuery drag and drop. when I drop item should make sound, dose anyone know how to do it? I know we can do it with HTML5 audio tag with CSS and jQuery to make it happen but I need a sample code in order to modify it. $(function() {...
[ "javascript", "jquery-ui", "html", "jquery-plugins" ]
1
2
2,502
2
0
2011-06-10T12:57:08.453000
2011-06-10T13:30:24.200000
6,306,690
6,306,805
Ruby on Rails Passing Parameter In URL
This is probably a very simple fix but I've been unable to find an answer just yet. My application has orders and tasks. Orders have many tasks. When a user clicks new task in the show order view, it passes the order.id: <%= link_to "New Task", new_task_path(:order_id=> @order.id) %> The url shows: /tasks/new?order_id=...
You can do: <%= f.text_field:order_id,:value => params[:order_id] %> Alternately, capture the value (with params ) in the controller and assign it to @order_id there.
Ruby on Rails Passing Parameter In URL This is probably a very simple fix but I've been unable to find an answer just yet. My application has orders and tasks. Orders have many tasks. When a user clicks new task in the show order view, it passes the order.id: <%= link_to "New Task", new_task_path(:order_id=> @order.id)...
TITLE: Ruby on Rails Passing Parameter In URL QUESTION: This is probably a very simple fix but I've been unable to find an answer just yet. My application has orders and tasks. Orders have many tasks. When a user clicks new task in the show order view, it passes the order.id: <%= link_to "New Task", new_task_path(:ord...
[ "ruby-on-rails", "routes" ]
6
2
6,393
2
0
2011-06-10T12:57:19.243000
2011-06-10T13:09:43.017000
6,306,699
6,307,089
Text xolor contrast usability testing?
I know sufficient color contrast between text and its background is important for usability, but how can I test for this? Specifically I have tabs and the title of tabs that aren't selected are greyed out but should still be readable. Currently the site im working on looks fine to me but is there a rule of thumb for pe...
This toolbar for firefox will give warning & Fails when the color contrast is under a specific amount - Accessibility Evaluation Toolbar
Text xolor contrast usability testing? I know sufficient color contrast between text and its background is important for usability, but how can I test for this? Specifically I have tabs and the title of tabs that aren't selected are greyed out but should still be readable. Currently the site im working on looks fine to...
TITLE: Text xolor contrast usability testing? QUESTION: I know sufficient color contrast between text and its background is important for usability, but how can I test for this? Specifically I have tabs and the title of tabs that aren't selected are greyed out but should still be readable. Currently the site im workin...
[ "colors", "accessibility" ]
1
0
155
1
0
2011-06-10T12:58:19.617000
2011-06-10T13:34:38.590000
6,306,719
6,306,761
ComboBox has its old value after Clear()
I have two comboBox cb_Brand and cb_Model on a winForm. cb_Model populates values on brand Select. the problem is: if we select the brand any and select the any model under that brand, cb_Model does not loose the value of previous model selected. for example: If we select the brand Audi and model A3 and the select the ...
Instead of adding the items manually like this: foreach (Model objM in colM.Values) { cb_Model.Items.Add(objM); } Let.NET take care of it for you and replace it with this: cb_Model.DataSource = colMValues; Which will bind the data to the list and refreshes the comboboxes items automatcially when a data source is set. Y...
ComboBox has its old value after Clear() I have two comboBox cb_Brand and cb_Model on a winForm. cb_Model populates values on brand Select. the problem is: if we select the brand any and select the any model under that brand, cb_Model does not loose the value of previous model selected. for example: If we select the br...
TITLE: ComboBox has its old value after Clear() QUESTION: I have two comboBox cb_Brand and cb_Model on a winForm. cb_Model populates values on brand Select. the problem is: if we select the brand any and select the any model under that brand, cb_Model does not loose the value of previous model selected. for example: I...
[ "c#", ".net", "winforms", "combobox" ]
8
7
43,102
8
0
2011-06-10T13:00:05.647000
2011-06-10T13:05:05.390000
6,306,720
6,307,902
how to merge a CssStyleCollection with a System.Web.UI.WebControls.Style
i have a listitem and i want to set its style using a System.Web.UI.WebControls.Style but there is not mergestyle like there is on controls. there is a Attributes.CssStyle which is of type CssStyleCollection but it wont merge with the Style class.
ListItem l = list.Items.FindByValue((String)e.Value); if (null!= l) { CssStyleCollection csc = AnswerItemStyle.GetStyleAttributes(list); foreach (String key in csc.Keys) { l.Attributes.CssStyle.Add(key, csc[key]); } } For those who need it in future. Thanks for answer SO, dont know why i bothered asking.
how to merge a CssStyleCollection with a System.Web.UI.WebControls.Style i have a listitem and i want to set its style using a System.Web.UI.WebControls.Style but there is not mergestyle like there is on controls. there is a Attributes.CssStyle which is of type CssStyleCollection but it wont merge with the Style class.
TITLE: how to merge a CssStyleCollection with a System.Web.UI.WebControls.Style QUESTION: i have a listitem and i want to set its style using a System.Web.UI.WebControls.Style but there is not mergestyle like there is on controls. there is a Attributes.CssStyle which is of type CssStyleCollection but it wont merge wit...
[ "asp.net", "css", "listitem" ]
1
1
797
1
0
2011-06-10T13:00:08.010000
2011-06-10T14:39:15.240000
6,306,723
6,306,745
Simple type test in F#
I've been googling for a while now... Ok, I'm sorry, this one is pathetically easy but is there an operator in F# to compare class types, like the 'is' keyword in C#? I don't want to use a full blown match statement or start casting things. Cheers
You can use the:? construct both as a pattern (inside match ) or as an operator: let foo = bar:? System.Random This behaves slightly differently than in C#, because the compiler still tries to do some checks at compile-time. For example, it is an error to use this if the result would be surely false: let bar = 42 let f...
Simple type test in F# I've been googling for a while now... Ok, I'm sorry, this one is pathetically easy but is there an operator in F# to compare class types, like the 'is' keyword in C#? I don't want to use a full blown match statement or start casting things. Cheers
TITLE: Simple type test in F# QUESTION: I've been googling for a while now... Ok, I'm sorry, this one is pathetically easy but is there an operator in F# to compare class types, like the 'is' keyword in C#? I don't want to use a full blown match statement or start casting things. Cheers ANSWER: You can use the:? cons...
[ "f#", "c#-to-f#" ]
19
28
3,838
2
0
2011-06-10T13:00:33.803000
2011-06-10T13:02:46.747000
6,306,724
6,306,858
Show Menu Option Automatically At First Activity Of Application
I develop a application and in which i have a Menu option which i invoke from onCreateOptionMenu() But this is called only when any user press the menu button so now i want that my application start and first Activity is Welcome.java then in onCreate(Bundle b) can i write sone line from which the menu is invoked automa...
You can request the menu be opened with an Activity method openOptionsMenu(); If you want to show a menu immediately, you'll have to wait for the window focus to change, rather than using onResume: @Override public void onWindowFocusChanged(boolean hasFocusFlag) { super.onWindowFocusChanged(hasFocusFlag); if (hasFocusF...
Show Menu Option Automatically At First Activity Of Application I develop a application and in which i have a Menu option which i invoke from onCreateOptionMenu() But this is called only when any user press the menu button so now i want that my application start and first Activity is Welcome.java then in onCreate(Bundl...
TITLE: Show Menu Option Automatically At First Activity Of Application QUESTION: I develop a application and in which i have a Menu option which i invoke from onCreateOptionMenu() But this is called only when any user press the menu button so now i want that my application start and first Activity is Welcome.java then...
[ "android" ]
1
3
2,609
3
0
2011-06-10T13:00:42.917000
2011-06-10T13:14:39.023000
6,306,728
6,307,894
Remove ANSI codes when storing script output
Some programs makes beautiful progressbars and stuff using ANSI escape sequences. That's nice. What's not nice though is that if i put the output of that kind of program into a file and then try to view it it's filled with strange escape sequences. Is there a way to strip away all the ANSI codes while logging? I usuall...
Try: $ TERM=dumb./script >> /tmp/output.log If that doesn't work, it's because the ANSI codes have been hard-coded into the script, so there is no easy way to remove them. If it does, it's because it's doing the right thing, delegating things like pretty output to libncurses or similar, so that when you change the TERM...
Remove ANSI codes when storing script output Some programs makes beautiful progressbars and stuff using ANSI escape sequences. That's nice. What's not nice though is that if i put the output of that kind of program into a file and then try to view it it's filled with strange escape sequences. Is there a way to strip aw...
TITLE: Remove ANSI codes when storing script output QUESTION: Some programs makes beautiful progressbars and stuff using ANSI escape sequences. That's nice. What's not nice though is that if i put the output of that kind of program into a file and then try to view it it's filled with strange escape sequences. Is there...
[ "linux", "logging", "command-line", "terminal", "ansi-escape" ]
5
7
2,935
2
0
2011-06-10T13:00:57.480000
2011-06-10T14:38:40.293000
6,306,738
6,306,787
change background of parent div on hover
I have this code: The image is centred in the middle of the div, how can I change the div's background when I hover over the image? I only know how to change the image properties when I hover over the div. Would prefer not to use jQuery, but don't mind too much. Thanks!
You can't. CSS does not have any way to select the "parent element": http://snook.ca/archives/html_and_css/css-parent-selectors Would prefer not to use jQuery, but don't mind too much. Use: http://jsfiddle.net/KHc6X/ $('.thumb_image_holder_orange > img').hover(function(){ $(this).parent().toggleClass('hover'); })
change background of parent div on hover I have this code: The image is centred in the middle of the div, how can I change the div's background when I hover over the image? I only know how to change the image properties when I hover over the div. Would prefer not to use jQuery, but don't mind too much. Thanks!
TITLE: change background of parent div on hover QUESTION: I have this code: The image is centred in the middle of the div, how can I change the div's background when I hover over the image? I only know how to change the image properties when I hover over the div. Would prefer not to use jQuery, but don't mind too much...
[ "jquery", "css" ]
10
13
18,772
6
0
2011-06-10T13:01:44.047000
2011-06-10T13:07:11.213000
6,306,762
6,306,875
enforce http with JavaScript
I have a srcURL variable which gets a path of the form /myFolder/myFile.jpg Now this gets assigned to the img element..which obviously would call it with the complete path https://mySite.com/myFolder/myFile.jpg Now I somehow want the https to be replaced/enforced with http using Javascript.. I am not sure if I can do t...
You are using a relative path. You need to use an explicit path when setting the src of the URL. srcURL = '/myFolder/myFile.jpg'; srcURL = 'http://' + window.location.host + srcURL; // srcURL == 'http:// /myFolder/myFile.jpg' Note: you'll probably get a warning message saying some parts of your page may be unsecure.
enforce http with JavaScript I have a srcURL variable which gets a path of the form /myFolder/myFile.jpg Now this gets assigned to the img element..which obviously would call it with the complete path https://mySite.com/myFolder/myFile.jpg Now I somehow want the https to be replaced/enforced with http using Javascript....
TITLE: enforce http with JavaScript QUESTION: I have a srcURL variable which gets a path of the form /myFolder/myFile.jpg Now this gets assigned to the img element..which obviously would call it with the complete path https://mySite.com/myFolder/myFile.jpg Now I somehow want the https to be replaced/enforced with http...
[ "javascript", "html", "css", "http", "https" ]
0
3
198
2
0
2011-06-10T13:05:07.820000
2011-06-10T13:16:28.600000
6,306,763
6,306,988
Regexp for robots.txt
I am trying to set up my robots.txt, but I am not sure about the regexps. I've got four different pages all available in three different languages. Instead of listing each page times 3, I figured I could use a regexp. nav.aspx page.aspx/changelang (might have a query string attached such as "?toLang=fr".) mypage.aspx?i...
Regular Expressions are not allowed in robots.txt, but Googlebot (and some other robots) can understands some simple pattern matching: Your robots.txt should look like this: User-agent: * Disallow: /*nav.aspx$ Disallow: /*page.aspx/changelang Disallow: /*mypage.aspx?id Disallow: /*login.aspx/logoff User-agent directive...
Regexp for robots.txt I am trying to set up my robots.txt, but I am not sure about the regexps. I've got four different pages all available in three different languages. Instead of listing each page times 3, I figured I could use a regexp. nav.aspx page.aspx/changelang (might have a query string attached such as "?toLa...
TITLE: Regexp for robots.txt QUESTION: I am trying to set up my robots.txt, but I am not sure about the regexps. I've got four different pages all available in three different languages. Instead of listing each page times 3, I figured I could use a regexp. nav.aspx page.aspx/changelang (might have a query string attac...
[ "regex", "robots.txt" ]
8
18
13,291
1
0
2011-06-10T13:05:08.157000
2011-06-10T13:26:23.113000
6,306,783
6,308,787
MVC3 - How to correctly inject dependencies with MVC3 and Ninject?
I am attempting to redesign an existing application using dependency injection with Ninject in MVC3. Here is a portion of the legacy behavior I'm having difficulty with (and yes I know its bad, that's why I'm trying to refactor it): protected override void OnActionExecuting(ActionExecutingContext filterContext) { base....
I'm not certain if this is exactly what you're looking for, but this should get you started down the path of refactoring your app for DI public class YourController: Controller { private readonly ISessionWrapper _sessionWrapper; private readonly IActiveDirSearcher _adSearcher; private readonly IMyDatabase _database; p...
MVC3 - How to correctly inject dependencies with MVC3 and Ninject? I am attempting to redesign an existing application using dependency injection with Ninject in MVC3. Here is a portion of the legacy behavior I'm having difficulty with (and yes I know its bad, that's why I'm trying to refactor it): protected override v...
TITLE: MVC3 - How to correctly inject dependencies with MVC3 and Ninject? QUESTION: I am attempting to redesign an existing application using dependency injection with Ninject in MVC3. Here is a portion of the legacy behavior I'm having difficulty with (and yes I know its bad, that's why I'm trying to refactor it): pr...
[ "asp.net-mvc", "design-patterns", "asp.net-mvc-3", "c#-4.0", "ninject-2" ]
0
3
437
1
0
2011-06-10T13:07:02.857000
2011-06-10T15:44:42.530000
6,306,788
6,309,061
Is there a way to index CHM files in Lucene?
Can anyone please suggest me a method by which a chm file can be indexed in such as pdfbox for pdf.
If you have also other document formats which you need to index, you might find a better and more general solution in Apache Tika They just added a CHM Parser recently (for reference: Support of CHM Format ) and it will be in the next version.
Is there a way to index CHM files in Lucene? Can anyone please suggest me a method by which a chm file can be indexed in such as pdfbox for pdf.
TITLE: Is there a way to index CHM files in Lucene? QUESTION: Can anyone please suggest me a method by which a chm file can be indexed in such as pdfbox for pdf. ANSWER: If you have also other document formats which you need to index, you might find a better and more general solution in Apache Tika They just added a ...
[ "lucene", "chm" ]
4
3
313
2
0
2011-06-10T13:07:34.880000
2011-06-10T16:06:40.993000
6,306,792
6,306,839
Any limit to number of properties on a .NET Class?
Received a spec to add over 800 properties to an object. Is their any 'limits' to the number of Properties an object can have in C# (or.NET)? Is their any performance impacts to be concerned with in regards to objects of this class with this many properties? Thanks!
The metadata can have up to 24-bit references/definitions per assembly. Being a property, you need 2 methods per property. Hence the limit will be 23-bit, or 1 << 23 - 1 for the entire assembly. Update: If they are only read-only properties, the limit would be 1 << 24 - 1. Answer to second question: No, there will be n...
Any limit to number of properties on a .NET Class? Received a spec to add over 800 properties to an object. Is their any 'limits' to the number of Properties an object can have in C# (or.NET)? Is their any performance impacts to be concerned with in regards to objects of this class with this many properties? Thanks!
TITLE: Any limit to number of properties on a .NET Class? QUESTION: Received a spec to add over 800 properties to an object. Is their any 'limits' to the number of Properties an object can have in C# (or.NET)? Is their any performance impacts to be concerned with in regards to objects of this class with this many prop...
[ "c#", ".net", "oop" ]
20
40
4,549
2
0
2011-06-10T13:07:57.870000
2011-06-10T13:12:31.353000
6,306,796
6,306,876
Make ball stop moving when no key is being pressed?
Here is my code: public class Main extends Applet implements Runnable, KeyListener, java.awt.event.MouseListener { int x_pos = 300; int y_pos = 200; int radius = 20; int appletsize_x = 600; int appletsize_y = 400; double x_speed = 0; double y_speed = 0; private Image dbImage; private Graphics dbg; public void init() ...
Under your keyReleased method, you should be able to do the opposite of your keyPressed method. That is, if you press the right arrow key, add 1 to x_speed, and when you release it, subtract 1 from x_speed, using similar logic for the other keys.
Make ball stop moving when no key is being pressed? Here is my code: public class Main extends Applet implements Runnable, KeyListener, java.awt.event.MouseListener { int x_pos = 300; int y_pos = 200; int radius = 20; int appletsize_x = 600; int appletsize_y = 400; double x_speed = 0; double y_speed = 0; private Image...
TITLE: Make ball stop moving when no key is being pressed? QUESTION: Here is my code: public class Main extends Applet implements Runnable, KeyListener, java.awt.event.MouseListener { int x_pos = 300; int y_pos = 200; int radius = 20; int appletsize_x = 600; int appletsize_y = 400; double x_speed = 0; double y_speed =...
[ "java", "applet" ]
1
2
1,639
2
0
2011-06-10T13:08:19.170000
2011-06-10T13:16:37.173000