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,259,101 | 6,259,184 | Disable (nxt/prv) buttons if there is no more pics | I already asked same question here after that i came up with this code: css div#big_container{ margin:0; padding:30px; width: 230px; height: 130px; border:1px solid #f0f0f0; background-color: #f0f0f0; text-align: center; z-index:-100; }
div#container{ overflow: hidden; width: 207px; background-color: #f0f0f0; }
div#c... | This should do it $("#left").click( function() { if(position < (size / 2)) { $('#right').removeAttr('disabled'); $("#content").animate({"right": "+=198px"}, "fast"); position ++; }if(position >= (size / 2)){ $('#left').attr("disabled", "true"); } });
$("#right").click( function() { if( position > 1) { $('#left').remov... | Disable (nxt/prv) buttons if there is no more pics I already asked same question here after that i came up with this code: css div#big_container{ margin:0; padding:30px; width: 230px; height: 130px; border:1px solid #f0f0f0; background-color: #f0f0f0; text-align: center; z-index:-100; }
div#container{ overflow: hidden... | TITLE:
Disable (nxt/prv) buttons if there is no more pics
QUESTION:
I already asked same question here after that i came up with this code: css div#big_container{ margin:0; padding:30px; width: 230px; height: 130px; border:1px solid #f0f0f0; background-color: #f0f0f0; text-align: center; z-index:-100; }
div#container... | [
"jquery",
"html",
"css",
"slider"
] | 0 | 1 | 202 | 2 | 0 | 2011-06-06T23:18:35.793000 | 2011-06-06T23:31:13.233000 |
6,259,114 | 6,259,198 | Docstrings in C extensions to Python? | When creating a C extension to Python, is it possible to be able to somehow write comments that are exposed as docstrings to users of the extension? | Docstrings for types can be included as the tp_doc member in the PyTypeObject structure, see an example in the docs. Docstrings for functions can be included in the ml_doc field of the module's method table. If you want your docstrings to be "physically close" to the actual functions, you could include string constants... | Docstrings in C extensions to Python? When creating a C extension to Python, is it possible to be able to somehow write comments that are exposed as docstrings to users of the extension? | TITLE:
Docstrings in C extensions to Python?
QUESTION:
When creating a C extension to Python, is it possible to be able to somehow write comments that are exposed as docstrings to users of the extension?
ANSWER:
Docstrings for types can be included as the tp_doc member in the PyTypeObject structure, see an example in... | [
"python",
"cpython",
"python-c-extension"
] | 23 | 21 | 3,164 | 1 | 0 | 2011-06-06T23:20:34.483000 | 2011-06-06T23:33:38.180000 |
6,259,120 | 6,259,767 | System.Threading.Timer call drifts a couple seconds every day | I have a service that is always running, it has a timer to perform a particular action every day at 2AM. TimeSpan runTime = new TimeSpan(2, 0, 0); // 2 AM TimeSpan timeToFirstRun = runTime - DateTime.Now.TimeOfDay;
if (timeToFirstRun.TotalHours < 0) { timeToFirstRun += TimeSpan.FromDays(1.0); }
_dailyNodalRunTimer = ... | None of the timers in the.NET Framework will be accurate. There are too many variables in play. If you want a more accurate timer then take a look at multimedia timers. I have never used them over longer durations, but I suspect they are still substantially more accurate than the BCL timers. But, I see no reason that w... | System.Threading.Timer call drifts a couple seconds every day I have a service that is always running, it has a timer to perform a particular action every day at 2AM. TimeSpan runTime = new TimeSpan(2, 0, 0); // 2 AM TimeSpan timeToFirstRun = runTime - DateTime.Now.TimeOfDay;
if (timeToFirstRun.TotalHours < 0) { timeT... | TITLE:
System.Threading.Timer call drifts a couple seconds every day
QUESTION:
I have a service that is always running, it has a timer to perform a particular action every day at 2AM. TimeSpan runTime = new TimeSpan(2, 0, 0); // 2 AM TimeSpan timeToFirstRun = runTime - DateTime.Now.TimeOfDay;
if (timeToFirstRun.Total... | [
"c#",
"time",
"windows-services",
"timer"
] | 4 | 3 | 6,599 | 5 | 0 | 2011-06-06T23:21:50.003000 | 2011-06-07T01:22:36.590000 |
6,259,122 | 6,265,634 | How to push view depending on the row selection? | /*****UPDATED** ***/ r.com/YH3cm.png I am trying to figure out in the above image, how will we know if the user has selected Date or Track. / UPDATED / The data I am receving is through a select query and I create an array to store the list. It is dynamic and not necessary limited to two fields, it can have 10 fields a... | It's still not very clear what you're trying to do. If you want to push a certain view controller depending on what the content of the cell is, but there is no definite arrangement of the rows, I would use the row index to access the array that is the source of your data. Some very loose code: WhateverObject* selectedO... | How to push view depending on the row selection? /*****UPDATED** ***/ r.com/YH3cm.png I am trying to figure out in the above image, how will we know if the user has selected Date or Track. / UPDATED / The data I am receving is through a select query and I create an array to store the list. It is dynamic and not necessa... | TITLE:
How to push view depending on the row selection?
QUESTION:
/*****UPDATED** ***/ r.com/YH3cm.png I am trying to figure out in the above image, how will we know if the user has selected Date or Track. / UPDATED / The data I am receving is through a select query and I create an array to store the list. It is dynam... | [
"iphone",
"objective-c",
"uitableview",
"uinavigationcontroller",
"uinavigationbar"
] | 0 | 0 | 1,063 | 3 | 0 | 2011-06-06T23:21:58.897000 | 2011-06-07T13:07:25.423000 |
6,259,135 | 6,259,188 | Simple routing error | Total noob question. I am building a simple photoblog in Rails which consists of Posts. Each post has its own id "/posts/1". I built Posts using rails scaffolding. The problem is that I am unable to go to a url such as "/posts/index" or "/posts/anything" because it's trying to match anything after "/posts/" it to an id... | Running rake routes is usually pretty helpful. In this case, the route to your index should just be /posts (not /posts/index). If you run rake routes you'll probably see something like posts GET /posts(.:format) {:action=>"index",:controller=>"posts"} That's trying to tell you that the URL /posts will be directed to th... | Simple routing error Total noob question. I am building a simple photoblog in Rails which consists of Posts. Each post has its own id "/posts/1". I built Posts using rails scaffolding. The problem is that I am unable to go to a url such as "/posts/index" or "/posts/anything" because it's trying to match anything after ... | TITLE:
Simple routing error
QUESTION:
Total noob question. I am building a simple photoblog in Rails which consists of Posts. Each post has its own id "/posts/1". I built Posts using rails scaffolding. The problem is that I am unable to go to a url such as "/posts/index" or "/posts/anything" because it's trying to mat... | [
"ruby-on-rails",
"routes"
] | 0 | 0 | 521 | 2 | 0 | 2011-06-06T23:24:19.147000 | 2011-06-06T23:32:17.390000 |
6,259,151 | 6,259,504 | Javascript Callable and prototype extendable Function | Basically I looking for the ability to attach methods to an executable function while using the javascript prototype method. The code below demonstrates want I'm talking about and the functionality I'm looking for, but it is really a hack. Notice I have a valid this object to attach variables along with a main and init... | You can put your the prototype functions into the "constructor" body. This technically is what you are currently doing, but defining them explicitly rather than using a helper method is much cleaner. Then, you can further simplify your code using the following pattern for public and private variables and methods: funct... | Javascript Callable and prototype extendable Function Basically I looking for the ability to attach methods to an executable function while using the javascript prototype method. The code below demonstrates want I'm talking about and the functionality I'm looking for, but it is really a hack. Notice I have a valid this... | TITLE:
Javascript Callable and prototype extendable Function
QUESTION:
Basically I looking for the ability to attach methods to an executable function while using the javascript prototype method. The code below demonstrates want I'm talking about and the functionality I'm looking for, but it is really a hack. Notice I... | [
"javascript",
"function-prototypes"
] | 2 | 1 | 1,320 | 2 | 0 | 2011-06-06T23:26:00.277000 | 2011-06-07T00:24:25.150000 |
6,259,173 | 6,259,210 | Ruby, weird substitution | For example: str1 = "pppp(m)pppp" str2 = "(m)" str1 = str1.sub(/#{str2}/, "<>#{str2}<>") I will got this: "pppp(<>(m)<>)pppp" I expected to get this: "pppp<>(m)<>pppp" Why it's happening and how to avoid this? | In ( and ) have a special meaning in regexen and do not actually match the characters ( and ). The regex /(m)/ will match any m whether or not it is enclosed in parentheses (and if it is, it won't match the parentheses). To match literal parentheses use \( and \) - or in a case like this where you're interpolating a st... | Ruby, weird substitution For example: str1 = "pppp(m)pppp" str2 = "(m)" str1 = str1.sub(/#{str2}/, "<>#{str2}<>") I will got this: "pppp(<>(m)<>)pppp" I expected to get this: "pppp<>(m)<>pppp" Why it's happening and how to avoid this? | TITLE:
Ruby, weird substitution
QUESTION:
For example: str1 = "pppp(m)pppp" str2 = "(m)" str1 = str1.sub(/#{str2}/, "<>#{str2}<>") I will got this: "pppp(<>(m)<>)pppp" I expected to get this: "pppp<>(m)<>pppp" Why it's happening and how to avoid this?
ANSWER:
In ( and ) have a special meaning in regexen and do not ac... | [
"ruby",
"regex"
] | 2 | 4 | 73 | 2 | 0 | 2011-06-06T23:29:31.140000 | 2011-06-06T23:34:55.620000 |
6,259,190 | 6,259,351 | Ant concat fileset separator | When using concat with fileset in Ant, how do I make an action happen for each element in the fileset. Such as, adding a string: test Or echoing the current file name for each file in the fileset (and, how do I GET the file name for the current file???): | I think there is no such thing in default ant. The closest one is, but it's system specific: Also you can install ant-contrib to enable task: file [@{file}] | Ant concat fileset separator When using concat with fileset in Ant, how do I make an action happen for each element in the fileset. Such as, adding a string: test Or echoing the current file name for each file in the fileset (and, how do I GET the file name for the current file???): | TITLE:
Ant concat fileset separator
QUESTION:
When using concat with fileset in Ant, how do I make an action happen for each element in the fileset. Such as, adding a string: test Or echoing the current file name for each file in the fileset (and, how do I GET the file name for the current file???):
ANSWER:
I think t... | [
"ant"
] | 5 | 4 | 2,857 | 1 | 0 | 2011-06-06T23:32:26.993000 | 2011-06-06T23:56:38.963000 |
6,259,191 | 6,259,688 | Using Enterprise Library 5.0 Data Access questions | This might be a very simple question, but more or less, I'm asking to so I can wrap my head around how Data Access blocks opens and closes connections. First, I have used something like the Enterprise Library for about 10 years, and have switched back and forth between Entities, etc. Anyway, when I use the CreateDataba... | CreateDatabase() does not open a connection to the database. The individual commands typically handle the opening and closing of the connection (e.g. ExecuteNonQuery). Of course there's always an exception. For ExecuteReader, it wouldn't make sense to close the connection immediately. ExecuteReader is set up to close t... | Using Enterprise Library 5.0 Data Access questions This might be a very simple question, but more or less, I'm asking to so I can wrap my head around how Data Access blocks opens and closes connections. First, I have used something like the Enterprise Library for about 10 years, and have switched back and forth between... | TITLE:
Using Enterprise Library 5.0 Data Access questions
QUESTION:
This might be a very simple question, but more or less, I'm asking to so I can wrap my head around how Data Access blocks opens and closes connections. First, I have used something like the Enterprise Library for about 10 years, and have switched back... | [
"c#",
"asp.net",
"asp.net-mvc-3",
"enterprise-library"
] | 1 | 5 | 2,741 | 1 | 0 | 2011-06-06T23:32:27.447000 | 2011-06-07T01:06:24.847000 |
6,259,194 | 6,259,347 | XOR ciphering works *most* of the time | I've been tasked with password-protecting a Java app with minimal concern for real security. So it seemed sensible to store username/password pairs in a text file and then encrypt it. For the encryption, it seemed appropriate to use XOR ciphers because they're easy and fast (remember--it just has to discourage the casu... | You are trying to store binary in text mode file. Use open(file, "wb") for writing and open(file, "rb") for reading to open file in binary mode and fix an issue. In text mode every "\r", "\n" and "\r\n" sequences are treated as newlines so they are converted into your local OS line ending convention ( "\r\n" for Window... | XOR ciphering works *most* of the time I've been tasked with password-protecting a Java app with minimal concern for real security. So it seemed sensible to store username/password pairs in a text file and then encrypt it. For the encryption, it seemed appropriate to use XOR ciphers because they're easy and fast (remem... | TITLE:
XOR ciphering works *most* of the time
QUESTION:
I've been tasked with password-protecting a Java app with minimal concern for real security. So it seemed sensible to store username/password pairs in a text file and then encrypt it. For the encryption, it seemed appropriate to use XOR ciphers because they're ea... | [
"python",
"encryption",
"xor"
] | 2 | 1 | 1,401 | 3 | 0 | 2011-06-06T23:32:55.653000 | 2011-06-06T23:56:11.203000 |
6,259,196 | 6,259,265 | How does jQuery getScript method ensure secure execution of dynamically loaded JavaScript? | I want to dynamically load JS file using AJAX and execute it. I am referring this page which says, "At this time,the preferred way of injecting JS code seems to be to use AJAX to load the JS source, then eval() the code." But I am worried of using eval to execute the script. Just to see how jQuery implements this I che... | There is nothing to ensure "security" (that actually can't be done). It is on you to just load trusted scripts. After some delegating, jQuery will call a method called "globalEval" which either runs.execScript() (IE) or a standard window.eval() on the transfered script files. Either way, the script which gets executed ... | How does jQuery getScript method ensure secure execution of dynamically loaded JavaScript? I want to dynamically load JS file using AJAX and execute it. I am referring this page which says, "At this time,the preferred way of injecting JS code seems to be to use AJAX to load the JS source, then eval() the code." But I a... | TITLE:
How does jQuery getScript method ensure secure execution of dynamically loaded JavaScript?
QUESTION:
I want to dynamically load JS file using AJAX and execute it. I am referring this page which says, "At this time,the preferred way of injecting JS code seems to be to use AJAX to load the JS source, then eval() ... | [
"jquery",
"security",
"eval"
] | 5 | 5 | 1,646 | 1 | 0 | 2011-06-06T23:33:18.810000 | 2011-06-06T23:44:19.440000 |
6,259,197 | 6,259,214 | What is the closest analog to Cocoa's `NSSwitchButton` checkbox in iOS? | What is the closest analog to Cocoa's NSSwitchButton checkbox in iOS? | Have a look at UISwitch. This is the same "lightswitch-style" ON/OFF button that is used in preferences. Here is a tutorial on using UISwitch on iOS. | What is the closest analog to Cocoa's `NSSwitchButton` checkbox in iOS? What is the closest analog to Cocoa's NSSwitchButton checkbox in iOS? | TITLE:
What is the closest analog to Cocoa's `NSSwitchButton` checkbox in iOS?
QUESTION:
What is the closest analog to Cocoa's NSSwitchButton checkbox in iOS?
ANSWER:
Have a look at UISwitch. This is the same "lightswitch-style" ON/OFF button that is used in preferences. Here is a tutorial on using UISwitch on iOS. | [
"objective-c",
"cocoa-touch",
"ios",
"ipad",
"uikit"
] | 2 | 3 | 651 | 1 | 0 | 2011-06-06T23:33:23.723000 | 2011-06-06T23:36:12.883000 |
6,259,202 | 6,259,292 | How do I print a Groovy stack trace? | How do I print a Groovy stack trace? The Java method, Thread.currentThread().getStackTrace() produces a huge stack trace, including a lot of the Groovy internals. I'm seeing a function called twice from a StreamingMarkupBuilder that looks like it should only be called once and I would like to see why Groovy thinks it s... | Solution: org.codehaus.groovy.runtime.StackTraceUtils.sanitize(new Exception()).printStackTrace() Original answer: A Google search returns the following information: Apparently, there is a method in org.codehaus.groovy.runtime.StackTraceUtils called printSanitizedStackTrace. There isn't much documentation for the metho... | How do I print a Groovy stack trace? How do I print a Groovy stack trace? The Java method, Thread.currentThread().getStackTrace() produces a huge stack trace, including a lot of the Groovy internals. I'm seeing a function called twice from a StreamingMarkupBuilder that looks like it should only be called once and I wou... | TITLE:
How do I print a Groovy stack trace?
QUESTION:
How do I print a Groovy stack trace? The Java method, Thread.currentThread().getStackTrace() produces a huge stack trace, including a lot of the Groovy internals. I'm seeing a function called twice from a StreamingMarkupBuilder that looks like it should only be cal... | [
"groovy"
] | 31 | 28 | 34,189 | 3 | 0 | 2011-06-06T23:34:15.947000 | 2011-06-06T23:48:50.920000 |
6,259,209 | 6,259,218 | C# remove elements in list starting with # | Possible Duplicate: How to remove elements from an array I have an List with a bunch of data in it. Some of the lines start with a #. I want to remove those lines. How...? | assuming its a string List myList.RemoveAll(x => x.BeginsWith("#")); | C# remove elements in list starting with # Possible Duplicate: How to remove elements from an array I have an List with a bunch of data in it. Some of the lines start with a #. I want to remove those lines. How...? | TITLE:
C# remove elements in list starting with #
QUESTION:
Possible Duplicate: How to remove elements from an array I have an List with a bunch of data in it. Some of the lines start with a #. I want to remove those lines. How...?
ANSWER:
assuming its a string List myList.RemoveAll(x => x.BeginsWith("#")); | [
"c#",
"arrays"
] | 2 | 11 | 194 | 1 | 0 | 2011-06-06T23:34:54.877000 | 2011-06-06T23:36:47.023000 |
6,259,236 | 6,259,251 | How to get related items without SELECT each id | I have to do a database design for a Friend-Network. When I add someone as someone friend, I actually add their uniqueID to a table with two columns. | USER 1 | USER 2 | So when I want to known what are someone friends, I do a SELECT in this table looking for ID. But the problem, is when I want to show the friend list ... | Your design seems fine to me. However look into JOINs which will help you get rid of nested queries to get info for the users. JOINs will allow you to get all the info about both users in one query and then you can loop through and print the list. The query might become something like: SELECT u.name FROM friends f JOIN... | How to get related items without SELECT each id I have to do a database design for a Friend-Network. When I add someone as someone friend, I actually add their uniqueID to a table with two columns. | USER 1 | USER 2 | So when I want to known what are someone friends, I do a SELECT in this table looking for ID. But the ... | TITLE:
How to get related items without SELECT each id
QUESTION:
I have to do a database design for a Friend-Network. When I add someone as someone friend, I actually add their uniqueID to a table with two columns. | USER 1 | USER 2 | So when I want to known what are someone friends, I do a SELECT in this table lookin... | [
"mysql",
"sql",
"database",
"database-design"
] | 0 | 1 | 129 | 2 | 0 | 2011-06-06T23:39:25.353000 | 2011-06-06T23:42:50.877000 |
6,259,237 | 6,259,248 | how to pass a variable to an XPathExpression | i want to pass the value of a variable in XPathExpression. I want to put the id value in a variable. How can I do that? Below is the code; XPathExpression expr = xpath.compile("//Number[@id=1]/Movies/text()"); Above, I want to put the value of id in a variable. I tried int num =1 but doesn't works. Thanks. | String yourArg= "1"; XPathExpression expr = xpath.compile("//Number[@id="+yourArg+"]/Movies/text()"); | how to pass a variable to an XPathExpression i want to pass the value of a variable in XPathExpression. I want to put the id value in a variable. How can I do that? Below is the code; XPathExpression expr = xpath.compile("//Number[@id=1]/Movies/text()"); Above, I want to put the value of id in a variable. I tried int n... | TITLE:
how to pass a variable to an XPathExpression
QUESTION:
i want to pass the value of a variable in XPathExpression. I want to put the id value in a variable. How can I do that? Below is the code; XPathExpression expr = xpath.compile("//Number[@id=1]/Movies/text()"); Above, I want to put the value of id in a varia... | [
"java",
"android",
"android-emulator"
] | 1 | 5 | 12,593 | 1 | 0 | 2011-06-06T23:39:52.663000 | 2011-06-06T23:42:02.427000 |
6,259,238 | 6,259,364 | Parsing Flickr Image-URL with NSXMLParser | I've the following problem: I'm parsing an XML File from Flickr API http://api.flickr.com/services/feeds/photos_public.gne?tags= with a specific tag, provided by the user before. Then I get a XML file where in each item a line exists like Is there an easy way to parse this line of code with NSXMLParser? Or should I use... | You should be able to use the delegate method parser:didStartElement:namespaceURI:qualifiedName:attributes: to get that info. The attributes are available in the attributesDict. So you can get the IMAGEURL using, NSString * imageURLString = [attributesDict objectForKey:@"href"]; when elementName is "link". | Parsing Flickr Image-URL with NSXMLParser I've the following problem: I'm parsing an XML File from Flickr API http://api.flickr.com/services/feeds/photos_public.gne?tags= with a specific tag, provided by the user before. Then I get a XML file where in each item a line exists like Is there an easy way to parse this line... | TITLE:
Parsing Flickr Image-URL with NSXMLParser
QUESTION:
I've the following problem: I'm parsing an XML File from Flickr API http://api.flickr.com/services/feeds/photos_public.gne?tags= with a specific tag, provided by the user before. Then I get a XML file where in each item a line exists like Is there an easy way ... | [
"iphone",
"ios",
"nsxmlparser"
] | 0 | 0 | 529 | 2 | 0 | 2011-06-06T23:39:54.590000 | 2011-06-06T23:59:09.213000 |
6,259,241 | 6,259,686 | Fixing a match clause warning by getting rid of a type parameter | i want to implement the following exhaustive match, but i can't figure out to remove the type parameter and thus the warning that it is erased: sealed trait Q[+V] case object QEmpty extends Q[Nothing] sealed trait QNonEmpty[V] extends Q[V] { def foo: V } final class QLeaf[V](val foo: V) extends QNonEmpty[V] final class... | You can use existential types to match on a type with erased parameters: type AnyNonEmpty = QNonEmpty[X] forSome { type X }
in match { case x: AnyNonEmpty => //... } An extractor could look like this: object QNonEmpty { def unapply(in: QNonEmpty[_]): Option[Any] = Some(in.foo) }
def test[ V ]( n: Q[ V ]): String = n ... | Fixing a match clause warning by getting rid of a type parameter i want to implement the following exhaustive match, but i can't figure out to remove the type parameter and thus the warning that it is erased: sealed trait Q[+V] case object QEmpty extends Q[Nothing] sealed trait QNonEmpty[V] extends Q[V] { def foo: V } ... | TITLE:
Fixing a match clause warning by getting rid of a type parameter
QUESTION:
i want to implement the following exhaustive match, but i can't figure out to remove the type parameter and thus the warning that it is erased: sealed trait Q[+V] case object QEmpty extends Q[Nothing] sealed trait QNonEmpty[V] extends Q[... | [
"scala",
"pattern-matching",
"type-erasure",
"extractor"
] | 1 | 3 | 717 | 1 | 0 | 2011-06-06T23:40:00.363000 | 2011-06-07T01:06:12.163000 |
6,259,253 | 6,259,413 | Get a COM object to throw an exception on any result except S_OK (0) in C# | I'm currently working on an upgrade to a project that extensively uses COM / MFC / (who knows how many other technologies). As part of the upgrade, we're trying to move as much functionality as we can into managed C# code, but unfortunately some stuff just can't move (for reasons I won't go into). One of those things i... | Two thoughts: Find and kill (or severely maim) whoever implemented this library Implement a wrapper in managed C++ as you will need to get at the method call's HResult directly and I cannot think of a way to do that using interop. EDIT Another option is to declare the COM interfaces in C# such that the signature of eac... | Get a COM object to throw an exception on any result except S_OK (0) in C# I'm currently working on an upgrade to a project that extensively uses COM / MFC / (who knows how many other technologies). As part of the upgrade, we're trying to move as much functionality as we can into managed C# code, but unfortunately some... | TITLE:
Get a COM object to throw an exception on any result except S_OK (0) in C#
QUESTION:
I'm currently working on an upgrade to a project that extensively uses COM / MFC / (who knows how many other technologies). As part of the upgrade, we're trying to move as much functionality as we can into managed C# code, but ... | [
"c#",
"com"
] | 5 | 5 | 566 | 1 | 0 | 2011-06-06T23:42:56.243000 | 2011-06-07T00:06:09.063000 |
6,259,260 | 6,259,325 | Selected UIImage in UITableView | I have a UITableView and it is populated with information, detailed information and images for each cell. I also have it so when a cell is selected it brings the user to a detailed view. What I am trying to accomplish is how to tell the difference between when the user clicks a cell or the image in the cell. I would li... | I think the easiest way would be to add a UIButton as the subview, and add your image as the background view for the UIButton, either through Interface Builder or by creating a UIImage. Then you can hook up an event handler to the Touch Up Inside outlet that will handle the button tap. With the UIButton, the UITableVie... | Selected UIImage in UITableView I have a UITableView and it is populated with information, detailed information and images for each cell. I also have it so when a cell is selected it brings the user to a detailed view. What I am trying to accomplish is how to tell the difference between when the user clicks a cell or t... | TITLE:
Selected UIImage in UITableView
QUESTION:
I have a UITableView and it is populated with information, detailed information and images for each cell. I also have it so when a cell is selected it brings the user to a detailed view. What I am trying to accomplish is how to tell the difference between when the user ... | [
"iphone",
"ios",
"uitableview",
"uiimage"
] | 0 | 1 | 2,493 | 2 | 0 | 2011-06-06T23:43:39.230000 | 2011-06-06T23:52:54.907000 |
6,259,267 | 6,260,166 | How to assert the content of the response body in rails 3 functional test | I have a Rails 3.0.7 application. In the functional test I have following code. I am not using rspec or anything. This is plain vanilla functional test that comes with rails. assert_response:success Above assertion is passing. However I need to assert on the full content that is returned as the body of the response. Ho... | You can access the response body in a functional test via: response.body Often, in this style of testing, you really want to use the method: assert_select A nice way to check out the assert_select API is via the cheat gem: gem install cheat cheat assert_select | How to assert the content of the response body in rails 3 functional test I have a Rails 3.0.7 application. In the functional test I have following code. I am not using rspec or anything. This is plain vanilla functional test that comes with rails. assert_response:success Above assertion is passing. However I need to a... | TITLE:
How to assert the content of the response body in rails 3 functional test
QUESTION:
I have a Rails 3.0.7 application. In the functional test I have following code. I am not using rspec or anything. This is plain vanilla functional test that comes with rails. assert_response:success Above assertion is passing. H... | [
"ruby-on-rails"
] | 21 | 45 | 22,445 | 2 | 0 | 2011-06-06T23:44:22.147000 | 2011-06-07T02:47:08.503000 |
6,259,268 | 6,268,509 | Strange LINQ Error When Using A Variable But Not a Hard-coded String | I have a simple LINQ query running on top of Entity Framework (v1) and pointing at SQL Server Compact v3.5 SP2 (8085): var myResults = (from m in myContext.MyData join o in myContext.SomeOtherData on new { m.ID, Name = myNameVariable } equals new { o.ID, o.Name } select m).ToArray(); The above query will fail with the ... | The EF generates different SQL for these queries. For the hard-coded string, it uses a string literal in SQL. For the variable, it uses a SQL parameter, to defend against SQL injection (no risk with the hard-coded string, unless you do it to yourself!). So SQL CE must be treating these two differently. | Strange LINQ Error When Using A Variable But Not a Hard-coded String I have a simple LINQ query running on top of Entity Framework (v1) and pointing at SQL Server Compact v3.5 SP2 (8085): var myResults = (from m in myContext.MyData join o in myContext.SomeOtherData on new { m.ID, Name = myNameVariable } equals new { o.... | TITLE:
Strange LINQ Error When Using A Variable But Not a Hard-coded String
QUESTION:
I have a simple LINQ query running on top of Entity Framework (v1) and pointing at SQL Server Compact v3.5 SP2 (8085): var myResults = (from m in myContext.MyData join o in myContext.SomeOtherData on new { m.ID, Name = myNameVariable... | [
"linq-to-entities",
"sql-server-ce"
] | 0 | 1 | 441 | 1 | 0 | 2011-06-06T23:44:32.793000 | 2011-06-07T16:28:52.150000 |
6,259,269 | 6,259,313 | Is The Java Tutorials Translucent Window example giving trouble to those playing with jdk7? | Here's the example. If you build and run TranslucentWindow in let's say, NetBeans IDE 7.0, which supports jdk7, you'll get the following exception: Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: The frame is decorated at java.awt.Frame.setOpacity(Frame.java:960) at main.TranslucentWindo... | Right from the JavaDocs for java.awt.frame.setOpacity() in JDK7: The following conditions must be met in order to set the opacity value less than 1.0f: The TRANSLUCENT translucency must be supported by the underlying system The window must be undecorated (see setUndecorated(boolean) and Dialog.setUndecorated(boolean)) ... | Is The Java Tutorials Translucent Window example giving trouble to those playing with jdk7? Here's the example. If you build and run TranslucentWindow in let's say, NetBeans IDE 7.0, which supports jdk7, you'll get the following exception: Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: ... | TITLE:
Is The Java Tutorials Translucent Window example giving trouble to those playing with jdk7?
QUESTION:
Here's the example. If you build and run TranslucentWindow in let's say, NetBeans IDE 7.0, which supports jdk7, you'll get the following exception: Exception in thread "AWT-EventQueue-0" java.awt.IllegalCompone... | [
"java",
"swing",
"java-7",
"translucency",
"netbeans7.0"
] | 12 | 18 | 19,622 | 5 | 0 | 2011-06-06T23:44:49.527000 | 2011-06-06T23:51:31.250000 |
6,259,282 | 6,261,521 | How should I convert country codes? | I'm storing addresses with country codes according to ISO 3166 3-letter country codes. If I want to display the unabbreviated format, what is the best OO way to do conversions like this? | It all boils down to a JOIN: you need to have a countries table with the country code as the primary key, plus a name column, and join that on the original table. This is just basic database design, nothing to do with OOP. An alternative would be to do two queries, which is only feasible if you need no more than a hand... | How should I convert country codes? I'm storing addresses with country codes according to ISO 3166 3-letter country codes. If I want to display the unabbreviated format, what is the best OO way to do conversions like this? | TITLE:
How should I convert country codes?
QUESTION:
I'm storing addresses with country codes according to ISO 3166 3-letter country codes. If I want to display the unabbreviated format, what is the best OO way to do conversions like this?
ANSWER:
It all boils down to a JOIN: you need to have a countries table with t... | [
"php",
"oop"
] | 0 | 3 | 358 | 3 | 0 | 2011-06-06T23:46:11.430000 | 2011-06-07T06:46:08.257000 |
6,259,287 | 6,259,375 | Android - Admob SurfaceView | I am new to android development, but I am trying to add admob to my app which is using a surfaceview (panelView - GameView). I tried following http://rx-games.com/admob-adverts-on-surfaceview-no-xml-tutorial/ but I must be doing something wrong, as rl.addView(panelView); adds a nullPointerException. Any help is greatly... | You are inflating the GameView class from an xml layout and add it to a root View that is not the one defined in that same xml. You have two options: You create your SurfaceView entirely in Java (as in the example you posted) You include the AdView in the xml layout (I would prefer this option over the other one) If yo... | Android - Admob SurfaceView I am new to android development, but I am trying to add admob to my app which is using a surfaceview (panelView - GameView). I tried following http://rx-games.com/admob-adverts-on-surfaceview-no-xml-tutorial/ but I must be doing something wrong, as rl.addView(panelView); adds a nullPointerEx... | TITLE:
Android - Admob SurfaceView
QUESTION:
I am new to android development, but I am trying to add admob to my app which is using a surfaceview (panelView - GameView). I tried following http://rx-games.com/admob-adverts-on-surfaceview-no-xml-tutorial/ but I must be doing something wrong, as rl.addView(panelView); ad... | [
"android",
"admob"
] | 1 | 0 | 3,099 | 1 | 0 | 2011-06-06T23:48:02.047000 | 2011-06-07T00:00:10.773000 |
6,259,291 | 6,259,332 | how to call methods of defined classes from within template class methods | How should I call a method within a defined class from a template class method? Below is my scenario - Template Class template class TC { void myTemplateMethod() { T.myMethod(); //can I call like this? } }; Defined Class class tdef { void myMethod() { //does something } }; Main int main() { TC tobj; tobj.myTemplateMeth... | That's a non-static member function, so it can only be called on an instance. Templates don't change that fact. T t; t.myMethod(); or if the function were static: T::myMethod(); | how to call methods of defined classes from within template class methods How should I call a method within a defined class from a template class method? Below is my scenario - Template Class template class TC { void myTemplateMethod() { T.myMethod(); //can I call like this? } }; Defined Class class tdef { void myMetho... | TITLE:
how to call methods of defined classes from within template class methods
QUESTION:
How should I call a method within a defined class from a template class method? Below is my scenario - Template Class template class TC { void myTemplateMethod() { T.myMethod(); //can I call like this? } }; Defined Class class t... | [
"c++",
"templates"
] | 2 | 6 | 160 | 1 | 0 | 2011-06-06T23:48:35.250000 | 2011-06-06T23:54:14.167000 |
6,259,314 | 6,259,338 | What does "shadowing" mean in Ruby? | If I do the following with warnings turned on under Ruby 1.9: $VERBOSE = true x = 42 5.times{|x| puts x} I get warning: shadowing outer local variable - x Presumably it's to do with using x as a block parameter as well as a variable outside of the block, but what does "shadowing" mean? | Shadowing is when you have two different local variables with the same name. It is said that the variable defined in the inner scope "shadows" the one in the outer scope (because the outer variable is now no longer accessible as long as the inner variable is in scope, even though it would otherwise be in scope). So in ... | What does "shadowing" mean in Ruby? If I do the following with warnings turned on under Ruby 1.9: $VERBOSE = true x = 42 5.times{|x| puts x} I get warning: shadowing outer local variable - x Presumably it's to do with using x as a block parameter as well as a variable outside of the block, but what does "shadowing" mea... | TITLE:
What does "shadowing" mean in Ruby?
QUESTION:
If I do the following with warnings turned on under Ruby 1.9: $VERBOSE = true x = 42 5.times{|x| puts x} I get warning: shadowing outer local variable - x Presumably it's to do with using x as a block parameter as well as a variable outside of the block, but what do... | [
"ruby",
"shadow"
] | 36 | 53 | 11,391 | 2 | 0 | 2011-06-06T23:51:50.607000 | 2011-06-06T23:55:00.743000 |
6,259,316 | 6,261,050 | Use self-signed cert without installing in cert store | I have a self-signed certificate (.cer) file from a third party. I'd like to use that certificate in code to connect to their webservice (over HTTPS), without installing it in my cert store in Windows. Specifically this is so all the other developers on the team won't have to install this cert locally in order for the ... | The reason why you need the certificate is HTTPS. The web service is secured by transport security (HTTPS) with certificate not trusted by your system. To trust the certificate the common approach is installing the certificate to certification store. This all is not.NET feature - it is Windows feature outside of.NET re... | Use self-signed cert without installing in cert store I have a self-signed certificate (.cer) file from a third party. I'd like to use that certificate in code to connect to their webservice (over HTTPS), without installing it in my cert store in Windows. Specifically this is so all the other developers on the team won... | TITLE:
Use self-signed cert without installing in cert store
QUESTION:
I have a self-signed certificate (.cer) file from a third party. I'd like to use that certificate in code to connect to their webservice (over HTTPS), without installing it in my cert store in Windows. Specifically this is so all the other develope... | [
".net",
"web-services",
"certificate",
"wcf-client",
"self-signed"
] | 4 | 4 | 2,428 | 2 | 0 | 2011-06-06T23:51:56.227000 | 2011-06-07T05:46:10.213000 |
6,259,321 | 6,259,357 | Get plain text from Word [2003-2007], and Excel [2003-2007] files using PHP | What is the simplest way to get the plain-text only from filetypes: Word [2003-2007], and Excel [2003-2007], using PHP on a Windows Server 2008 machine? Theoretically, I could use the indexing service on Windows; however, I have no idea how/if that can be accessed using PHP only. Bonus points for simplicity! Thanks in ... | Check this: How do I read Word, Excell, and PDF docs in PHP? or pay 35$: http://www.phpwordlib.motion-bg.com/ | Get plain text from Word [2003-2007], and Excel [2003-2007] files using PHP What is the simplest way to get the plain-text only from filetypes: Word [2003-2007], and Excel [2003-2007], using PHP on a Windows Server 2008 machine? Theoretically, I could use the indexing service on Windows; however, I have no idea how/if ... | TITLE:
Get plain text from Word [2003-2007], and Excel [2003-2007] files using PHP
QUESTION:
What is the simplest way to get the plain-text only from filetypes: Word [2003-2007], and Excel [2003-2007], using PHP on a Windows Server 2008 machine? Theoretically, I could use the indexing service on Windows; however, I ha... | [
"php",
"excel",
"file-io",
"ms-word"
] | 0 | 2 | 1,222 | 1 | 0 | 2011-06-06T23:52:26.960000 | 2011-06-06T23:57:14.003000 |
6,259,327 | 6,270,586 | TestNG @AfterMethod for a specific group is running after each method in Eclipse | I don't get how the grouping works in TestNG, I have this code: @AfterMethod(groups = { "refreshPage" }) public void refresh() throws IOException { driver.navigate().refresh(); }
@Test public void test1() {
}
@Test(groups = { "refreshPage" }) public void test2() {
} And the @AfterMethod is run after both of them, e... | I'm sorry but I don't understand your description of the problem. Your two test methods belong to the group "refresh", so if you run that group, you will see both of them run, and each of them will be followed by a call to prepareTest() (by the way, it seems odd that an after method would be called "prepareTest()", are... | TestNG @AfterMethod for a specific group is running after each method in Eclipse I don't get how the grouping works in TestNG, I have this code: @AfterMethod(groups = { "refreshPage" }) public void refresh() throws IOException { driver.navigate().refresh(); }
@Test public void test1() {
}
@Test(groups = { "refreshPa... | TITLE:
TestNG @AfterMethod for a specific group is running after each method in Eclipse
QUESTION:
I don't get how the grouping works in TestNG, I have this code: @AfterMethod(groups = { "refreshPage" }) public void refresh() throws IOException { driver.navigate().refresh(); }
@Test public void test1() {
}
@Test(gro... | [
"java",
"testng"
] | 0 | 1 | 3,080 | 1 | 0 | 2011-06-06T23:53:16.833000 | 2011-06-07T19:32:16.597000 |
6,259,333 | 6,262,564 | Detecting with jQuery that a GWT application has loaded | I'm incorporating a GWT application in my website and I need to execute some functions after the application has finished loading. I've read this question but calling some javascript function from GWT is not what I want. I would like to be able, from the page, to detect that the loading is finished. Is there a way to f... | You could probably just use this NativeEvent event = Document.get().createChangeEvent(); DomEvent.fireNativeEvent(event, this); To fire a custom event (after populating it) and having it event propagate to some jQuery handler. It seems like an awful amount of overhead to bundle in jQuery when using the build in stuff f... | Detecting with jQuery that a GWT application has loaded I'm incorporating a GWT application in my website and I need to execute some functions after the application has finished loading. I've read this question but calling some javascript function from GWT is not what I want. I would like to be able, from the page, to ... | TITLE:
Detecting with jQuery that a GWT application has loaded
QUESTION:
I'm incorporating a GWT application in my website and I need to execute some functions after the application has finished loading. I've read this question but calling some javascript function from GWT is not what I want. I would like to be able, ... | [
"jquery",
"events",
"gwt"
] | 1 | 1 | 973 | 1 | 0 | 2011-06-06T23:54:18.683000 | 2011-06-07T08:31:34.730000 |
6,259,339 | 6,259,377 | How to read a text file directly from Internet using Java? | I am trying to read some words from an online text file. I tried doing something like this File file = new File("http://www.puzzlers.org/pub/wordlists/pocket.txt"); Scanner scan = new Scanner(file); but it didn't work, I am getting http://www.puzzlers.org/pub/wordlists/pocket.txt as the output and I just want to get al... | Use an URL instead of File for any access that is not on your local computer. URL url = new URL("http://www.puzzlers.org/pub/wordlists/pocket.txt"); Scanner s = new Scanner(url.openStream()); Actually, URL is even more generally useful, also for local access (use a file: URL), jar files, and about everything that one c... | How to read a text file directly from Internet using Java? I am trying to read some words from an online text file. I tried doing something like this File file = new File("http://www.puzzlers.org/pub/wordlists/pocket.txt"); Scanner scan = new Scanner(file); but it didn't work, I am getting http://www.puzzlers.org/pub/w... | TITLE:
How to read a text file directly from Internet using Java?
QUESTION:
I am trying to read some words from an online text file. I tried doing something like this File file = new File("http://www.puzzlers.org/pub/wordlists/pocket.txt"); Scanner scan = new Scanner(file); but it didn't work, I am getting http://www.... | [
"java",
"file",
"text-files",
"java.util.scanner"
] | 47 | 71 | 151,690 | 9 | 0 | 2011-06-06T23:55:13.333000 | 2011-06-07T00:00:24.463000 |
6,259,354 | 6,259,488 | What should int compareTo() return when the parameter string is null? | It is said that when input parameter is null, compareTo() should throw a NullPointerException. However, I am implementing a class which needs to compare fields with the type of String. These fields need not to be mandatory. I wonder in this case, 1) What should I return when the input is null? Should any not-null strin... | Yes, there is no problem allowing null for instance fields - just make sure its sorting order is defined. Most natural would be putting it either before or after all real strings, but you could do anything here, just do it consistently. (For example, you could sort null like "null".) Here is an example implementation f... | What should int compareTo() return when the parameter string is null? It is said that when input parameter is null, compareTo() should throw a NullPointerException. However, I am implementing a class which needs to compare fields with the type of String. These fields need not to be mandatory. I wonder in this case, 1) ... | TITLE:
What should int compareTo() return when the parameter string is null?
QUESTION:
It is said that when input parameter is null, compareTo() should throw a NullPointerException. However, I am implementing a class which needs to compare fields with the type of String. These fields need not to be mandatory. I wonder... | [
"java",
"string",
"null",
"nullpointerexception",
"compareto"
] | 21 | 16 | 27,532 | 6 | 0 | 2011-06-06T23:56:45.197000 | 2011-06-07T00:20:54.103000 |
6,259,358 | 6,259,385 | AlertDialog - Trying to get the Alert to work | So I have searched through a few question here regarding the AlertDialog, and I'm not completely sure what I'm doing, so I am having a hard time relating those questions to my own example. (I'm still new to this whole android programming so please bear with me.) I have defined this under the public class _ Activity imp... | I'm pretty sure you just aren't importing the DialogInterface. Try adding this statement to the beginning of your code. import android.content.DialogInterface; | AlertDialog - Trying to get the Alert to work So I have searched through a few question here regarding the AlertDialog, and I'm not completely sure what I'm doing, so I am having a hard time relating those questions to my own example. (I'm still new to this whole android programming so please bear with me.) I have defi... | TITLE:
AlertDialog - Trying to get the Alert to work
QUESTION:
So I have searched through a few question here regarding the AlertDialog, and I'm not completely sure what I'm doing, so I am having a hard time relating those questions to my own example. (I'm still new to this whole android programming so please bear wit... | [
"android",
"android-layout",
"dialog",
"alert",
"android-alertdialog"
] | 1 | 16 | 10,366 | 2 | 0 | 2011-06-06T23:57:35.540000 | 2011-06-07T00:02:06.893000 |
6,259,366 | 6,259,554 | Can I reference an external DTD for the structure of an ELEMENT in a DTD? | Can I define a DTD such that elements in it have their structures defined in an external DTD? I mean something like the following (this is an example that I know is invalid in several ways, but which hopefully will give you an idea of what I am looking for): The attempt here is to represent that a Message requires a Me... | Yes and you are very close with your example. You just need to reference the parameter entities. Here's an example of 3 DTD's and an XML instance. I only used #PCDATA for MessageHdr and MessageBody, but this can be any structure you define. message.dtd %MessageHdr-DTD; %MessageBody-DTD; messagehdr.dtd messagebody.dtd m... | Can I reference an external DTD for the structure of an ELEMENT in a DTD? Can I define a DTD such that elements in it have their structures defined in an external DTD? I mean something like the following (this is an example that I know is invalid in several ways, but which hopefully will give you an idea of what I am l... | TITLE:
Can I reference an external DTD for the structure of an ELEMENT in a DTD?
QUESTION:
Can I define a DTD such that elements in it have their structures defined in an external DTD? I mean something like the following (this is an example that I know is invalid in several ways, but which hopefully will give you an i... | [
"xml",
"dtd"
] | 4 | 8 | 658 | 1 | 0 | 2011-06-06T23:59:19.230000 | 2011-06-07T00:34:04.047000 |
6,259,368 | 6,271,479 | internet explorer 7 jquery slideshow layout | I am working on this site: http://richardthearchitect.com/site/ I just checked it in ie7 and the slideshow is not showing up right. Instead of only one image showing at a time, all of them are showing up on the page. Also when I scrolled down it seemed that the menu also scrolled down. How can i fix these issues? | in your script find: timeout: 5000, and delete the comma to timeout: 5000 hope this eliminate js error Expected identifier, string or number and probably your problem with slideshow too. | internet explorer 7 jquery slideshow layout I am working on this site: http://richardthearchitect.com/site/ I just checked it in ie7 and the slideshow is not showing up right. Instead of only one image showing at a time, all of them are showing up on the page. Also when I scrolled down it seemed that the menu also scro... | TITLE:
internet explorer 7 jquery slideshow layout
QUESTION:
I am working on this site: http://richardthearchitect.com/site/ I just checked it in ie7 and the slideshow is not showing up right. Instead of only one image showing at a time, all of them are showing up on the page. Also when I scrolled down it seemed that ... | [
"jquery",
"html",
"css",
"internet-explorer-7",
"internet-explorer-6"
] | 1 | 0 | 225 | 1 | 0 | 2011-06-06T23:59:25.660000 | 2011-06-07T20:50:54.243000 |
6,259,376 | 6,259,406 | How to add input check in a Linq Query to build XML only if input is valid | I have an input value that I need to use to build out an XML. Only if the value exists, do I need to build the sub-elements. Example string classInput="something"; XDocument classes = new XDocument( new XElement("Classes", new XElement("Class", new XElement("Name", classInput)) )); returns what I want: something Howeve... | Check the input with a conditional operator and return null if the input is null or empty: XDocument classes = new XDocument( new XElement("Classes", String.IsNullOrEmpty(classInput)? null: new XElement("Class", new XElement("Name", classInput)) )); | How to add input check in a Linq Query to build XML only if input is valid I have an input value that I need to use to build out an XML. Only if the value exists, do I need to build the sub-elements. Example string classInput="something"; XDocument classes = new XDocument( new XElement("Classes", new XElement("Class", ... | TITLE:
How to add input check in a Linq Query to build XML only if input is valid
QUESTION:
I have an input value that I need to use to build out an XML. Only if the value exists, do I need to build the sub-elements. Example string classInput="something"; XDocument classes = new XDocument( new XElement("Classes", new ... | [
"c#",
"linq-to-xml"
] | 1 | 0 | 81 | 1 | 0 | 2011-06-07T00:00:22.887000 | 2011-06-07T00:05:09.697000 |
6,259,380 | 6,259,391 | Having problems turning JSON into javascript object | I'm using jquery and the jquery-json plugin found here: http://code.google.com/p/jquery-json/ I've checked at http://jsonlint.com/ to make sure the returned JSON is valid and it is. I cannot get this function in the jquery-json plugin to return a javascript object. It simply throws an error at JSON.parse(src) on line 1... | If rsp is already an Object then you don't have to parse it. If typeof rsp returned String then you would. | Having problems turning JSON into javascript object I'm using jquery and the jquery-json plugin found here: http://code.google.com/p/jquery-json/ I've checked at http://jsonlint.com/ to make sure the returned JSON is valid and it is. I cannot get this function in the jquery-json plugin to return a javascript object. It... | TITLE:
Having problems turning JSON into javascript object
QUESTION:
I'm using jquery and the jquery-json plugin found here: http://code.google.com/p/jquery-json/ I've checked at http://jsonlint.com/ to make sure the returned JSON is valid and it is. I cannot get this function in the jquery-json plugin to return a jav... | [
"jquery",
"json"
] | 0 | 0 | 123 | 4 | 0 | 2011-06-07T00:00:49.430000 | 2011-06-07T00:02:49.687000 |
6,259,387 | 6,259,416 | PHP Math: Why is mod (%) not working with fac(13)? | Okay, this one is beyond me: I must be having a long day. Why does (13! mod 10) come out as 4, when the number ends in two 0s?? Try this out: Result is 4. Expected 0. I must be forgetting something exceedingly obvious... | 6227020800 is too large for an integer (on a 32 bit system anyway). PHP will store it as float in your variable. The modulo operation will thus use an inexact up/downrounded number as basis. | PHP Math: Why is mod (%) not working with fac(13)? Okay, this one is beyond me: I must be having a long day. Why does (13! mod 10) come out as 4, when the number ends in two 0s?? Try this out: Result is 4. Expected 0. I must be forgetting something exceedingly obvious... | TITLE:
PHP Math: Why is mod (%) not working with fac(13)?
QUESTION:
Okay, this one is beyond me: I must be having a long day. Why does (13! mod 10) come out as 4, when the number ends in two 0s?? Try this out: Result is 4. Expected 0. I must be forgetting something exceedingly obvious...
ANSWER:
6227020800 is too lar... | [
"php",
"math",
"floating-point"
] | 4 | 8 | 1,164 | 1 | 0 | 2011-06-07T00:02:19.627000 | 2011-06-07T00:06:53.150000 |
6,259,388 | 6,259,506 | Regex autoincrement replacements | is there a string in regular expressions that can instruct it to autoincrement it's replacements, whether they be numbers or letters. Thank you for instance, I have strings that should be number 1, 2, 3, 4, 5 but they are currently numbered as 1, 1, 1, 1, 1 how would I replace the number in those 5 individual similar s... | I'm not familiar with the syntax of TextWrangler; however, it uses pcre so this should be what you want as long as you have a way to assign an initial value to your incrementing variable (in this case, I use $ii )... the script below replaces any occurrence of "pizza-x" with "pizza-0", "pizza-1"... @foo = ('pizza', 'pi... | Regex autoincrement replacements is there a string in regular expressions that can instruct it to autoincrement it's replacements, whether they be numbers or letters. Thank you for instance, I have strings that should be number 1, 2, 3, 4, 5 but they are currently numbered as 1, 1, 1, 1, 1 how would I replace the numbe... | TITLE:
Regex autoincrement replacements
QUESTION:
is there a string in regular expressions that can instruct it to autoincrement it's replacements, whether they be numbers or letters. Thank you for instance, I have strings that should be number 1, 2, 3, 4, 5 but they are currently numbered as 1, 1, 1, 1, 1 how would I... | [
"regex",
"perl",
"pcre",
"auto-increment",
"textwrangler"
] | 2 | 4 | 3,489 | 1 | 0 | 2011-06-07T00:02:22.520000 | 2011-06-07T00:24:47.133000 |
6,259,390 | 6,259,618 | How I can get QMetaObject from just class name? | I need to get QMetaObject for dynamic creation of object instances. If I khow the object then QObject::metaObject() is what I need. If I know the class then I can use QObject::staticMetaObject variable. But what should I use if I know only class name as a string value? | You ask for a QMetaObject, but say it is for creation purposes. If that's all you have to do, QMetaType may well be what you need. You have to register your types with it, but I'm pretty sure QT doesn't have a master list of QMetaObject s just floating around by default, so such registration will be necessary no matter... | How I can get QMetaObject from just class name? I need to get QMetaObject for dynamic creation of object instances. If I khow the object then QObject::metaObject() is what I need. If I know the class then I can use QObject::staticMetaObject variable. But what should I use if I know only class name as a string value? | TITLE:
How I can get QMetaObject from just class name?
QUESTION:
I need to get QMetaObject for dynamic creation of object instances. If I khow the object then QObject::metaObject() is what I need. If I know the class then I can use QObject::staticMetaObject variable. But what should I use if I know only class name as ... | [
"c++",
"qt"
] | 6 | 4 | 3,637 | 2 | 0 | 2011-06-07T00:02:46.437000 | 2011-06-07T00:48:51.843000 |
6,259,395 | 6,259,441 | Problem with codeigniter's redirect function | This may be a n00b topic but, anyways, I have been having a rather difficult and strange time with this bug. Basically I was working on a controller method for a page that displays a form. Basically, I was debugging the form's submitted data by var dumping the form input using codeigniter's $this->input->post function ... | While I can't be sure, I'm going to assume you were outputting things like the var_dump() in your view file. A view is not executed at the time you call it, for example: $this->load->view('some_view'); echo "hi!"; In a controller will not result in the contents of some view followed by "hi". It will results in "hi" fol... | Problem with codeigniter's redirect function This may be a n00b topic but, anyways, I have been having a rather difficult and strange time with this bug. Basically I was working on a controller method for a page that displays a form. Basically, I was debugging the form's submitted data by var dumping the form input usi... | TITLE:
Problem with codeigniter's redirect function
QUESTION:
This may be a n00b topic but, anyways, I have been having a rather difficult and strange time with this bug. Basically I was working on a controller method for a page that displays a form. Basically, I was debugging the form's submitted data by var dumping ... | [
"php",
"codeigniter",
"redirect",
"header",
"superglobals"
] | 1 | 2 | 2,318 | 2 | 0 | 2011-06-07T00:03:18.307000 | 2011-06-07T00:11:46.333000 |
6,259,401 | 6,259,498 | Extra Padding From Bottom Of Div After jQuery Accordian Script Is Actived | I have designed a website that consists of the "body", a "container" to hold and center a "content" div on the page. The height of the "content" and "container" divs is set to 100%, I have also added an Accordian jQuery Script within the "content" div. Now in Google Chrome, when I activate the div that uses the jQuery ... | No idea what the problem is, haven't invested enough time to understand. Although it goes away when I add the following to the css #wrapper {overflow:auto} Not sure how satisfying a "this solves it with no explanation" is:) | Extra Padding From Bottom Of Div After jQuery Accordian Script Is Actived I have designed a website that consists of the "body", a "container" to hold and center a "content" div on the page. The height of the "content" and "container" divs is set to 100%, I have also added an Accordian jQuery Script within the "content... | TITLE:
Extra Padding From Bottom Of Div After jQuery Accordian Script Is Actived
QUESTION:
I have designed a website that consists of the "body", a "container" to hold and center a "content" div on the page. The height of the "content" and "container" divs is set to 100%, I have also added an Accordian jQuery Script w... | [
"javascript",
"jquery",
"css",
"xhtml",
"jquery-ui-accordion"
] | 4 | 4 | 1,063 | 1 | 0 | 2011-06-07T00:03:53.163000 | 2011-06-07T00:22:50.420000 |
6,259,405 | 6,259,412 | How to ignore white space when comparing source in Visual Studio / TFS? | The compare tool in Visual Source Safe (pre TFS) had a handy checkbox to select "Ignore White Space". Now we are using TFS with Visual Studio 2010, and the compare dialog no longer has this option. (A ridiculous oversight from Microsoft!) So, is it possible somehow to work around this? | This is a workaround that seems to get around the problem. In Visual Studio, select Tools / Options / Source Control / Visual Studio Team Foundation System and click the Configure User Tools button. In the dialog, Add an item with the following settings. Extension:.* Operation: Compare Command: C:\Program Files\Microso... | How to ignore white space when comparing source in Visual Studio / TFS? The compare tool in Visual Source Safe (pre TFS) had a handy checkbox to select "Ignore White Space". Now we are using TFS with Visual Studio 2010, and the compare dialog no longer has this option. (A ridiculous oversight from Microsoft!) So, is it... | TITLE:
How to ignore white space when comparing source in Visual Studio / TFS?
QUESTION:
The compare tool in Visual Source Safe (pre TFS) had a handy checkbox to select "Ignore White Space". Now we are using TFS with Visual Studio 2010, and the compare dialog no longer has this option. (A ridiculous oversight from Mic... | [
"visual-studio-2010",
"tfs"
] | 84 | 82 | 60,962 | 6 | 0 | 2011-06-07T00:05:09.767000 | 2011-06-07T00:05:54.447000 |
6,259,424 | 6,268,497 | Troubleshooting "No such file or directory" when running `php app/console doctrine:schema:create` | I am new to Symfony2 (beta4) and Doctrine and am having issues when i try to create the DB schema via command line. Here's the error: $ php app/console doctrine:schema:create
Creating database schema...
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
[ErrorException] Warning: PDO::__construct(): [200... | I fixed it by following this small tutorial: http://andreys.info/blog/2007-11-07/configuring-terminal-to-work-with-mamp-mysql-on-leopard [EDIT]: I modified the right php.ini and everything's working fine now. Now I get the following error: [Exception] DateTime::__construct(): It is not safe to rely on the system's time... | Troubleshooting "No such file or directory" when running `php app/console doctrine:schema:create` I am new to Symfony2 (beta4) and Doctrine and am having issues when i try to create the DB schema via command line. Here's the error: $ php app/console doctrine:schema:create
Creating database schema...
[PDOException] SQ... | TITLE:
Troubleshooting "No such file or directory" when running `php app/console doctrine:schema:create`
QUESTION:
I am new to Symfony2 (beta4) and Doctrine and am having issues when i try to create the DB schema via command line. Here's the error: $ php app/console doctrine:schema:create
Creating database schema...
... | [
"php",
"mysql",
"doctrine-orm",
"symfony"
] | 42 | 5 | 78,375 | 12 | 0 | 2011-06-07T00:08:38.163000 | 2011-06-07T16:27:47.590000 |
6,259,432 | 6,259,486 | Why does a newline character in textview cause the newline to be indented? | I try to show this in a textview when the newline (or the white space before the start of the next line) causes the new line to be indented by 1 blank space. Show basically this looks like - This is a test This is another line Why is this happening and how do I fix this? Any clues? | I think it has to do with the extra whitespace you are adding yourself in the characters. I would guess that Android is treating all of your extra whitespace as a single space (it may also be a function of the parser, I am not sure). I think you would rather do something like this to get what you are expecting. This is... | Why does a newline character in textview cause the newline to be indented? I try to show this in a textview when the newline (or the white space before the start of the next line) causes the new line to be indented by 1 blank space. Show basically this looks like - This is a test This is another line Why is this happen... | TITLE:
Why does a newline character in textview cause the newline to be indented?
QUESTION:
I try to show this in a textview when the newline (or the white space before the start of the next line) causes the new line to be indented by 1 blank space. Show basically this looks like - This is a test This is another line ... | [
"java",
"android",
"mobile",
"android-3.0-honeycomb"
] | 5 | 8 | 1,615 | 1 | 0 | 2011-06-07T00:09:55.587000 | 2011-06-07T00:20:29.203000 |
6,259,433 | 6,259,457 | How to connect with a database on Access inside a intranet | I have made connection with sql server but i have never done a connection with access and now this isn't in the computer local, if not it is going to be in a server users are going to full the form with their information, but the database will be in another computer, how is the connection class to be? and I have never ... | ConnectionStrings.com is a great resource for figuring out how to create a connection string for a variety of database engines. Here's one example of an Access connection string: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=; Once you generate a connection string, you'll notice ... | How to connect with a database on Access inside a intranet I have made connection with sql server but i have never done a connection with access and now this isn't in the computer local, if not it is going to be in a server users are going to full the form with their information, but the database will be in another com... | TITLE:
How to connect with a database on Access inside a intranet
QUESTION:
I have made connection with sql server but i have never done a connection with access and now this isn't in the computer local, if not it is going to be in a server users are going to full the form with their information, but the database will... | [
"c#",
"ms-access",
"connection",
"database-connection",
"connection-string"
] | 1 | 5 | 1,068 | 1 | 0 | 2011-06-07T00:10:45.023000 | 2011-06-07T00:14:36.763000 |
6,259,438 | 6,259,634 | Remove overlap from vectors of vectors | What basically I am doing is the set cover problem, removing duplicate from the vectors that has the same numbers. An example: I have the following vectors of vectors after sorting: {{1,2,3,4,5},{2,3,7,8},{10,11,12}} NOW, I would like to remove the occurrence from 2nd vector which is 2,3 and sort again... {{1,2,3,4,5},... | Pick this apart and take what you need: #include #include struct binary_search_pred { typedef bool result_type;
explicit binary_search_pred(std::vector const& v): v_(&v) { }
bool operator ()(int const& i) const { return std::binary_search(v_->begin(), v_->end(), i); }
private: std::vector const* v_; };
struct size_... | Remove overlap from vectors of vectors What basically I am doing is the set cover problem, removing duplicate from the vectors that has the same numbers. An example: I have the following vectors of vectors after sorting: {{1,2,3,4,5},{2,3,7,8},{10,11,12}} NOW, I would like to remove the occurrence from 2nd vector which... | TITLE:
Remove overlap from vectors of vectors
QUESTION:
What basically I am doing is the set cover problem, removing duplicate from the vectors that has the same numbers. An example: I have the following vectors of vectors after sorting: {{1,2,3,4,5},{2,3,7,8},{10,11,12}} NOW, I would like to remove the occurrence fro... | [
"c++",
"arrays",
"vector"
] | 0 | 1 | 530 | 2 | 0 | 2011-06-07T00:11:36.653000 | 2011-06-07T00:53:28.490000 |
6,259,442 | 6,259,453 | typecasting in php | I have an interface in PHP interface IDummy{ public function DoSomething(); } I have another class that implements this interface. class Dummy implements IDummy{ public function DoSomething(){
} How can I type cast the Dummy Object to IDummy in PHP, so that I can call it as $dum = new Dummy(); $instance = (IDummy)$dum... | The cast is completely unnecessary. It will simply work. And the Dummy objects will be considered an instance of IDummy if you ever check it with one of the various type hinting functions. This works... no casting needed: interface I { public function foo(); };
class A implements I { public function foo() { } }
funct... | typecasting in php I have an interface in PHP interface IDummy{ public function DoSomething(); } I have another class that implements this interface. class Dummy implements IDummy{ public function DoSomething(){
} How can I type cast the Dummy Object to IDummy in PHP, so that I can call it as $dum = new Dummy(); $inst... | TITLE:
typecasting in php
QUESTION:
I have an interface in PHP interface IDummy{ public function DoSomething(); } I have another class that implements this interface. class Dummy implements IDummy{ public function DoSomething(){
} How can I type cast the Dummy Object to IDummy in PHP, so that I can call it as $dum = ... | [
"php",
"oop"
] | 4 | 4 | 8,571 | 5 | 0 | 2011-06-07T00:11:50.773000 | 2011-06-07T00:13:44.827000 |
6,259,443 | 6,259,570 | How to match a line not containing a word | I was wondering how to match a line not containing a specific word using Python-style Regex (Just use Regex, not involve Python functions)? Example: PART ONE OVERVIEW 1 Chapter 1 Introduction 3 I want to match lines that do not contain the word "PART"? | This should work: /^((?!PART).)*$/ Edit (by request): How this works The (?!...) syntax is a negative lookahead, which I've always found tough to explain. Basically, it means "whatever follows this point must not match the regular expression /PART/." The site I've linked explains this far better than I can, but I'll tr... | How to match a line not containing a word I was wondering how to match a line not containing a specific word using Python-style Regex (Just use Regex, not involve Python functions)? Example: PART ONE OVERVIEW 1 Chapter 1 Introduction 3 I want to match lines that do not contain the word "PART"? | TITLE:
How to match a line not containing a word
QUESTION:
I was wondering how to match a line not containing a specific word using Python-style Regex (Just use Regex, not involve Python functions)? Example: PART ONE OVERVIEW 1 Chapter 1 Introduction 3 I want to match lines that do not contain the word "PART"?
ANSWER... | [
"regex"
] | 98 | 189 | 143,426 | 1 | 0 | 2011-06-07T00:11:55.837000 | 2011-06-07T00:37:32.837000 |
6,259,446 | 6,259,464 | XML over HTTP with GZIP - Bandwidth efficiency | In one of my applications, I need to download about 50,000 XML documents, most averaging around 5kb in size. I need to find the most efficient way bandwidth wise to transfer all of it over http, and the XML is gzipped. Which is the most efficient way to download it, using the least bandwidth. Downloading each XML file ... | If you are using HTTP, the primary factor for perceived connection speed is the number of TCP connections established. Serving it as one master file will help (for only one connection would be established). If the server, supports Accept-Ranges (in other words, the resumption of file downloads) feature, then you can us... | XML over HTTP with GZIP - Bandwidth efficiency In one of my applications, I need to download about 50,000 XML documents, most averaging around 5kb in size. I need to find the most efficient way bandwidth wise to transfer all of it over http, and the XML is gzipped. Which is the most efficient way to download it, using ... | TITLE:
XML over HTTP with GZIP - Bandwidth efficiency
QUESTION:
In one of my applications, I need to download about 50,000 XML documents, most averaging around 5kb in size. I need to find the most efficient way bandwidth wise to transfer all of it over http, and the XML is gzipped. Which is the most efficient way to d... | [
"xml",
"gzip",
"bandwidth"
] | 0 | 2 | 538 | 2 | 0 | 2011-06-07T00:12:35.273000 | 2011-06-07T00:16:44.617000 |
6,259,447 | 6,259,855 | SetVisibility not working with ImageButton | So I've been looking around in forums for how to do this, but nothing I have found has worked. When I call setVisibility() on my image button, the button is unaffected. Below is my code that is in the onCreate method, and both buttons are showing up when I run the application. However, if I were to hardcode the attribu... | Change your code to: super.onCreate(savedInstanceState); setContentView(R.layout.main); btn1 = (ImageButton)findViewById(R.id.btn1); btn1.setVisibility(View.GONE); btn2 = (ImageButton)findViewById(R.id.btn2); btn2.setVisibility(View.GONE); and modify your main.xml: | SetVisibility not working with ImageButton So I've been looking around in forums for how to do this, but nothing I have found has worked. When I call setVisibility() on my image button, the button is unaffected. Below is my code that is in the onCreate method, and both buttons are showing up when I run the application.... | TITLE:
SetVisibility not working with ImageButton
QUESTION:
So I've been looking around in forums for how to do this, but nothing I have found has worked. When I call setVisibility() on my image button, the button is unaffected. Below is my code that is in the onCreate method, and both buttons are showing up when I ru... | [
"android",
"visibility",
"imagebutton"
] | 2 | 5 | 9,495 | 2 | 0 | 2011-06-07T00:12:38.100000 | 2011-06-07T01:44:04.987000 |
6,259,466 | 6,259,676 | Do compilers optimize away calls to trivial functions made through pointers? | Say I have a function that takes a function pointer: int funct(double (*f)(double)); And I pass it a function that doesn't actually do anything: double g(double a) { return 1.0;} //... funct(g); Will the compiler optimize out the calls to g? Or will this still have overhead? If it does have overhead, how much? Enough t... | Newer versions of GCC (4.4 and later) can inline and optimize a known function pointer using the option -findirect-inlining. This only works when GCC also knows all of the code that uses the pointer. For example, the C library function qsort will not benefit from this optimization. The compiled machine code for qsort i... | Do compilers optimize away calls to trivial functions made through pointers? Say I have a function that takes a function pointer: int funct(double (*f)(double)); And I pass it a function that doesn't actually do anything: double g(double a) { return 1.0;} //... funct(g); Will the compiler optimize out the calls to g? O... | TITLE:
Do compilers optimize away calls to trivial functions made through pointers?
QUESTION:
Say I have a function that takes a function pointer: int funct(double (*f)(double)); And I pass it a function that doesn't actually do anything: double g(double a) { return 1.0;} //... funct(g); Will the compiler optimize out... | [
"c++",
"optimization",
"function-pointers"
] | 17 | 18 | 4,192 | 3 | 0 | 2011-06-07T00:17:21.390000 | 2011-06-07T01:03:40.760000 |
6,259,471 | 6,259,477 | Extracting JSON from cURL results | I'm new to regex and I'm trying to grab the JSON response from a cURL request in PHP. I was thinking of using preg_match_all. Edit: Should have mentioned the full response from curl_exec() includes header information which is why I need to extract the JSON. HTTP/1.1 401 Unauthorized Server: Apache-Coyote/1.1 WWW-Authen... | Regex is great, but definitely not the correct tool for this. There is a function json_decode() that can handle this for you. It will return the structure as an object. You can return it as an array by setting the second argument to TRUE. Even if PHP didn't have this function, you are better off writing or using an exi... | Extracting JSON from cURL results I'm new to regex and I'm trying to grab the JSON response from a cURL request in PHP. I was thinking of using preg_match_all. Edit: Should have mentioned the full response from curl_exec() includes header information which is why I need to extract the JSON. HTTP/1.1 401 Unauthorized Se... | TITLE:
Extracting JSON from cURL results
QUESTION:
I'm new to regex and I'm trying to grab the JSON response from a cURL request in PHP. I was thinking of using preg_match_all. Edit: Should have mentioned the full response from curl_exec() includes header information which is why I need to extract the JSON. HTTP/1.1 4... | [
"php",
"regex",
"json",
"curl",
"preg-replace"
] | 4 | 13 | 8,180 | 2 | 0 | 2011-06-07T00:17:56.223000 | 2011-06-07T00:19:00.053000 |
6,259,489 | 6,259,602 | How do I add a header to urllib2 opener? | cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) opener.open('http://abc.com') opener.open('http://google.com') As you can see, I use opener to visit different websites, using a cookie jar. Can I set a header so that each time a website is it, the header is applied? | You can add the headers directly to the OpenerDirector object returned by build_opener. From the last example in the urllib2 docs: OpenerDirector automatically adds a User-Agent header to every Request. To change this: import urllib2 opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] op... | How do I add a header to urllib2 opener? cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) opener.open('http://abc.com') opener.open('http://google.com') As you can see, I use opener to visit different websites, using a cookie jar. Can I set a header so that each time a website i... | TITLE:
How do I add a header to urllib2 opener?
QUESTION:
cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) opener.open('http://abc.com') opener.open('http://google.com') As you can see, I use opener to visit different websites, using a cookie jar. Can I set a header so that eac... | [
"python",
"http",
"header",
"urllib2"
] | 33 | 62 | 57,399 | 2 | 0 | 2011-06-07T00:20:58.220000 | 2011-06-07T00:43:40.473000 |
6,259,491 | 6,298,974 | Change Management in e-commerce system | So, I have an e-commerce site. This site has items, which in turn have attachments, pricing, and a order form etc. I'm looking for approaches to handle changes in pricing, forms etc. If a pricing structure changes, it's reflected for new orders no problems, but how do I keep the order history intact? E.g pricing option... | When the pricing is updated, the original values should be appended to a price history table that shows the price, the date range during which it was valid, and a Foreign Key to the item. This is a normalized approach; it doesn't involve copying data. It may take a little extra design/coding up front, but consider it a... | Change Management in e-commerce system So, I have an e-commerce site. This site has items, which in turn have attachments, pricing, and a order form etc. I'm looking for approaches to handle changes in pricing, forms etc. If a pricing structure changes, it's reflected for new orders no problems, but how do I keep the o... | TITLE:
Change Management in e-commerce system
QUESTION:
So, I have an e-commerce site. This site has items, which in turn have attachments, pricing, and a order form etc. I'm looking for approaches to handle changes in pricing, forms etc. If a pricing structure changes, it's reflected for new orders no problems, but h... | [
"database",
"e-commerce"
] | 0 | 1 | 458 | 1 | 0 | 2011-06-07T00:21:05.210000 | 2011-06-09T20:41:36.533000 |
6,259,495 | 6,259,702 | What are some of the barriers client-server developers face to understand Web applications/development? | Would you guys mind to shed some light about what are the difficulties that a client-server programmer faces (has to overcome) to be able to understand (and be able to move to) web application programming? Think someone that has been writing windows forms client-server database applications for at least 10 years. | The nature of HTTP is such that a server won't just sit there and wait for a client's response. It can't. (ASP.net acts like it can, but that's an illusion/abstraction provided by the framework. Evidence: If IsPostBack.) Each HTTP request is separate from every other, so you must include enough information with each re... | What are some of the barriers client-server developers face to understand Web applications/development? Would you guys mind to shed some light about what are the difficulties that a client-server programmer faces (has to overcome) to be able to understand (and be able to move to) web application programming? Think some... | TITLE:
What are some of the barriers client-server developers face to understand Web applications/development?
QUESTION:
Would you guys mind to shed some light about what are the difficulties that a client-server programmer faces (has to overcome) to be able to understand (and be able to move to) web application progr... | [
"web-applications",
"client-server",
"barrier"
] | 1 | 0 | 112 | 1 | 0 | 2011-06-07T00:21:43.420000 | 2011-06-07T01:08:24.407000 |
6,259,497 | 6,259,530 | Getting the min() of a count(*) column | I have a table called Vehicle_Location containing the columns (and more): ID NUMBER(10) SEQUENCE_NUMBER NUMBER(10) TIME DATE and I'm trying to get the min/max/avg number of records per day per id. So far, I have select id, to_char(time), count(*) as c from vehicle_location group by id, to_char(time), min having id = 16... | I don't have an oracle station to test on but you should be able to just wrap the aggregator around your SELECT as a subquery/derived table/inline view So it would be (UNTESTED!!) SELECT AVG(s.c), MIN(s.c), MAX(s.c), s.ID FROM --Note this is just your query (select id, to_char(time), count(*) as c from vehicle_location... | Getting the min() of a count(*) column I have a table called Vehicle_Location containing the columns (and more): ID NUMBER(10) SEQUENCE_NUMBER NUMBER(10) TIME DATE and I'm trying to get the min/max/avg number of records per day per id. So far, I have select id, to_char(time), count(*) as c from vehicle_location group b... | TITLE:
Getting the min() of a count(*) column
QUESTION:
I have a table called Vehicle_Location containing the columns (and more): ID NUMBER(10) SEQUENCE_NUMBER NUMBER(10) TIME DATE and I'm trying to get the min/max/avg number of records per day per id. So far, I have select id, to_char(time), count(*) as c from vehicl... | [
"sql",
"oracle"
] | 4 | 9 | 5,964 | 1 | 0 | 2011-06-07T00:21:52.887000 | 2011-06-07T00:28:14.390000 |
6,259,500 | 6,261,208 | How to Input Text From User Input File for Parsing - Java | I have been learning Java for a few months now, and I am faced with a problem that I need some help on. I have a user input file that has many entries in the form: >Item1 Description DILDEQCLKGACQGTSVVIHTA >Item2 Description DILDEQCLKGACQGTSVVIHTASVIDVRNAV >Item3 Description AEKAGTS >Item4 Description RNAVPRHESAW There... | Don't reinvent the wheel! Apache commons libraries have many common programming problems solved for you. Here's two classes that you can use for your problem: List lines = org.apache.commons.FileUtils.readLines(file); which does all the I/O work for you and reads the lines of the file in as a List. Then you can use ano... | How to Input Text From User Input File for Parsing - Java I have been learning Java for a few months now, and I am faced with a problem that I need some help on. I have a user input file that has many entries in the form: >Item1 Description DILDEQCLKGACQGTSVVIHTA >Item2 Description DILDEQCLKGACQGTSVVIHTASVIDVRNAV >Item... | TITLE:
How to Input Text From User Input File for Parsing - Java
QUESTION:
I have been learning Java for a few months now, and I am faced with a problem that I need some help on. I have a user input file that has many entries in the form: >Item1 Description DILDEQCLKGACQGTSVVIHTA >Item2 Description DILDEQCLKGACQGTSVVI... | [
"string",
"user-input",
"text-parsing"
] | 0 | 1 | 337 | 1 | 0 | 2011-06-07T00:23:14.297000 | 2011-06-07T06:10:38.277000 |
6,259,503 | 6,259,518 | Mysql rename JPG to jpg | I'm switching from a windows server to a linux server and case sensitivity is a bit of a problem in the database. For most fields I've just been able to use the following command: UPDATE images_T SET image_path = LOWER(image_path) However for one of the fields I need to change just the JPG part to jpg and keep all othe... | UPDATE images_T SET image_path = REPLACE(image_path, '.JPG', '.jpg') With LEFT+Right (works with any extension): UPDATE images_T SET image_path = CONCAT( LEFT(image_path, length(image_path - 3)), lower(RIGHT(image_path, 3)) ) | Mysql rename JPG to jpg I'm switching from a windows server to a linux server and case sensitivity is a bit of a problem in the database. For most fields I've just been able to use the following command: UPDATE images_T SET image_path = LOWER(image_path) However for one of the fields I need to change just the JPG part ... | TITLE:
Mysql rename JPG to jpg
QUESTION:
I'm switching from a windows server to a linux server and case sensitivity is a bit of a problem in the database. For most fields I've just been able to use the following command: UPDATE images_T SET image_path = LOWER(image_path) However for one of the fields I need to change ... | [
"mysql"
] | 1 | 4 | 131 | 3 | 0 | 2011-06-07T00:23:39.210000 | 2011-06-07T00:26:18.303000 |
6,259,505 | 6,259,650 | ModalViewCOntroller in NavigationController | I have a NavigationController that present a view (ShoppingController) with a button which one I call a ModalViewController: AddProductController *maView = [[AddProductController alloc] init]; maView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:maView animated:YES]; When... | You could use the delegate pattern. In your AddProductController class, when handling the button tap, you can then send a message to its delegate, which you set as your ShoppingController. So, in AddProductController: -(void)buttonHandler:(id)sender { // after doing some stuff and handling the button tap, i check to se... | ModalViewCOntroller in NavigationController I have a NavigationController that present a view (ShoppingController) with a button which one I call a ModalViewController: AddProductController *maView = [[AddProductController alloc] init]; maView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentMo... | TITLE:
ModalViewCOntroller in NavigationController
QUESTION:
I have a NavigationController that present a view (ShoppingController) with a button which one I call a ModalViewController: AddProductController *maView = [[AddProductController alloc] init]; maView.modalTransitionStyle = UIModalTransitionStyleFlipHorizonta... | [
"ios",
"objective-c",
"iphone",
"uinavigationcontroller",
"modalviewcontroller"
] | 0 | 1 | 336 | 1 | 0 | 2011-06-07T00:24:38.017000 | 2011-06-07T00:57:49.943000 |
6,259,507 | 6,259,584 | C# :how to have message box within an event handler that freezes the application until Ok is pressed? | Hi I have this in the main NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(AddressChangedCallback); //The main also contains a form and this method below it. static void AddressChangedCallback(object sender, EventArgs e){ // would like to have a message box here that freezes the entire appl... | I'm assuming this is a WinForms application. NetworkAddressChanged event is invoked on a background thread. This is why when you display a message box from there your app stays active. Solution 1: You need to marshal this call to your main UI thread. You can do this by using Invoke method on your main form. Define a me... | C# :how to have message box within an event handler that freezes the application until Ok is pressed? Hi I have this in the main NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(AddressChangedCallback); //The main also contains a form and this method below it. static void AddressChangedCallb... | TITLE:
C# :how to have message box within an event handler that freezes the application until Ok is pressed?
QUESTION:
Hi I have this in the main NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(AddressChangedCallback); //The main also contains a form and this method below it. static void A... | [
"c#",
".net",
"showdialog"
] | 1 | 4 | 1,655 | 2 | 0 | 2011-06-07T00:24:57.177000 | 2011-06-07T00:40:18.147000 |
6,259,509 | 6,284,629 | error attempting to use NPOI to fill excel template | Using NPOI and attempting to follow a tutorial here: http://www.zachhunter.com/2010/05/npoi-excel-template/, I'm coming across an "Object reference not set to an instance of an object" error at this line: sheet.GetRow(1).GetCell(1).SetCellValue("some test value") when trying to use this code: Imports System.IO Imports ... | In your examples, the first uses sheet.GetRow(1) that grabs an existing row in a worksheet. The second uses sheet1.CreateRow(1), which creates a new row in a worksheet. Rows that have never been used/initialized don't exist and can't be accessed until they are created using CreateRow. To prove this, you can make a work... | error attempting to use NPOI to fill excel template Using NPOI and attempting to follow a tutorial here: http://www.zachhunter.com/2010/05/npoi-excel-template/, I'm coming across an "Object reference not set to an instance of an object" error at this line: sheet.GetRow(1).GetCell(1).SetCellValue("some test value") when... | TITLE:
error attempting to use NPOI to fill excel template
QUESTION:
Using NPOI and attempting to follow a tutorial here: http://www.zachhunter.com/2010/05/npoi-excel-template/, I'm coming across an "Object reference not set to an instance of an object" error at this line: sheet.GetRow(1).GetCell(1).SetCellValue("some... | [
"asp.net",
"vb.net",
"excel",
"npoi"
] | 1 | 3 | 6,267 | 1 | 0 | 2011-06-07T00:25:04.117000 | 2011-06-08T20:10:25.473000 |
6,259,515 | 6,259,543 | How can I split a string into segments of n characters? | As the title says, I've got a string and I want to split into segments of n characters. For example: var str = 'abcdefghijkl'; after some magic with n=3, it will become var arr = ['abc','def','ghi','jkl']; Is there a way to do this? | var str = 'abcdefghijkl';
console.log(str.match(/.{1,3}/g)); Note: Use {1,3} instead of just {3} to include the remainder for string lengths that aren't a multiple of 3, e.g: console.log("abcd".match(/.{1,3}/g)); // ["abc", "d"] A couple more subtleties: If your string may contain newlines ( which you want to count as... | How can I split a string into segments of n characters? As the title says, I've got a string and I want to split into segments of n characters. For example: var str = 'abcdefghijkl'; after some magic with n=3, it will become var arr = ['abc','def','ghi','jkl']; Is there a way to do this? | TITLE:
How can I split a string into segments of n characters?
QUESTION:
As the title says, I've got a string and I want to split into segments of n characters. For example: var str = 'abcdefghijkl'; after some magic with n=3, it will become var arr = ['abc','def','ghi','jkl']; Is there a way to do this?
ANSWER:
var ... | [
"javascript",
"arrays",
"string",
"split"
] | 316 | 551 | 290,408 | 19 | 0 | 2011-06-07T00:25:55.350000 | 2011-06-07T00:30:54.340000 |
6,259,520 | 6,259,734 | Changing user email address | I would like to allow a user to change his email address. A user would change his email address, then a confirmation email with a link would be sent to that address, after the user clicked the link it would change his email address in the database. I know there django-generic-confirmation deals with confirmations like ... | This is pretty simple. What you want to do is write an app with at least a model that looks like this; class EmailChangeAuth(models.Model): auth_key = models.CharField(max_length=42) user = models.ForeignKey(User) new_email = models.CharField(max_length=256) Fill in the auth_key with a UUID4 and you can treat it like y... | Changing user email address I would like to allow a user to change his email address. A user would change his email address, then a confirmation email with a link would be sent to that address, after the user clicked the link it would change his email address in the database. I know there django-generic-confirmation de... | TITLE:
Changing user email address
QUESTION:
I would like to allow a user to change his email address. A user would change his email address, then a confirmation email with a link would be sent to that address, after the user clicked the link it would change his email address in the database. I know there django-gener... | [
"django",
"email",
"email-validation"
] | 6 | 7 | 3,822 | 2 | 0 | 2011-06-07T00:26:38.123000 | 2011-06-07T01:14:58.890000 |
6,259,521 | 6,259,532 | Best script to modify file contents on server | Problem: I have web server that was recently compromised. They targeted javascript files. They inserted the following snippet document.write(' ') this was added to the top of every single.js file on the server. Solution: Write a script to open every javascript file on my server that checks for malicious code, removes m... | What programming language should the script be written in? Hardly matters. Will python work? Yes. If I run a python script under root will I have to worry about accidentally changing the owner permissions of the modified files? No. Not "accidentally". You could change them if you did a really bad job coding. import os ... | Best script to modify file contents on server Problem: I have web server that was recently compromised. They targeted javascript files. They inserted the following snippet document.write(' ') this was added to the top of every single.js file on the server. Solution: Write a script to open every javascript file on my se... | TITLE:
Best script to modify file contents on server
QUESTION:
Problem: I have web server that was recently compromised. They targeted javascript files. They inserted the following snippet document.write(' ') this was added to the top of every single.js file on the server. Solution: Write a script to open every javasc... | [
"python",
"perl",
"bash",
"scripting",
"sed"
] | 2 | 4 | 2,074 | 4 | 0 | 2011-06-07T00:26:51.587000 | 2011-06-07T00:29:19.723000 |
6,259,523 | 6,259,544 | implode the array by AND in between | I have this $myarr = Array( 0 => "Person.id = PL.id AND AIG.id = PL.key," 1 => "start_date BETWEEN '$startDate' AND '$endDate'", 2 => "J = 78349", 3 => "text is not null;" ) I want to implode this array with an AND like implode("AND", $myarr) But it doesnt but AND between the 4 elements of array. How would I put an AND... | $string = implode(" AND ",$myarr); that should work fine. It will write the output to $string. | implode the array by AND in between I have this $myarr = Array( 0 => "Person.id = PL.id AND AIG.id = PL.key," 1 => "start_date BETWEEN '$startDate' AND '$endDate'", 2 => "J = 78349", 3 => "text is not null;" ) I want to implode this array with an AND like implode("AND", $myarr) But it doesnt but AND between the 4 eleme... | TITLE:
implode the array by AND in between
QUESTION:
I have this $myarr = Array( 0 => "Person.id = PL.id AND AIG.id = PL.key," 1 => "start_date BETWEEN '$startDate' AND '$endDate'", 2 => "J = 78349", 3 => "text is not null;" ) I want to implode this array with an AND like implode("AND", $myarr) But it doesnt but AND b... | [
"php"
] | 1 | 4 | 79 | 1 | 0 | 2011-06-07T00:27:01.380000 | 2011-06-07T00:31:10.183000 |
6,259,538 | 6,259,852 | Socket closing with error | I'm writing a bunch of data to a socket, however, after what seems like around 64k is written the socket is closed with an error "Connection reset by peer". I believe what is happening is that what is reading the socket (Android media player) is dying when trying to read more data than is available from the socket. Thi... | This usually means you have written to a connection that has already been closed by the other end. In other words, an application protocol error. The 64k probably just represents the amount of buffering between you and the peer. Your question about writing to the socket before accept() doesn't make sense if it refers t... | Socket closing with error I'm writing a bunch of data to a socket, however, after what seems like around 64k is written the socket is closed with an error "Connection reset by peer". I believe what is happening is that what is reading the socket (Android media player) is dying when trying to read more data than is avai... | TITLE:
Socket closing with error
QUESTION:
I'm writing a bunch of data to a socket, however, after what seems like around 64k is written the socket is closed with an error "Connection reset by peer". I believe what is happening is that what is reading the socket (Android media player) is dying when trying to read more... | [
"java",
"android",
"sockets"
] | 1 | 1 | 1,659 | 1 | 0 | 2011-06-07T00:30:22.420000 | 2011-06-07T01:43:50.613000 |
6,259,548 | 6,259,678 | Is any way in fluent NH to map Views? | Is any way in fluent NH to map [View]s to c# classes? I need to have them read-only. | NHibernate allows you to map views as you would a table. It's exactly the same. The only thing you can't do is update it. | Is any way in fluent NH to map Views? Is any way in fluent NH to map [View]s to c# classes? I need to have them read-only. | TITLE:
Is any way in fluent NH to map Views?
QUESTION:
Is any way in fluent NH to map [View]s to c# classes? I need to have them read-only.
ANSWER:
NHibernate allows you to map views as you would a table. It's exactly the same. The only thing you can't do is update it. | [
"nhibernate",
"fluent-nhibernate",
"nhibernate-mapping"
] | 1 | 6 | 681 | 3 | 0 | 2011-06-07T00:32:03.290000 | 2011-06-07T01:04:18.300000 |
6,259,550 | 6,259,896 | How do I enable my innodb | I need to enable innodb on my ubuntu server 10.04 and having tons of problems, I have tried posting questions everywhere and I have no answers....i tried this show variables like "%innodb%"; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | have_innodb | NO | | ignore_built... | Solved the issue enabling the following two InnoDB directives in your "/etc/mysql/my.cnf" file appears to have resolved this issue: default-storage-engine=innodb default-table-type=innodb When restarting your MySQL server, there appears to have been some lingering processes so the "mysqld.sock" file wasn't being create... | How do I enable my innodb I need to enable innodb on my ubuntu server 10.04 and having tons of problems, I have tried posting questions everywhere and I have no answers....i tried this show variables like "%innodb%"; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | have_in... | TITLE:
How do I enable my innodb
QUESTION:
I need to enable innodb on my ubuntu server 10.04 and having tons of problems, I have tried posting questions everywhere and I have no answers....i tried this show variables like "%innodb%"; +-----------------------+-------+ | Variable_name | Value | +-----------------------+... | [
"mysql",
"innodb"
] | 1 | 0 | 10,842 | 1 | 0 | 2011-06-07T00:33:07.997000 | 2011-06-07T01:54:41.173000 |
6,259,557 | 6,259,595 | mq_notify only starts one thread | I am trying to use the mq_notify call to initiate a thread with POSIX message queues. Everything seems right but I only get one thread and it process all messages but it never terminates. I was under the impression I would get new threads to process with and this doesn't seem right. | First, mq_notify() will only start one thread at a time. Second, threads are not started each time a message is put in the queue; they are only started when a queue that has been empty gets a new message. Third, mq_notify() is a one-shot deal. Once a thread is fired off, if you want to fire a new one the next time an e... | mq_notify only starts one thread I am trying to use the mq_notify call to initiate a thread with POSIX message queues. Everything seems right but I only get one thread and it process all messages but it never terminates. I was under the impression I would get new threads to process with and this doesn't seem right. | TITLE:
mq_notify only starts one thread
QUESTION:
I am trying to use the mq_notify call to initiate a thread with POSIX message queues. Everything seems right but I only get one thread and it process all messages but it never terminates. I was under the impression I would get new threads to process with and this doesn... | [
"c++",
"c",
"linux",
"posix",
"message-queue"
] | 3 | 4 | 815 | 1 | 0 | 2011-06-07T00:34:35.260000 | 2011-06-07T00:42:06.243000 |
6,259,563 | 6,259,631 | How do I create a drawable for my custom separator? | I'm trying to create a separator line in my android view. The setup I want is for the drawable to be 2px tall and width set to fill_parent, with the bottom 1px being a white line and the top 1px being a black line with an alpha component. It seems like this should be possible with layer-list using an offset, but, as th... | What about using a ShapeDrawable? You can define it in XML and use as you would a png. | How do I create a drawable for my custom separator? I'm trying to create a separator line in my android view. The setup I want is for the drawable to be 2px tall and width set to fill_parent, with the bottom 1px being a white line and the top 1px being a black line with an alpha component. It seems like this should be ... | TITLE:
How do I create a drawable for my custom separator?
QUESTION:
I'm trying to create a separator line in my android view. The setup I want is for the drawable to be 2px tall and width set to fill_parent, with the bottom 1px being a white line and the top 1px being a black line with an alpha component. It seems li... | [
"android"
] | 1 | 2 | 316 | 1 | 0 | 2011-06-07T00:35:49.520000 | 2011-06-07T00:51:45.330000 |
6,259,565 | 6,259,590 | MySQL: Looking up list of id's for many to many relationship | I have three tables: keywords, queries, and keywords_queries. keywords_queries has two columns; one linking to a keywords id and the other linking to a queries id. If I have the id of the query and a list of keywords that I want to link it to, what is the most efficient way to look up the id's of the keywords I have an... | INSERT INTO keywords_queries SELECT query.id, keyword.id FROM keywords, queries WHERE keywords.id in (???) AND queries.id =? | MySQL: Looking up list of id's for many to many relationship I have three tables: keywords, queries, and keywords_queries. keywords_queries has two columns; one linking to a keywords id and the other linking to a queries id. If I have the id of the query and a list of keywords that I want to link it to, what is the mos... | TITLE:
MySQL: Looking up list of id's for many to many relationship
QUESTION:
I have three tables: keywords, queries, and keywords_queries. keywords_queries has two columns; one linking to a keywords id and the other linking to a queries id. If I have the id of the query and a list of keywords that I want to link it t... | [
"mysql",
"many-to-many"
] | 0 | 1 | 166 | 2 | 0 | 2011-06-07T00:36:51.470000 | 2011-06-07T00:40:51.047000 |
6,259,573 | 6,270,575 | How do I access JAR classes from within my Clojure program? | I've been stuck for several days on something that I know I've gotten to work once before. I'm probably missing something obvious. Any help would be appreciated. In my Clojure program, I want to access methods from classes originally written in Java. Let's use a specific example: org.infoml.jaxb.ObjectFactory. These cl... | The way you import the classes is fine. Obviously the ObjectFactory class cannot be initialised because some other class it needs is not on the classpath. Lookup at the full stacktrace to find out which class is missing for ObjectFactory to work. As @mikera suggested, you can use (import 'org.infoml.jaxb.ObjectFactory)... | How do I access JAR classes from within my Clojure program? I've been stuck for several days on something that I know I've gotten to work once before. I'm probably missing something obvious. Any help would be appreciated. In my Clojure program, I want to access methods from classes originally written in Java. Let's use... | TITLE:
How do I access JAR classes from within my Clojure program?
QUESTION:
I've been stuck for several days on something that I know I've gotten to work once before. I'm probably missing something obvious. Any help would be appreciated. In my Clojure program, I want to access methods from classes originally written ... | [
"java",
"clojure",
"compilation",
"noclassdeffounderror"
] | 5 | 1 | 5,240 | 3 | 0 | 2011-06-07T00:37:59.870000 | 2011-06-07T19:31:44.453000 |
6,259,599 | 6,261,032 | SSL error in SugarCRM in localhost | I did install SugarCRM professional on one of the public IP address and configured that which works smoothly in this following link http://66.240.55.100/fs I tried to copy the files and database as it is to my local system which could be accessed like this link http://localhost/fs/index.php When I add the exception and... | Change the settings on.htaccess file. Like redirecting to other files and/or https URL. It should fix the issue. | SSL error in SugarCRM in localhost I did install SugarCRM professional on one of the public IP address and configured that which works smoothly in this following link http://66.240.55.100/fs I tried to copy the files and database as it is to my local system which could be accessed like this link http://localhost/fs/ind... | TITLE:
SSL error in SugarCRM in localhost
QUESTION:
I did install SugarCRM professional on one of the public IP address and configured that which works smoothly in this following link http://66.240.55.100/fs I tried to copy the files and database as it is to my local system which could be accessed like this link http:... | [
"php",
"ssl",
"sugarcrm"
] | 1 | 0 | 801 | 1 | 0 | 2011-06-07T00:43:23.160000 | 2011-06-07T05:43:07.930000 |
6,259,600 | 6,259,642 | What might solve OpenID's security problems | The problem I have with OpenID is how anyone can put up a form that looks like yahoo/google's form and direct users there and steel the passwords. This affects me as a user (though I can be careful about it), but it affects OpenID providers. What can be done to prevent this? Other than educating the users to look at th... | This problem is called Trusted Path and there are few good solutions to it. Ka-Ping Yee's thesis, linked in that wikipedia article includes a good treatment of it though. | What might solve OpenID's security problems The problem I have with OpenID is how anyone can put up a form that looks like yahoo/google's form and direct users there and steel the passwords. This affects me as a user (though I can be careful about it), but it affects OpenID providers. What can be done to prevent this? ... | TITLE:
What might solve OpenID's security problems
QUESTION:
The problem I have with OpenID is how anyone can put up a form that looks like yahoo/google's form and direct users there and steel the passwords. This affects me as a user (though I can be careful about it), but it affects OpenID providers. What can be done... | [
"security",
"web-applications",
"authentication",
"openid"
] | 1 | 4 | 168 | 4 | 0 | 2011-06-07T00:43:34.683000 | 2011-06-07T00:54:19.903000 |
6,259,605 | 6,259,633 | Testing which interfaces a class/interface implements? | I want to test which interfaces a class/interface is implementing. So I have a basic interface Adapter and some interfaces base on it (e.g. PermissionsAdapter ). Now I get a variable typed as Adapter and now I want to get every interface based on Adapter that this variable is implementing. A simple implementation: impo... | Your test A.class.isInstance(clazz) is wrong. It tests whether the interface's class object is of your A type, which it isn't (it is of type Class, Object, Serializable, AnnotatedElement, GenericDeclaration and Type (in 1.6), nothing more). You want Class.isAssignableFrom, I think. (But read the documentation.) Also, y... | Testing which interfaces a class/interface implements? I want to test which interfaces a class/interface is implementing. So I have a basic interface Adapter and some interfaces base on it (e.g. PermissionsAdapter ). Now I get a variable typed as Adapter and now I want to get every interface based on Adapter that this ... | TITLE:
Testing which interfaces a class/interface implements?
QUESTION:
I want to test which interfaces a class/interface is implementing. So I have a basic interface Adapter and some interfaces base on it (e.g. PermissionsAdapter ). Now I get a variable typed as Adapter and now I want to get every interface based on ... | [
"java"
] | 2 | 3 | 279 | 1 | 0 | 2011-06-07T00:44:37.777000 | 2011-06-07T00:53:10.013000 |
6,259,621 | 6,259,733 | What device information can be accessed in android | I working on an android app which can benefit from device information. Like make, model, API level, resolution, size, installed apps, memory, etc. Can you direct me to a link which might be useful to learn what all is available and how to access it? | Take a look at this It holds various informations regarding the cellphone (or tablet). You might also need some information that can only be accessed with the proper permissions, so take a look at this other. Both links are from android's developers site | What device information can be accessed in android I working on an android app which can benefit from device information. Like make, model, API level, resolution, size, installed apps, memory, etc. Can you direct me to a link which might be useful to learn what all is available and how to access it? | TITLE:
What device information can be accessed in android
QUESTION:
I working on an android app which can benefit from device information. Like make, model, API level, resolution, size, installed apps, memory, etc. Can you direct me to a link which might be useful to learn what all is available and how to access it?
... | [
"java",
"android",
"device"
] | 3 | 4 | 1,790 | 1 | 0 | 2011-06-07T00:49:16.970000 | 2011-06-07T01:14:54.020000 |
6,259,622 | 6,260,123 | Dragging/selecting inside SVG in Firefox | I am making a web-application which uses an inline SVG as its basic UI element. Some of the UI actions include selecting the text in the SVG, and dragging across the SVG. This works in Webkit and Presto, but Gecko refuses to cooperate. When I try to drag across the SVG in Firefox, it initiates a drag action with the wh... | This behaviour is described in the following bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=525591 You can fix this by calling preventDefault() on the event. This really needs to go in an FAQ somewhere. | Dragging/selecting inside SVG in Firefox I am making a web-application which uses an inline SVG as its basic UI element. Some of the UI actions include selecting the text in the SVG, and dragging across the SVG. This works in Webkit and Presto, but Gecko refuses to cooperate. When I try to drag across the SVG in Firefo... | TITLE:
Dragging/selecting inside SVG in Firefox
QUESTION:
I am making a web-application which uses an inline SVG as its basic UI element. Some of the UI actions include selecting the text in the SVG, and dragging across the SVG. This works in Webkit and Presto, but Gecko refuses to cooperate. When I try to drag across... | [
"firefox",
"xhtml",
"svg"
] | 1 | 2 | 1,629 | 1 | 0 | 2011-06-07T00:49:25.973000 | 2011-06-07T02:36:28.303000 |
6,259,623 | 6,259,637 | Why is '362' > 378? | Possible Duplicate: How does Python compare string and int? An intern was just asking me to help debug code that looked something like this: widths = [image.width for image in images] widths.append(374) width = max(widths)...when the first line should have been: widths = [int(image.width) for image in images] Thus, the... | Python 2.x compares every built-in type to every other. From the docs: Objects of different types, except different numeric types and different string types, never compare equal; such objects are ordered consistently but arbitrarily (so that sorting a heterogeneous array yields a consistent result). This "arbitrary ord... | Why is '362' > 378? Possible Duplicate: How does Python compare string and int? An intern was just asking me to help debug code that looked something like this: widths = [image.width for image in images] widths.append(374) width = max(widths)...when the first line should have been: widths = [int(image.width) for image ... | TITLE:
Why is '362' > 378?
QUESTION:
Possible Duplicate: How does Python compare string and int? An intern was just asking me to help debug code that looked something like this: widths = [image.width for image in images] widths.append(374) width = max(widths)...when the first line should have been: widths = [int(image... | [
"python",
"string",
"comparison",
"integer"
] | 4 | 11 | 484 | 3 | 0 | 2011-06-07T00:49:38.567000 | 2011-06-07T00:53:53.567000 |
6,259,632 | 6,259,804 | How to determine the display object hierarchy an event will capture/bubble through? | In Actionscript 3 is there any way to determine the precise display object hierarchy an event will traverse through when dispatched from a given object? The object is not necessarily a display object. Although I could imagine this actually being useful somehow, in my particular case it is a learning exercise. I'm tryin... | The answer is sort of. Events aren't limited to DisplayObjects, and when they are triggered by DisplayObjects, they don't always follow the same pattern -- the Event may very based on what type of DisplayObject and whether the event was triggered programmatically (through dispatchEvent) or natively (by a mouseClick). I... | How to determine the display object hierarchy an event will capture/bubble through? In Actionscript 3 is there any way to determine the precise display object hierarchy an event will traverse through when dispatched from a given object? The object is not necessarily a display object. Although I could imagine this actua... | TITLE:
How to determine the display object hierarchy an event will capture/bubble through?
QUESTION:
In Actionscript 3 is there any way to determine the precise display object hierarchy an event will traverse through when dispatched from a given object? The object is not necessarily a display object. Although I could ... | [
"flash",
"apache-flex",
"actionscript-3",
"events"
] | 0 | 1 | 645 | 2 | 0 | 2011-06-07T00:52:29.433000 | 2011-06-07T01:31:39.033000 |
6,259,635 | 6,259,658 | Select or leave a field blank dependent on a condition without affecting query | I would like to select a field but only under specific circumstance, otherwise i would like it to just be blank or null. Example Select a.Name, c.Hat as FancyHat, b.Shirt, b.Shoes, c.Hat
from directory a, store b, superHatStore c
where a.key = b.key a.key = c.key now I would only want to display a FancyHat name if it... | For MS-Access you can use either the IIF statement http://www.techonthenet.com/access/functions/advanced/iif.php or the CASE statement (if you're using VBA) http://www.techonthenet.com/access/functions/advanced/case.php EDIT: So if I'm reading correctly you want (UNTESTED!): Select a.Name, iif (c.[type] = "fancy_hat", ... | Select or leave a field blank dependent on a condition without affecting query I would like to select a field but only under specific circumstance, otherwise i would like it to just be blank or null. Example Select a.Name, c.Hat as FancyHat, b.Shirt, b.Shoes, c.Hat
from directory a, store b, superHatStore c
where a.k... | TITLE:
Select or leave a field blank dependent on a condition without affecting query
QUESTION:
I would like to select a field but only under specific circumstance, otherwise i would like it to just be blank or null. Example Select a.Name, c.Hat as FancyHat, b.Shirt, b.Shoes, c.Hat
from directory a, store b, superHat... | [
"sql",
"ms-access"
] | 1 | 1 | 1,147 | 1 | 0 | 2011-06-07T00:53:29.237000 | 2011-06-07T00:59:58.920000 |
6,259,636 | 6,259,900 | Making a link from a string | I am using Ruby on Rails 3 and I would like to extract from a string the first URL or e-mail address and then use the resulting string (examples: " http://www.test.com ", " mailto:test@test.com ",...) as the href attribute value used in a HTML Test link name. How can I do that in the safest way? P.S.: I know the RoR au... | Ok, you probably didn't want a regular expression, but it works, and you might use it as a helper The code for urls: str = "http://someurl.com/" str.scan(/http:\/\/([^\/]*)/) The code for emails: str = "mailto:someemail@email.com" str.scan(/mailto:([^ ]*)/) Putting it all together: result_array = str.scan(/mailto:([^ ]... | Making a link from a string I am using Ruby on Rails 3 and I would like to extract from a string the first URL or e-mail address and then use the resulting string (examples: " http://www.test.com ", " mailto:test@test.com ",...) as the href attribute value used in a HTML Test link name. How can I do that in the safest ... | TITLE:
Making a link from a string
QUESTION:
I am using Ruby on Rails 3 and I would like to extract from a string the first URL or e-mail address and then use the resulting string (examples: " http://www.test.com ", " mailto:test@test.com ",...) as the href attribute value used in a HTML Test link name. How can I do t... | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3",
"email",
"url"
] | 1 | 0 | 395 | 3 | 0 | 2011-06-07T00:53:29.257000 | 2011-06-07T01:55:00.053000 |
6,259,639 | 6,259,657 | Properties Component | What is the component that allows me to create a custom properties form? I mean, a component like this: I'm trying to make an editor, so I need that component. | This is done via quite a few things. If you're working with the PropertyGrid, I recommend reading: Getting the Most Out of the.NET Framework PropertyGrid Control. In particular, " Providing a Custom UI for Your Properties " describes the process of creating a custom UITypeEditor. In addition, it discusses TypeConverter... | Properties Component What is the component that allows me to create a custom properties form? I mean, a component like this: I'm trying to make an editor, so I need that component. | TITLE:
Properties Component
QUESTION:
What is the component that allows me to create a custom properties form? I mean, a component like this: I'm trying to make an editor, so I need that component.
ANSWER:
This is done via quite a few things. If you're working with the PropertyGrid, I recommend reading: Getting the M... | [
"c#",
"components"
] | 1 | 4 | 916 | 2 | 0 | 2011-06-07T00:54:10.713000 | 2011-06-07T00:59:50.930000 |
6,259,654 | 6,259,669 | Exiting the Rails console after an error | I have been use the rails console for testing and learning purposes and when I encounter an error I cannot exit anymore using the "Control + C" command. Is there another command to exit? This is what the console looks like when I try to do this: ruby-1.9.2-p180:026 > user.find_by_name("Test") NoMethodError: undefined m... | You could try: Ctrl D Ctrl Z and then Enter Typing exit, then Enter. | Exiting the Rails console after an error I have been use the rails console for testing and learning purposes and when I encounter an error I cannot exit anymore using the "Control + C" command. Is there another command to exit? This is what the console looks like when I try to do this: ruby-1.9.2-p180:026 > user.find_b... | TITLE:
Exiting the Rails console after an error
QUESTION:
I have been use the rails console for testing and learning purposes and when I encounter an error I cannot exit anymore using the "Control + C" command. Is there another command to exit? This is what the console looks like when I try to do this: ruby-1.9.2-p180... | [
"ruby-on-rails"
] | 29 | 85 | 46,542 | 3 | 0 | 2011-06-07T00:58:48.607000 | 2011-06-07T01:02:35.283000 |
6,259,655 | 6,259,785 | R recombine split.xts operation | I have a xts object (stock price time series) that is comprised of intraday data for multiple years i.e. the data is a continuous stream that stitches together intraday data for each day in the period. I split the object by day (using split.xts(x, f="days)) as I need to compute various proprietary operations on a per d... | I believe that do.call(rbind,XLE1_split) should do what you want. | R recombine split.xts operation I have a xts object (stock price time series) that is comprised of intraday data for multiple years i.e. the data is a continuous stream that stitches together intraday data for each day in the period. I split the object by day (using split.xts(x, f="days)) as I need to compute various p... | TITLE:
R recombine split.xts operation
QUESTION:
I have a xts object (stock price time series) that is comprised of intraday data for multiple years i.e. the data is a continuous stream that stitches together intraday data for each day in the period. I split the object by day (using split.xts(x, f="days)) as I need to... | [
"r",
"split",
"undo",
"xts"
] | 1 | 1 | 385 | 1 | 0 | 2011-06-07T00:59:12.040000 | 2011-06-07T01:25:45.993000 |
6,259,674 | 6,259,993 | python script does not run from cron | I have a python script "start.py" that executes well from the command line. There is only one statement in it (print "hello"). EDIT: start.py contains also a working interpreter directive in the first line. As soon as I run the script from a cron job, every time it fires there is a message in syslog: Jun 7 02:57:01 mit... | A recent update of PAM broke cron. Try restarting your computer (or restarting cron with sudo /etc/init.d/cron restart ) | python script does not run from cron I have a python script "start.py" that executes well from the command line. There is only one statement in it (print "hello"). EDIT: start.py contains also a working interpreter directive in the first line. As soon as I run the script from a cron job, every time it fires there is a ... | TITLE:
python script does not run from cron
QUESTION:
I have a python script "start.py" that executes well from the command line. There is only one statement in it (print "hello"). EDIT: start.py contains also a working interpreter directive in the first line. As soon as I run the script from a cron job, every time it... | [
"python",
"ubuntu",
"cron",
"ubuntu-10.04",
"pam"
] | 4 | 3 | 2,955 | 2 | 0 | 2011-06-07T01:03:23.897000 | 2011-06-07T02:12:30.163000 |
6,259,675 | 6,259,695 | Split a table in half | Is there anyway to split a table in half using CSS and display the two parts side-by-side. For example, take this: | row1 | row1 | row1 | | row2 | row2 | row2 | | row3 | row3 | row3 | | row4 | row4 | row4 | | row5 | row5 | row5 | And make this: | row1 | row1 | row1 | | row4 | row4 | row4 | | row2 | row2 | row2 | | row5... | you can use multi column, but it is a CSS3 property. eg: -moz-column-count: 2; -moz-column-gap: 20px; -webkit-column-count: 2; -webkit-column-gap: 20px; column-count: 2; column-gap: 20px; This should work in the modern browsers You can also try this method http://www.csscripting.com/css-multi-column/ | Split a table in half Is there anyway to split a table in half using CSS and display the two parts side-by-side. For example, take this: | row1 | row1 | row1 | | row2 | row2 | row2 | | row3 | row3 | row3 | | row4 | row4 | row4 | | row5 | row5 | row5 | And make this: | row1 | row1 | row1 | | row4 | row4 | row4 | | row2 ... | TITLE:
Split a table in half
QUESTION:
Is there anyway to split a table in half using CSS and display the two parts side-by-side. For example, take this: | row1 | row1 | row1 | | row2 | row2 | row2 | | row3 | row3 | row3 | | row4 | row4 | row4 | | row5 | row5 | row5 | And make this: | row1 | row1 | row1 | | row4 | row... | [
"html",
"css-tables"
] | 14 | 5 | 6,498 | 1 | 0 | 2011-06-07T01:03:34.473000 | 2011-06-07T01:07:42.023000 |
6,259,680 | 6,263,006 | Restlet Default Route? | I'm trying to setup a couple routes with the restlet framework, but I can't seem to figure out how to setup a "default route". I tried this: @Override public Restlet createInboundRoot() { Router router = new Router( getContext() );
router.attach( "http://localhost:8111/", TestActionResource.class ); router.attach( "ht... | I almost had it, this is it: @Override public Restlet createInboundRoot() { Router router = new Router( getContext() );
router.attachDefault( TestActionResource.class ); router.attach( "http://localhost:8111/echo", EchoResource.class );
return router; } | Restlet Default Route? I'm trying to setup a couple routes with the restlet framework, but I can't seem to figure out how to setup a "default route". I tried this: @Override public Restlet createInboundRoot() { Router router = new Router( getContext() );
router.attach( "http://localhost:8111/", TestActionResource.clas... | TITLE:
Restlet Default Route?
QUESTION:
I'm trying to setup a couple routes with the restlet framework, but I can't seem to figure out how to setup a "default route". I tried this: @Override public Restlet createInboundRoot() { Router router = new Router( getContext() );
router.attach( "http://localhost:8111/", TestA... | [
"java",
"restlet"
] | 2 | 3 | 1,007 | 1 | 0 | 2011-06-07T01:04:27.427000 | 2011-06-07T09:08:44.120000 |
6,259,687 | 6,259,721 | If an attacker were able to read a Joomla!'s database, would he be able to do much harm? | I found out after a while that a component used on my website had an unfiltered parameter, in a WHERE condition in the following settings: Using Joomla! 1.5, latest update. The component is custom made, fairly small, and after reading its source I couldn't indentify any other security flaws. The attacker was using SQLM... | If you can read the database, you can dump it with SQLMap and find the hash of the administrator's password. With that hash, the attacker could crack it (or if it is MD5, find a collision fairly quickly) and login into your administrator account. From there, your admin account is screwed. The attacker has admin privile... | If an attacker were able to read a Joomla!'s database, would he be able to do much harm? I found out after a while that a component used on my website had an unfiltered parameter, in a WHERE condition in the following settings: Using Joomla! 1.5, latest update. The component is custom made, fairly small, and after read... | TITLE:
If an attacker were able to read a Joomla!'s database, would he be able to do much harm?
QUESTION:
I found out after a while that a component used on my website had an unfiltered parameter, in a WHERE condition in the following settings: Using Joomla! 1.5, latest update. The component is custom made, fairly sma... | [
"mysql",
"joomla",
"sql-injection"
] | 0 | 3 | 344 | 1 | 0 | 2011-06-07T01:06:13.840000 | 2011-06-07T01:12:47.937000 |
6,259,699 | 6,259,743 | JPA primary key value is always 0 | I have a post class and it kind of works, but there's one problem: the primary key doesn't increase. @Entity @Table(name="posts") public class Post extends GenericModel{
@Id @Column(name="post_id") public int id;
@Column(name="post_situation") public String situation;
@Column(name="post_date") public Date date;
@Co... | It seems that you want the primary key values to be auto-generated. If that is the case, if you'll need to add the @GeneratedValue annotation to the id attribute, in addition to the @Id annotation. Your code should therefore be: @Id @Column(name="post_id") @GeneratedValue public int id; There are several strategies ava... | JPA primary key value is always 0 I have a post class and it kind of works, but there's one problem: the primary key doesn't increase. @Entity @Table(name="posts") public class Post extends GenericModel{
@Id @Column(name="post_id") public int id;
@Column(name="post_situation") public String situation;
@Column(name="... | TITLE:
JPA primary key value is always 0
QUESTION:
I have a post class and it kind of works, but there's one problem: the primary key doesn't increase. @Entity @Table(name="posts") public class Post extends GenericModel{
@Id @Column(name="post_id") public int id;
@Column(name="post_situation") public String situatio... | [
"java",
"jpa",
"primary-key",
"playframework"
] | 3 | 5 | 5,624 | 2 | 0 | 2011-06-07T01:07:54.973000 | 2011-06-07T01:17:19.360000 |
6,259,704 | 6,259,940 | How to open/join more than one file (depending on user input) and then use 2 files simultaneously | EDIT: Sorry for the misunderstanding, I have edited a few things, to hopefully actually request what I want. I was wondering if there was a way to open/join two or more files to run the rest of the program on. For example, my directory has these files: taggedchpt1_1.txt, parsedchpt1_1.txt, taggedchpt1_2.txt, parsedchpt... | You could iterate over the file names, opening and reading each one in turn. Or you could produce an iterator that knows how to read lines from sequence of files. sub files_reader { # Takes a list of file names and returns a closure that # will yield lines from those files. my @handles = map { open(my $h, '<', $_) or d... | How to open/join more than one file (depending on user input) and then use 2 files simultaneously EDIT: Sorry for the misunderstanding, I have edited a few things, to hopefully actually request what I want. I was wondering if there was a way to open/join two or more files to run the rest of the program on. For example,... | TITLE:
How to open/join more than one file (depending on user input) and then use 2 files simultaneously
QUESTION:
EDIT: Sorry for the misunderstanding, I have edited a few things, to hopefully actually request what I want. I was wondering if there was a way to open/join two or more files to run the rest of the progra... | [
"perl"
] | 1 | 4 | 565 | 3 | 0 | 2011-06-07T01:08:59.450000 | 2011-06-07T02:01:28.517000 |
6,259,708 | 6,259,723 | Why is a generic argument that "extends" something not allowed in derived function, but generic return type is? | I would like to override a generic function in a subclass, as follows: Superclass: public abstract class Metric {
public abstract T precompute(); // valid syntax public abstract void distance(T arg); // valid syntax public static class Foo {}
} Subclass: public class MetricDefault extends Metric {
@Override public B... | public abstract class Metric {
public abstract T precompute(); // valid syntax public abstract void distance(T arg); // valid syntax public class Foo {}
} then if as I understood Bar extends Foo: public class MetricDefault extends Metric {
@Override public Bar precompute() { return new Bar(); }
@Override public voi... | Why is a generic argument that "extends" something not allowed in derived function, but generic return type is? I would like to override a generic function in a subclass, as follows: Superclass: public abstract class Metric {
public abstract T precompute(); // valid syntax public abstract void distance(T arg); // vali... | TITLE:
Why is a generic argument that "extends" something not allowed in derived function, but generic return type is?
QUESTION:
I would like to override a generic function in a subclass, as follows: Superclass: public abstract class Metric {
public abstract T precompute(); // valid syntax public abstract void distan... | [
"java",
"generics"
] | 3 | 3 | 1,043 | 5 | 0 | 2011-06-07T01:09:54.863000 | 2011-06-07T01:12:59.120000 |
6,259,714 | 6,259,903 | Amazon Web Services AMI Image Issue (Host not Responding to Requests) | I had a Micro Instance from which I created an AMI Image. I then upgraded to a Large Instance with this Image in tow and assigned an elastic IP Address. I changed my A Name to point to the new IP and, according to a reverse DNS lookup service, my DNS appears to have propagated correctly (cranku.com). I created a virtua... | I can reach your ssh server on the machine, but attempts to reach the webserver here are failing too, in a manner that makes me think the packets are being DROP ed rather than REJECT ed. Have you authorized port 80? | Amazon Web Services AMI Image Issue (Host not Responding to Requests) I had a Micro Instance from which I created an AMI Image. I then upgraded to a Large Instance with this Image in tow and assigned an elastic IP Address. I changed my A Name to point to the new IP and, according to a reverse DNS lookup service, my DNS... | TITLE:
Amazon Web Services AMI Image Issue (Host not Responding to Requests)
QUESTION:
I had a Micro Instance from which I created an AMI Image. I then upgraded to a Large Instance with this Image in tow and assigned an elastic IP Address. I changed my A Name to point to the new IP and, according to a reverse DNS look... | [
"django",
"apache",
"amazon-ec2",
"mod-wsgi"
] | 1 | 1 | 116 | 1 | 0 | 2011-06-07T01:11:13.070000 | 2011-06-07T01:55:27.890000 |
6,259,716 | 6,259,737 | Refactoring a Rails view | I'm new to Rails development, so please bear with me. I'm creating a view that has several fields on it that look very similar. It's just begging to be refactored somehow but I haven't been able to figure it out. See code sample below: <%= form_for(@tapelog) do |f| %> <%= f.label:client %> <%= f.collection_select:clien... | If you want to use the 'f' in the subsequent partials, pass it as a parameter <%= render:partial =>:some_partial,:locals => {:f => f } %> | Refactoring a Rails view I'm new to Rails development, so please bear with me. I'm creating a view that has several fields on it that look very similar. It's just begging to be refactored somehow but I haven't been able to figure it out. See code sample below: <%= form_for(@tapelog) do |f| %> <%= f.label:client %> <%= ... | TITLE:
Refactoring a Rails view
QUESTION:
I'm new to Rails development, so please bear with me. I'm creating a view that has several fields on it that look very similar. It's just begging to be refactored somehow but I haven't been able to figure it out. See code sample below: <%= form_for(@tapelog) do |f| %> <%= f.la... | [
"ruby-on-rails",
"refactoring"
] | 0 | 3 | 221 | 2 | 0 | 2011-06-07T01:11:32.213000 | 2011-06-07T01:15:13.580000 |
6,259,736 | 6,259,881 | Android Drag onto screen layout | How would you recreate the drag onto screen layout/effect similar to the one on some android home screen devices? Specifically there is a bar at the top of the home screen and that you can put your finger on and drag down. When you drag it another screen comes down from the top of the screen. On my phone this screen ha... | You want to use a slidingdrawer control. Here is a tutorial: http://android-journey.blogspot.com/2009/12/android-viewflipper-and-slidingdrawer.html | Android Drag onto screen layout How would you recreate the drag onto screen layout/effect similar to the one on some android home screen devices? Specifically there is a bar at the top of the home screen and that you can put your finger on and drag down. When you drag it another screen comes down from the top of the sc... | TITLE:
Android Drag onto screen layout
QUESTION:
How would you recreate the drag onto screen layout/effect similar to the one on some android home screen devices? Specifically there is a bar at the top of the home screen and that you can put your finger on and drag down. When you drag it another screen comes down from... | [
"android",
"layout",
"drag",
"effect"
] | 2 | 4 | 1,493 | 1 | 0 | 2011-06-07T01:15:13.040000 | 2011-06-07T01:49:01.083000 |
6,259,741 | 6,261,686 | Reliable way to run code against Entities just Inserted with ObjectContext? | I have some code that needs to run every time an Entity is Inserted into my database, the problem is that this code requires the Entity PrimaryKey. I have found that I can get the Entities from the ObjectStateManager with EntityState.Unchanged and that is my object after Insert, but I am not sure if that will always be... | Yes there is a way. You must call overloaded SaveChanges which will not accept changes after saving automatically and instead you will be responsible for calling AcceptAllChanges. In this scenario objects will be still in Added state after calling SaveChanges (but only till you call AcceptAllChanges ). The general code... | Reliable way to run code against Entities just Inserted with ObjectContext? I have some code that needs to run every time an Entity is Inserted into my database, the problem is that this code requires the Entity PrimaryKey. I have found that I can get the Entities from the ObjectStateManager with EntityState.Unchanged ... | TITLE:
Reliable way to run code against Entities just Inserted with ObjectContext?
QUESTION:
I have some code that needs to run every time an Entity is Inserted into my database, the problem is that this code requires the Entity PrimaryKey. I have found that I can get the Entities from the ObjectStateManager with Enti... | [
"c#",
"entity-framework",
"objectcontext"
] | 1 | 1 | 129 | 1 | 0 | 2011-06-07T01:17:08.993000 | 2011-06-07T07:04:33.177000 |
6,259,742 | 6,259,771 | PHP time subtraction not functioning | I'm trying to display the time x started, the time x finished, and how long x took to complete. I have the start and end displaying correctly, but the following subtraction gives me a bonkers answer. // to unix timestamps for subtraction $startTime = strtotime($row['bp_rec_start']); $endTime = strtotime($row['bp_rec_en... | Timestamps are seconds since 1970, each timestamp representing an absolute point in time. So $endTime - $startTime produces some point in time like 1975-04-12 07:01:52. Printing the hour and minute part of that will of course print 07:01. The timestamp itself though is the difference in seconds, so you can do: echo "Di... | PHP time subtraction not functioning I'm trying to display the time x started, the time x finished, and how long x took to complete. I have the start and end displaying correctly, but the following subtraction gives me a bonkers answer. // to unix timestamps for subtraction $startTime = strtotime($row['bp_rec_start']);... | TITLE:
PHP time subtraction not functioning
QUESTION:
I'm trying to display the time x started, the time x finished, and how long x took to complete. I have the start and end displaying correctly, but the following subtraction gives me a bonkers answer. // to unix timestamps for subtraction $startTime = strtotime($row... | [
"php",
"date",
"time",
"strtotime",
"unix-timestamp"
] | 2 | 4 | 196 | 1 | 0 | 2011-06-07T01:17:11.677000 | 2011-06-07T01:23:20.440000 |
6,259,745 | 6,259,761 | Volatile variable in Java | So I am reading this book titled Java Concurrency in Practice and I am stuck on this one explanation which I cannot seem to comprehend without an example. This is the quote: When thread A writes to a volatile variable and subsequently thread B reads that same variable, the values of all variables that were visible to A... | Thread B may have a CPU-local cache of those variables. A read of a volatile variable ensures that any intermediate cache flush from a previous write to the volatile is observed. For an example, read the following link, which concludes with "Fixing Double-Checked Locking using Volatile": http://www.cs.umd.edu/~pugh/jav... | Volatile variable in Java So I am reading this book titled Java Concurrency in Practice and I am stuck on this one explanation which I cannot seem to comprehend without an example. This is the quote: When thread A writes to a volatile variable and subsequently thread B reads that same variable, the values of all variab... | TITLE:
Volatile variable in Java
QUESTION:
So I am reading this book titled Java Concurrency in Practice and I am stuck on this one explanation which I cannot seem to comprehend without an example. This is the quote: When thread A writes to a volatile variable and subsequently thread B reads that same variable, the va... | [
"java",
"multithreading",
"concurrency",
"volatile"
] | 23 | 15 | 15,360 | 5 | 0 | 2011-06-07T01:17:31.790000 | 2011-06-07T01:21:41.230000 |
6,259,747 | 6,259,821 | Print all matches of a regular expression from the command line? | What's the simplest way to print all matches (either one line per match or one line per line of input) to a regular expression on a unix command line? Note that there may be 0 or more than 1 match per line of input. I assume there must be some way to do this with sed, awk, grep, and/or perl, and I'm hoping for a simple... | Assuming you only use non-capturing parentheses, perl -wnE'say /yourregex/g' or perl -wnE'say for /yourregex/g' Sample use: $ echo -ne 'fod,food,fad\nbar\nfooooood\n' | perl -wnE'say for /fo*d/g' fod food fooooood $ echo -ne 'fod,food,fad\nbar\nfooooood\n' | perl -wnE'say /fo*d/g' fodfood
fooooood | Print all matches of a regular expression from the command line? What's the simplest way to print all matches (either one line per match or one line per line of input) to a regular expression on a unix command line? Note that there may be 0 or more than 1 match per line of input. I assume there must be some way to do t... | TITLE:
Print all matches of a regular expression from the command line?
QUESTION:
What's the simplest way to print all matches (either one line per match or one line per line of input) to a regular expression on a unix command line? Note that there may be 0 or more than 1 match per line of input. I assume there must b... | [
"regex",
"perl",
"grep"
] | 4 | 16 | 21,827 | 4 | 0 | 2011-06-07T01:17:33.290000 | 2011-06-07T01:34:59.790000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.