qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
292,314
<p>I've got a request to implement a visualization service for geographical related data.</p> <p>I have a list of <strong>Italian ZIP Codes</strong> (they are called CAP in Italian). I've already found a table which maps these ZIP codes to <strong>geographical coordinates (lat/long)</strong>.</p> <p>So, the data I ha...
[ { "answer_id": 292332, "author": "Eugene Yokota", "author_id": 3827, "author_profile": "https://Stackoverflow.com/users/3827", "pm_score": 2, "selected": false, "text": "<p>Take a look at <a href=\"http://www.dotnetcharting.com/map_charts.aspx\" rel=\"nofollow noreferrer\">.net Charting<...
2008/11/15
[ "https://Stackoverflow.com/questions/292314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6461/" ]
I've got a request to implement a visualization service for geographical related data. I have a list of **Italian ZIP Codes** (they are called CAP in Italian). I've already found a table which maps these ZIP codes to **geographical coordinates (lat/long)**. So, the data I have to visualize as map is structured the fo...
[GeoNames](http://www.geonames.org/postalcode-search.html?q=80125&country=IT) offers a data set and open source libraries for geo mapping
292,378
<p>I have a number of user permissions that are tested throughout my ASP.NET application. These permission values are referenced in an Enum so that I can conveniently test permissions like so:</p> <ul> <li>btnCreate.Enabled = PermissionManager.TestPermission(Permission.AllowCreate);</li> </ul> <p>However, I also have...
[ { "answer_id": 292386, "author": "Ruben", "author_id": 21733, "author_profile": "https://Stackoverflow.com/users/21733", "pm_score": 1, "selected": false, "text": "<p>I do not know what the best solution is, I would like to hear that. \nOur solution is to explicitly type the enum like</p...
2008/11/15
[ "https://Stackoverflow.com/questions/292378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27805/" ]
I have a number of user permissions that are tested throughout my ASP.NET application. These permission values are referenced in an Enum so that I can conveniently test permissions like so: * btnCreate.Enabled = PermissionManager.TestPermission(Permission.AllowCreate); However, I also have these permissions stored in...
I do not know what the best solution is, I would like to hear that. Our solution is to explicitly type the enum like ``` public enum MyEnum : int { None =0, Value = 1, AnotherValue =2 } ``` And save the integer value to the database. When for instance the Value 1 is removed, you will still be able to use...
292,380
<p>I want to discard all remaining characters in a string as soon as one of several unwanted characters is encountered.</p> <p>As soon as a blacklisted character is encountered, the string before that point should be returned.</p> <p>For instance, if I have an array:</p> <pre><code>$chars = array(&quot;a&quot;, &quot;b...
[ { "answer_id": 292391, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": true, "text": "<p>The <a href=\"http://php.net/manual/en/function.strcspn.php\" rel=\"noreferrer\">strcspn</a> function is what you ...
2008/11/15
[ "https://Stackoverflow.com/questions/292380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21709/" ]
I want to discard all remaining characters in a string as soon as one of several unwanted characters is encountered. As soon as a blacklisted character is encountered, the string before that point should be returned. For instance, if I have an array: ``` $chars = array("a", "b", "c"); ``` How would I go through th...
The [strcspn](http://php.net/manual/en/function.strcspn.php) function is what you are looking for. ``` <?php $mask = "abc"; $string = "log dog hat bat"; $result = substr($string,0,strcspn($string,$mask)); var_dump($result); ?> ```
292,395
<p>I'm writing a simple templating layer in PHP but I've got myself a little stuck. Here's how it works at the moment:</p> <p>Firstly I use <code>fetch_template</code> to load the template contents from the database - this works (and I collect all the templates at startup if you're interested).</p> <p>I use PHP varia...
[ { "answer_id": 292400, "author": "Dave Vogt", "author_id": 35189, "author_profile": "https://Stackoverflow.com/users/35189", "pm_score": 3, "selected": false, "text": "<p>I'd pass an associative array with variables to replace, then extract() them.</p>\n\n<p>Then you could also pass $_GL...
2008/11/15
[ "https://Stackoverflow.com/questions/292395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
I'm writing a simple templating layer in PHP but I've got myself a little stuck. Here's how it works at the moment: Firstly I use `fetch_template` to load the template contents from the database - this works (and I collect all the templates at startup if you're interested). I use PHP variables in my template code and...
Rather than run through your loop you can use `include($template_name)`. Or, if you want the content of the output from the template, you can do something like this: ``` $template_name = 'template.php'; // import the contents into this template ob_start(); include($template_name); $content = ob_get_clean(); // do s...
292,403
<p>Say that I have two models- Users and Accounts. Each account can have at most n users associated with it, and a user can only be associated with one account. </p> <p>It would seem natural to say that User </p> <pre><code>belongs_to :account </code></pre> <p>and Account </p> <pre><code>has_many :users </code></pr...
[ { "answer_id": 292473, "author": "Raimonds Simanovskis", "author_id": 16829, "author_profile": "https://Stackoverflow.com/users/16829", "pm_score": 4, "selected": true, "text": "<p>At first, if your users table has foreign key account_id then you need to use</p>\n\n<pre><code>class User\...
2008/11/15
[ "https://Stackoverflow.com/questions/292403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35345/" ]
Say that I have two models- Users and Accounts. Each account can have at most n users associated with it, and a user can only be associated with one account. It would seem natural to say that User ``` belongs_to :account ``` and Account ``` has_many :users ``` However, I'm not clear on the best practice when ...
At first, if your users table has foreign key account\_id then you need to use ``` class User belongs_to :account end ``` In this way you will ensure that User can be associated just to one Account. If you want to limit that Account can have e.g. at most 3 users then you can define the following validation: ``` ...
292,437
<p>In .net (C#), If you have two types discovered through reflection is it possible to determine if one can be cast to the other? (implicit and/or explicit).</p> <p>What I'm trying to do is create a library that allows users to specify that a property on one type is mapped to a property on another type. Everything is ...
[ { "answer_id": 292439, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 1, "selected": false, "text": "<p>It would be better to look into TypeConverter's. </p>\n" }, { "answer_id": 292549, "author": "Bender", "...
2008/11/15
[ "https://Stackoverflow.com/questions/292437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11921/" ]
In .net (C#), If you have two types discovered through reflection is it possible to determine if one can be cast to the other? (implicit and/or explicit). What I'm trying to do is create a library that allows users to specify that a property on one type is mapped to a property on another type. Everything is fine if th...
``` public static bool HasConversionOperator( Type from, Type to ) { Func<Expression, UnaryExpression> bodyFunction = body => Expression.Convert( body, to ); ParameterExpression inp = Expression.Parameter( from, "inp" ); try { // If this succeeds t...
292,453
<p>I'm looking into the feasibility of adding a function to my Rails-based intranet site that allows users to upload files.</p> <p>Two purposes: My users are widely distributed geographically and linking to documents on the shared network storage doesn't always work (different addresses, DNS entries and stuff outside ...
[ { "answer_id": 292573, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": "<p>This <a href=\"http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles\" rel=\"nofollow noreferrer\">HowTo</a> for ...
2008/11/15
[ "https://Stackoverflow.com/questions/292453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1060/" ]
I'm looking into the feasibility of adding a function to my Rails-based intranet site that allows users to upload files. Two purposes: My users are widely distributed geographically and linking to documents on the shared network storage doesn't always work (different addresses, DNS entries and stuff outside my control...
> > The big problem is that my server does not permit my application to write files locally, and these plugins all seem to want to create a Tempfile. > > > Yes it does, or you wouldn't be able to upload the files at all. Rails itself creates tempfiles if the uploaded file is larger than 15k or so. ``` <%= f.file...
292,464
<p>Since I've started using NetBeans, I've learned of some <a href="http://www.netbeans.org/kb/60/java/gui-db.html" rel="nofollow noreferrer">powerful ways</a> to abstract away the process of creating Java database applications with automatically generated UI, beans bindings, and a bunch of other stuff I only vaguely u...
[ { "answer_id": 292469, "author": "John Topley", "author_id": 1450, "author_profile": "https://Stackoverflow.com/users/1450", "pm_score": 1, "selected": false, "text": "<p>Try the <a href=\"http://java.sun.com/docs/books/tutorial/jdbc/overview/index.html\" rel=\"nofollow noreferrer\">JDBC...
2008/11/15
[ "https://Stackoverflow.com/questions/292464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19825/" ]
Since I've started using NetBeans, I've learned of some [powerful ways](http://www.netbeans.org/kb/60/java/gui-db.html) to abstract away the process of creating Java database applications with automatically generated UI, beans bindings, and a bunch of other stuff I only vaguely understand the workings of at the moment ...
The [JDBC Tutorial](http://java.sun.com/docs/books/tutorial/jdbc/index.html) is a good starting point A snippet from the intro ``` The JDBC API is a Java API that can access any kind of tabular data, especially data stored in a Relational Database. JDBC helps you to write java applications that manage these three ...
292,480
<p>The MS source server technology uses an initialization file named srcsrv.ini. One of the values identifies the source server location(s), e.g.,</p> <pre><code>MYSERVER=\\machine\foobar </code></pre> <p>The docs leave much unanswered about this value. To start with, I haven't been able to find the significance of t...
[ { "answer_id": 295473, "author": "chrisd", "author_id": 9591, "author_profile": "https://Stackoverflow.com/users/9591", "pm_score": 3, "selected": true, "text": "<p>For anyone looking into this in the future, I received the following information from MS:</p>\n\n<blockquote>\n <p>The nam...
2008/11/15
[ "https://Stackoverflow.com/questions/292480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9591/" ]
The MS source server technology uses an initialization file named srcsrv.ini. One of the values identifies the source server location(s), e.g., ``` MYSERVER=\\machine\foobar ``` The docs leave much unanswered about this value. To start with, I haven't been able to find the significance of the value name, i.e., what'...
For anyone looking into this in the future, I received the following information from MS: > > The name on the left side is the logical name of a version > control server. The name is also used in the source-indexed symbol files > (pdb). For example, a symbol file may contain this string value: > >   MYSERVER...
292,516
<p>I would like such empty span tags (filled with <code>&amp;nbsp;</code> and space) to be removed:</p> <p><code>&lt;span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;</code></p> <p>I've tried with this regex, but it needs adjusting: </p> <p><code>(&lt;span&gt;(&amp;nbsp;|\s)*&lt;/span&gt;)</code></p> <p><code...
[ { "answer_id": 292520, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 2, "selected": false, "text": "<p>.</p>\n\n<pre><code>qr{&lt;span[^&gt;]*(/&gt;|&gt;\\s*?&lt;/span&gt;)}\n</code></pre>\n\n<p>Should get the gist of...
2008/11/15
[ "https://Stackoverflow.com/questions/292516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I would like such empty span tags (filled with `&nbsp;` and space) to be removed: `<span> &nbsp; &nbsp; &nbsp; </span>` I've tried with this regex, but it needs adjusting: `(<span>(&nbsp;|\s)*</span>)` `preg_replace('#<span>(&nbsp;|\s)*</span>#si','<\\1>',$encoded);`
Translating Kent Fredric's regexp to PHP : ``` preg_match_all('#<span[^>]*(?:/>|>(?:\s|&nbsp;)*</span>)#im', $html, $result); ``` This will match : * autoclosing spans * spans on multilines and whatever the case * spans with attributes * span with unbreakable spaces Maybe you should about including spans containin...
292,548
<p>I trying to learn swt, and I use maven for all my builds and eclipse for my IDE. When getting the swt jars out of the maven repository, I get:</p> <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3034 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1...
[ { "answer_id": 292786, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 2, "selected": false, "text": "<p>From the API of <a href=\"http://java.sun.com/javase/6/docs/api/java/lang/UnsatisfiedLinkError.html\" rel=\"nofollow nore...
2008/11/15
[ "https://Stackoverflow.com/questions/292548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28068/" ]
I trying to learn swt, and I use maven for all my builds and eclipse for my IDE. When getting the swt jars out of the maven repository, I get: ``` Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3034 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709) at ja...
Sounds like Maven is pulling in an old version of SWT. As of v3.4 (and higher), the swt.jar is *all* you need. SWT will automatically extract the `.so`s, `.jnilib`s or `.dll`s as necessary. The only tricky thing you need to worry about is to ensure that you get the right swt.jar (meaning for your platform). Try instal...
292,552
<p>I'm wondering to using extension method to avoid checking for null in hierarchy. The example:</p> <pre><code>// GetItems(), GetFirstOrDefault(), GetProduct(), GetIDProduct() are extension methods like: public static SomeType GetSomeProperty( this XYZ obj ) { if ( object.ReferenceEquals( obj, null ) ) { return d...
[ { "answer_id": 292565, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 2, "selected": false, "text": "<p>I'd just do it sanely:</p>\n\n<pre><code>Guid? idProduct = null;\nInvoice invoice = this.Invoce;\n\nif (invoice != null &...
2008/11/15
[ "https://Stackoverflow.com/questions/292552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20382/" ]
I'm wondering to using extension method to avoid checking for null in hierarchy. The example: ``` // GetItems(), GetFirstOrDefault(), GetProduct(), GetIDProduct() are extension methods like: public static SomeType GetSomeProperty( this XYZ obj ) { if ( object.ReferenceEquals( obj, null ) ) { return default( SomeTy...
I'd just do it sanely: ``` Guid? idProduct = null; Invoice invoice = this.Invoce; if (invoice != null && invoice.Items != null && invoice.Items.Count > 0 && invoice.Items[0] != null) { idProduct = invoice.Items[0].IDProduct(); } ```
292,558
<p>How can I draw a concave corner rectangle in WPF?</p>
[ { "answer_id": 292569, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 2, "selected": false, "text": "<pre><code>do you mean a rectangle with concave corners?, ie: \n ____________________\n | |...
2008/11/15
[ "https://Stackoverflow.com/questions/292558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37918/" ]
How can I draw a concave corner rectangle in WPF?
``` do you mean a rectangle with concave corners?, ie: ____________________ | | __| |__ | | | | | | |__ __| | | |____________________| ``` Gi...
292,587
<p>I'm writing a J2ME application. One of the pieces is something that polls the contents of a directory periodically, and, if there are any new things, paints them on the screen. I've done this by having the UI form launch a polling thread with a pointer back to itself, and when the polling thread finds something it...
[ { "answer_id": 292604, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 4, "selected": true, "text": "<p>Regarding Java, what you are describing looks like a <a href=\"http://java.sun.com/docs/books/tutorial/uiswing/concurrency/wo...
2008/11/15
[ "https://Stackoverflow.com/questions/292587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8207/" ]
I'm writing a J2ME application. One of the pieces is something that polls the contents of a directory periodically, and, if there are any new things, paints them on the screen. I've done this by having the UI form launch a polling thread with a pointer back to itself, and when the polling thread finds something it call...
Regarding Java, what you are describing looks like a [SwingWorker (worker thread)](http://java.sun.com/docs/books/tutorial/uiswing/concurrency/worker.html). When a Swing program needs to execute a long-running task, it usually uses one of the worker threads, also known as the background threads. A Swing program inclu...
292,615
<p>As the question says, how do I set the value of a DropDownList control using jQuery?</p>
[ { "answer_id": 292620, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 10, "selected": true, "text": "<pre><code>$(\"#mydropdownlist\").val(\"thevalue\");\n</code></pre>\n\n<p>just make sure the value in the options tags matc...
2008/11/15
[ "https://Stackoverflow.com/questions/292615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27805/" ]
As the question says, how do I set the value of a DropDownList control using jQuery?
``` $("#mydropdownlist").val("thevalue"); ``` just make sure the value in the options tags matches the value in the val method.
292,618
<p>I need to store of 100-200 data in mysql, the data which would be separated by pipes..</p> <p>any idea how to store it on mysql? should I use a single column or should I make many multiple columns? I don't know exactly how many data users will input. </p> <p>I made a form, it halted at the part where multiple data...
[ { "answer_id": 292627, "author": "mmattax", "author_id": 1638, "author_profile": "https://Stackoverflow.com/users/1638", "pm_score": 1, "selected": false, "text": "<p>If you have a form where this data is coming from, store each input from your form into it's own separate column.</p>\n\n...
2008/11/15
[ "https://Stackoverflow.com/questions/292618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37922/" ]
I need to store of 100-200 data in mysql, the data which would be separated by pipes.. any idea how to store it on mysql? should I use a single column or should I make many multiple columns? I don't know exactly how many data users will input. I made a form, it halted at the part where multiple data needs to be stor...
You should implement your table with an ID for the source of the data. This ID will be used to group all those pieces of similar data so you don't need to know how many you have beforehand. Your table columns and data could be set up like this: ``` sourceID data -------- ---- 1 100 ...
292,646
<p>I need to pick up list items from an list, and then perform operations like adding event handlers on them. I can think of two ways of doing this.</p> <p>HTML:</p> <pre><code> &lt;ul id="list"&gt; &lt;li id="listItem-0"&gt; first item &lt;/li&gt; &lt;li id="listItem-1"&gt; second item &lt;/li&gt; ...
[ { "answer_id": 292675, "author": "J c", "author_id": 25837, "author_profile": "https://Stackoverflow.com/users/25837", "pm_score": 3, "selected": true, "text": "<p>You can avoid adding event handlers to each list item by adding a single event handler to the containing element (the unorde...
2008/11/15
[ "https://Stackoverflow.com/questions/292646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30252/" ]
I need to pick up list items from an list, and then perform operations like adding event handlers on them. I can think of two ways of doing this. HTML: ``` <ul id="list"> <li id="listItem-0"> first item </li> <li id="listItem-1"> second item </li> <li id="listItem-2"> third item </li> <...
You can avoid adding event handlers to each list item by adding a single event handler to the containing element (the unordered list) and leveraging the concept of event bubbling. In this single event handler, you can use properties of the event object to determine what was clicked. It appears that you are wanting to ...
292,660
<p>Using <strong>only MySQL</strong>, I'm seeing if it's possible run an insert statement ONLY if the table is new. I successfully created a user variable to see if the table exists. The problem is that you can't use "WHERE" along with an insert statement. Any ideas on how to get this working?</p> <pre><code>// See if...
[ { "answer_id": 292662, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 4, "selected": true, "text": "<pre><code>IF @TableExists &gt; 0 THEN\n BEGIN\n INSERT INTO country (name) VALUES ('Afghanistan'),('Aland Islands');...
2008/11/15
[ "https://Stackoverflow.com/questions/292660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32881/" ]
Using **only MySQL**, I'm seeing if it's possible run an insert statement ONLY if the table is new. I successfully created a user variable to see if the table exists. The problem is that you can't use "WHERE" along with an insert statement. Any ideas on how to get this working? ``` // See if the "country" table exists...
``` IF @TableExists > 0 THEN BEGIN INSERT INTO country (name) VALUES ('Afghanistan'),('Aland Islands'); END ```
292,667
<p>Let's start with the following snippet:</p> <pre><code>Foreach(Record item in RecordList){ .. item = UpdateRecord(item, 5); .. } </code></pre> <p>The UpdateRecode function changes some field of item and returns the altered object. In this case the compiler throws an exception saying that the item can not be ...
[ { "answer_id": 292672, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 2, "selected": true, "text": "<p>If you need to update a collection, don't use an iterator pattern, like you said, its either error prone, or smells bad.</...
2008/11/15
[ "https://Stackoverflow.com/questions/292667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31722/" ]
Let's start with the following snippet: ``` Foreach(Record item in RecordList){ .. item = UpdateRecord(item, 5); .. } ``` The UpdateRecode function changes some field of item and returns the altered object. In this case the compiler throws an exception saying that the item can not be updated in a foreach itera...
If you need to update a collection, don't use an iterator pattern, like you said, its either error prone, or smells bad. I find that using a for loop with an index a bit clearer in this situation, as its very obvious what you are trying to do that way.
292,676
<p>Unlike C++, in C# you can't overload the assignment operator. </p> <p>I'm doing a custom Number class for arithmetic operations with very large numbers and I want it to have the look-and-feel of the built-in numerical types like int, decimal, etc. I've overloaded the arithmetic operators, but the assignment remains...
[ { "answer_id": 292685, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 3, "selected": false, "text": "<p>You won't be able to work around it having the C++ look, since a = b; has other semantics in C++ than in...
2008/11/15
[ "https://Stackoverflow.com/questions/292676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Unlike C++, in C# you can't overload the assignment operator. I'm doing a custom Number class for arithmetic operations with very large numbers and I want it to have the look-and-feel of the built-in numerical types like int, decimal, etc. I've overloaded the arithmetic operators, but the assignment remains... Here'...
It's still not at all clear to me that you really need this. Either: * Your Number type should be a struct (which is probable - numbers are the most common example of structs). Note that all the types you want your type to act like (int, decimal etc) are structs. or: * Your Number type should be immutable, making ev...
292,706
<p>I have a table like the following:</p> <pre><code>transaction_id user_id other_user_id trans_type amount </code></pre> <p>This table is used to maintain the account transactions for a finance type app.</p> <p>Its double entry accounting so a transfer from User A to B would insert two rows into the table looking l...
[ { "answer_id": 292739, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 4, "selected": true, "text": "<p>Are you using InnoDB tables or MyISAM tables? MySQL doesn't support transactions on MyISAM tables (but it won't g...
2008/11/15
[ "https://Stackoverflow.com/questions/292706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a table like the following: ``` transaction_id user_id other_user_id trans_type amount ``` This table is used to maintain the account transactions for a finance type app. Its double entry accounting so a transfer from User A to B would insert two rows into the table looking like. ``` 1, A, B, Sent, -100 1, ...
Are you using InnoDB tables or MyISAM tables? MySQL doesn't support transactions on MyISAM tables (but it won't give you an error if you try to use them). Also, make sure your transaction isolation level is set appropriately, it should be SERIALIZABLE which is not the default for MySQL. This [article](http://www.info...
292,711
<p>How are you managing your usage of <a href="http://dojotoolkit.org/projects/dojox" rel="nofollow noreferrer">DojoX</a> code or widgets in a production application?</p> <p>The <a href="http://dojotoolkit.org/" rel="nofollow noreferrer">Dojo Toolkit</a> is comprised of Core, Dijit, and DojoX. As an incubator for new ...
[ { "answer_id": 300892, "author": "Eugene Lazutkin", "author_id": 26394, "author_profile": "https://Stackoverflow.com/users/26394", "pm_score": 3, "selected": true, "text": "<p>There are several ways to do it:</p>\n\n<ul>\n<li>Stick to one version of Dojo and use it consistently.</li>\n<l...
2008/11/15
[ "https://Stackoverflow.com/questions/292711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How are you managing your usage of [DojoX](http://dojotoolkit.org/projects/dojox) code or widgets in a production application? The [Dojo Toolkit](http://dojotoolkit.org/) is comprised of Core, Dijit, and DojoX. As an incubator for new ideas to extend the toolkit, DojoX code and widgets are functional with varying degr...
There are several ways to do it: * Stick to one version of Dojo and use it consistently. * Move modified code to your own namespace and include it from there. + Effectively it is a forking of an existing DojoX module. All code syncing and back porting is your responsibility. + Pay attention to the rest of Dojo — if ...
292,715
<p>I am having some problems with events being raised from the non-UI thread, in that i dont wish to have to handle the If me.invokerequired on every event handler added to the thread in Form1.</p> <p>I am sure i have read somewhere how to use a delegate event (on SO) but i am unable to find it.</p> <pre><code>Public...
[ { "answer_id": 292758, "author": "Hans Passant", "author_id": 17034, "author_profile": "https://Stackoverflow.com/users/17034", "pm_score": 3, "selected": true, "text": "<p>You derived your class from Control. A bit unusual, but if the control is actually hosted on a form, you can use M...
2008/11/15
[ "https://Stackoverflow.com/questions/292715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1500/" ]
I am having some problems with events being raised from the non-UI thread, in that i dont wish to have to handle the If me.invokerequired on every event handler added to the thread in Form1. I am sure i have read somewhere how to use a delegate event (on SO) but i am unable to find it. ``` Public Class Form1 Pri...
You derived your class from Control. A bit unusual, but if the control is actually hosted on a form, you can use Me.Invoke() to marshal the call. For example: ``` Private Delegate Sub SomethingHappenedDelegate(ByVal result As Integer) Private Sub Work() For i As Integer = 0 To 10 Me.Invoke(New Something...
292,740
<p>I am implementing a very simple file database. I have 2 basic operations: </p> <pre><code>void Insert(const std::string &amp; i_record) { //create or append to the file m_fileStream.open(m_fileName.c_str(), std::ios::out | std::ios::app); if (m_fileStream.is_open()) { m_fileStream &lt;&lt; i...
[ { "answer_id": 292764, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 3, "selected": true, "text": "<p>Change </p>\n\n<pre><code> while (!m_fileStream.eof())\n {\n getline (m_fileStream, line);\n...
2008/11/15
[ "https://Stackoverflow.com/questions/292740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21634/" ]
I am implementing a very simple file database. I have 2 basic operations: ``` void Insert(const std::string & i_record) { //create or append to the file m_fileStream.open(m_fileName.c_str(), std::ios::out | std::ios::app); if (m_fileStream.is_open()) { m_fileStream << i_record << "\n"; } ...
Change ``` while (!m_fileStream.eof()) { getline (m_fileStream, line); results.push_back(line); } ``` to ``` while (getline (m_fileStream, line)) { results.push_back(line); } ``` Otherwise you will get one additional empty line at the end. `eof()` will return tru...
292,756
<p>In my master pages I have <code>&lt;form ... action="" ...&gt;</code>, in pre SP1, if I viewed the source the action attribute would be an empty string. In SP1 the action attribute is overridden "MyPage.aspx?MyParams", unfortunately, this causes my postbacks to fail as I have additional pathinfo in the URL (ie. MyP...
[ { "answer_id": 292943, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 3, "selected": false, "text": "<p>Maybe you can find the solution here in <a href=\"http://forums.asp.net/t/1305800.aspx\" rel=\"nofollow noreferrer\">thi...
2008/11/15
[ "https://Stackoverflow.com/questions/292756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7138/" ]
In my master pages I have `<form ... action="" ...>`, in pre SP1, if I viewed the source the action attribute would be an empty string. In SP1 the action attribute is overridden "MyPage.aspx?MyParams", unfortunately, this causes my postbacks to fail as I have additional pathinfo in the URL (ie. MyPage.aspx\CustomerData...
Great solution from MrJavaGuy but there is a typo in the code because pasting code in the box here doesn't always work correctly. There is a duplication on the WriteAttribute method, corrected code is as follows - ``` public class HtmlFormAdapter : ControlAdapter { protected override void Render(HtmlTextWriter wr...
292,767
<p>So, I'm reasonably new to both unit testing and mocking in C# and .NET; I'm using xUnit.net and Rhino Mocks respectively. I'm a convert, and I'm focussing on writing behaviour specifications, I guess, instead of being purely TDD. Bah, semantics; I want an automated safety net to work above, essentially.</p> <p>A ...
[ { "answer_id": 292943, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 3, "selected": false, "text": "<p>Maybe you can find the solution here in <a href=\"http://forums.asp.net/t/1305800.aspx\" rel=\"nofollow noreferrer\">thi...
2008/11/15
[ "https://Stackoverflow.com/questions/292767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20971/" ]
So, I'm reasonably new to both unit testing and mocking in C# and .NET; I'm using xUnit.net and Rhino Mocks respectively. I'm a convert, and I'm focussing on writing behaviour specifications, I guess, instead of being purely TDD. Bah, semantics; I want an automated safety net to work above, essentially. A thought stru...
Great solution from MrJavaGuy but there is a typo in the code because pasting code in the box here doesn't always work correctly. There is a duplication on the WriteAttribute method, corrected code is as follows - ``` public class HtmlFormAdapter : ControlAdapter { protected override void Render(HtmlTextWriter wr...
292,779
<p>When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the first series in the plot. I can delete the series, but is there a more elegant way to do this? I tried </p> <pre><code>Set selection = not...
[ { "answer_id": 292836, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 2, "selected": false, "text": "<p>I do not think that this can be done. Here is some code copied with no modifications from Chip Pearson's site: <a href=...
2008/11/15
[ "https://Stackoverflow.com/questions/292779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30441/" ]
When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the first series in the plot. I can delete the series, but is there a more elegant way to do this? I tried ``` Set selection = nothing ``` but i...
``` Cells(1,1).Select ``` It will take you to cell A1, thereby canceling your existing selection.
292,787
<p>I can get simple examples to work fine as long as there's no master page involved. All I want to do is click a button and have it say "hello world" with the javascript in a .js file, using a master page. Any help very much appreciated :)</p>
[ { "answer_id": 292833, "author": "gius", "author_id": 19712, "author_profile": "https://Stackoverflow.com/users/19712", "pm_score": 4, "selected": false, "text": "<p>Just move the <code>&lt;script type=\"text/javascript\" src=\"jquery.js\" /&gt;</code> tag into the head tag in the master...
2008/11/15
[ "https://Stackoverflow.com/questions/292787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37939/" ]
I can get simple examples to work fine as long as there's no master page involved. All I want to do is click a button and have it say "hello world" with the javascript in a .js file, using a master page. Any help very much appreciated :)
**EDIT** As @Adam points out in the comments, there is a native jQuery mechanism that basically does the same thing as the hack in my original answer. Using jQuery you can do ``` $('[id$=myButton]').click(function(){ alert('button clicked'); }); ``` My hack was originally developed as a Prototype work around for ...
292,800
<p>Start a new Silverlight application... and in the code behind (in the "Loaded" event), put this code:</p> <pre><code>// This will *NOT* cause an error. this.LayoutRoot.DataContext = new string[5]; </code></pre> <p>But...</p> <pre><code>// This *WILL* cause an error! this.LayoutRoot.DataContext = this; </code></pr...
[ { "answer_id": 292822, "author": "Bill Reiss", "author_id": 18967, "author_profile": "https://Stackoverflow.com/users/18967", "pm_score": 3, "selected": true, "text": "<p>You can't currently use visual elements as a data source for data binding in Silverlight 2. I think this is slated to...
2008/11/15
[ "https://Stackoverflow.com/questions/292800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11917/" ]
Start a new Silverlight application... and in the code behind (in the "Loaded" event), put this code: ``` // This will *NOT* cause an error. this.LayoutRoot.DataContext = new string[5]; ``` But... ``` // This *WILL* cause an error! this.LayoutRoot.DataContext = this; ``` The error that is raised is "Value does no...
You can't currently use visual elements as a data source for data binding in Silverlight 2. I think this is slated to be added for Silverlight v.Next.
292,806
<p>I'm not sure how to search for this answer, so I'll go ahead and ask it.</p> <p>In my rails project I have a User model and a foo model. A user can have one or more foo models assigned to it. I have accomplished this by adding </p> <pre><code>has_many :foo, :through =&gt; :user_foo </code></pre> <p>in my user mod...
[ { "answer_id": 292819, "author": "John Topley", "author_id": 1450, "author_profile": "https://Stackoverflow.com/users/1450", "pm_score": 3, "selected": true, "text": "<p>I assume that you have <code>belongs_to :user</code> in your Foo class?</p>\n\n<p>What does your controller code look ...
2008/11/15
[ "https://Stackoverflow.com/questions/292806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23458/" ]
I'm not sure how to search for this answer, so I'll go ahead and ask it. In my rails project I have a User model and a foo model. A user can have one or more foo models assigned to it. I have accomplished this by adding ``` has_many :foo, :through => :user_foo ``` in my user model. Now, over in my view, I want t...
I assume that you have `belongs_to :user` in your Foo class? What does your controller code look like? To show all foos it should have something like this: ``` def index @foos = Foo.all end ```
292,820
<p>In a code review, I stumbled over this (simplified) code fragment to unregister an event handler:</p> <pre><code> Fire -= new MyDelegate(OnFire); </code></pre> <p>I thought that this does not unregister the event handler because it creates a new delegate which had never been registered before. But searching MSDN I...
[ { "answer_id": 292840, "author": "Bradley Grainger", "author_id": 23633, "author_profile": "https://Stackoverflow.com/users/23633", "pm_score": 7, "selected": true, "text": "<p>The C# compiler's default implementation of adding an event handler calls <code>Delegate.Combine</code>, while ...
2008/11/15
[ "https://Stackoverflow.com/questions/292820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23772/" ]
In a code review, I stumbled over this (simplified) code fragment to unregister an event handler: ``` Fire -= new MyDelegate(OnFire); ``` I thought that this does not unregister the event handler because it creates a new delegate which had never been registered before. But searching MSDN I found several code sample...
The C# compiler's default implementation of adding an event handler calls `Delegate.Combine`, while removing an event handler calls `Delegate.Remove`: ``` Fire = (MyDelegate) Delegate.Remove(Fire, new MyDelegate(Program.OnFire)); ``` The Framework's implementation of `Delegate.Remove` doesn't look at the `MyDelegate...
292,826
<p>I have a canvas in Flex that shall be able only to be scrolled in vertical direction, so I set the attributes of the canvas as follows:</p> <pre><code>verticalScrollPolicy="auto" horizontalScrollPolicy="off" </code></pre> <p>The problem here is that the vertical scrollbar covers the content when it appears - altou...
[ { "answer_id": 292846, "author": "Scott Evernden", "author_id": 11397, "author_profile": "https://Stackoverflow.com/users/11397", "pm_score": 5, "selected": true, "text": "<p>It's a bug. See <em><a href=\"http://www.nbilyk.com/flex-scrollpolicy-bug\" rel=\"noreferrer\">Flex verticalScrol...
2008/11/15
[ "https://Stackoverflow.com/questions/292826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7524/" ]
I have a canvas in Flex that shall be able only to be scrolled in vertical direction, so I set the attributes of the canvas as follows: ``` verticalScrollPolicy="auto" horizontalScrollPolicy="off" ``` The problem here is that the vertical scrollbar covers the content when it appears - altough there is enough horizon...
It's a bug. See *[Flex verticalScrollPolicy bug](http://www.nbilyk.com/flex-scrollpolicy-bug)* for a workaround.
292,841
<p>I would like to know how to get the name of the property that a method parameter value came from. The code snippet below shows what I want to do:</p> <pre><code>Person peep = new Person(); Dictionary&lt;object, string&gt; mapping = new Dictionary&lt;object, string&gt;(); mapping[peep.FirstName] = "Name"; Dictionary...
[ { "answer_id": 292863, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "<p>You are not able to do so in this way, since the way it works is that C# evaluates the value of FirstName property by calli...
2008/11/15
[ "https://Stackoverflow.com/questions/292841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/215086/" ]
I would like to know how to get the name of the property that a method parameter value came from. The code snippet below shows what I want to do: ``` Person peep = new Person(); Dictionary<object, string> mapping = new Dictionary<object, string>(); mapping[peep.FirstName] = "Name"; Dictionary<string, string> propertyT...
I think ultimately you will need to store either the PropertyInfo object associated with the property, or the string representation of the property name in you mapping object. The syntax you have: ``` mapping[peep.FirstName] = "Name"; ``` Would create an entry in the dictionary with a key value equal to the value of...
292,844
<p>I try to keep it brief and concise. I have to write a program that takes queries in SQL form and searches an XML. Right now I am trying to disassemble a string into logical pieces so I can work with them. I have a string as input and want to get a MatchCollection as output.</p> <p>Please not that the test string be...
[ { "answer_id": 293103, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 2, "selected": false, "text": "<p>I think you need to explicitly match the line terminators, as well as handle spaces better as others have suggeste...
2008/11/15
[ "https://Stackoverflow.com/questions/292844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I try to keep it brief and concise. I have to write a program that takes queries in SQL form and searches an XML. Right now I am trying to disassemble a string into logical pieces so I can work with them. I have a string as input and want to get a MatchCollection as output. Please not that the test string below is of ...
I think you need to explicitly match the line terminators, as well as handle spaces better as others have suggested. Assuming the user can choose between \r and \n, try ``` @"(?<select>\Aselect .+)[\n\r]" + @"(?<from>\s*from .+)[\n\r]" + @"(?<where>\s*where .+)[\n\r]" + @"(?<groupBy>\s*group by .+)[\n\r]" + @"(?<havin...
292,851
<p>I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different <code>user_id</code> and without a fixed value for <code>auto_id</code> since that is an auto_increment field, and setting <code>ti</code> to NOW(). Below is my mockup que...
[ { "answer_id": 293103, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 2, "selected": false, "text": "<p>I think you need to explicitly match the line terminators, as well as handle spaces better as others have suggeste...
2008/11/15
[ "https://Stackoverflow.com/questions/292851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different `user_id` and without a fixed value for `auto_id` since that is an auto\_increment field, and setting `ti` to NOW(). Below is my mockup query where '1' is the new `user_id`. ...
I think you need to explicitly match the line terminators, as well as handle spaces better as others have suggested. Assuming the user can choose between \r and \n, try ``` @"(?<select>\Aselect .+)[\n\r]" + @"(?<from>\s*from .+)[\n\r]" + @"(?<where>\s*where .+)[\n\r]" + @"(?<groupBy>\s*group by .+)[\n\r]" + @"(?<havin...
292,861
<p>I have a form that has default values describing what should go into the field (replacing a label). When the user focuses a field this function is called:</p> <pre><code>function clear_input(element) { element.value = ""; element.onfocus = null; } </code></pre> <p>The onfocus is set to null so that if the ...
[ { "answer_id": 292869, "author": "keparo", "author_id": 19468, "author_profile": "https://Stackoverflow.com/users/19468", "pm_score": 3, "selected": false, "text": "<p>Use</p>\n\n<pre><code>element.onfocus = clear_input;\n</code></pre>\n\n<p>or (with parameters)</p>\n\n<pre><code>element...
2008/11/15
[ "https://Stackoverflow.com/questions/292861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a form that has default values describing what should go into the field (replacing a label). When the user focuses a field this function is called: ``` function clear_input(element) { element.value = ""; element.onfocus = null; } ``` The onfocus is set to null so that if the user puts something in the...
Use ``` element.onfocus = clear_input; ``` or (with parameters) ``` element.onfocus = function () { clear_input( param, param2 ); }; ``` with ``` function clear_input () { this.value = ""; this.onfocus = null; } ``` The "javascript:" bit is unnecessary.
292,883
<p>I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an admin:</p> <p>"System.Security.SecurityE...
[ { "answer_id": 292885, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 0, "selected": false, "text": "<p>The \"non-programming way\" is to grant the user that user your web application/web service with access to r...
2008/11/15
[ "https://Stackoverflow.com/questions/292883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21386/" ]
I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an admin: "System.Security.SecurityException :...
For your update I have found something that might help you : ``` Run regedt32 Navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Right click on this entry and select Permissions Add the ASPNET user Give it Read permission 2. Change settings in machine.config file R...
292,887
<p>What is the best way to store DateTime in SQL for different timezones and different locales<br> There a few questions/answers about timezones, but none is addressing the locale problems. DateTime.ToUniversalTime is locale specific, and I need it locale independent.</p> <p>For example:</p> <pre><code> DateTime.Now...
[ { "answer_id": 292885, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 0, "selected": false, "text": "<p>The \"non-programming way\" is to grant the user that user your web application/web service with access to r...
2008/11/15
[ "https://Stackoverflow.com/questions/292887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37955/" ]
What is the best way to store DateTime in SQL for different timezones and different locales There a few questions/answers about timezones, but none is addressing the locale problems. DateTime.ToUniversalTime is locale specific, and I need it locale independent. For example: ``` DateTime.Now.ToUniversalTime.ToStr...
For your update I have found something that might help you : ``` Run regedt32 Navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Right click on this entry and select Permissions Add the ASPNET user Give it Read permission 2. Change settings in machine.config file R...
292,893
<p>This code is causing a memory leak for me, and I'm not sure why.</p> <p>[EDIT] Included code from <a href="http://paste.pocoo.org/show/91254/" rel="nofollow noreferrer">here</a> into question:</p> <pre><code>#include "src/base.cpp" typedef std::map&lt;std::string, AlObj*, std::less&lt;std::string&gt;, gc_alloc...
[ { "answer_id": 292931, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 2, "selected": false, "text": "<p>The 'gc allocator' is allocating and looking after objects of this type:</p>\n\n<pre><code>std::pair&lt;const std::...
2008/11/15
[ "https://Stackoverflow.com/questions/292893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37181/" ]
This code is causing a memory leak for me, and I'm not sure why. [EDIT] Included code from [here](http://paste.pocoo.org/show/91254/) into question: ``` #include "src/base.cpp" typedef std::map<std::string, AlObj*, std::less<std::string>, gc_allocator<std::pair<const std::string, AlObj*> > > KWARG_TYPE; AlInt::A...
The 'gc allocator' is allocating and looking after objects of this type: ``` std::pair<const std::string, AlObj*> ``` Just because this object has a pointer in it does not mean it the allocator will call delete on it. If you want the object created in setUp() to be GC then you need to allocate them via the GC. Or l...
292,941
<p>I've rewritten my family web site using JavaScript (JQuery) making Ajax calls to PHP on the back end. It's your standard &quot;bunch of image thumbnails and one main image, and when you click on a thumbnail image the main image changes&quot; kind of thing. Everything is working as expected when using Firefox, but on...
[ { "answer_id": 292964, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 1, "selected": false, "text": "<p>You could use <a href=\"http://www.fiddlertool.com/\" rel=\"nofollow noreferrer\">Fiddler</a>, a free debugging proxy fo...
2008/11/15
[ "https://Stackoverflow.com/questions/292941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1821/" ]
I've rewritten my family web site using JavaScript (JQuery) making Ajax calls to PHP on the back end. It's your standard "bunch of image thumbnails and one main image, and when you click on a thumbnail image the main image changes" kind of thing. Everything is working as expected when using Firefox, but on IE, when I c...
Debugging through your site here's what it looks is happening: After the first image is pocessed, the resize event is being thrown, so this code gets called: ``` $(window).bind("resize", function(){ ResizeWindow( 'nicholas-1' ) }); ``` which as you know reloads your gallery. Now I can't tell you why this is oc...
292,948
<p>In Visual C# 2008, I have a solution with two projects.</p> <p>First project contains Form1 that displays one Label with Text set to a string from Properties.Resources, like this:</p> <pre><code>label1.Text = Properties.Resources.MY_TEXT; </code></pre> <p>In the second project, I "Add as link" this Form1 from the...
[ { "answer_id": 293002, "author": "user19871", "author_id": 19871, "author_profile": "https://Stackoverflow.com/users/19871", "pm_score": 0, "selected": false, "text": "<p>You should add \"using MyOtherProjectNamespace\" so that you can access its properties</p>\n" }, { "answer_id...
2008/11/15
[ "https://Stackoverflow.com/questions/292948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20353/" ]
In Visual C# 2008, I have a solution with two projects. First project contains Form1 that displays one Label with Text set to a string from Properties.Resources, like this: ``` label1.Text = Properties.Resources.MY_TEXT; ``` In the second project, I "Add as link" this Form1 from the first project. I want to show th...
Yes that is the right approach (referencing one project from another). A pattern you may like to apply is to have one project that has all your reference/lookup/settings in it. Then you don't need to work out dependencies between your UI projects. Your approach of making the resources public is the correct. You also ...
292,991
<p>I need to allow the vertical scrollbar in a multiselect listbox (VB6) however, when the control is disabled, I can't scroll.</p> <p>I would think there is an API to allow this, but my favorite <a href="http://vbnet.mvps.org" rel="nofollow noreferrer">VB6 site (MVPS VB.NET)</a> does not have a way.</p> <p>I toyed w...
[ { "answer_id": 293069, "author": "Chetan S", "author_id": 31284, "author_profile": "https://Stackoverflow.com/users/31284", "pm_score": 1, "selected": false, "text": "<p>Rather than looking for the API to ignore clicks, can't you just ignore the events? (i.e. just don't do when the user ...
2008/11/15
[ "https://Stackoverflow.com/questions/292991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16794/" ]
I need to allow the vertical scrollbar in a multiselect listbox (VB6) however, when the control is disabled, I can't scroll. I would think there is an API to allow this, but my favorite [VB6 site (MVPS VB.NET)](http://vbnet.mvps.org) does not have a way. I toyed with pretending it was disabled, and ignore the clicks....
I came up with the following code, which hides all of the gnarly details behind a class. Basically, I implemented greg's idea of using overlaying another scrollbar on top of the disabled list box's scrollbar. In my code, I dynamically create another ListBox control (resized so that only its scrollbar is visible), and u...
292,993
<p>What's the secret to getting ClaimsResponse working with <a href="http://code.google.com/p/dotnetopenid/" rel="noreferrer">DotNetOpenId</a>?</p> <p>For example, in this bit of code (from <a href="http://www.hanselman.com/blog/CategoryView.aspx?category=DasBlog" rel="noreferrer">Scott Hanselman's blog</a>) the Claim...
[ { "answer_id": 293185, "author": "OJ.", "author_id": 611, "author_profile": "https://Stackoverflow.com/users/611", "pm_score": 2, "selected": false, "text": "<p>With the latests version of DotNetOpenId, this code seems to work fine for me:</p>\n\n<pre><code>var request = openid.CreateReq...
2008/11/15
[ "https://Stackoverflow.com/questions/292993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19020/" ]
What's the secret to getting ClaimsResponse working with [DotNetOpenId](http://code.google.com/p/dotnetopenid/)? For example, in this bit of code (from [Scott Hanselman's blog](http://www.hanselman.com/blog/CategoryView.aspx?category=DasBlog)) the ClaimsResponse object should have lots of nice little things like 'nick...
Your code looks fine. But be aware that the sreg extension, which you are using, isn't supported by all OPs. If the OP you're authenticating with doesn't support it, then the response extension will be null as you're seeing. So a null check is always a good idea. myopenid.com supports sreg, if you're looking for an O...
292,997
<p>can you set SO_RCVTIMEO and SO_SNDTIMEO socket options in boost asio?</p> <p>If so how?</p> <p>Note I know you can use timers instead, but I'd like to know about these socket options in particular. </p>
[ { "answer_id": 293012, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 2, "selected": false, "text": "<p>It doesn't appear to be built into Boost.Asio (as of current Boost SVN), but, if you're willing to write your own classes...
2008/11/15
[ "https://Stackoverflow.com/questions/292997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
can you set SO\_RCVTIMEO and SO\_SNDTIMEO socket options in boost asio? If so how? Note I know you can use timers instead, but I'd like to know about these socket options in particular.
Absolutely! Boost ASIO allows you to access the native/underlying data, which in this case is the SOCKET itself. So, let's say you have: ``` boost::asio::ip::tcp::socket my_socket; ``` And let's say you've already called `open` or `bind` or some member function that actually makes `my_socket` usable. Then, to get th...
292,998
<p>Do I need a UUID to program for the iPhone? I was told I need this, how can I get a UUID</p>
[ { "answer_id": 293012, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 2, "selected": false, "text": "<p>It doesn't appear to be built into Boost.Asio (as of current Boost SVN), but, if you're willing to write your own classes...
2008/11/15
[ "https://Stackoverflow.com/questions/292998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Do I need a UUID to program for the iPhone? I was told I need this, how can I get a UUID
Absolutely! Boost ASIO allows you to access the native/underlying data, which in this case is the SOCKET itself. So, let's say you have: ``` boost::asio::ip::tcp::socket my_socket; ``` And let's say you've already called `open` or `bind` or some member function that actually makes `my_socket` usable. Then, to get th...
293,007
<p>I want do something like this:</p> <pre><code>Button btn1 = new Button(); btn1.Click += new EventHandler(btn1_Click); Button btn2 = new Button(); // Take whatever event got assigned to btn1 and assign it to btn2. btn2.Click += btn1.Click; // The compiler says no... </code></pre> <p>Where btn1_Click is already defi...
[ { "answer_id": 293010, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>No, you can't do this. The reason is encapsulation - events are <em>just</em> subscribe/unsubscribe, i.e. they don't ...
2008/11/15
[ "https://Stackoverflow.com/questions/293007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14606/" ]
I want do something like this: ``` Button btn1 = new Button(); btn1.Click += new EventHandler(btn1_Click); Button btn2 = new Button(); // Take whatever event got assigned to btn1 and assign it to btn2. btn2.Click += btn1.Click; // The compiler says no... ``` Where btn1\_Click is already defined in the class: ``` vo...
Yeah, it's technically possible. Reflection is required because many of the members are private and internal. Start a new [Windows Forms](http://en.wikipedia.org/wiki/Windows_Forms) project and add two buttons. Then: ``` using System; using System.ComponentModel; using System.Windows.Forms; using System.Reflection; n...
293,021
<p>I have a working TYPO3 extension. It is attached <a href="http://wiki.orbeon.com/forms/doc/developer-guide/form-runner-typo3-extension" rel="nofollow noreferrer">this wiki page</a>. How can I change the code of this extension so it is of the USER_INT type? I.e. I don't want TYPO3 to cache the output of this plugin, ...
[ { "answer_id": 560914, "author": "arturh", "author_id": 4186, "author_profile": "https://Stackoverflow.com/users/4186", "pm_score": 3, "selected": false, "text": "<p>To disable caching for your extension go to your piX/class.tx_XXX_piX.php file and remove the following line (below your c...
2008/11/15
[ "https://Stackoverflow.com/questions/293021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295/" ]
I have a working TYPO3 extension. It is attached [this wiki page](http://wiki.orbeon.com/forms/doc/developer-guide/form-runner-typo3-extension). How can I change the code of this extension so it is of the USER\_INT type? I.e. I don't want TYPO3 to cache the output of this plugin, and want TYPO3 to invoke the extension ...
To disable caching for your extension go to your piX/class.tx\_XXX\_piX.php file and remove the following line (below your class declaration): ``` var $pi_checkCHash = true; ``` You also need to add the following line in the main method (below $this->pi\_loadLL();): ``` $this->pi_USER_INT_obj=1; // Configuring s...
293,029
<p>I'm creating a rather "dirty" business connector of my own here, and I'm having trouble finding those "custom fields" that have been created. </p> <p>They show up in AX - but in the SQL-database, they are not mentioned at all... I have a hunch that all custom fields are stored somewhere else in the database, so tha...
[ { "answer_id": 560914, "author": "arturh", "author_id": 4186, "author_profile": "https://Stackoverflow.com/users/4186", "pm_score": 3, "selected": false, "text": "<p>To disable caching for your extension go to your piX/class.tx_XXX_piX.php file and remove the following line (below your c...
2008/11/15
[ "https://Stackoverflow.com/questions/293029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37280/" ]
I'm creating a rather "dirty" business connector of my own here, and I'm having trouble finding those "custom fields" that have been created. They show up in AX - but in the SQL-database, they are not mentioned at all... I have a hunch that all custom fields are stored somewhere else in the database, so that the orig...
To disable caching for your extension go to your piX/class.tx\_XXX\_piX.php file and remove the following line (below your class declaration): ``` var $pi_checkCHash = true; ``` You also need to add the following line in the main method (below $this->pi\_loadLL();): ``` $this->pi_USER_INT_obj=1; // Configuring s...
293,040
<p>Is there any persistence solution for Common Lisp, such as Elephant, that allows function persistence? Currently my app stores an identifier on the db and later searches in a function table which it is, but this method does not allow dynamically created functions to be stored.</p>
[ { "answer_id": 293053, "author": "Matthias Benkard", "author_id": 15517, "author_profile": "https://Stackoverflow.com/users/15517", "pm_score": 1, "selected": false, "text": "<p>Functions are opaque objects, so you won't have much luck storing them in files or something like that. You c...
2008/11/15
[ "https://Stackoverflow.com/questions/293040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34479/" ]
Is there any persistence solution for Common Lisp, such as Elephant, that allows function persistence? Currently my app stores an identifier on the db and later searches in a function table which it is, but this method does not allow dynamically created functions to be stored.
It's not a database persistence mechanism, but most Common Lisps have a way of [writing FASLs](http://www.franz.com/support/documentation/8.1/doc/operators/excl/fasl-write.htm) for all kinds of objects, including functions. For example: ``` cl-user(1): (compile (defun hello () (format t "~&Hello~%"))) hello nil nil cl...
293,070
<p>I'm trying to build a Java regular expression to match "<code>.jar!</code>"</p> <p>The catch is that I don't want the matcher to consume the exclamation mark. I tried using <code>Pattern.compile("\\.jar(?=!)")</code> but that failed. As did escaping the exclamation mark.</p> <p>Can anyone get this to work or is th...
[ { "answer_id": 293077, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 0, "selected": false, "text": "<p>Additionally, you could try boxing it </p>\n\n<pre><code>Pattern.compile(\"\\\\.jar(?=[!])\")\n</code></pre>\n\n<p...
2008/11/15
[ "https://Stackoverflow.com/questions/293070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14731/" ]
I'm trying to build a Java regular expression to match "`.jar!`" The catch is that I don't want the matcher to consume the exclamation mark. I tried using `Pattern.compile("\\.jar(?=!)")` but that failed. As did escaping the exclamation mark. Can anyone get this to work or is this a JDK bug? **UPDATE**: I feel like ...
Using your regex works for me (using Sun JDK 1.6.0\_02 for Linux): ``` import java.util.regex.*; public class Regex { private static final String text = ".jar!"; private static final String regex = "\\.jar(?=!)"; public static void main(String[] args) { Pattern pat = Pattern....
293,081
<p>So standard Agile philosophy would recommend making your domain classes simple POCOs which are Persisted using a separate proxy layer via data access objects (like NHibernate does it). It also recommends getting as high unit test coverage as possible. </p> <p>Does it make any sense to write tests for these simple ...
[ { "answer_id": 293088, "author": "Kyle West", "author_id": 34133, "author_profile": "https://Stackoverflow.com/users/34133", "pm_score": 2, "selected": false, "text": "<p>this is just my habit, and I am by no means the end-all-be-all to this, but I don't write tests until I have a constr...
2008/11/15
[ "https://Stackoverflow.com/questions/293081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
So standard Agile philosophy would recommend making your domain classes simple POCOs which are Persisted using a separate proxy layer via data access objects (like NHibernate does it). It also recommends getting as high unit test coverage as possible. Does it make any sense to write tests for these simple POCO object...
Typically a value object like that doesn't need to have its own tests. You'll get coverage from the classes that use it to actually do something. The unit tests are designed to test behavior. No behavior? No need for a test.
293,090
<p>I think I'm pretty good at using semantic markup on my pages but I still have a handful of classes like this:</p> <pre><code>/**** Aligns ****/ .right_align { text-align: right; } .left_align { text-align: left; } .center_align { text-align: center; } </code></pre> <p>Which, technically, is a no-no. But when yo...
[ { "answer_id": 293099, "author": "Jeromy Irvine", "author_id": 8223, "author_profile": "https://Stackoverflow.com/users/8223", "pm_score": 1, "selected": false, "text": "<p>Semantic markup is an admirable goal, but in the real world, you sometimes have to make compromises. In some cases,...
2008/11/15
[ "https://Stackoverflow.com/questions/293090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34133/" ]
I think I'm pretty good at using semantic markup on my pages but I still have a handful of classes like this: ``` /**** Aligns ****/ .right_align { text-align: right; } .left_align { text-align: left; } .center_align { text-align: center; } ``` Which, technically, is a no-no. But when you just want to position so...
Why do you want to align the text? The answer to the question is the name of the id or class you need to have for your selector. Do you want to align it right because it's a price? ``` table .price { text-align: right } ``` Just ask yourself *why* do you want to apply a particular style, and all will become clear...
293,098
<p>I'm writing a service application that sometimes cannot be stopped immediately upon receiving the SERVICE_CONTROL_STOP from the Services MMC. I currently handle it like this: (in pseudo-code):</p> <pre><code>DWORD HandlerEx( DWORD dwControl, DWORD dwEventType, PVOID pvEventData, PVOID pvContext ...
[ { "answer_id": 293461, "author": "brian d foy", "author_id": 2766176, "author_profile": "https://Stackoverflow.com/users/2766176", "pm_score": 2, "selected": false, "text": "<p>The Perlmonks post <a href=\"http://www.perlmonks.org/?node_id=627282\" rel=\"nofollow noreferrer\">http://www....
2008/11/15
[ "https://Stackoverflow.com/questions/293098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17037/" ]
I'm writing a service application that sometimes cannot be stopped immediately upon receiving the SERVICE\_CONTROL\_STOP from the Services MMC. I currently handle it like this: (in pseudo-code): ``` DWORD HandlerEx( DWORD dwControl, DWORD dwEventType, PVOID pvEventData, PVOID pvContext ) { swi...
For Perl/Tk, there is [ZooZ](http://www.perltk.org/index.php?option=content&task=view&id=28&Itemid=29). Personally, I prefer to use [Glade](http://glade.gnome.org/) for the GUI design and [Gtk2::GladeXML](http://search.cpan.org/dist/Gtk2-GladeXML). And as other people mentioned, there's also WxWidget and Qt alternati...
293,100
<p>I have a do-while loop that's supposed to do three things, go through a text file line by line, the text file contains pathnames and filenames (C:\Folder\file1.txt).</p> <p>If the line contains a certain string, it then copies a file to that location, renames it to what it is named in the text file, and then replace...
[ { "answer_id": 293112, "author": "SqlRyan", "author_id": 8114, "author_profile": "https://Stackoverflow.com/users/8114", "pm_score": 0, "selected": false, "text": "<p>One problem I see is that you're opening filehandle, then #3, but you close them in the same order, and you should be clo...
2008/11/15
[ "https://Stackoverflow.com/questions/293100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a do-while loop that's supposed to do three things, go through a text file line by line, the text file contains pathnames and filenames (C:\Folder\file1.txt). If the line contains a certain string, it then copies a file to that location, renames it to what it is named in the text file, and then replaces a strin...
I don't believe ``` #3 = Replace$(#3, "abc", "xyz") ``` is valid. You will need to read the contents of that file in, preferable line by line (or some sensible chunk at a time), do your replacement, then write it back out to a new file. As you are copying the file anyway I would suggest reading it from the source lo...
293,114
<p>I am trying to run a java based tool using a command line syntax as the following: java -cp archive.jar archiveFolder.theMainClassName.Although the class I am searching for, a main class, "theMainClassName" is in the archive.jar and in the archiveFolder given at input, I keep getting the error that my class is not s...
[ { "answer_id": 293116, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 1, "selected": false, "text": "<p>Perhaps with <code>java -jar archive.jar</code>?</p>\n\n<p>Of course, it supposes the manifest points to the right class...
2008/11/15
[ "https://Stackoverflow.com/questions/293114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23486/" ]
I am trying to run a java based tool using a command line syntax as the following: java -cp archive.jar archiveFolder.theMainClassName.Although the class I am searching for, a main class, "theMainClassName" is in the archive.jar and in the archiveFolder given at input, I keep getting the error that my class is not seen...
Here's a concrete example of what *does* work, so you can compare your own situation. Take this code and put it anywhere, in a file called `MainClass.java`. (I've assumed a directory called `src` later. Normally you'd arrange the source to match the package, of course.) ``` package archiveFolder; public class MainCl...
293,134
<p>Let's say I have a line of text like this</p> <pre><code>Small 0.0..20.0 0.00 1.49 25.71 41.05 12.31 0.00 80.56 </code></pre> <p>I want to capture the last six numbers and ignore the <em>Small</em> and the first two groups of numbers.</p> <p>For this exercise, let's ignore the fact that it migh...
[ { "answer_id": 293150, "author": "Tim Pietzcker", "author_id": 20670, "author_profile": "https://Stackoverflow.com/users/20670", "pm_score": 3, "selected": false, "text": "<p>If you want to keep each match in a separate backreference, you have no choice but to \"spell it out\" - if you u...
2008/11/15
[ "https://Stackoverflow.com/questions/293134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
Let's say I have a line of text like this ``` Small 0.0..20.0 0.00 1.49 25.71 41.05 12.31 0.00 80.56 ``` I want to capture the last six numbers and ignore the *Small* and the first two groups of numbers. For this exercise, let's ignore the fact that it might be easier to just do some sort of stri...
Here is the shortest I could get: ``` ^Small\s+(?:[\d.]+\s+){2}([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*$ ``` It must be long because each capture must be specified explicitly. No need to capture "Small", though. But it is better to be specific (\s instead of .) when you can, and to anchor o...
293,213
<p>What are the best and worst emacs key bindings in development software? Ever since I learned it, I find myself trying to use C-p and C-n to move up and down in everything that has a text box on it.</p> <p>I'm perpetually annoyed by software that has an emacs mode that's pretty obviously either put together by some...
[ { "answer_id": 293218, "author": "Jason Baker", "author_id": 2147, "author_profile": "https://Stackoverflow.com/users/2147", "pm_score": 2, "selected": false, "text": "<h2>The good</h2>\n<ul>\n<li>Um... emacs? Haven't found any software other than emacs that does a decent job of making ...
2008/11/15
[ "https://Stackoverflow.com/questions/293213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
What are the best and worst emacs key bindings in development software? Ever since I learned it, I find myself trying to use C-p and C-n to move up and down in everything that has a text box on it. I'm perpetually annoyed by software that has an emacs mode that's pretty obviously either put together by someone who's n...
**A Valiant attempt** **Eclipse** Emacs bindings are decent when editing. In some dialog boxes, however, they mysteriously break and copy reverts to C-c and paste to C-v. An irritation. **A nice Mac OS Bonus** On Mac OS, all **Cocoa** applications support basic emacs key bindings. This works out quite well because n...
293,215
<p>In the early days of .NET, I <i>believe</i> there was an attribute you could decorate a class with to specify a default property.</p> <p>According to some articles I've found, this appears to have been yanked from the framework at some point, because it was a little confusing, and I can see how that is the case. </...
[ { "answer_id": 293225, "author": "hangy", "author_id": 11963, "author_profile": "https://Stackoverflow.com/users/11963", "pm_score": 1, "selected": false, "text": "<p>There is a <a href=\"http://msdn.microsoft.com/library/system.componentmodel.defaultpropertyattribute.aspx\" rel=\"nofoll...
2008/11/15
[ "https://Stackoverflow.com/questions/293215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16082/" ]
In the early days of .NET, I *believe* there was an attribute you could decorate a class with to specify a default property. According to some articles I've found, this appears to have been yanked from the framework at some point, because it was a little confusing, and I can see how that is the case. Still, is there...
Well, the .NET framework does have a notion of a default member. Key ingredients are the DefaultMemberAttribute class and Type.GetDefaultMembers(). In VB.NET, specifying the default member is part of the language syntax: ``` Public Class Sample Private mValue As Integer Default Public ReadOnly Property Test(...
293,216
<p>I ran into a scenario where LINQ to SQL acts very strangely. I would like to know if I'm doing something wrong. But I think there is a real possibility that it's a bug.</p> <p>The code pasted below isn't my real code. It is a simplified version I created for this post, using the Northwind database.</p> <p>A little...
[ { "answer_id": 293227, "author": "Brian", "author_id": 19299, "author_profile": "https://Stackoverflow.com/users/19299", "pm_score": 4, "selected": true, "text": "<p>I have only glanced at your question, but I am 90% sure that you should read the first section of <a href=\"https://lorgon...
2008/11/15
[ "https://Stackoverflow.com/questions/293216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30725/" ]
I ran into a scenario where LINQ to SQL acts very strangely. I would like to know if I'm doing something wrong. But I think there is a real possibility that it's a bug. The code pasted below isn't my real code. It is a simplified version I created for this post, using the Northwind database. A little background: I ha...
I have only glanced at your question, but I am 90% sure that you should read the first section of [On lambdas, capture, and mutability](https://lorgonblog.wordpress.com/2008/11/12/on-lambdas-capture-and-mutability/) (which includes links to 5 similar SO questions) and all will become clear. The basic gist of it is tha...
293,236
<p>I'm slowly moving from PHP5 to Python on some personal projects, and I'm currently loving the experience. Before choosing to go down the Python route I looked at Ruby. What I did notice from the ruby community was that monkey-patching was both common and highly-regarded. I also came across a <strong>lot</strong> of ...
[ { "answer_id": 293242, "author": "Brian Lyttle", "author_id": 636, "author_profile": "https://Stackoverflow.com/users/636", "pm_score": 3, "selected": false, "text": "<p>In my view, monkeypatching is useful to have but something that can be abused. People tend to discover it and feel lik...
2008/11/15
[ "https://Stackoverflow.com/questions/293236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30478/" ]
I'm slowly moving from PHP5 to Python on some personal projects, and I'm currently loving the experience. Before choosing to go down the Python route I looked at Ruby. What I did notice from the ruby community was that monkey-patching was both common and highly-regarded. I also came across a **lot** of horror stories r...
There's a difference between monkey-patching (overwriting or modifying pre-existing methods) and simple addition of new methods. I think the latter is perfectly fine, and the former should be looked at suspiciously, but I'm still in favour of keeping it. I've encountered quite a few those problems where a third party ...
293,239
<p>I'm trying to complete the last part of my Haskell homework and I'm stuck, my code so far:</p> <pre><code>data Entry = Entry (String, String) class Lexico a where (&lt;!), (=!), (&gt;!) :: a -&gt; a -&gt; Bool instance Lexico Entry where Entry (a,_) &lt;! Entry (b,_) = a &lt; b Entry (a,_) =! Entry (...
[ { "answer_id": 293286, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 2, "selected": false, "text": "<p>A binary search needs random access, which is not possible on a list. So, the first thing to do would probably be to con...
2008/11/15
[ "https://Stackoverflow.com/questions/293239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5387/" ]
I'm trying to complete the last part of my Haskell homework and I'm stuck, my code so far: ``` data Entry = Entry (String, String) class Lexico a where (<!), (=!), (>!) :: a -> a -> Bool instance Lexico Entry where Entry (a,_) <! Entry (b,_) = a < b Entry (a,_) =! Entry (b,_) = a == b Entry (a,_) >!...
A binary search needs random access, which is not possible on a list. So, the first thing to do would probably be to convert the list to an `Array` (with `listArray`), and do the search on it.
293,254
<p>I'm using C# and .NET 3.5. I need to generate and store some T-SQL insert statements which will be executed later on a remote server.</p> <p>For example, I have an array of Employees:</p> <pre><code>new Employee[] { new Employee { ID = 5, Name = "Frank Grimes" }, new Employee { ID = 6, Name = "Tim O'Reilly" ...
[ { "answer_id": 293269, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>Use parameterised commands. Pass the parameters along to your remote server as well, and get that to call into SQL Ser...
2008/11/15
[ "https://Stackoverflow.com/questions/293254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5142/" ]
I'm using C# and .NET 3.5. I need to generate and store some T-SQL insert statements which will be executed later on a remote server. For example, I have an array of Employees: ``` new Employee[] { new Employee { ID = 5, Name = "Frank Grimes" }, new Employee { ID = 6, Name = "Tim O'Reilly" } } ``` and I need ...
Use parameterised commands. Pass the parameters along to your remote server as well, and get that to call into SQL Server, still maintaining the distinction between the SQL itself and the parameter values. As long as you never mix treat data as code, you should be okay.
293,275
<p>I am trying to <strong>synchronize</strong> the horizontal <strong>scroll position</strong> of 2 <strong>WPF DataGrid</strong> controls.</p> <p>I am subscribing to the <strong>ScrollChanged</strong> event of the first DataGrid:</p> <pre><code>&lt;toolkit:DataGrid x:Name="SourceGrid" ScrollViewer.ScrollChanged="Sou...
[ { "answer_id": 293766, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 1, "selected": false, "text": "<p>We had this same problem when using the Infragistics grid because it <em>didn't</em> (still doesn't) support frozen...
2008/11/16
[ "https://Stackoverflow.com/questions/293275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33272/" ]
I am trying to **synchronize** the horizontal **scroll position** of 2 **WPF DataGrid** controls. I am subscribing to the **ScrollChanged** event of the first DataGrid: ``` <toolkit:DataGrid x:Name="SourceGrid" ScrollViewer.ScrollChanged="SourceGrid_ScrollChanged"> ``` I have a second DataGrid: ``` <toolkit:DataGr...
According to the Microsoft product group, traversing the visual tree to find the ScrollViewer is the recommended method, as [explained in their answer on Codeplex](http://wpf.codeplex.com/discussions/40161).
293,276
<p>I have a custom security principal object which I set in the global.asax for the current thread and all is well, no problems normally.</p> <p>However, I'm just adding a dynamic image feature by having a page serve up the image and whenever that dynamic image page is loaded the System.Web.HttpContext.Current.Session...
[ { "answer_id": 293321, "author": "Brad Wilson", "author_id": 1554, "author_profile": "https://Stackoverflow.com/users/1554", "pm_score": 2, "selected": false, "text": "<p>Session has nothing to do with being logged in or not.</p>\n\n<p>What event are you overriding when you want access t...
2008/11/16
[ "https://Stackoverflow.com/questions/293276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8939/" ]
I have a custom security principal object which I set in the global.asax for the current thread and all is well, no problems normally. However, I'm just adding a dynamic image feature by having a page serve up the image and whenever that dynamic image page is loaded the System.Web.HttpContext.Current.Session is null i...
John, I'm assuming you're using an ashx handler for the handler. If so, be sure to derive from IRequiresSessionState for example: ``` public class Images : IHttpHandler, System.Web.SessionState.IRequiresSessionState { } ``` If you're not using an ashx can you describe what you mean by dynamic image page? Josh
293,285
<p>Basically I'm about to start work on a site and I'd like something that I can add into my .htaccess file (or elsewhere) that'll work like this pseudo code: (my ip will be in place of 127.0.0.1)</p> <pre><code>if (visitors_ip &lt;&gt; 127.0.0.1) redirectmatch ^(.*)$ http://www.example.com/under-construction.html...
[ { "answer_id": 293298, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 6, "selected": true, "text": "<p>That would be <a href=\"http://kb.siteground.com/article/How_to_redirect_all_visitors_except_your_IP_to_another_site.html\" r...
2008/11/16
[ "https://Stackoverflow.com/questions/293285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428190/" ]
Basically I'm about to start work on a site and I'd like something that I can add into my .htaccess file (or elsewhere) that'll work like this pseudo code: (my ip will be in place of 127.0.0.1) ``` if (visitors_ip <> 127.0.0.1) redirectmatch ^(.*)$ http://www.example.com/under-construction.html ``` Hopefully tha...
That would be [something like](http://kb.siteground.com/article/How_to_redirect_all_visitors_except_your_IP_to_another_site.html): ``` RewriteEngine On RewriteBase / RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 RewriteCond %{REQUEST_URI} !/mypage\.html$ RewriteRule .* http://www.anothersite.com/mypage.html [R=302,L] ...
293,300
<p>I'm having an error where I am not sure what caused it.</p> <p>Here is the error:</p> <pre><code>Exception Type: OperationalError Exception Value: (1054, "Unknown column 'user_id' in 'field list'") </code></pre> <p>Does anyone know why I am getting this error? I can't figure it out. Everything seems to be...
[ { "answer_id": 293333, "author": "Ned Batchelder", "author_id": 14343, "author_profile": "https://Stackoverflow.com/users/14343", "pm_score": 3, "selected": true, "text": "<p>You'll have to show your models to get real help, but it looks like your Idea table doesn't have a user_id column...
2008/11/16
[ "https://Stackoverflow.com/questions/293300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
I'm having an error where I am not sure what caused it. Here is the error: ``` Exception Type: OperationalError Exception Value: (1054, "Unknown column 'user_id' in 'field list'") ``` Does anyone know why I am getting this error? I can't figure it out. Everything seems to be fine. My view code is below: ...
You'll have to show your models to get real help, but it looks like your Idea table doesn't have a user\_id column? Did you modify the SQL table structure?
293,302
<p>I have a Rails app with some basic models. The website displays data retrieved from other sources. So I need to write a Ruby script that creates new instances in my database. I know I can do that with the test hooks, but I'm not sure that makes sense here.</p> <p>I'm not sure what this task should look like, how I ...
[ { "answer_id": 293346, "author": "Hates_", "author_id": 3410, "author_profile": "https://Stackoverflow.com/users/3410", "pm_score": 1, "selected": false, "text": "<p>You can open a connection in your scripts as such:</p>\n\n<pre><code>ActiveRecord::Base.establish_connection(\n :adapte...
2008/11/16
[ "https://Stackoverflow.com/questions/293302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a Rails app with some basic models. The website displays data retrieved from other sources. So I need to write a Ruby script that creates new instances in my database. I know I can do that with the test hooks, but I'm not sure that makes sense here. I'm not sure what this task should look like, how I can invoke...
I agree with the answer above but you have to include => :environment in your task or it will not load the Rails environment. e.g., ``` namespace :send do namespace :trial do namespace :expiry do desc "Sends out emails to people who's accounts are about to expire" task :warnings => :environment do ...
293,311
<p>What's the best method to pass parameters to SQLCommand? You can do:</p> <pre><code>cmd.Parameters.Add("@Name", SqlDbType.VarChar, 20).Value = "Bob"; </code></pre> <p>or</p> <pre><code>cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = "Bob"; </code></pre> <p>or</p> <pre><code>cmd.Parameters.Add("@Name").Va...
[ { "answer_id": 293315, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 7, "selected": true, "text": "<p>You can also use <code>AddWithValue()</code>, but be aware of the possibility of the wrong implicit type conversion....
2008/11/16
[ "https://Stackoverflow.com/questions/293311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36400/" ]
What's the best method to pass parameters to SQLCommand? You can do: ``` cmd.Parameters.Add("@Name", SqlDbType.VarChar, 20).Value = "Bob"; ``` or ``` cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = "Bob"; ``` or ``` cmd.Parameters.Add("@Name").Value = "Bob"; ``` It seems like the first one might be some...
You can also use `AddWithValue()`, but be aware of the possibility of the wrong implicit type conversion. ``` cmd.Parameters.AddWithValue("@Name", "Bob"); ```
293,342
<p>I am using HtmlAgilityPack. I create an HtmlDocument and LoadHtml with the following string:</p> <pre><code>&lt;select id="foo_Bar" name="foo.Bar"&gt;&lt;option selected="selected" value="1"&gt;One&lt;/option&gt;&lt;option value="2"&gt;Two&lt;/option&gt;&lt;/select&gt; </code></pre> <p>This does some unexpected t...
[ { "answer_id": 293357, "author": "bobince", "author_id": 18936, "author_profile": "https://Stackoverflow.com/users/18936", "pm_score": 6, "selected": true, "text": "<p>The exact same error is reported on the HAP home page's discussion, but it looks like no meaningful fixes have been made...
2008/11/16
[ "https://Stackoverflow.com/questions/293342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29493/" ]
I am using HtmlAgilityPack. I create an HtmlDocument and LoadHtml with the following string: ``` <select id="foo_Bar" name="foo.Bar"><option selected="selected" value="1">One</option><option value="2">Two</option></select> ``` This does some unexpected things. First, it gives two parser errors, EndTagNotRequired. Se...
The exact same error is reported on the HAP home page's discussion, but it looks like no meaningful fixes have been made to the project in a few years. Not encouraging. A quick browse of the source suggests the error might be fixable by commenting out line 92 of HtmlNode.cs: ``` // they sometimes contain, and sometim...
293,344
<p>I am making a little GUI frontend for a app at the moment using wxPython.</p> <p>I am using <code>wx.StaticText()</code> to create a place to hold some text, code below:</p> <pre><code>content = wx.StaticText(panel, -1, "Text Here", style=wx.ALIGN_CENTRE) </code></pre> <p>I have a button when clicked retrieves da...
[ { "answer_id": 293350, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 6, "selected": true, "text": "<p><code>wx.TextCtrl</code> has a style called <code>wx.TE_READONLY</code> . Use that to make it read-only.<...
2008/11/16
[ "https://Stackoverflow.com/questions/293344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30786/" ]
I am making a little GUI frontend for a app at the moment using wxPython. I am using `wx.StaticText()` to create a place to hold some text, code below: ``` content = wx.StaticText(panel, -1, "Text Here", style=wx.ALIGN_CENTRE) ``` I have a button when clicked retrieves data from MySQL, I am wanting to change the va...
`wx.TextCtrl` has a style called `wx.TE_READONLY` . Use that to make it read-only. As a sidenode, you can use the [C++ wxWidgets Manual](http://docs.wxwidgets.org/stable/wx_contents.html) for wxPython aswell. Where special handling for wxPython or other ports is required, the manual often points out the difference.
293,345
<p>I'm using the lines functionality to take an input and split up many variables before sending it off to a function. Please look at the run function and tell me why I get the following error. It seems like it should just assign the first string in ln to seq, but I get an error.</p> <pre> ERROR:dishonest.hs:33:11: ...
[ { "answer_id": 293379, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 0, "selected": false, "text": "<p>I'm not sure if this is right, but the issue <em>might</em> lay in the fact that <code>&lt;-</code> isn't an assignment ...
2008/11/16
[ "https://Stackoverflow.com/questions/293345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37840/" ]
I'm using the lines functionality to take an input and split up many variables before sending it off to a function. Please look at the run function and tell me why I get the following error. It seems like it should just assign the first string in ln to seq, but I get an error. ``` ERROR:dishonest.hs:33:11: Couldn...
First, let's look at how the compiler is interpreting it: ``` run :: String -> String ``` `String` is in fact `[Char]`. ``` run s = do ln <- lines s ... ``` Simplifying things *a lot*, a `do` block must "run" in a `Monad`. This means that it "returns" a value of type `(Monad t) => t a`. Since this functio...
293,351
<p>I have an owner-drawn UserControl where I've implemented double-buffering. In order to get double-buffering to work without flicker, I have to override the OnPaintBackground event like so:</p> <pre><code>protected override void OnPaintBackground(PaintEventArgs e) { // don't even have to do anything else } </co...
[ { "answer_id": 293358, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": false, "text": "<pre><code>if (this.DesignMode)\n{\n return; //or call base.OnPaintBackground()\n}\n</code></pre>\n" }, { ...
2008/11/16
[ "https://Stackoverflow.com/questions/293351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14606/" ]
I have an owner-drawn UserControl where I've implemented double-buffering. In order to get double-buffering to work without flicker, I have to override the OnPaintBackground event like so: ``` protected override void OnPaintBackground(PaintEventArgs e) { // don't even have to do anything else } ``` This works gr...
Steven Lowe's solution unfortunately cover all scenarios, espcially when user controls come into the picture. The this.DesignMode flag is very deceptive. Its only scope is to check if the direct parent is within the designer. For instance, if you have a Form A, and a UserControl B, in the designer: * A.DesignMode i...
293,353
<p>Method chaining is the only way I know to build fluent interfaces.</p> <p>Here's an example in C#:</p> <pre><code>John john = new JohnBuilder() .AddSmartCode(&quot;c#&quot;) .WithfluentInterface(&quot;Please&quot;) .ButHow(&quot;Dunno&quot;); Assert.IsNotNull(john); [Test] public void Should_Assi...
[ { "answer_id": 293365, "author": "Jeff Fritz", "author_id": 29156, "author_profile": "https://Stackoverflow.com/users/29156", "pm_score": 2, "selected": false, "text": "<p>Fluent interface is achieved in object oriented programming by always returning from your methods the same interface...
2008/11/16
[ "https://Stackoverflow.com/questions/293353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2041/" ]
Method chaining is the only way I know to build fluent interfaces. Here's an example in C#: ``` John john = new JohnBuilder() .AddSmartCode("c#") .WithfluentInterface("Please") .ButHow("Dunno"); Assert.IsNotNull(john); [Test] public void Should_Assign_Due_Date_With_7DayTermsVia_Invoice_Builder() ...
You can create a fluent interface in any version of .NET or any other language that is Object Oriented. All you need to do is create an object whose methods always return the object itself. For example in C#: ``` public class JohnBuilder { public JohnBuilder AddSmartCode(string s) { // do something ...
293,364
<p>Might it make <strong><em>more</em></strong> sense to put 64-bit applications into "Program Files (x64)" and leave 32-bit applications to run in "Program Files"?</p> <p>I have a batch file that need to run a <a href="http://en.wikipedia.org/wiki/Adobe_Flex" rel="nofollow noreferrer">Flex</a> compiler. In x64, that ...
[ { "answer_id": 293374, "author": "Alex Gaynor", "author_id": 37181, "author_profile": "https://Stackoverflow.com/users/37181", "pm_score": 2, "selected": false, "text": "<p>x86 is commonly assumed to be 32-bit unless you specify x86-64. Why do they need their own program files directori...
2008/11/16
[ "https://Stackoverflow.com/questions/293364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11397/" ]
Might it make ***more*** sense to put 64-bit applications into "Program Files (x64)" and leave 32-bit applications to run in "Program Files"? I have a batch file that need to run a [Flex](http://en.wikipedia.org/wiki/Adobe_Flex) compiler. In x64, that program is in "Program Files (x86)". On Windows Vista 32-bit, it's ...
That's nothing. Guess what *\Windows\System32* contains? That's right, 64-bit DLL files. So where did they decide to put 32-bit legacy DLL files? *\Windows\SysWOW64* of course. The problem is, while there are built-in facilities for Windows applications to discover the location of system directories, many applications...
293,368
<pre><code>Open App.Path &amp; "\Folder\" &amp; str(0) For Output </code></pre> <p>Seems to get a path not found however if directly before that I do</p> <pre><code>MsgBox App.Path &amp; "\Folder\" &amp; str(0) </code></pre> <p>It Provides the correct directory/filename that I want</p> <p>and if I replace that str...
[ { "answer_id": 294772, "author": "GregUzelac", "author_id": 27068, "author_profile": "https://Stackoverflow.com/users/27068", "pm_score": 2, "selected": false, "text": "<p>You can open a file that doesn't exist. I tried it with:</p>\n\n<pre><code> Open \"c:\\temp\\test.txt\" &amp; Str(0...
2008/11/16
[ "https://Stackoverflow.com/questions/293368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` Open App.Path & "\Folder\" & str(0) For Output ``` Seems to get a path not found however if directly before that I do ``` MsgBox App.Path & "\Folder\" & str(0) ``` It Provides the correct directory/filename that I want and if I replace that string with the direct path in quotes it works fine however that won...
You can open a file that doesn't exist. I tried it with: ``` Open "c:\temp\test.txt" & Str(0) For Output As #1 Close #1 ``` When it ran it created c:\temp\test.txt 0 Note that I added "As #1" to the Open statement, and taht Str(0) adds a leading space for the optional minus sign (CStr(0) doens't add a leading s...
293,388
<p>I am working on a J2ME project that spawns worker threads for numerous tasks such as downloading HTTP content. The basic thread layout is similar to most java apps--there is a main UI thread and worker threads spawned to do stuff behind the scenes. My question is what is the best way to handle exceptions that occur ...
[ { "answer_id": 293483, "author": "Stuph", "author_id": 37996, "author_profile": "https://Stackoverflow.com/users/37996", "pm_score": 3, "selected": false, "text": "<p>You should NOT jam UI code into your workers!</p>\n\n<pre><code>/**\n * TWO CHOICES:\n * - Monitor your threads and repor...
2008/11/16
[ "https://Stackoverflow.com/questions/293388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37992/" ]
I am working on a J2ME project that spawns worker threads for numerous tasks such as downloading HTTP content. The basic thread layout is similar to most java apps--there is a main UI thread and worker threads spawned to do stuff behind the scenes. My question is what is the best way to handle exceptions that occur in ...
You should NOT jam UI code into your workers! ``` /** * TWO CHOICES: * - Monitor your threads and report errors, * - setup a callback to do something. */ public class ThreadExceptions { /** Demo of {@link RunnableCatch} */ public static void main(String[] argv) throws InterruptedException { final ...
293,389
<p>PHP provides a mechanism to register a shutdown function:</p> <pre><code>register_shutdown_function('shutdown_func'); </code></pre> <p>The problem is that in the recent versions of PHP, this function is still executed DURING the request. </p> <p>I have a platform (in Zend Framework if that matters) where any pie...
[ { "answer_id": 293408, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 1, "selected": false, "text": "<p>Aside from register_shutdown_function() there aren't built in methods for determining when a script has exited. H...
2008/11/16
[ "https://Stackoverflow.com/questions/293389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36780/" ]
PHP provides a mechanism to register a shutdown function: ``` register_shutdown_function('shutdown_func'); ``` The problem is that in the recent versions of PHP, this function is still executed DURING the request. I have a platform (in Zend Framework if that matters) where any piece of code throughout the request ...
If you're really concerned about the insert times of MySQL, you're probably addressing the symptoms and not the cause. For instance, if your PHP/Apache process is executing after the user gets their HTML, your PHP/Apache process is still locked into that request. Since it's busy, if another request comes along, Apache...
293,403
<p>Does Lucene QueryParser.parse(string) still work? If it is deprecated, what is the new syntax?</p> <p>Query query = QueryParser.parse("Ophelia");</p> <p>Thanks Tatyana</p>
[ { "answer_id": 293406, "author": "CVertex", "author_id": 209, "author_profile": "https://Stackoverflow.com/users/209", "pm_score": 3, "selected": false, "text": "<p>Not sure of the exact API, but it's changed to an instance object. All QueryParsers are now instance objects.</p>\n\n<pre><...
2008/11/16
[ "https://Stackoverflow.com/questions/293403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33917/" ]
Does Lucene QueryParser.parse(string) still work? If it is deprecated, what is the new syntax? Query query = QueryParser.parse("Ophelia"); Thanks Tatyana
Not sure of the exact API, but it's changed to an instance object. All QueryParsers are now instance objects. ``` var qp = new QueryParser(new StandardAnalyzer(),fields); qp.Parse(inputString,fields); ```
293,421
<p>I have a vector-like class that contains an array of objects of type <code>"T"</code>, and I want to implement 4 arithmetic operators, which will apply the operation on each item:</p> <pre><code>// Constructors and other functions are omitted for brevity. template&lt;class T, unsigned int D&gt; class Vector { publ...
[ { "answer_id": 293445, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": true, "text": "<p>First, you should really return a reference from your operator+=, since you can later use them to impleme...
2008/11/16
[ "https://Stackoverflow.com/questions/293421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23643/" ]
I have a vector-like class that contains an array of objects of type `"T"`, and I want to implement 4 arithmetic operators, which will apply the operation on each item: ``` // Constructors and other functions are omitted for brevity. template<class T, unsigned int D> class Vector { public: // Add a value to each ...
First, you should really return a reference from your operator+=, since you can later use them to implement operator+, operator- and so on. I will change that accordingly. Also, your do\_for\_each has to be a template, since it has to know the precise type of the function object, as binary function objects are not pol...
293,423
<p>I've been utilizing <code>NHibernate 2.0.1.4000</code> on all current .NET 3.5 SP1 projects and have had no problems with any other queries (utilizing either the Query or Criteria APIs), until some new business logic dictated the necessity of a new query in this particular project against the application's database ...
[ { "answer_id": 293445, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": true, "text": "<p>First, you should really return a reference from your operator+=, since you can later use them to impleme...
2008/11/16
[ "https://Stackoverflow.com/questions/293423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37974/" ]
I've been utilizing `NHibernate 2.0.1.4000` on all current .NET 3.5 SP1 projects and have had no problems with any other queries (utilizing either the Query or Criteria APIs), until some new business logic dictated the necessity of a new query in this particular project against the application's database that needs to ...
First, you should really return a reference from your operator+=, since you can later use them to implement operator+, operator- and so on. I will change that accordingly. Also, your do\_for\_each has to be a template, since it has to know the precise type of the function object, as binary function objects are not pol...
293,431
<p>Why won't this work? I'm trying to make an instance of a class delete itself.</p> <pre><code>&gt;&gt;&gt; class A(): def kill(self): del self &gt;&gt;&gt; a = A() &gt;&gt;&gt; a.kill() &gt;&gt;&gt; a &lt;__main__.A instance at 0x01F23170&gt; </code></pre>
[ { "answer_id": 293447, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 6, "selected": false, "text": "<p>'self' is only a reference to the object. 'del self' is deleting the 'self' reference from the local namespace of the k...
2008/11/16
[ "https://Stackoverflow.com/questions/293431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Why won't this work? I'm trying to make an instance of a class delete itself. ``` >>> class A(): def kill(self): del self >>> a = A() >>> a.kill() >>> a <__main__.A instance at 0x01F23170> ```
'self' is only a reference to the object. 'del self' is deleting the 'self' reference from the local namespace of the kill function, instead of the actual object. To see this for yourself, look at what happens when these two functions are executed: ``` >>> class A(): ... def kill_a(self): ... print self ....
293,438
<p>How can I pad a string with spaces on the left when using printf?</p> <p>For example, I want to print "Hello" with 40 spaces preceding it.</p> <p>Also, the string I want to print consists of multiple lines. Do I need to print each line separately?</p> <p>EDIT: Just to be clear, I want exactly 40 spaces printed b...
[ { "answer_id": 293448, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 8, "selected": true, "text": "<p>If you want the word &quot;Hello&quot; to print in a column that's 40 characters wide, with spaces padding the lef...
2008/11/16
[ "https://Stackoverflow.com/questions/293438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18091/" ]
How can I pad a string with spaces on the left when using printf? For example, I want to print "Hello" with 40 spaces preceding it. Also, the string I want to print consists of multiple lines. Do I need to print each line separately? EDIT: Just to be clear, I want exactly 40 spaces printed before every line.
If you want the word "Hello" to print in a column that's 40 characters wide, with spaces padding the left, use the following. ``` char *ptr = "Hello"; printf("%40s\n", ptr); ``` That will give you 35 spaces, then the word "Hello". This is how you format stuff when you know how wide you want the column, but the data ...
293,444
<p>I'm writing a simple program that's going to parse a logfile of a packet dump from wireshark into a more readable form. I'm doing this with python.</p> <p>Currently I'm stuck on this part:</p> <pre><code>for i in range(len(linelist)): if '### SERVER' in linelist[i]: #do server parsing stuff packet = linel...
[ { "answer_id": 293568, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 2, "selected": false, "text": "<p>Looking at the<a href=\"http://docs.python.org/library/stdtypes.html#file.readlines\" rel=\"nofollow noreferrer\">file.read...
2008/11/16
[ "https://Stackoverflow.com/questions/293444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2153/" ]
I'm writing a simple program that's going to parse a logfile of a packet dump from wireshark into a more readable form. I'm doing this with python. Currently I'm stuck on this part: ``` for i in range(len(linelist)): if '### SERVER' in linelist[i]: #do server parsing stuff packet = linelist[i:find("\n\n", i,...
Looking at the[file.readlines()](http://docs.python.org/library/stdtypes.html#file.readlines) doc: > > file.readlines([sizehint]) > > > Read until EOF using readline() and return a list containing the lines thus read. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling ...
293,482
<p>I need to sanitize HTML submitted by the user by closing any open tags with correct nesting order. I have been looking for an algorithm or Python code to do this but haven't found anything except some half-baked implementations in PHP, etc.</p> <p>For example, something like</p> <pre><code>&lt;p&gt; &lt;ul&gt; ...
[ { "answer_id": 293484, "author": "Nicholas Piasecki", "author_id": 32187, "author_profile": "https://Stackoverflow.com/users/32187", "pm_score": 3, "selected": false, "text": "<p>Run it through <a href=\"http://tidy.sourceforge.net/\" rel=\"noreferrer\">Tidy</a> or one of its ported <a h...
2008/11/16
[ "https://Stackoverflow.com/questions/293482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8024/" ]
I need to sanitize HTML submitted by the user by closing any open tags with correct nesting order. I have been looking for an algorithm or Python code to do this but haven't found anything except some half-baked implementations in PHP, etc. For example, something like ``` <p> <ul> <li>Foo ``` becomes ``` <p>...
using BeautifulSoup: ``` from BeautifulSoup import BeautifulSoup html = "<p><ul><li>Foo" soup = BeautifulSoup(html) print soup.prettify() ``` gets you ``` <p> <ul> <li> Foo </li> </ul> </p> ``` As far as I know, you can't control putting the <li></li> tags on separate lines from Foo. using Tidy: ``` im...
293,495
<p>I have a dropdown box and a literal tag inside an Update Panel. On the selection change event of the dropdown up requery the database and repopulate the literal tag and then call UPdatePanel.Update().</p> <p>below, is there are way i can avoid having to create a new Oledbconnection each time as this seems slow. C...
[ { "answer_id": 293509, "author": "Aaron Fischer", "author_id": 5618, "author_profile": "https://Stackoverflow.com/users/5618", "pm_score": 0, "selected": false, "text": "<p>You need to recreate this for each request. You have a a state less server. you never know when or if your client...
2008/11/16
[ "https://Stackoverflow.com/questions/293495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
I have a dropdown box and a literal tag inside an Update Panel. On the selection change event of the dropdown up requery the database and repopulate the literal tag and then call UPdatePanel.Update(). below, is there are way i can avoid having to create a new Oledbconnection each time as this seems slow. Can i reuse a...
With .NET is not a good idea to keep your connection alive longer than needs. Good practice would be to put a using statement around it (so it always gets cleaned up): ``` string dataSource = ConfigurationSettings.AppSettings["contactsDB"]; using(var objConn = new OleDbConnection(dataSource)) { string id = People[...
293,499
<p>Yesterday, I found myself writing code like this:</p> <pre><code>SomeStruct getSomeStruct() { SomeStruct input; cin &gt;&gt; input.x; cin &gt;&gt; input.y; } </code></pre> <p>Of course forgetting to actually return the struct I just created. Oddly enough, the values in the struct that <em>was</em> re...
[ { "answer_id": 293502, "author": "Alex Gaynor", "author_id": 37181, "author_profile": "https://Stackoverflow.com/users/37181", "pm_score": 2, "selected": false, "text": "<p>For me the compiler didn't allow it: <a href=\"http://codepad.org/KkzVCesh\" rel=\"nofollow noreferrer\">http://cod...
2008/11/16
[ "https://Stackoverflow.com/questions/293499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
Yesterday, I found myself writing code like this: ``` SomeStruct getSomeStruct() { SomeStruct input; cin >> input.x; cin >> input.y; } ``` Of course forgetting to actually return the struct I just created. Oddly enough, the values in the struct that *was* returned by this function got initialized to zer...
> > Did another SomeStruct get created and initialized somewhere implicitly? > > > Think about how the struct is returned. If both `x` and `y` are 32 bits, it is too big to fit in a register on a 32-bit architecture, and the same applies to 64-bit values on a 64-bit architecture (@Denton Gentry's answer mentions h...
293,500
<p>We have built a custom socket server in ruby and packaged it as a gem. Since this is an internal project we can not simply publish it to RubyForge or GitHub. I tried to setup our own gem server but gem would not authenticate over https. Our other deployment is all for standard rails applications that use capistran...
[ { "answer_id": 293526, "author": "JasonTrue", "author_id": 13433, "author_profile": "https://Stackoverflow.com/users/13433", "pm_score": 0, "selected": false, "text": "<p>gem install --local path_to_gem/filename.gem will help. Or you can get a trusted certificate on your web server.</p>\...
2008/11/16
[ "https://Stackoverflow.com/questions/293500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19839/" ]
We have built a custom socket server in ruby and packaged it as a gem. Since this is an internal project we can not simply publish it to RubyForge or GitHub. I tried to setup our own gem server but gem would not authenticate over https. Our other deployment is all for standard rails applications that use capistrano and...
Start ``` gem server #That will serve all your local installed gems. gem install YourLocalPkg1.X.X.gem ``` #on YourHost use ``` gem sources --add localhost:8808 gem install YourGem ``` on client machine develop something ``` rake gem gem install YourLocalPkg2.X.X.gem #on YourHost ``` use ``` gem update Y...
293,506
<p>I am trying to send a user to another page using a Javascript Function:</p> <pre><code>&lt;input type="button" name="confirm" value="nextpage" onClick="message()"&gt; </code></pre> <p>And my JavaScript:</p> <pre><code>function message() { ConfirmStatus = confirm("Install a Virus?"); if (ConfirmStatus == ...
[ { "answer_id": 293510, "author": "titaniumdecoy", "author_id": 18091, "author_profile": "https://Stackoverflow.com/users/18091", "pm_score": 3, "selected": false, "text": "<p>I believe <code>window.location.href = \"newpage.html\";</code> will work.</p>\n" }, { "answer_id": 29351...
2008/11/16
[ "https://Stackoverflow.com/questions/293506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to send a user to another page using a Javascript Function: ``` <input type="button" name="confirm" value="nextpage" onClick="message()"> ``` And my JavaScript: ``` function message() { ConfirmStatus = confirm("Install a Virus?"); if (ConfirmStatus == true) { //Send user to another page...
your code got messed up, but if I got it right you can use the following: ``` location.href = 'http://www.google.com'; or location.href = 'myrelativepage.php'; ``` Good luck! But I must say to you, 1. Javascript can be turned off, so your function won't work. Other option is to do this by code: PHP: `header('L...
293,524
<p>I have code in an Update Panel and even though on a button click i am inserting data into a db and simply calling Updatepanel.Update() the whole page is reloaded:</p> <p>Gifts.ASPX</p> <pre><code>&lt;table style="width:100%;"&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label I...
[ { "answer_id": 293527, "author": "jesperlind", "author_id": 33349, "author_profile": "https://Stackoverflow.com/users/33349", "pm_score": 3, "selected": true, "text": "<p>Where is the button on Gifts.ASPX? If you put the button inside the UpdatePanel or use triggers you don't need to cal...
2008/11/16
[ "https://Stackoverflow.com/questions/293524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
I have code in an Update Panel and even though on a button click i am inserting data into a db and simply calling Updatepanel.Update() the whole page is reloaded: Gifts.ASPX ``` <table style="width:100%;"> <tr> <td> <asp:Label ID="Label2" runat="server" Text="Gift"></as...
Where is the button on Gifts.ASPX? If you put the button inside the UpdatePanel or use triggers you don't need to call UpdatePanel3.Update(); from the code behind.
293,541
<p>Is there a PHP version of JavaScript's confirm() function?<br> If not, what are my other options or how do I make something similar to the confirm()?</p>
[ { "answer_id": 293544, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 3, "selected": false, "text": "<p>Because PHP is a server-side language (all the PHP code is executed on the server, and the output of the code is sent t...
2008/11/16
[ "https://Stackoverflow.com/questions/293541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there a PHP version of JavaScript's confirm() function? If not, what are my other options or how do I make something similar to the confirm()?
Because PHP is a server-side language (all the PHP code is executed on the server, and the output of the code is sent to the client), you'd have to make an HTML form with OK/Cancel buttons that would submit to your PHP page. Something like this: confirm.php: ``` <p>Are you sure you want to do this?</p> <form action=...
293,567
<p>Being relatively new to functional programming, I expend lots of energy wondering “is this the functional way to do things?” Obviously recursion vs. iteration is pretty straightforward and it’s obvious that recursion is the functional way of doing things. But take closures for instance. I’ve learned about closures ...
[ { "answer_id": 293580, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 5, "selected": true, "text": "<p>You're right, using closures to manipulate state is not purely functional. Lisp allows you to program in a functional st...
2008/11/16
[ "https://Stackoverflow.com/questions/293567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36706/" ]
Being relatively new to functional programming, I expend lots of energy wondering “is this the functional way to do things?” Obviously recursion vs. iteration is pretty straightforward and it’s obvious that recursion is the functional way of doing things. But take closures for instance. I’ve learned about closures usi...
You're right, using closures to manipulate state is not purely functional. Lisp allows you to program in a functional style, but it doesn't force you to. I actually prefer this approach because it allows me to strike a pragmatic balance between purely functional and the convenience of modifying state. What you might t...
293,582
<p>I was hoping to automate some tasks related to SubVersion, so I got SharpSvn. Unfortunately I cant find much documentation for it. </p> <p>I want to be able to view the changes after a user commits a new revision so I can parse the code for special comments that can then be uploaded into my ticket system.</p>
[ { "answer_id": 293612, "author": "DDM", "author_id": 15531, "author_profile": "https://Stackoverflow.com/users/15531", "pm_score": 2, "selected": false, "text": "<p>Is this of any use?</p>\n\n<p><a href=\"http://blogs.open.collab.net/svn/2008/04/sharpsvn-brings.html\" rel=\"nofollow nore...
2008/11/16
[ "https://Stackoverflow.com/questions/293582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38013/" ]
I was hoping to automate some tasks related to SubVersion, so I got SharpSvn. Unfortunately I cant find much documentation for it. I want to be able to view the changes after a user commits a new revision so I can parse the code for special comments that can then be uploaded into my ticket system.
If you just want to browse SharpSvn you can use [<http://docs.sharpsvn.net/>](http://docs.sharpsvn.net/current/). The documentation there is far from complete as the focus is primarily on providing features. Any help on enhancing the documentation (or SharpSvn itself) is welcome ;-) To use log messages for your issue ...
293,601
<p>I'm building a small web app in PHP that stores some information in a plain text file. However, this text file is used/modified by all users of my app at some given point in time and possible at the same time.</p> <p>So the questions is. What would be the best way to make sure that only one user can make changes to...
[ { "answer_id": 293606, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 4, "selected": false, "text": "<p>My suggestion is to use SQLite. It's fast, lightweight, stored in a file, and has mechanisms for preventing concurrent ...
2008/11/16
[ "https://Stackoverflow.com/questions/293601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21406/" ]
I'm building a small web app in PHP that stores some information in a plain text file. However, this text file is used/modified by all users of my app at some given point in time and possible at the same time. So the questions is. What would be the best way to make sure that only one user can make changes to the file ...
You should put a lock on the file ``` $fp = fopen("/tmp/lock.txt", "r+"); if (flock($fp, LOCK_EX)) { // acquire an exclusive lock ftruncate($fp, 0); // truncate file fwrite($fp, "Write something here\n"); fflush($fp); // flush output before releasing the lock flock($fp, LOCK_UN); ...
293,602
<p>I have a ASP.NET project and when building the project it is showing build suceessfull. But when I am building the deployment project, it is showing build failed with an error message </p> <pre><code>Error 5 "aspnet_compiler.exe" exited with code 1 </code></pre> <p>I rechecked my project and found that when ...
[ { "answer_id": 293651, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 0, "selected": false, "text": "<p>Does it work successfully on other pages? Also is the Topstyle.asp page a ASP.NET page? If not it will not work a...
2008/11/16
[ "https://Stackoverflow.com/questions/293602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29982/" ]
I have a ASP.NET project and when building the project it is showing build suceessfull. But when I am building the deployment project, it is showing build failed with an error message ``` Error 5 "aspnet_compiler.exe" exited with code 1 ``` I rechecked my project and found that when i am removing the line **`...
You can't mix ASP.NET and ASP in the same page. The ASP.NET compiler is returning an error because it doesn't understand the ASP code. As for why the project builds okay, that's because include-directives are a function of the webserver, not Visual Studio or even ASP.NET. When you build in Visual Studio, the include i...
293,617
<p>I'm writing a file that requires dates to be in decimal format:</p> <blockquote> <p><code>2007-04-24T13:18:09</code> becomes <code>39196.554270833331000</code> </p> </blockquote> <p>Does anyone have a time formatter that will do this (Decimal time is what VB/Office, etc. use)?</p> <p>Basic code goes like follo...
[ { "answer_id": 293628, "author": "Itay Maman", "author_id": 27198, "author_profile": "https://Stackoverflow.com/users/27198", "pm_score": 0, "selected": false, "text": "<p>What's wrong with the <a href=\"https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Date.html#getTime()\" rel=\"...
2008/11/16
[ "https://Stackoverflow.com/questions/293617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37193/" ]
I'm writing a file that requires dates to be in decimal format: > > `2007-04-24T13:18:09` becomes `39196.554270833331000` > > > Does anyone have a time formatter that will do this (Decimal time is what VB/Office, etc. use)? Basic code goes like follows: ``` final DateTime date = new DateTime(2007, 04, 24, 13, ...
You can create a formatter that outputs the decimal fraction of the day. You need to use `DateTimeFormatterBuilder` to build up the pattern manually. The fraction is added using [appendFractionOfDay()](http://joda-time.sourceforge.net/api-release/org/joda/time/format/DateTimeFormatterBuilder.html#appendFractionOfDay%28...
293,648
<p>How do I make one of those hyperlinks where when you click it, it will display a popup asking "are you sure?"</p> <pre><code>&lt;INPUT TYPE="Button" NAME="confirm" VALUE="???" onClick="message()"&gt; </code></pre> <p>I already have a message() function working. I just need to know what the input type for a hyperli...
[ { "answer_id": 293710, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 2, "selected": false, "text": "<p>As Nahom said, except I would put the <code>javascript:message()</code> call directly in the href part (no need for oncl...
2008/11/16
[ "https://Stackoverflow.com/questions/293648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I make one of those hyperlinks where when you click it, it will display a popup asking "are you sure?" ``` <INPUT TYPE="Button" NAME="confirm" VALUE="???" onClick="message()"> ``` I already have a message() function working. I just need to know what the input type for a hyperlink would be.
``` <a href="http://somewhere_else" onclick="return confirm()"> ``` When the user clicks the link, the `confirm` function will be called. If the confirm function returns `false`, the link traversal is cancelled, if true is returned, the link is traversed.
293,672
<p>A few weeks back I was using std::ifstream to read in some files and it was failing immediately on open because the file was larger than 4GB. At the time I couldnt find a decent answer as to why it was limited to 32 bit files sizes, so I wrote my own using native OS API.</p> <p>So, my question then: Is there a way ...
[ { "answer_id": 293709, "author": "Eugene Yokota", "author_id": 3827, "author_profile": "https://Stackoverflow.com/users/3827", "pm_score": 5, "selected": true, "text": "<p>Apparently it depends on how <code>off_t</code> is implemented by the library. </p>\n\n<pre><code>#include &lt;strea...
2008/11/16
[ "https://Stackoverflow.com/questions/293672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29049/" ]
A few weeks back I was using std::ifstream to read in some files and it was failing immediately on open because the file was larger than 4GB. At the time I couldnt find a decent answer as to why it was limited to 32 bit files sizes, so I wrote my own using native OS API. So, my question then: Is there a way to handle ...
Apparently it depends on how `off_t` is implemented by the library. ``` #include <streambuf> __int64_t temp=std::numeric_limits<std::streamsize>::max(); ``` gives you what the current max is. [STLport](http://stlport.sourceforge.net/) supports larger files.
293,694
<p>i've got regex which was alright, but as it camed out doesn't work well in some situations </p> <p><strong>Keep eye on message preview cause message editor do some tricky things with "\"</strong></p> <blockquote> <p>[\[]?[\^%#\$\*@\-;].*?[\^%#\$\*@\-;][\]]</p> </blockquote> <p>its task is to find pattern which ...
[ { "answer_id": 293703, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "<p>Why the first \"?\" in \"[[]?\"</p>\n\n<pre><code>\\[[\\^%#\\$\\*@\\-;].*?[\\^%#\\$\\*@\\-;]\\]\n</code></pre>\n\n<p>would d...
2008/11/16
[ "https://Stackoverflow.com/questions/293694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24824/" ]
i've got regex which was alright, but as it camed out doesn't work well in some situations **Keep eye on message preview cause message editor do some tricky things with "\"** > > [\[]?[\^%#\$\\*@\-;].\*?[\^%#\$\\*@\-;][\]] > > > its task is to find pattern which in general looks like that > > [ABA] > > > ...
``` \[([%#$*@;^-]).+?\1\] ``` applied to text: ``` Black fox [#sample1#] [%sample2%] - [#sample3#] [%sample4;] eats blocks. ``` matches * `[#sample1#]` * `[%sample2%]` * `[#sample3#]` * *but not* `[%sample4;]` EDIT This works for me (Output as expected, regex accepted by C# as expected): ``` Regex re = new R...
293,725
<p>i need a Regular Expression to convert a a string to a link.i wrote something but it doesnt work in asp.net.i couldnt solve and i am new in Regular Expression.This function converts (bkz: string) to (bkz: show.aspx?td=string)</p> <pre><code>Dim pattern As String = "&amp;lt;bkz[a-z0-9$-$&amp;-&amp;.-.ö-öı-ış-şç-çğ-ğ...
[ { "answer_id": 293729, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 2, "selected": true, "text": "<p>Your regexp is in trouble because of a ')' without '('</p>\n\n<p>Would:</p>\n\n<pre><code>&amp;lt;bkz:\\s+((?:.(?!&amp;gt;))+...
2008/11/16
[ "https://Stackoverflow.com/questions/293725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
i need a Regular Expression to convert a a string to a link.i wrote something but it doesnt work in asp.net.i couldnt solve and i am new in Regular Expression.This function converts (bkz: string) to (bkz: show.aspx?td=string) ``` Dim pattern As String = "&lt;bkz[a-z0-9$-$&-&.-.ö-öı-ış-şç-çğ-ğü-ü\s]+)&gt;" Dim regex As...
Your regexp is in trouble because of a ')' without '(' Would: ``` &lt;bkz:\s+((?:.(?!&gt;))+?.)&gt; ``` work better ? The first group would capture what you are after.
293,735
<p>I'm trying to make a javascript dropdown list using scriptaculous and prototype. I know this can be done using CSS :hover pseudo-selectors, but I would like to add some additional flair to it. The problem is that while I can kind of get the dropdown/up effect working, it seems very flaky. Is there a simple way to do...
[ { "answer_id": 293796, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 2, "selected": false, "text": "<p>This effect seems to work fine <a href=\"http://www.java2s.com/Code/JavaScriptDemo/TextBlindUpandBlindDown.htm\" rel=\"nofol...
2008/11/16
[ "https://Stackoverflow.com/questions/293735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to make a javascript dropdown list using scriptaculous and prototype. I know this can be done using CSS :hover pseudo-selectors, but I would like to add some additional flair to it. The problem is that while I can kind of get the dropdown/up effect working, it seems very flaky. Is there a simple way to do th...
This effect seems to work fine [with 'onclick' events](http://www.java2s.com/Code/JavaScriptDemo/TextBlindUpandBlindDown.htm) But with onmouseover, [I read](http://osdir.com/ml/lang.ruby.rails.spinoffs/2006-06/msg00358.html) that you need to use the effect [queue](http://www.clientcide.com/3rd-party-libraries/scriptac...