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
536,281
<p>I've always used the following rule for signatures of functions that return ref-counted objects based on whether they do an AddRef or not, but want to explain it to my colleagues too... So my question is, is the rule described below a widely followed rule? I'm looking for pointers to (for example) coding rules that ...
[ { "answer_id": 537356, "author": "François Beausoleil", "author_id": 7355, "author_profile": "https://Stackoverflow.com/users/7355", "pm_score": 1, "selected": false, "text": "<p>I have an incomplete answer over at <a href=\"http://github.com/francois/so-536261/tree/master\" rel=\"nofoll...
2009/02/11
[ "https://Stackoverflow.com/questions/536281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38659/" ]
I've always used the following rule for signatures of functions that return ref-counted objects based on whether they do an AddRef or not, but want to explain it to my colleagues too... So my question is, is the rule described below a widely followed rule? I'm looking for pointers to (for example) coding rules that adv...
Here's a solution using a self-referential relationship using single table inheritance. Use these commands to create the app: ``` $ rails myproject $ cd myproject $ script/generate model publication type:string name:string $ script/generate model citation publication_id:integer reference_id:integer ``` The setup the...
536,283
<p>I am trying to pass some text from a textbox to a controller to get JSON results like so</p> <pre><code>function invokeAction() { var searchText = $("#SearchTextBox").val(); // Invoke MVC controller action $.getJSON("/Home/Results/" + searchText, bindResults); } </code></pre> <p>If I p...
[ { "answer_id": 536966, "author": "Christian Dalager", "author_id": 11239, "author_profile": "https://Stackoverflow.com/users/11239", "pm_score": 2, "selected": false, "text": "<p>You will have to fix your route and replace {id} with {search} in order to get it to bind to the correct para...
2009/02/11
[ "https://Stackoverflow.com/questions/536283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33054/" ]
I am trying to pass some text from a textbox to a controller to get JSON results like so ``` function invokeAction() { var searchText = $("#SearchTextBox").val(); // Invoke MVC controller action $.getJSON("/Home/Results/" + searchText, bindResults); } ``` If I put an alert here I can see...
I've had some problems returning json from services and I wasn't getting any calls back. it turned out that the json was malformed and I was able to test that and get those errors by handling the error option of the plain ajax call. ``` $.ajax({ type: "GET", url: "Home/Results/", data: { search: searchText }, ...
536,299
<p>This query seems to be running incredibly slow (25 seconds for 4 million records!) on Sybase v10 at a clients database:</p> <pre><code>Select max(tnr) from myTable; </code></pre> <p>With tnr being the primary key.</p> <p>If I run it 1000x on our server however, it seems to go fast (15 ms...) which makes me think...
[ { "answer_id": 539344, "author": "Allethrin", "author_id": 52347, "author_profile": "https://Stackoverflow.com/users/52347", "pm_score": 0, "selected": false, "text": "<p>Try <code>dbcc cacheremove</code></p>\n" }, { "answer_id": 553168, "author": "Vincent", "author_id": ...
2009/02/11
[ "https://Stackoverflow.com/questions/536299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21679/" ]
This query seems to be running incredibly slow (25 seconds for 4 million records!) on Sybase v10 at a clients database: ``` Select max(tnr) from myTable; ``` With tnr being the primary key. If I run it 1000x on our server however, it seems to go fast (15 ms...) which makes me think it's because the query result is...
Unfortunately dbcc cacheremove will not work as it does not clear down the pages from cache but rather removes the descriptor and places it back on the free chain. Aside from restarting the data server the only way to do this is to bind the object to a cache and then do your tests then unbind the object which will rem...
536,301
<p>I have a small namespace containing some type definitions, which I use to make my code look cleaner. However I don't want to have to add a "using namespace ..." line to every file that uses one of these types, after all I already have to add a #include for the file.</p> <hr> <p><i>MyFile.cpp:</i></p> <pre><code>#...
[ { "answer_id": 536312, "author": "jpalecek", "author_id": 51831, "author_profile": "https://Stackoverflow.com/users/51831", "pm_score": 2, "selected": false, "text": "<p>It's possible but I don't think it's wise. It just defeats the whole purpose of the namespace by exposing its contents...
2009/02/11
[ "https://Stackoverflow.com/questions/536301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61697/" ]
I have a small namespace containing some type definitions, which I use to make my code look cleaner. However I don't want to have to add a "using namespace ..." line to every file that uses one of these types, after all I already have to add a #include for the file. --- *MyFile.cpp:* ``` #include "typedefs.h" void B...
Use unnamednamespace.If you want to have the names visible only to the files in which you have included the headers ``` namespace { int i = 10; } ``` above has the same effect as like below code ``` namespace randomName { int i = 10; } using randomName; ``` so nothing will be accessible from any other file.
536,307
<p>I'm currently working on a largish Ruby on Rails project. It's old enough and big enough that it's not clear if all views are actually in use.</p> <p>Is there any script/plugin out there that can generate a list of unused view files? </p>
[ { "answer_id": 537656, "author": "Arne", "author_id": 30344, "author_profile": "https://Stackoverflow.com/users/30344", "pm_score": 4, "selected": true, "text": "<p>I wrote a script to find unused partials/views. I assumed, though, that \"unused\" means that a view-file is present for wh...
2009/02/11
[ "https://Stackoverflow.com/questions/536307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4936/" ]
I'm currently working on a largish Ruby on Rails project. It's old enough and big enough that it's not clear if all views are actually in use. Is there any script/plugin out there that can generate a list of unused view files?
I wrote a script to find unused partials/views. I assumed, though, that "unused" means that a view-file is present for which no controller-method is defined (any more). The script does not check whether the view is called because there is no link from the default-route to it. This would have been far more complex. Pla...
536,327
<p>First of all, I must say that I am quite new to the API java.util.concurrent, so maybe what I am doing is completely wrong.</p> <p>What do I want to do?</p> <p>I have a Java application that basically runs 2 separate processing (called <em>myFirstProcess</em>, <em>mySecondProcess</em>), but these processing must b...
[ { "answer_id": 536354, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 7, "selected": true, "text": "<p>You'd be better off using the <code>get()</code> method.</p>\n\n<pre><code>futureOne.get();\nfutureTwo.get();\n</code...
2009/02/11
[ "https://Stackoverflow.com/questions/536327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26457/" ]
First of all, I must say that I am quite new to the API java.util.concurrent, so maybe what I am doing is completely wrong. What do I want to do? I have a Java application that basically runs 2 separate processing (called *myFirstProcess*, *mySecondProcess*), but these processing must be run at the same time. So, I ...
You'd be better off using the `get()` method. ``` futureOne.get(); futureTwo.get(); ``` Both of which wait for notification from the thread that it finished processing, this saves you the busy-wait-with-timer you are now using which is not efficient nor elegant. As a bonus, you have the API `get(long timeout, TimeU...
536,334
<p>This has bugged me for a long time, and try as I might I can't find a way round it.</p> <p>When I'm editing text (specifically latex, but that doesn't matter) files, I want it to auto-wrap at 80 columns. It does this, except if I happen to be in the middle of a parenthetical clause, it indents the text which is <em...
[ { "answer_id": 536347, "author": "Henry B", "author_id": 6414, "author_profile": "https://Stackoverflow.com/users/6414", "pm_score": 1, "selected": false, "text": "<p>:set noai</p>\n\n<p>sets no auto indent tt may be smartindent though. Check out the doc and see if you can find something...
2009/02/11
[ "https://Stackoverflow.com/questions/536334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26334/" ]
This has bugged me for a long time, and try as I might I can't find a way round it. When I'm editing text (specifically latex, but that doesn't matter) files, I want it to auto-wrap at 80 columns. It does this, except if I happen to be in the middle of a parenthetical clause, it indents the text which is *very* annoyi...
``` :set nocindent ``` The other options do nothing, and the filetype detection doesn't change it.
536,345
<p>I have a service I have developed myself in C# and it includes an msi installation package. When I install this on my own computer I can see it (and start/stop it) in administrative tools -> Services but on another (very similar) machine I can't. I don't really care that much about whether I can see it there but som...
[ { "answer_id": 536427, "author": "Bob Moore", "author_id": 9368, "author_profile": "https://Stackoverflow.com/users/9368", "pm_score": 0, "selected": false, "text": "<p>Does this other machine have the appropriate version of .Net installed ?</p>\n" }, { "answer_id": 536581, "...
2009/02/11
[ "https://Stackoverflow.com/questions/536345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a service I have developed myself in C# and it includes an msi installation package. When I install this on my own computer I can see it (and start/stop it) in administrative tools -> Services but on another (very similar) machine I can't. I don't really care that much about whether I can see it there but someho...
I don't remember seeing any machine with a functional service that did not appear in the Services window. My first guess would be that your service is, in fact, **not installed**. Try installing it again [[MSDN](http://msdn.microsoft.com/en-us/library/aa984379(VS.71).aspx)] with ``` installutil yourproject.exe ``` ...
536,350
<p>Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and deleting stored procedures, triggers, constraints and all the dependencies in one SQL statement?</p> <p><strong>REASON FOR REQUEST:</strong></p> <p>I want to have a DB script for cleaning up an existing DB which is n...
[ { "answer_id": 536367, "author": "John Sansom", "author_id": 60308, "author_profile": "https://Stackoverflow.com/users/60308", "pm_score": -1, "selected": false, "text": "<p>There is no single statement that can be used to achieve this aim.</p>\n\n<p>You could of course create yourself a...
2009/02/11
[ "https://Stackoverflow.com/questions/536350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53270/" ]
Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and deleting stored procedures, triggers, constraints and all the dependencies in one SQL statement? **REASON FOR REQUEST:** I want to have a DB script for cleaning up an existing DB which is not in use rather than creating...
this script cleans all views, SPS, functions PKs, FKs and tables. ``` /* Drop all non-system stored procs */ DECLARE @name VARCHAR(128) DECLARE @SQL VARCHAR(254) SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) WHILE @name is not null BEGIN SELECT @SQL = 'D...
536,352
<p>I am currently integrating with a system created by a 3rd party. This system requires me to send a request using XML/HTTPS. The 3rd party send me the certificate and I installed it</p> <p>I use the following code:</p> <pre><code>using (WebClient client = new WebClient()) { client.Headers.Add(HttpRequestHeader.C...
[ { "answer_id": 3842773, "author": "atconway", "author_id": 410937, "author_profile": "https://Stackoverflow.com/users/410937", "pm_score": 3, "selected": false, "text": "<p>For the VB.NET version of the original answer, here you go (converters don't work well when needing to wire up even...
2009/02/11
[ "https://Stackoverflow.com/questions/536352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5147/" ]
I am currently integrating with a system created by a 3rd party. This system requires me to send a request using XML/HTTPS. The 3rd party send me the certificate and I installed it I use the following code: ``` using (WebClient client = new WebClient()) { client.Headers.Add(HttpRequestHeader.ContentType, "text/xml...
The shortest notation of the code to allow all certificates is actually: ``` ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; ``` And works well for this error. Needless to say that you should provide an implementation which actually checks the certificate and decides based on the...
536,370
<p>I'm working on a grid system which has a number of very powerful computers. These can be used to execute python functions very quickly. My users have a number of python functions which take a long time to calculate on workstations, ideally they would like to be able to call some functions on a remote powerful server...
[ { "answer_id": 536408, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "<p>It sounds like you want to do the following.</p>\n\n<ul>\n<li><p>Define a shared filesystem space.</p></li>\n<li><p>Put ...
2009/02/11
[ "https://Stackoverflow.com/questions/536370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46411/" ]
I'm working on a grid system which has a number of very powerful computers. These can be used to execute python functions very quickly. My users have a number of python functions which take a long time to calculate on workstations, ideally they would like to be able to call some functions on a remote powerful server, b...
Take a look at [PyRO](https://pyro4.readthedocs.io/en/stable/) (Python Remote objects) It has the ability to set up services on all the computers in your cluster, and invoke them directly, or indirectly through a name server and a publish-subscribe mechanism.
536,379
<p>I frequently encounter this situation in my VB6 applications</p> <pre><code>Private Sub DoSomething On Error Goto err1 Call ProcessLargeBatch1 Call ProcessLargeBatch2 '... more ...' Exit Sub err1: Call Cleanup 'Specific for DoSomething' Call HandleError 'General error handling: Logging, message bo...
[ { "answer_id": 536394, "author": "Charles Graham", "author_id": 7705, "author_profile": "https://Stackoverflow.com/users/7705", "pm_score": 1, "selected": false, "text": "<p>Log your error first. Then do an On Error Resume Next. Have your cleanup encapsulated in methods that have their...
2009/02/11
[ "https://Stackoverflow.com/questions/536379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23368/" ]
I frequently encounter this situation in my VB6 applications ``` Private Sub DoSomething On Error Goto err1 Call ProcessLargeBatch1 Call ProcessLargeBatch2 '... more ...' Exit Sub err1: Call Cleanup 'Specific for DoSomething' Call HandleError 'General error handling: Logging, message box, ...' End S...
Firstly, read all the information out of the Err object that you will need, i.e. number, description, etc., then clear the error and do what you want. Change the way you inform the user to use the values you have cached, and not to use the Err object itself.
536,382
<p>I would like to change the behaviour of the insert button on the standard DBNavigator bar, from a dataset insert to append.</p> <p>I could trap the button click in the BeforeAction event, do the append, etc; and then in the OnClick event abort the original insert, but this seems a bit of a hack. Any better ideas? I...
[ { "answer_id": 536494, "author": "Ondrej Kelle", "author_id": 11480, "author_profile": "https://Stackoverflow.com/users/11480", "pm_score": 5, "selected": true, "text": "<p>You could derive your own class from TDBNavigator and override BtnClick method.\nOr, for a quick and dirty fix, you...
2009/02/11
[ "https://Stackoverflow.com/questions/536382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39664/" ]
I would like to change the behaviour of the insert button on the standard DBNavigator bar, from a dataset insert to append. I could trap the button click in the BeforeAction event, do the append, etc; and then in the OnClick event abort the original insert, but this seems a bit of a hack. Any better ideas? I'm using D...
You could derive your own class from TDBNavigator and override BtnClick method. Or, for a quick and dirty fix, you could change the insert button's click handler at runtime, e.g.: ``` type THackDBNavigator = class(TDBNavigator); procedure TForm1.DBNavigatorInsertClick(Sender: TObject); var DBNavigator: TDBNavigat...
536,396
<p>I would like to check whether an object (e.g. <code>someObject</code>) is assignable (cast-able) to a variable of another type (e.g. <code>SpecifiedType</code>). In Java, I can write:</p> <pre><code>someObject instanceof SpecifiedType </code></pre> <p>A related question is finding whether the runtime type of an ob...
[ { "answer_id": 536404, "author": "mouviciel", "author_id": 45249, "author_profile": "https://Stackoverflow.com/users/45249", "pm_score": 9, "selected": true, "text": "<p>Try <code>[myObject class]</code> for returning the class of an object.</p>\n\n<p>You can make exact comparisons with:...
2009/02/11
[ "https://Stackoverflow.com/questions/536396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9771/" ]
I would like to check whether an object (e.g. `someObject`) is assignable (cast-able) to a variable of another type (e.g. `SpecifiedType`). In Java, I can write: ``` someObject instanceof SpecifiedType ``` A related question is finding whether the runtime type of an object is equal to a another type. In Java, I can ...
Try `[myObject class]` for returning the class of an object. You can make exact comparisons with: ``` if ([myObject class] == [MyClass class]) ``` but not by using directly `MyClass` identifier. Similarily, you can find if the object is of a subclass of your class with: ``` if ([myObject isKindOfClass:[AnObject ...
536,399
<p>I have a NavigationBar app with two views: a parent and a sub view. In the sub view I'm adding a button to the right corner as follows:</p> <pre><code>- (void)viewDidLoad { UIBarButtonItem *tempButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"lock-unlocked.png"] style:UIBarButtonItemStylePl...
[ { "answer_id": 536599, "author": "Gcoop", "author_id": 65040, "author_profile": "https://Stackoverflow.com/users/65040", "pm_score": 5, "selected": true, "text": "<p>Question 1: Declare UIBarButtonItem *tempButton in the interface </p>\n\n<pre><code>@interface MyAppDelegate : NSObject &l...
2009/02/11
[ "https://Stackoverflow.com/questions/536399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44091/" ]
I have a NavigationBar app with two views: a parent and a sub view. In the sub view I'm adding a button to the right corner as follows: ``` - (void)viewDidLoad { UIBarButtonItem *tempButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"lock-unlocked.png"] style:UIBarButtonItemStylePlain target:sel...
Question 1: Declare UIBarButtonItem \*tempButton in the interface ``` @interface MyAppDelegate : NSObject <UIApplicationDelegate> { UIBarButtonItem *tempButton; } @property (nonatomic, retain) UIBarButtonItem *tempButton; ``` and synthesize it in the implementation. ``` @synthesize tempButton; ``` Create t...
536,400
<p>I am trying to attach a LINQ entity to the data context after I receive it from a form POST. However, all I get is the following exception:</p> <pre><code>An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy. </code></pre> <p>I ha...
[ { "answer_id": 537909, "author": "Benjamin Autin", "author_id": 1440933, "author_profile": "https://Stackoverflow.com/users/1440933", "pm_score": 5, "selected": true, "text": "<p>In the LinqToSQL designer set all of the Update Checks to Never and when you attach call it like so:</p>\n\n<...
2009/02/11
[ "https://Stackoverflow.com/questions/536400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5646/" ]
I am trying to attach a LINQ entity to the data context after I receive it from a form POST. However, all I get is the following exception: ``` An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy. ``` I have also tried attaching th...
In the LinqToSQL designer set all of the Update Checks to Never and when you attach call it like so: ``` context.entity.Attach(entity, true); ``` Alternatively, you could also grab the entity from the db and change it using the data from the POSTed entity, then submit that as a change.
536,430
<p>Hey! I am trying to change a number of seconds in to a proper time stamp format. Like I do this to change 180 to 03:00</p> <pre><code>private void writeTime(int tempo) { TimeSpan otempo = new TimeSpan(0, 0, tempo); string minutos = ((otempo.Minutes &lt;= 9) ? "0" : "") + ot...
[ { "answer_id": 536433, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<pre><code> int tempo = 180;\n TimeSpan time = TimeSpan.FromSeconds(tempo);\n string txt = string.Format(\n ...
2009/02/11
[ "https://Stackoverflow.com/questions/536430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8715/" ]
Hey! I am trying to change a number of seconds in to a proper time stamp format. Like I do this to change 180 to 03:00 ``` private void writeTime(int tempo) { TimeSpan otempo = new TimeSpan(0, 0, tempo); string minutos = ((otempo.Minutes <= 9) ? "0" : "") + otempo.Minutes.ToStr...
``` int tempo = 180; TimeSpan time = TimeSpan.FromSeconds(tempo); string txt = string.Format( "{0:00}:{1:00}", time.Minutes, time.Seconds); ``` (edit) As has already been observed - there are no immediate memory concerns with `TimeSpan`, since it is a `struct`. However, if you want to be paranoid:...
536,435
<p>Often I find myself filling ASP.NET repeaters with items that need the CSS class set depending on index: 'first' for index 0, 'last' for index (length-1), and 'mid' in the middle:</p> <pre><code>_repeater.DataSource = from f in foos select new { ...
[ { "answer_id": 536451, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>You might be interested in my <a href=\"http://www.yoda.arachsys.com/csharp/miscutil/usage/smartenumerable.html\" rel=...
2009/02/11
[ "https://Stackoverflow.com/questions/536435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6604/" ]
Often I find myself filling ASP.NET repeaters with items that need the CSS class set depending on index: 'first' for index 0, 'last' for index (length-1), and 'mid' in the middle: ``` _repeater.DataSource = from f in foos select new { ..., ...
You might be interested in my [SmartEnumerable](http://www.yoda.arachsys.com/csharp/miscutil/usage/smartenumerable.html) type in [MiscUtil](http://pobox.com/~skeet/csharp/miscutil). From the usage page, there's an example: ``` using System; using System.Collections.Generic; using MiscUtil.Collections; class Example...
536,441
<p>Its a .vbproj and looks like this</p> <pre><code>&lt;Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;PropertyGroup&gt; &lt;ProjectGuid&gt;15a7ee82-9020-4fda-a7fb-85a61664692d&lt;/ProjectGuid&gt; </code></pre> <p>all i want to get is the ProjectGuid but...
[ { "answer_id": 536460, "author": "Lonzo", "author_id": 47342, "author_profile": "https://Stackoverflow.com/users/47342", "pm_score": -1, "selected": false, "text": "<p>Why not use the // to ignore the namespace:</p>\n\n<pre><code>Dim value As Object = xmlDoc.SelectNodes(\"//ProjectGuid\"...
2009/02/11
[ "https://Stackoverflow.com/questions/536441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58553/" ]
Its a .vbproj and looks like this ``` <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectGuid>15a7ee82-9020-4fda-a7fb-85a61664692d</ProjectGuid> ``` all i want to get is the ProjectGuid but it does not work when a namespace is there... ``...
The best way to do things like this (IMHO) is to create a namespace manager. This can be used calling SelectNodes to indicate which namespace URLs are connected to which prefixes. I normally set up a static property that returns an adequate instance like this (it's C#, you'll have to translate): ``` private static Xml...
536,449
<p>I just got Java5 project that has this error, i tried using Java5 and Java6, but its still there. it worked somehow before(since it was in svn), how can i bypass that compiler error?</p>
[ { "answer_id": 536461, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "<p>Don't \"bypass\" the error - it won't do what you want it to. The error is there for good reason.</p>\n\n<p>The enum v...
2009/02/11
[ "https://Stackoverflow.com/questions/536449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30453/" ]
I just got Java5 project that has this error, i tried using Java5 and Java6, but its still there. it worked somehow before(since it was in svn), how can i bypass that compiler error?
Don't "bypass" the error - it won't do what you want it to. The error is there for good reason. The enum values are initialized before any other static fields. If you want to do something like adding all the values into a map, do it in a static initializer *after* everything else: ``` import java.util.*; public enum...
536,455
<p>I have a jquery menu that has so many entries that it extends further than the length of the page. I want to get the number of entries in each menu section so I can use that to resize a padding div at the end of the page.</p> <pre><code>$('.hideMe').click(function(){ alert( $(this).next('ul').children() ); });...
[ { "answer_id": 536462, "author": "Ionuț Staicu", "author_id": 23810, "author_profile": "https://Stackoverflow.com/users/23810", "pm_score": 3, "selected": true, "text": "<p>What about this:</p>\n\n<pre><code>$(this).next('ul').find('li').length\n</code></pre>\n\n<p>?</p>\n" }, { ...
2009/02/11
[ "https://Stackoverflow.com/questions/536455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65025/" ]
I have a jquery menu that has so many entries that it extends further than the length of the page. I want to get the number of entries in each menu section so I can use that to resize a padding div at the end of the page. ``` $('.hideMe').click(function(){ alert( $(this).next('ul').children() ); }); ``` So I w...
What about this: ``` $(this).next('ul').find('li').length ``` ?
536,464
<p>I have an ABC with several derived classes. To create these derived classes I use the factory pattern:</p> <p>.h file:</p> <pre><code>class derivedFactory { public: base* createInstance(); }; </code></pre> <p>.cpp file:</p> <pre><code>base* derivedFactory::createInstance() { return new derived(); } </co...
[ { "answer_id": 536490, "author": "thinkbeforecoding", "author_id": 47001, "author_profile": "https://Stackoverflow.com/users/47001", "pm_score": 1, "selected": false, "text": "<p>Having a interface with a single method or a pointer to method is equivalent.</p>\n\n<p>But in the second cas...
2009/02/11
[ "https://Stackoverflow.com/questions/536464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65031/" ]
I have an ABC with several derived classes. To create these derived classes I use the factory pattern: .h file: ``` class derivedFactory { public: base* createInstance(); }; ``` .cpp file: ``` base* derivedFactory::createInstance() { return new derived(); } ``` Is there any advantage to this over just ha...
It depends on how flexible your factory needs to be. If the factory needs external information (like from a configuration file, program options, etc) to determine how to construct objects, than an object makes sense. If all you will ever need is in the arguments to factory, than a function is probably fine. The only a...
536,478
<p>I'm looking for a simple java lib/src to highlight differences between two Strings, case-sensitive. A html output would be great, but I would be happy to get the indexes of the diffs, something like:</p> <pre><code>diff("abcd","aacd") &gt; [2,2] diff("maniac", "brainiac") &gt; ["man",brain"] or [0,3] or something ...
[ { "answer_id": 536509, "author": "Mikezx6r", "author_id": 5382, "author_profile": "https://Stackoverflow.com/users/5382", "pm_score": 4, "selected": true, "text": "<p>Apache Commons Lang has a class called StringUtils which has both difference and indexOfDifference which fulfills your ne...
2009/02/11
[ "https://Stackoverflow.com/questions/536478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22992/" ]
I'm looking for a simple java lib/src to highlight differences between two Strings, case-sensitive. A html output would be great, but I would be happy to get the indexes of the diffs, something like: ``` diff("abcd","aacd") > [2,2] diff("maniac", "brainiac") > ["man",brain"] or [0,3] or something like that ``` The ...
Apache Commons Lang has a class called StringUtils which has both difference and indexOfDifference which fulfills your needs. <http://commons.apache.org/lang/> Check it out
536,483
<p>I'm writing multilingual website. I have several files on server like:</p> <pre><code>/index.php /files.php /funny.php </code></pre> <p>And would like to add language support by placing language code into URL like this:</p> <pre><code>http://mywebsite/en/index.php </code></pre> <p>would redirect to:</p> <pre><c...
[ { "answer_id": 536530, "author": "Rich Adams", "author_id": 10018, "author_profile": "https://Stackoverflow.com/users/10018", "pm_score": 1, "selected": false, "text": "<p>Something like this should do the trick,</p>\n\n<pre><code>RewriteEngine on\nRewriteRule ^(.[^/]+)/(.*).php([5])?$ $...
2009/02/11
[ "https://Stackoverflow.com/questions/536483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38940/" ]
I'm writing multilingual website. I have several files on server like: ``` /index.php /files.php /funny.php ``` And would like to add language support by placing language code into URL like this: ``` http://mywebsite/en/index.php ``` would redirect to: ``` http://mywebsite/index.php?lang=en ``` And ``` http:...
Try this: ``` RewriteEngine on RewriteRule ^([a-z]{2}(-[A-Z]{2})?)/(.*) $3?lang=$1 [L,QSA] ``` And for the *current path* problem, you have to know how relative URIs are resolved: Relative URIs are resolved *by the client* from a base URI that is the URI (*not filesystem path!*) of the current resource if not declar...
536,502
<p>Is there any way to fadeout a div after 5 Seconds without using a setTimeOut function? </p>
[ { "answer_id": 536512, "author": "stuartd", "author_id": 43846, "author_profile": "https://Stackoverflow.com/users/43846", "pm_score": 0, "selected": false, "text": "<p>Assuming you mean 'wait five seconds and then fade out', I think you'll have to use a plugin to force the delay, eg <a ...
2009/02/11
[ "https://Stackoverflow.com/questions/536502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60917/" ]
Is there any way to fadeout a div after 5 Seconds without using a setTimeOut function?
everyone knows that in jquery 1.4 there's a delay function now, right? ``` $('#div').delay(5000).fadeOut(400) ``` that's how you do it, without having to add any custom functions or plug-ins. it's native to jquery 1.4
536,511
<p>Given a fileset</p> <pre><code>&lt;fileset id="myFiles" dir="."&gt; &lt;include name="**/*.file"/&gt; &lt;/fileset&gt; </code></pre> <p>How do I create a sub-directory at each file in the set, named after the filename without the extension?</p> <p>For example, given the files folderA/X.file and folderA/folder...
[ { "answer_id": 536554, "author": "Bhushan Bhangale", "author_id": 57423, "author_profile": "https://Stackoverflow.com/users/57423", "pm_score": 1, "selected": false, "text": "<p>You would be using for task to iterate on your file list. But I have not come across any substring type of uti...
2009/02/11
[ "https://Stackoverflow.com/questions/536511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45062/" ]
Given a fileset ``` <fileset id="myFiles" dir="."> <include name="**/*.file"/> </fileset> ``` How do I create a sub-directory at each file in the set, named after the filename without the extension? For example, given the files folderA/X.file and folderA/folderB/Y.file, I want to create the directories folderA/...
The ant touch task supports creating files, parent dirs and filename mapping, so can be used to achieve this: ``` <target name="mkdirs"> <touch mkdirs="true"> <fileset dir="the_dir"/> <mapper type="glob" from="*.file" to="the_dir/*/.tmp" /> </touch> <delete> <fileset dir="the_dir" inclu...
536,515
<p>I have a huge log file that has a structure like this:</p> <pre><code>ip=X.X.X.X userAgent=Firefox ----- Referer=hxxp://www.bla.org </code></pre> <p>I want to create a custom output like this: ip:userAgent</p> <p>for ex: </p> <pre><code>X.X.X.X:Firefox </code></pre> <p>and the pattern will ignore lines which do...
[ { "answer_id": 536545, "author": "José Leal", "author_id": 37190, "author_profile": "https://Stackoverflow.com/users/37190", "pm_score": 0, "selected": false, "text": "<p>You can use:</p>\n\n<pre><code>^ip=((?:[0-9]{1,3}\\.){3}[0-9]{1,3})$\n</code></pre>\n\n<p>And</p>\n\n<pre><code>^user...
2009/02/11
[ "https://Stackoverflow.com/questions/536515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a huge log file that has a structure like this: ``` ip=X.X.X.X userAgent=Firefox ----- Referer=hxxp://www.bla.org ``` I want to create a custom output like this: ip:userAgent for ex: ``` X.X.X.X:Firefox ``` and the pattern will ignore lines which don't start with ip= and userAgent=. (these two must form ...
``` ^ip=(\d+(?:\.\d+){3})[\r\n]+userAgent=(.+)$ ``` Apply in global + multiline mode. Group 1 will contain the IP, group 2 will contain the user agent string. Edit: The above expression can be simplified a bit, we can remove the IP address format checking - assuming that there will be nothing but real IP addresses ...
536,516
<p>I'm trying to log all the errors in my database into a table. So as user sys i wrote the following code:</p> <pre><code>CREATE TABLE servererror_log ( error_datetime TIMESTAMP, error_user VARCHAR2(30), db_name VARCHAR2(9), error_stack VARCHAR2(2000), captured_sql VARCHAR2(10...
[ { "answer_id": 536653, "author": "Yasin B", "author_id": 65055, "author_profile": "https://Stackoverflow.com/users/65055", "pm_score": 2, "selected": false, "text": "<p>Do not query v$sql; get the statement using ora_sql_txt.</p>\n\n<pre><code>CREATE OR REPLACE TRIGGER log_server_errors\...
2009/02/11
[ "https://Stackoverflow.com/questions/536516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/64550/" ]
I'm trying to log all the errors in my database into a table. So as user sys i wrote the following code: ``` CREATE TABLE servererror_log ( error_datetime TIMESTAMP, error_user VARCHAR2(30), db_name VARCHAR2(9), error_stack VARCHAR2(2000), captured_sql VARCHAR2(1000)); / CREATE...
Do not query v$sql; get the statement using ora\_sql\_txt. ``` CREATE OR REPLACE TRIGGER log_server_errors AFTER SERVERERROR ON DATABASE DECLARE sql_text ora_name_list_t; stmt clob; n number; BEGIN n := ora_sql_txt(sql_text); if n > 1000 then n:= 1000; end if ; FOR i IN 1..n LOOP stmt := stmt || sql_text(i)...
536,527
<p>I have a strongly typed User Control which should show a user's orders on all pages, it's included in a master page. I have an OrdersController which can give me the current orders and is used at other locations.</p> <p>How do I tell the UserControl in the Master Page that it should get its Data from that specific ...
[ { "answer_id": 536579, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>One way to do this would be to implement a base controller. Move the logic that obtains the orders to the base cont...
2009/02/11
[ "https://Stackoverflow.com/questions/536527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a strongly typed User Control which should show a user's orders on all pages, it's included in a master page. I have an OrdersController which can give me the current orders and is used at other locations. How do I tell the UserControl in the Master Page that it should get its Data from that specific Controller...
Pass model and ViewData as parameters to the RenderPartial method. It will make model and view data accessible as if you were in the parent view page. ``` <% Html.RenderPartial ( "../Shared/HRMasterData/DependentPersonDossiers", ViewData.Model, ViewData ); %> ```
536,538
<p>I need to send a value to an iframe.</p> <p>The iframe is present within the current window. How can I achieve this?</p> <p>I need to do it with javascript in the parent window that contains the iframe.</p>
[ { "answer_id": 536560, "author": "Gcoop", "author_id": 65040, "author_profile": "https://Stackoverflow.com/users/65040", "pm_score": 0, "selected": false, "text": "<p>Have a look at the link below, which suggests it is possible to alter the contents of an iFrame within your page with Jav...
2009/02/11
[ "https://Stackoverflow.com/questions/536538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38172/" ]
I need to send a value to an iframe. The iframe is present within the current window. How can I achieve this? I need to do it with javascript in the parent window that contains the iframe.
First, you need to understand that you have two documents: The frame and the container (which contains the frame). The main obstacle with manipulating the frame from the container is that the frame loads asynchronously. You can't simply access it any time, you must know when it has finished loading. So you need a tric...
536,552
<p>I want to change a value from <code>int</code> or <code>string</code> format to <code>datetime</code> format. There is any function in SQL like the following?:</p> <pre> Function: Result TimeAdd( nextrundate,"sec",45) 00:00:45 TimeAdd( nextrundate,"min",45) 00:45:0...
[ { "answer_id": 536570, "author": "RvdK", "author_id": 47351, "author_profile": "https://Stackoverflow.com/users/47351", "pm_score": 3, "selected": false, "text": "<p>You mean:</p>\n\n<ul>\n<li>TimeSpan.FromSeconds(double)</li>\n<li>TimeSpan.FromMinutes(double)</li>\n</ul>\n\n<p>see MSDN:...
2009/02/11
[ "https://Stackoverflow.com/questions/536552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52420/" ]
I want to change a value from `int` or `string` format to `datetime` format. There is any function in SQL like the following?: ``` Function: Result TimeAdd( nextrundate,"sec",45) 00:00:45 TimeAdd( nextrundate,"min",45) 00:45:00 TimeAdd( nextrundate,"hour",4) 04...
You mean: * TimeSpan.FromSeconds(double) * TimeSpan.FromMinutes(double) see MSDN: <http://msdn.microsoft.com/en-us/library/system.timespan_members(VS.80).aspx>
536,588
<p>How to prevent ctrl+v paste for flash.display.textarea()?</p> <p>field.selectable = false; does not seem to work, also it disables caret/cursor</p>
[ { "answer_id": 536784, "author": "Tom", "author_id": 20979, "author_profile": "https://Stackoverflow.com/users/20979", "pm_score": 2, "selected": true, "text": "<p>this seem to work in TextEvent listener, any comments is it too bad solution to avoid copy+paste to a field ?</p>\n\n<pre><...
2009/02/11
[ "https://Stackoverflow.com/questions/536588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20979/" ]
How to prevent ctrl+v paste for flash.display.textarea()? field.selectable = false; does not seem to work, also it disables caret/cursor
this seem to work in TextEvent listener, any comments is it too bad solution to avoid copy+paste to a field ? ``` if (evt.text.length >1) evt.preventDefault () ; ```
536,597
<p>I have an @XML document created from a single select statement. </p> <pre><code>&lt;root&gt; &lt;node&gt; &lt;node1&gt; &lt;targetNode&gt; &lt;/targetNode&gt; &lt;/node1&gt; &lt;node1&gt; &lt;targetNode&gt; &lt;/targetNode&gt; &lt;/node1&gt; &lt;node1&gt; &lt;targetNode&gt; &lt;/targetN...
[ { "answer_id": 536781, "author": "Jonas Lincoln", "author_id": 17436, "author_profile": "https://Stackoverflow.com/users/17436", "pm_score": 2, "selected": false, "text": "<p>That's not possible with the modify-function. It only works on a single node.</p>\n\n<p>You can manipulate it as ...
2009/02/11
[ "https://Stackoverflow.com/questions/536597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65035/" ]
I have an @XML document created from a single select statement. ``` <root> <node> <node1> <targetNode> </targetNode> </node1> <node1> <targetNode> </targetNode> </node1> <node1> <targetNode> </targetNode> </node1> </node> <node> ...... </node> </root> ``` I want to insert the xsi...
you can do this in the select, that you are using to create your xml, using the XSINILL parameter. <http://msdn.microsoft.com/en-us/library/ms178079.aspx> (here is a very rough example) ``` --create 2 tables and put some data in them create table node ( id int identity(1,1) primary key, node int ) GO create ta...
536,601
<p>Grails can be a bit of a bear to debug with its long stack dumps. Getting to the source of the problem can be tricky. I've gotten burned a few times in the BootStrap.groovy doing "def foo = new Foo(a: a, b: b).save()", for example. What are your favorite tricks for debugging Grails apps?</p>
[ { "answer_id": 539530, "author": "chanwit", "author_id": 60903, "author_profile": "https://Stackoverflow.com/users/60903", "pm_score": 2, "selected": false, "text": "<p>Here's some tricks collected by @<a href=\"http://twitter.com/groovymag\" rel=\"nofollow noreferrer\">groovymag</a> fro...
2009/02/11
[ "https://Stackoverflow.com/questions/536601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Grails can be a bit of a bear to debug with its long stack dumps. Getting to the source of the problem can be tricky. I've gotten burned a few times in the BootStrap.groovy doing "def foo = new Foo(a: a, b: b).save()", for example. What are your favorite tricks for debugging Grails apps?
Some general tips: * Clear stacktrace.log, do grails run-app, then open stacktrace.log in a viewer (I prefer `less stacktrace.log` on linux)... once in your viewer, search for .groovy and .gsp... that generally brings you to what you actually care about. * When a stacktrace refers to a line number in a GSP file, you s...
536,605
<p>I am trying to put some jquery UI code into an existing asp.net app, and could use a helping hand...</p> <p>I have a button, when a user clicks it, I want to popup a jquery UI dialog with two go/nogo confirmation buttons.</p> <p>This works except, when I click the button, it opens and then immediately closes...as...
[ { "answer_id": 536651, "author": "Steerpike", "author_id": 60598, "author_profile": "https://Stackoverflow.com/users/60598", "pm_score": 1, "selected": false, "text": "<p>Remove the </p>\n\n<pre><code>$('#CancelDialog').dialog(); \n</code></pre>\n\n<p>after </p>\n\n<pre><code>$(document...
2009/02/11
[ "https://Stackoverflow.com/questions/536605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53686/" ]
I am trying to put some jquery UI code into an existing asp.net app, and could use a helping hand... I have a button, when a user clicks it, I want to popup a jquery UI dialog with two go/nogo confirmation buttons. This works except, when I click the button, it opens and then immediately closes...as a new jquery user...
so you want to catch the event before it triggers the server, right? first of all, you need to take the Click event away, use that button as a normal button only, change the current button to: ``` <asp:Button id="btnShowDialog" Text="Delete Event" runat="server" OnClientClick="$('#myDialog').dialog('open');" /> ``` ...
536,619
<p>I have a page that will list news articles. To cut down on the page's length, I only want to display a teaser (the first 200 words / 600 letters of the article) and then display a "more..." link, that, when clicked, will expand the rest of the article in a jQuery/Javascript way. Now, I've all that figured out and ev...
[ { "answer_id": 536844, "author": "LDomagala", "author_id": 45719, "author_profile": "https://Stackoverflow.com/users/45719", "pm_score": 1, "selected": false, "text": "<p>you would have to write a more complex parsers if you dont want to split in the middle of html elements. it would hav...
2009/02/11
[ "https://Stackoverflow.com/questions/536619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29909/" ]
I have a page that will list news articles. To cut down on the page's length, I only want to display a teaser (the first 200 words / 600 letters of the article) and then display a "more..." link, that, when clicked, will expand the rest of the article in a jQuery/Javascript way. Now, I've all that figured out and even ...
Thanks a lot for your answers! However, in the meantime I stumbled upon the [jQuery HTML Truncator plugin](http://henrik.nyh.se/examples/truncator/), which perfectly fits my purposes and shifts the truncation to the client-side. It doesn't get any easier :-)
536,629
<p>I am using C# and created a proxy from a ASP.Net asmx Web Service at client side, by using Add Web Reference... feature of VSTS 2008.</p> <p>And I am using the asynchronous method call model (i.e. call the AsyncXXX method, which will return immediately) and handles the complete event (I add event handler to handle ...
[ { "answer_id": 536667, "author": "Michaël Carpentier", "author_id": 63081, "author_profile": "https://Stackoverflow.com/users/63081", "pm_score": -1, "selected": false, "text": "<p><code>SoapHttpClientProtocol</code> which your proxy should inherit from has a <code>Timeout</code> propert...
2009/02/11
[ "https://Stackoverflow.com/questions/536629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63235/" ]
I am using C# and created a proxy from a ASP.Net asmx Web Service at client side, by using Add Web Reference... feature of VSTS 2008. And I am using the asynchronous method call model (i.e. call the AsyncXXX method, which will return immediately) and handles the complete event (I add event handler to handle the comple...
In the web.config for your webservice you can set a timeout (You will also need to change to not be in debug mode if it is). This should then cause it to throw an exception that will raise your completed event. You will then need to inspect for an exception to see if it passed or failed. ``` <system.web> <httpRunt...
536,636
<p>I'm currently trying to write data from an array of objects to a range in Excel using the following code, where <code>objData</code> is just an array of strings:</p> <pre><code>private object m = System.Type.Missing; object[] objData = getDataIWantToWrite(); Range rn_Temp; rn_Temp = (Range)XlApp.get_Range(RangeNam...
[ { "answer_id": 536659, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 2, "selected": false, "text": "<p>You could put your data into a recordset and use <a href=\"http://msdn.microsoft.com/en-us/library/aa223845.aspx\" rel=...
2009/02/11
[ "https://Stackoverflow.com/questions/536636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4019/" ]
I'm currently trying to write data from an array of objects to a range in Excel using the following code, where `objData` is just an array of strings: ``` private object m = System.Type.Missing; object[] objData = getDataIWantToWrite(); Range rn_Temp; rn_Temp = (Range)XlApp.get_Range(RangeName, m); rn_Temp = rn_Temp....
This is an excerpt from method of mine, which converts a `DataTable` (the `dt` variable) into an array and then writes the array into a `Range` on a worksheet (`wsh` var). You can also change the `topRow` variable to whatever row you want the array of strings to be placed at. ``` object[,] arr = new object[dt.Rows.Cou...
536,661
<p>I want to convert an aspx page to PDF using a component that can convert Html to PDF. Is it possible to, during post back, redirect the output from the aspx-page and send it as a stream or string to a HtmlToPdf method?</p>
[ { "answer_id": 536733, "author": "ThorHalvor", "author_id": 63243, "author_profile": "https://Stackoverflow.com/users/63243", "pm_score": 0, "selected": false, "text": "<p>Have you tried to send the value returned from \"HttpContext.Current.Response.OutputStream;\" in the postback ?</p>\...
2009/02/11
[ "https://Stackoverflow.com/questions/536661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65058/" ]
I want to convert an aspx page to PDF using a component that can convert Html to PDF. Is it possible to, during post back, redirect the output from the aspx-page and send it as a stream or string to a HtmlToPdf method?
``` protected override void Render(HtmlTextWriter writer) { // setup a TextWriter to capture the page markup TextWriter tw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(tw); // render the page into our surrogate TextWriter base.Render(htw); // convert the TextWriter markup to a...
536,665
<p>I have some code that works and changes the style sheet using a form. That work as long as you keep the browser window open. You can got to a different site come back and the style will be the one you selected, thats fine but if u close the browser and come back it will be set to the default. Is this due to the fact...
[ { "answer_id": 536677, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 3, "selected": true, "text": "<p><a href=\"http://php.net/setcookie\" rel=\"nofollow noreferrer\">setcookie</a> has an <code>expire</code> parameter,...
2009/02/11
[ "https://Stackoverflow.com/questions/536665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60163/" ]
I have some code that works and changes the style sheet using a form. That work as long as you keep the browser window open. You can got to a different site come back and the style will be the one you selected, thats fine but if u close the browser and come back it will be set to the default. Is this due to the fact th...
[setcookie](http://php.net/setcookie) has an `expire` parameter, which you can use to set desired expiration date. docs have an example on how to do this. just create another cookie with font size information and invoke relevant stylesheet. radio button need to be inside the `form` tag to be send as a part of http req...
536,676
<p>I'm using the excellent JQuery UI to do a "mapping" so the user can "map" persons from one program to persons from other program.</p> <p>using this simple JQuery:</p> <pre><code>$(document).ready(function() { $("div .draggable").draggable({ revert: 'valid', snap: false }); $("div .drop...
[ { "answer_id": 543965, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 7, "selected": true, "text": "<ul>\n<li><strong>updated (08.Jul.2013)</strong> Updated with latest versions of libraries; html refactored using JsRend...
2009/02/11
[ "https://Stackoverflow.com/questions/536676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28004/" ]
I'm using the excellent JQuery UI to do a "mapping" so the user can "map" persons from one program to persons from other program. using this simple JQuery: ``` $(document).ready(function() { $("div .draggable").draggable({ revert: 'valid', snap: false }); $("div .droppable").droppable({ ...
* **updated (08.Jul.2013)** Updated with latest versions of libraries; html refactored using JsRender; * **updated (29.Sep.2011)** Added GIT Repo; cleaned the code; update to latest framework versions; * **updated (03.Mar.2013)** Fixed links with working example; Current example uses: * HTML 5 doctype * [jQuery](htt...
536,683
<p>In PHP I'm trying to match each character as its own group. Which would mimic the <code>str_split()</code>. I tried:</p> <pre><code>$string = '123abc456def'; preg_match_all('/(.)*/', $string, $array); // $array = array(2) { // [0]=&gt; array(2) { // [0]=&gt; string(12) "123abc456def" // [1]=&gt; st...
[ { "answer_id": 536713, "author": "alphadogg", "author_id": 59494, "author_profile": "https://Stackoverflow.com/users/59494", "pm_score": 3, "selected": true, "text": "<p>The * outside the parens means you want to repeat the capturing group. (This means you will only capture the last iter...
2009/02/11
[ "https://Stackoverflow.com/questions/536683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25411/" ]
In PHP I'm trying to match each character as its own group. Which would mimic the `str_split()`. I tried: ``` $string = '123abc456def'; preg_match_all('/(.)*/', $string, $array); // $array = array(2) { // [0]=> array(2) { // [0]=> string(12) "123abc456def" // [1]=> string(0) "" } // [1]=> array(2)...
The \* outside the parens means you want to repeat the capturing group. (This means you will only capture the last iteration.) Try a global match of any single character, like this: ``` preg_match_all('/(.)/', $subject, $result, PREG_PATTERN_ORDER); $result = $result[0]; ```
536,687
<p>I have a main menu in an MDI parent form, and it as a main menu. Now I need to change the first level caption of my first menu item in runtime. How can I do that?</p> <p>--- Update ---</p> <p>Sorry. I forgot to tell you that the mainMenu is housed in a TcontrolBar. I think that is the problem because all answer so...
[ { "answer_id": 536716, "author": "Ondrej Kelle", "author_id": 11480, "author_profile": "https://Stackoverflow.com/users/11480", "pm_score": 2, "selected": false, "text": "<p>Perhaps I'm missing something, but it seems to be very simple:</p>\n\n<pre><code>MainMenu1.Items[0].Caption := '&a...
2009/02/11
[ "https://Stackoverflow.com/questions/536687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48705/" ]
I have a main menu in an MDI parent form, and it as a main menu. Now I need to change the first level caption of my first menu item in runtime. How can I do that? --- Update --- Sorry. I forgot to tell you that the mainMenu is housed in a TcontrolBar. I think that is the problem because all answer so far don’t work. ...
Perhaps I'm missing something, but it seems to be very simple: ``` MainMenu1.Items[0].Caption := '&Hello'; // first top-level item MainMenu1.Items[1].Caption := '&World'; // second top-level item, etc. ```
536,688
<pre><code>&lt;?php if (preg_match('/^[a-z0-9]+$/', $_GET['page'])) { $page = realpath('includes/'.$_GET['page'].'.php'); $tpl = realpath('templates/'.$_GET['page'].'.html'); if ($page &amp;&amp; $tpl) { include $page; include $tpl; } else { // log error! } } else { // log error! } ?&gt; </code></pre> <p>H...
[ { "answer_id": 536695, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 0, "selected": false, "text": "<p>you including your own code. how safe is it?</p>\n" }, { "answer_id": 536704, "author": "Ian P", "a...
2009/02/11
[ "https://Stackoverflow.com/questions/536688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` <?php if (preg_match('/^[a-z0-9]+$/', $_GET['page'])) { $page = realpath('includes/'.$_GET['page'].'.php'); $tpl = realpath('templates/'.$_GET['page'].'.html'); if ($page && $tpl) { include $page; include $tpl; } else { // log error! } } else { // log error! } ?> ``` How safe would you say this is? Gu...
My first thought isn't about safety, but about why in the world would you do that?
536,691
<p>It was once possible to change the message a browser shows in the status bar at the bottom of the window. This functionality has been disabled in newer browser versions due to abuse.</p> <pre><code>&lt;script type="text/javascript"&gt; window.status = 'hello world'; &lt;/script&gt; </code></pre> <p>Is there still ...
[ { "answer_id": 536748, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>Using the browsers statusbar to display page info is in most cases a very bad idea, the browsers has not disabled it withou...
2009/02/11
[ "https://Stackoverflow.com/questions/536691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
It was once possible to change the message a browser shows in the status bar at the bottom of the window. This functionality has been disabled in newer browser versions due to abuse. ``` <script type="text/javascript"> window.status = 'hello world'; </script> ``` Is there still any way to achieve this (consider jQue...
There are two things you can do without Flash or Java: 1. Fake it: display a `div` that looks like a status bar. ``` position: fixed; bottom: 0; left: 0; border: 1px solid silver; background: #aaaaaa; ``` 2. Choose URLs so that you show desired information to the user when they hover over links. But please don't.
536,694
<p>I'm trying to retrieve HTTP HEAD information from a S3 resource using Python. Unfortunately the response always returns a 403 error. I am using code that was suggested <a href="https://stackoverflow.com/questions/107405/how-do-you-send-a-head-http-request-in-python">here</a> but unfortunately this does not work for...
[ { "answer_id": 536726, "author": "jheriko", "author_id": 17604, "author_profile": "https://Stackoverflow.com/users/17604", "pm_score": 0, "selected": false, "text": "<p>403 tells you that the request sent was valid (whether it was correct is another story), but that you don't have permis...
2009/02/11
[ "https://Stackoverflow.com/questions/536694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1199234/" ]
I'm trying to retrieve HTTP HEAD information from a S3 resource using Python. Unfortunately the response always returns a 403 error. I am using code that was suggested [here](https://stackoverflow.com/questions/107405/how-do-you-send-a-head-http-request-in-python) but unfortunately this does not work for S3 requests. ...
If you are using a signed URL, the URL is signed by method (e.g. HEAD or GET). So you will need a different URL for each method.
536,702
<p>Is there a way to figure out if a win 2003 server server you are connecting to is virtualised? I tried asking but not 100% sure of the answer is correct.</p>
[ { "answer_id": 536719, "author": "Sean Chambers", "author_id": 2993, "author_profile": "https://Stackoverflow.com/users/2993", "pm_score": 0, "selected": false, "text": "<p>This depends on a couple of factors.</p>\n\n<ol>\n<li>Are you using remote desktop to connect to the server and can...
2009/02/11
[ "https://Stackoverflow.com/questions/536702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52843/" ]
Is there a way to figure out if a win 2003 server server you are connecting to is virtualised? I tried asking but not 100% sure of the answer is correct.
I guess looking at the Device Manager (Control Panel | System | Hardware | Device Manager) should give you a good idea. On one server, running on VMWare ESX, I see the following tell-tale signs of a virtual machine: * System Devices: VMware server memory controller * Network adapters: VMware Accelerated AMD PCNet Ada...
536,712
<h2>Scenario:</h2> <ul> <li>I load some data into a local MySQL database each day, about 2 million rows;</li> <li>I have to (<em>have</em> to - it's an audit/regulatory thing) move to a "properly" administered server, which currently looks to be Oracle 10g;</li> <li>The server is in a different country: a network roun...
[ { "answer_id": 536738, "author": "Nuno G", "author_id": 20959, "author_profile": "https://Stackoverflow.com/users/20959", "pm_score": 3, "selected": false, "text": "<p>How about shipping the csv file to the oracle db server, use <a href=\"http://www.orafaq.com/wiki/SQL*Loader_FAQ\" rel=\...
2009/02/11
[ "https://Stackoverflow.com/questions/536712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1060/" ]
Scenario: --------- * I load some data into a local MySQL database each day, about 2 million rows; * I have to (*have* to - it's an audit/regulatory thing) move to a "properly" administered server, which currently looks to be Oracle 10g; * The server is in a different country: a network round-trip current takes 60-70 ...
You could use: ``` insert into tablea (id,b,c) ( select tablea_seq.nextval,1,2 from dual union all select tablea_seq.nextval,3,4 from dual union all select tablea_seq.nextval,3,4 from dual union all select tablea_seq.nextval,3,4 from dual union all ... ) ``` This works until about up to 1024 lines when...
536,721
<p>I have an informix database consisting of a large number of tables.</p> <p>I know that there is a string "example" somewhere inside some table, but don't know which table it is or which column it is. (I know this is a very rare case)</p> <p>Because of the large number of tables, there is no way to look for it manu...
[ { "answer_id": 537263, "author": "alphadogg", "author_id": 59494, "author_profile": "https://Stackoverflow.com/users/59494", "pm_score": 2, "selected": false, "text": "<p>Generally, you have two approaches.</p>\n\n<p>One way would be to dump each table to individual text files and grep t...
2009/02/11
[ "https://Stackoverflow.com/questions/536721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an informix database consisting of a large number of tables. I know that there is a string "example" somewhere inside some table, but don't know which table it is or which column it is. (I know this is a very rare case) Because of the large number of tables, there is no way to look for it manually. How do i fi...
Generally, you have two approaches. One way would be to dump each table to individual text files and grep the files. This can be done manually on a small database, or via a script in the case of a larger one. Look into UNLOAD and dbaccess. Example in a BASH script: (you'll need to generate the table list in the script...
536,728
<p>my sql statement is something like this below</p> <pre><code>DECLARE @OLD_NAV_VALUE AS INT DECLARE @FINAL AS INT SELECT @OLD_NAV_VALUE = [col1] from TBL_BA where DATE = @id_Date SET @FINAL = @OLD_NAV_VALUE * 50 </code></pre> <p>But the problem i am haveing here is that the column name in the select statement wh...
[ { "answer_id": 536812, "author": "Tom H", "author_id": 5696608, "author_profile": "https://Stackoverflow.com/users/5696608", "pm_score": 1, "selected": false, "text": "<p>First, I'd suggest that you do a Google on \"Erland dynamic SQL\" and read his white paper on the subject.</p>\n\n<p>...
2009/02/11
[ "https://Stackoverflow.com/questions/536728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20951/" ]
my sql statement is something like this below ``` DECLARE @OLD_NAV_VALUE AS INT DECLARE @FINAL AS INT SELECT @OLD_NAV_VALUE = [col1] from TBL_BA where DATE = @id_Date SET @FINAL = @OLD_NAV_VALUE * 50 ``` But the problem i am haveing here is that the column name in the select statement which is given as [col1] is ...
This worked for me. I declared a temp table and used it to receive the values from the select statement. Something like below. ``` declare @i int declare @v int create table #t (val int) insert into #t exec ('declare @i int set @i = 0 select @i+1') select * from #t ```
536,739
<p>I've just updated to .NET 3.5 SP1 and my once working ASP.NET MVC page has now stopped working.</p> <p>When trying to load a page I get the following YSOD</p> <pre><code>[CryptographicException: Padding is invalid and cannot be removed.] System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] i...
[ { "answer_id": 536933, "author": "Remmus", "author_id": 65051, "author_profile": "https://Stackoverflow.com/users/65051", "pm_score": 5, "selected": true, "text": "<p>Doh, just solved it.</p>\n\n<p>Cleared my browser cache and cookies and everything works fine again.</p>\n" }, { ...
2009/02/11
[ "https://Stackoverflow.com/questions/536739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65051/" ]
I've just updated to .NET 3.5 SP1 and my once working ASP.NET MVC page has now stopped working. When trying to load a page I get the following YSOD ``` [CryptographicException: Padding is invalid and cannot be removed.] System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inp...
Doh, just solved it. Cleared my browser cache and cookies and everything works fine again.
536,744
<p>I currently design all of my websites with a file for each page, then include common elements like the header, footer and so on. However, I've noticed that many frameworks and CMSs use the Front Controller pattern.</p> <p>What are the advantages and disadvantages of using a Front Controller? Is the pattern simply u...
[ { "answer_id": 536785, "author": "ThorHalvor", "author_id": 63243, "author_profile": "https://Stackoverflow.com/users/63243", "pm_score": 1, "selected": false, "text": "<p>One advantage of using a Front Controller is its testability. if you use TDD it is alot easier to test a controller ...
2009/02/11
[ "https://Stackoverflow.com/questions/536744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21709/" ]
I currently design all of my websites with a file for each page, then include common elements like the header, footer and so on. However, I've noticed that many frameworks and CMSs use the Front Controller pattern. What are the advantages and disadvantages of using a Front Controller? Is the pattern simply used in fra...
Srikanth has a good answer. I'd like to elaborate on the alternative, though. Suppose you have this simple URL hierarchy: ``` /gallery /blog /admin/login /admin/newpost ``` If this is implemented with Page Controllers (PHP, for example), both `gallery.php` and `blog.php` will need to include some `common.php` at th...
536,753
<p>These days I'm solving <a href="https://projecteuler.net" rel="nofollow noreferrer">Project Euler</a> problems in Erlang.</p> <p>Since I'm a C++ programmer from the beginning, sometimes I really want to code using two dimensional arrays.</p> <p>One of my idea is to use tuples and lists like this:</p> <pre><code>L...
[ { "answer_id": 536785, "author": "ThorHalvor", "author_id": 63243, "author_profile": "https://Stackoverflow.com/users/63243", "pm_score": 1, "selected": false, "text": "<p>One advantage of using a Front Controller is its testability. if you use TDD it is alot easier to test a controller ...
2009/02/11
[ "https://Stackoverflow.com/questions/536753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59597/" ]
These days I'm solving [Project Euler](https://projecteuler.net) problems in Erlang. Since I'm a C++ programmer from the beginning, sometimes I really want to code using two dimensional arrays. One of my idea is to use tuples and lists like this: ``` List=[{X,0}||X<-lists:seq(1,3)] {1,0} {2,0} {3,0} ``` Is there n...
Srikanth has a good answer. I'd like to elaborate on the alternative, though. Suppose you have this simple URL hierarchy: ``` /gallery /blog /admin/login /admin/newpost ``` If this is implemented with Page Controllers (PHP, for example), both `gallery.php` and `blog.php` will need to include some `common.php` at th...
536,760
<p>Does Ruby have block comments?</p> <p>If not, is there an efficient way of inserting <code>#</code> in front of a block of highlighted code in TextMate?</p>
[ { "answer_id": 536766, "author": "Garry Shutler", "author_id": 6369, "author_profile": "https://Stackoverflow.com/users/6369", "pm_score": 9, "selected": true, "text": "<p>You can do</p>\n\n<pre><code>=begin\n [Multi line comment]\n=end\n</code></pre>\n\n<p><code>=begin</code> and <code...
2009/02/11
[ "https://Stackoverflow.com/questions/536760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58521/" ]
Does Ruby have block comments? If not, is there an efficient way of inserting `#` in front of a block of highlighted code in TextMate?
You can do ``` =begin [Multi line comment] =end ``` `=begin` and `=end` must be at the beginning of the line (not indented at all). [Source](http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#embed_doc) Also, in TextMate you can press `Command` + `/` to toggle regular comments on a highlight...
536,775
<p>Is it possible to run a windows form application or a console application under system account? Like asp.net application can run under system account by changing machine config file :</p> <pre><code>&lt;processModel userName="machine" password="AutoGenerate" /&gt; </code></pre> <p>This is to give more privileges...
[ { "answer_id": 536789, "author": "MartinHN", "author_id": 2972, "author_profile": "https://Stackoverflow.com/users/2972", "pm_score": 0, "selected": false, "text": "<p>Can't you do that by launching it from a scheduled task in Windows?</p>\n" }, { "answer_id": 536816, "author...
2009/02/11
[ "https://Stackoverflow.com/questions/536775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is it possible to run a windows form application or a console application under system account? Like asp.net application can run under system account by changing machine config file : ``` <processModel userName="machine" password="AutoGenerate" /> ``` This is to give more privileges to the program ...
It sounds like you're attacking the symptom rather than the problem. What exactly does your program need to do that requires additional permissions? Maybe there's a different way of accomplishing that task without requiring any kind of elevation.
536,787
<p>For a standard "add item" form page it is desirable to have two submit buttons: an "OK" button and a "cancel" button, where the former POSTs the form to one URL, and the latter GETs some other URL.</p> <p>This obviously means that two separate FORMs are needed, and, if laid out with tables, the markup would go as f...
[ { "answer_id": 536873, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 2, "selected": false, "text": "<p>You broke my mind.</p>\n\n<p>There are many and varied problems with what you have here, but I'll start by pointing ou...
2009/02/11
[ "https://Stackoverflow.com/questions/536787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50572/" ]
For a standard "add item" form page it is desirable to have two submit buttons: an "OK" button and a "cancel" button, where the former POSTs the form to one URL, and the latter GETs some other URL. This obviously means that two separate FORMs are needed, and, if laid out with tables, the markup would go as follows: `...
You broke my mind. There are many and varied problems with what you have here, but I'll start by pointing out that Cancel/Reset are [not considered good](http://www.useit.com/alertbox/20000416.html) things [generally](http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=416). I'll follow that by poi...
536,798
<p>JetBrains ReSharper Issue</p> <p>We have the following C# code where we are populating an imagelist from an image resource file. ReSharper is indicating "Possible "null" assignment to entity with "NotNull" attribute".</p> <p>The issue would indicate to us that we simply need to check to ensure that our ResMan_Grap...
[ { "answer_id": 536828, "author": "Ryan Emerle", "author_id": 62195, "author_profile": "https://Stackoverflow.com/users/62195", "pm_score": -1, "selected": false, "text": "<p>So you've tried:</p>\n\n<pre><code>if( ResMan_Graphics != null ) {\n Icons.Images.Add((Image)ResMan_Graphics.GetO...
2009/02/11
[ "https://Stackoverflow.com/questions/536798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
JetBrains ReSharper Issue We have the following C# code where we are populating an imagelist from an image resource file. ReSharper is indicating "Possible "null" assignment to entity with "NotNull" attribute". The issue would indicate to us that we simply need to check to ensure that our ResMan\_Graphics is not null...
It's because `GetObject` might return null. You want to do this: ``` Image image = (Image)ResMan_Graphics.GetObject("ICON_Main"); if (image != null) Icons.Images.Add(image); ```
536,811
<p>Can you tell the idea of how to doing it?</p> <p>Code :</p> <pre><code>public void main(String[] args) { try { //Some Exception throws here } catch(SomeException se) { se.printStackTrace(); } finally { try { //SomeException1 throws here } cat...
[ { "answer_id": 536825, "author": "Srikanth", "author_id": 7205, "author_profile": "https://Stackoverflow.com/users/7205", "pm_score": 1, "selected": false, "text": "<p>How about printing outside of the first try block in your nested try blocks just before main ends?</p>\n\n<pre><code> p...
2009/02/11
[ "https://Stackoverflow.com/questions/536811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51659/" ]
Can you tell the idea of how to doing it? Code : ``` public void main(String[] args) { try { //Some Exception throws here } catch(SomeException se) { se.printStackTrace(); } finally { try { //SomeException1 throws here } catch(SomeException1 se1...
Just add another finally block ``` public void main(String[] args) { try { //Some Exception throws here } catch(SomeException se) { se.printStackTrace(); } finally { try { //SomeException1 throws here } catch(SomeException1 se1) { se.printStackTrace(); } finally { ...
536,814
<p>I have a webpage with an elastic layout that changes its width if the browser window is resized.</p> <p>In this layout there are headlines (<code>h2</code>) that will have a variable length (actually being headlines from blogposts that I don't have control over). Currently - if they are wider than the window - they...
[ { "answer_id": 536882, "author": "Ramuns Usovs", "author_id": 2952, "author_profile": "https://Stackoverflow.com/users/2952", "pm_score": 2, "selected": false, "text": "<p>Well, one simple solution, that doesn't quite add the \"...\", but does prevent the &lt;h2&gt; from breaking into tw...
2009/02/11
[ "https://Stackoverflow.com/questions/536814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
I have a webpage with an elastic layout that changes its width if the browser window is resized. In this layout there are headlines (`h2`) that will have a variable length (actually being headlines from blogposts that I don't have control over). Currently - if they are wider than the window - they are broken into two ...
I've got a solution working in FF3, Safari and IE6+ with single and multiline text ``` .ellipsis { white-space: nowrap; overflow: hidden; } .ellipsis.multiline { white-space: normal; } <div class="ellipsis" style="width: 100px; border: 1px solid black;">Lorem ipsum dolor sit amet, consectetur adipisicing...
536,820
<p>So I am learning WPF right now, and want to do a simple databind between a bool value, and whether or not a <code>MenuItem</code> is enabled or not. </p> <p>I have coded it like this:</p> <pre><code>&lt;MenuItem Name="miSaveFile" Header="Save" Click="miSaveFile_Click" IsEnabled="{Binding}" /&gt; </code></pre> <p...
[ { "answer_id": 536884, "author": "Kjetil Watnedal", "author_id": 4116, "author_profile": "https://Stackoverflow.com/users/4116", "pm_score": 1, "selected": false, "text": "<p>How does the UI know when the dataChanged variable has actually changed?</p>\n\n<p>I normally bind to a property ...
2009/02/11
[ "https://Stackoverflow.com/questions/536820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47630/" ]
So I am learning WPF right now, and want to do a simple databind between a bool value, and whether or not a `MenuItem` is enabled or not. I have coded it like this: ``` <MenuItem Name="miSaveFile" Header="Save" Click="miSaveFile_Click" IsEnabled="{Binding}" /> ``` And in the .cs file I set: ``` miSaveFile.DataCon...
You are better off binding to an object than to a primitive type. This object is often referred to as the "model" for your view. WPF uses the INotifyPropertyChanged interface for the model (or often view-model) to notify the view that the model has changed states. So you will first want to define a data class as the...
536,821
<p>Following up on an older question of mine, I managed to get URL Rewriting working somewhat correctly for my struts project where URLs like <code>search?q=blah</code> get converted to queries <code>search.action?q=blah</code>. We use <a href="http://code.google.com/p/urlrewritefilter/" rel="nofollow noreferrer">UrlRe...
[ { "answer_id": 536884, "author": "Kjetil Watnedal", "author_id": 4116, "author_profile": "https://Stackoverflow.com/users/4116", "pm_score": 1, "selected": false, "text": "<p>How does the UI know when the dataChanged variable has actually changed?</p>\n\n<p>I normally bind to a property ...
2009/02/11
[ "https://Stackoverflow.com/questions/536821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10098/" ]
Following up on an older question of mine, I managed to get URL Rewriting working somewhat correctly for my struts project where URLs like `search?q=blah` get converted to queries `search.action?q=blah`. We use [UrlRewriteFilter](http://code.google.com/p/urlrewritefilter/) for this. This seems to forward fine to struts...
You are better off binding to an object than to a primitive type. This object is often referred to as the "model" for your view. WPF uses the INotifyPropertyChanged interface for the model (or often view-model) to notify the view that the model has changed states. So you will first want to define a data class as the...
536,838
<p>Is there a way to attach an image to an html formatted email message created in PHP?</p> <p>We need to ensure that a corporate logo is on emails sent to clients who may not have access to the internet whilst reading their email (They will obviously have it to download the files).</p>
[ { "answer_id": 536860, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 5, "selected": true, "text": "<p>Try the PEAR <a href=\"http://pear.php.net/package/Mail_Mime\" rel=\"nofollow noreferrer\">Mail_Mime</a> package, which...
2009/02/11
[ "https://Stackoverflow.com/questions/536838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
Is there a way to attach an image to an html formatted email message created in PHP? We need to ensure that a corporate logo is on emails sent to clients who may not have access to the internet whilst reading their email (They will obviously have it to download the files).
Try the PEAR [Mail\_Mime](http://pear.php.net/package/Mail_Mime) package, which can [embed images for you](http://pear.php.net/manual/en/package.mail.mail-mime.addhtmlimage.php). You need to use the [addHTMLImage()](https://pear.php.net/manual/en/package.mail.mail-mime.addhtmlimage.php) method and pass a content id (c...
536,854
<pre><code>Warning: include(/2008/2009/assets/inc/base/error.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\2008\2009\assets\inc\base\header.inc.php on line 82 </code></pre> <p>I am receiving the above error when including a file on a WAMP ...
[ { "answer_id": 536863, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 3, "selected": true, "text": "<p>You’re using an absolute path rather than a relative path.</p>\n" }, { "answer_id": 536877, "author": "phihag"...
2009/02/11
[ "https://Stackoverflow.com/questions/536854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22216/" ]
``` Warning: include(/2008/2009/assets/inc/base/error.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\2008\2009\assets\inc\base\header.inc.php on line 82 ``` I am receiving the above error when including a file on a WAMP setup. Is it possib...
You’re using an absolute path rather than a relative path.
536,883
<p>I have a window, with an iframe in it. When i clicking a button, then the iframe will load (loaded from a web site). Is it possible to retrieve the content of that iframe? How can I retrieve the content of that page?</p> <p>I can view the source code by left clicking iframes View Source.</p> <p>I need to store the...
[ { "answer_id": 536910, "author": "Ryan Emerle", "author_id": 62195, "author_profile": "https://Stackoverflow.com/users/62195", "pm_score": 3, "selected": true, "text": "<p>This should work (if it's on the same domain):</p>\n\n<pre><code>document.getElementById('iframeId').contentWindow.d...
2009/02/11
[ "https://Stackoverflow.com/questions/536883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38172/" ]
I have a window, with an iframe in it. When i clicking a button, then the iframe will load (loaded from a web site). Is it possible to retrieve the content of that iframe? How can I retrieve the content of that page? I can view the source code by left clicking iframes View Source. I need to store the source in a DB. ...
This should work (if it's on the same domain): ``` document.getElementById('iframeId').contentWindow.document.body.innerHTML ``` Note that you need to make sure the frame has been loaded completely before you run this code. Otherwise, you will get strange exceptions. Disclaimer: I have not tested this. Here's the ...
536,932
<p>Given a string: "Person.Address.Postcode" I want to be able to get/set this postcode property on an instance of Person. How can I do this? My idea was to split the string by "." and then iterate over the parts, looking for the property on the previous type, then build up an expression tree that would look something ...
[ { "answer_id": 536964, "author": "Konstantin Savelev", "author_id": 61941, "author_profile": "https://Stackoverflow.com/users/61941", "pm_score": 3, "selected": true, "text": "<p>Why you don't use recursion? Something like:</p>\n\n<pre><code>setProperyValue(obj, propertyName, value)\n{\n...
2009/02/11
[ "https://Stackoverflow.com/questions/536932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
Given a string: "Person.Address.Postcode" I want to be able to get/set this postcode property on an instance of Person. How can I do this? My idea was to split the string by "." and then iterate over the parts, looking for the property on the previous type, then build up an expression tree that would look something lik...
Why you don't use recursion? Something like: ``` setProperyValue(obj, propertyName, value) { head, tail = propertyName.SplitByDotToHeadAndTail(); // Person.Address.Postcode => {head=Person, tail=Address.Postcode} if(tail.Length == 0) setPropertyValueUsingReflection(obj, head, value); else setPropertyValu...
536,958
<p>I'd like to create a generic type hierarchy for representing graphs. In particular, I'd like like to have classes Graph and Node, and I want that for every Graph type, there is a corresponding Node type and if I create a generic function for manipulating Graphs, I want this function to use the actual Node type. An e...
[ { "answer_id": 537350, "author": "James Iry", "author_id": 65133, "author_profile": "https://Stackoverflow.com/users/65133", "pm_score": 4, "selected": true, "text": "<p>A very good example of an extensible graph structure is at\n<a href=\"http://www.scala-lang.org/node/124\" rel=\"noref...
2009/02/11
[ "https://Stackoverflow.com/questions/536958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51831/" ]
I'd like to create a generic type hierarchy for representing graphs. In particular, I'd like like to have classes Graph and Node, and I want that for every Graph type, there is a corresponding Node type and if I create a generic function for manipulating Graphs, I want this function to use the actual Node type. An exam...
A very good example of an extensible graph structure is at <http://www.scala-lang.org/node/124> I have thee ways to write yours. Note that in all cases there were some type changes required - i.e. GNode's type parameter needs to be covariant, and ConcreteGraph needs to be written with both a distinct node class and a ...
536,959
<p>I have a big problem. My boss said to me that he wants two "magic black box": 1- something that receives a micropocessor like input and return, like output, the MIPS and/or MFLOPS. 2- something that receives a c code like input and return, like output, something that can characterize the code in term of performance ...
[ { "answer_id": 537350, "author": "James Iry", "author_id": 65133, "author_profile": "https://Stackoverflow.com/users/65133", "pm_score": 4, "selected": true, "text": "<p>A very good example of an extensible graph structure is at\n<a href=\"http://www.scala-lang.org/node/124\" rel=\"noref...
2009/02/11
[ "https://Stackoverflow.com/questions/536959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65088/" ]
I have a big problem. My boss said to me that he wants two "magic black box": 1- something that receives a micropocessor like input and return, like output, the MIPS and/or MFLOPS. 2- something that receives a c code like input and return, like output, something that can characterize the code in term of performance (so...
A very good example of an extensible graph structure is at <http://www.scala-lang.org/node/124> I have thee ways to write yours. Note that in all cases there were some type changes required - i.e. GNode's type parameter needs to be covariant, and ConcreteGraph needs to be written with both a distinct node class and a ...
536,965
<p>Here is my code snippet:</p> <pre><code>SPSecurity.RunWithElevatedPrivileges(delegate() { SPSolution newSolution = SPFarm.Local.Solutions.Add(@fullPath); }); </code></pre> <p>The stacktrace and innerexception give no further clues. The Exception.Source says <strong>Microsoft.SharePo...
[ { "answer_id": 537350, "author": "James Iry", "author_id": 65133, "author_profile": "https://Stackoverflow.com/users/65133", "pm_score": 4, "selected": true, "text": "<p>A very good example of an extensible graph structure is at\n<a href=\"http://www.scala-lang.org/node/124\" rel=\"noref...
2009/02/11
[ "https://Stackoverflow.com/questions/536965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54775/" ]
Here is my code snippet: ``` SPSecurity.RunWithElevatedPrivileges(delegate() { SPSolution newSolution = SPFarm.Local.Solutions.Add(@fullPath); }); ``` The stacktrace and innerexception give no further clues. The Exception.Source says **Microsoft.SharePoint**. SPFarm.Local.CurrentUser...
A very good example of an extensible graph structure is at <http://www.scala-lang.org/node/124> I have thee ways to write yours. Note that in all cases there were some type changes required - i.e. GNode's type parameter needs to be covariant, and ConcreteGraph needs to be written with both a distinct node class and a ...
536,968
<p>I understand how to process this doc (below) with XSLT from the outermost <em>person</em> element to the innermost. But I was wondering if:</p> <ol> <li>If its possible to work from the deepest element out.</li> <li>What that would look like given my example.</li> </ol> <pre><code>&lt;?xml version="1.0" encoding...
[ { "answer_id": 536982, "author": "Teun D", "author_id": 64963, "author_profile": "https://Stackoverflow.com/users/64963", "pm_score": 4, "selected": false, "text": "<p>You can use the parent:: axis for working up.</p>\n\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;xs...
2009/02/11
[ "https://Stackoverflow.com/questions/536968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36590/" ]
I understand how to process this doc (below) with XSLT from the outermost *person* element to the innermost. But I was wondering if: 1. If its possible to work from the deepest element out. 2. What that would look like given my example. ``` <?xml version="1.0" encoding="utf-8" ?> <container> <person name="Larry"> ...
**Here is the most general way of performing "backwards recursion"** that does not depend on this specific problem and can be used in a wide variety of problems. **This transformation**: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:templat...
536,971
<p>I have a java application that uses some third party API. The third party jar files change fairly frequently because of all kinds of patches, but the API itself does not change that often. </p> <p>Do I have to recompile my application every time the third party jar changes? </p>
[ { "answer_id": 536983, "author": "Fabian Steeg", "author_id": 18154, "author_profile": "https://Stackoverflow.com/users/18154", "pm_score": 2, "selected": false, "text": "<p>No, you only need to recompile code you change.</p>\n" }, { "answer_id": 536996, "author": "Jon Skeet"...
2009/02/11
[ "https://Stackoverflow.com/questions/536971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65092/" ]
I have a java application that uses some third party API. The third party jar files change fairly frequently because of all kinds of patches, but the API itself does not change that often. Do I have to recompile my application every time the third party jar changes?
If the API changes, you should recompile even if you don't need to make any changes in your source code. If the API hasn't changed, you don't need to recompile. The reason for the "even if you don't need to make any changes" is that some source-compatible changes may not be binary compatible. For instance, suppose you...
536,978
<p>I'm looking for a more efficient way to find a type in an Assembly that derives from a known specific type. Basically, I have a plugin architecture in my application, and for the longest time we've been doing this:</p> <pre><code>For Each t As Type In assem.GetTypes() If t.BaseType Is pluginType Then 'D...
[ { "answer_id": 537017, "author": "BC.", "author_id": 54838, "author_profile": "https://Stackoverflow.com/users/54838", "pm_score": 1, "selected": false, "text": "<p>Assembly.GetExportedTypes() only returns public classes. Could this help?</p>\n" }, { "answer_id": 537018, "aut...
2009/02/11
[ "https://Stackoverflow.com/questions/536978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6897/" ]
I'm looking for a more efficient way to find a type in an Assembly that derives from a known specific type. Basically, I have a plugin architecture in my application, and for the longest time we've been doing this: ``` For Each t As Type In assem.GetTypes() If t.BaseType Is pluginType Then 'Do Stuff here' ...
First off, you may try using `GetExportedTypes()` to narrow down the list of potential types. Other than that, there's no way you can speed up the iteration process. You can, however, include a plugin mainfest which would specify the exact type (types) of plugins within a particular assembly: ``` <manifest> <plugi...
537,014
<p>What's a good way to leverage TDD to drive out thread-safe code? For example, say I have a factory method that utilizes lazy initialization to create only one instance of a class, and return it thereafter:</p> <pre><code>private TextLineEncoder textLineEncoder; ... public ProtocolEncoder getEncoder() throws Except...
[ { "answer_id": 537032, "author": "Morendil", "author_id": 61168, "author_profile": "https://Stackoverflow.com/users/61168", "pm_score": 3, "selected": true, "text": "<p>It's hard, though possible - possibly harder than it's worth. Known solutions involve instrumenting the code under test...
2009/02/11
[ "https://Stackoverflow.com/questions/537014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56076/" ]
What's a good way to leverage TDD to drive out thread-safe code? For example, say I have a factory method that utilizes lazy initialization to create only one instance of a class, and return it thereafter: ``` private TextLineEncoder textLineEncoder; ... public ProtocolEncoder getEncoder() throws Exception { if(te...
It's hard, though possible - possibly harder than it's worth. Known solutions involve instrumenting the code under test. The discussion [here, "Extreme Programming Challenge Fourteen"](http://c2.com/cgi-bin/wiki?ExtremeProgrammingChallengeFourteen) is worth sifting through.
537,027
<p>I am relatively new to development within COM, and I was wondering what the community standard was for access of COM object properties. I have seen both of the following conventions in code:</p> <pre><code>comObjectPtr-&gt;PutValue(value); </code></pre> <p>and</p> <pre><code>comObjectPtr-&gt;Value = value; </code...
[ { "answer_id": 537063, "author": "Jason S", "author_id": 44330, "author_profile": "https://Stackoverflow.com/users/44330", "pm_score": 1, "selected": false, "text": "<p>You're talking about the smart wrapper classes created with #import, right?</p>\n\n<p>PutValue() is more explicit as to...
2009/02/11
[ "https://Stackoverflow.com/questions/537027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39122/" ]
I am relatively new to development within COM, and I was wondering what the community standard was for access of COM object properties. I have seen both of the following conventions in code: ``` comObjectPtr->PutValue(value); ``` and ``` comObjectPtr->Value = value; ``` and both seem to work, but I was wondering ...
If I remember correctly, using the property assignment will throw an exception vs. a HRESULT returned in the setter if there is a problem. Same thing is true of the getter method calls vs. property. A "benefit" of using the property is that you can use the prop-get values directly instead of having to declare a varia...
537,037
<p>In LINQ I can do a join like this:</p> <pre><code>from c in dc.Customers join o in dc.Orders on c.custid equals o.custid ... </code></pre> <p>However left joins are far more complicated:</p> <pre><code>from c in dc.Customers join o in dc.Orders on c.custid equals o.custid into temp from x in temp.DefaultIfEmpty() ...
[ { "answer_id": 537093, "author": "Adam Lassek", "author_id": 1249, "author_profile": "https://Stackoverflow.com/users/1249", "pm_score": 0, "selected": false, "text": "<p>Probably because Linq expressions are simply <a href=\"http://en.wikipedia.org/wiki/Syntactic_sugar\" rel=\"nofollow ...
2009/02/11
[ "https://Stackoverflow.com/questions/537037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52110/" ]
In LINQ I can do a join like this: ``` from c in dc.Customers join o in dc.Orders on c.custid equals o.custid ... ``` However left joins are far more complicated: ``` from c in dc.Customers join o in dc.Orders on c.custid equals o.custid into temp from x in temp.DefaultIfEmpty() ... ``` Why couldn't the designe...
> > why couldn't the designers of Linq make things simple (more sql like) > > > They could have. But your definition of simple (as a sql programmer) is not the same as the OO programmer's definition of simple. Linq (in C#) is a query technology for OO programmers, first. An example of this is *why select comes las...
537,040
<p>I have a pkcs12 file. I need to use this to connect to a webpage using https protocol. I came across some code where in order to connect to a secure web page i need to set the following system properties:</p> <pre><code>System.setProperty("javax.net.ssl.trustStore", "myTrustStore"); System.setProperty("javax.net.ss...
[ { "answer_id": 537344, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 2, "selected": false, "text": "<p>It appears that you are extracting you certificate from the PKCS #12 key store and creating a new Java key store (with t...
2009/02/11
[ "https://Stackoverflow.com/questions/537040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27221/" ]
I have a pkcs12 file. I need to use this to connect to a webpage using https protocol. I came across some code where in order to connect to a secure web page i need to set the following system properties: ``` System.setProperty("javax.net.ssl.trustStore", "myTrustStore"); System.setProperty("javax.net.ssl.trustStorePa...
For anyone encountering a similar situation I was able to solve the issue above as follows: 1. Regenerate your pkcs12 file as follows: ``` openssl pkcs12 -in oldpkcs.p12 -out keys -passout pass:tmp openssl pkcs12 -in keys -export -out new.p12 -passin pass:tmp -passout pass:newpasswd ``` 2. Import the CA certificate ...
537,043
<p>I am trying to figure out if there is a way to create a custom tag using Doxygen. I did find the ALIAS configuration file option but that does not do exactly what I need. Basically in my code I want to be able to write something like </p> <pre><code>/// \req Requirement #322 - blah blah </code></pre> <p>And then h...
[ { "answer_id": 537296, "author": "mouviciel", "author_id": 45249, "author_profile": "https://Stackoverflow.com/users/45249", "pm_score": 7, "selected": true, "text": "<p>The generalization of <code>\\bug</code> and <code>\\todo</code> is <code>\\xrefitem</code>.</p>\n\n<p>The solution I ...
2009/02/11
[ "https://Stackoverflow.com/questions/537043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52704/" ]
I am trying to figure out if there is a way to create a custom tag using Doxygen. I did find the ALIAS configuration file option but that does not do exactly what I need. Basically in my code I want to be able to write something like ``` /// \req Requirement #322 - blah blah ``` And then have Doxygen create a list ...
The generalization of `\bug` and `\todo` is `\xrefitem`. The solution I suggest is: * in Doxyfile: ``` ALIASES += "req=\xrefitem req \"Requirement\" \"Requirements\" " ``` * in documented code: ``` /// \req #42 - The system shall work in any situation ```
537,044
<p>I've recently been trying to store the search results of my iPhone app in the NSUserDefaults collection. I also use this to save user registration info successfully, but for some reason trying to store my NSMutableArray of custom Location classes always comes back empty.</p> <p>I tried converting the NSMutableArray...
[ { "answer_id": 537098, "author": "f3lix", "author_id": 60617, "author_profile": "https://Stackoverflow.com/users/60617", "pm_score": 0, "selected": false, "text": "<p>See \"Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?\n\" (<a href=\"https://stackoverflow.com/quest...
2009/02/11
[ "https://Stackoverflow.com/questions/537044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258/" ]
I've recently been trying to store the search results of my iPhone app in the NSUserDefaults collection. I also use this to save user registration info successfully, but for some reason trying to store my NSMutableArray of custom Location classes always comes back empty. I tried converting the NSMutableArray to a NSDa...
For loading custom objects in an array, this is what I've used to grab the array: ``` NSUserDefaults *currentDefaults = [NSUserDefaults standardUserDefaults]; NSData *dataRepresentingSavedArray = [currentDefaults objectForKey:@"savedArray"]; if (dataRepresentingSavedArray != nil) { NSArray *oldSavedArray = [NSKeye...
537,057
<p>Is it possible to assign variables to the client scope using JavaScript? More specifically, I'm trying to assign a value after it is returned from an AJAX call.</p> <p>I understand that ColdFusion is run on the server side and JavaScript on the client side, but with the proliferation of AJAX, I'm curious if someth...
[ { "answer_id": 537089, "author": "mkoryak", "author_id": 26188, "author_profile": "https://Stackoverflow.com/users/26188", "pm_score": 2, "selected": false, "text": "<p>I dont knoew anything about CF, but usually this is done by posting a name/value pair to the server, where the server p...
2009/02/11
[ "https://Stackoverflow.com/questions/537057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65094/" ]
Is it possible to assign variables to the client scope using JavaScript? More specifically, I'm trying to assign a value after it is returned from an AJAX call. I understand that ColdFusion is run on the server side and JavaScript on the client side, but with the proliferation of AJAX, I'm curious if something like th...
Peter Boughton was pretty much dead on in his concept, but you asked how to write client variables, and he didn't test his code. Also, what you're trying to do would be called a ClientFacade, so I've written (and tested) a ClientFacade CFC and companion JavaScript. Note that I'm using jQuery because I never go anywhere...
537,073
<p>I am creating a <code>TextBox</code> and a <code>Button</code> dynamically using the following code:</p> <pre><code>Button btnClickMe = new Button(); btnClickMe.Content = "Click Me"; btnClickMe.Name = "btnClickMe"; btnClickMe.Click += new RoutedEventHandler(this.CallMeClick); someStackPanel.Childern.Add(btnClickMe...
[ { "answer_id": 537105, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 2, "selected": false, "text": "<p>Is there any way you can make the TextBox control a field in your class instead of a variable inside your generator me...
2009/02/11
[ "https://Stackoverflow.com/questions/537073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469/" ]
I am creating a `TextBox` and a `Button` dynamically using the following code: ``` Button btnClickMe = new Button(); btnClickMe.Content = "Click Me"; btnClickMe.Name = "btnClickMe"; btnClickMe.Click += new RoutedEventHandler(this.CallMeClick); someStackPanel.Childern.Add(btnClickMe); TextBox txtNumber = new TextBox(...
Josh G had the clue that fixed this code: use RegisterName(). Three benefits here: 1. Doesn't use a member variable to save the reference to the dynamically created TextBox. 2. Compiles. 3. Complete code. ``` using System; using System.Windows; using System.Windows.Controls; namespace AddControlsDynamically { p...
537,077
<p>What is the most elegant method for dumping a list in python into an sqlite3 DB as binary data (i.e., a BLOB cell)?</p> <pre><code>data = [ 0, 1, 2, 3, 4, 5 ] # now write this to db as binary data # 0000 0000 # 0000 0001 # ... # 0000 0101 </code></pre>
[ { "answer_id": 537192, "author": "Brian", "author_id": 9493, "author_profile": "https://Stackoverflow.com/users/9493", "pm_score": 4, "selected": true, "text": "<p>Assuming you want it treated as a sequence of 8-bit unsigned values, use the <code>array</code> module.</p>\n\n<pre><code>a ...
2009/02/11
[ "https://Stackoverflow.com/questions/537077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11515/" ]
What is the most elegant method for dumping a list in python into an sqlite3 DB as binary data (i.e., a BLOB cell)? ``` data = [ 0, 1, 2, 3, 4, 5 ] # now write this to db as binary data # 0000 0000 # 0000 0001 # ... # 0000 0101 ```
Assuming you want it treated as a sequence of 8-bit unsigned values, use the `array` module. ``` a = array.array('B', data) >>> a.tostring() '\x00\x01\x02\x03\x04\x05' ``` Use different typecodes than `'B'` if you want to treat the data as different types. eg. 'b' for a sequence of signed bytes, or `'i'` for a signe...
537,086
<p>When programming in Python, is it possible to reserve memory for a list that will be populated with a known number of items, so that the list will not be reallocated several times while building it? I've looked through the docs for a Python list type, and have not found anything that seems to do this. However, thi...
[ { "answer_id": 537134, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 4, "selected": false, "text": "<p>you can create list of the known length like this:</p>\n\n<pre><code>&gt;&gt;&gt; [None] * known_number\n</code></p...
2009/02/11
[ "https://Stackoverflow.com/questions/537086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23903/" ]
When programming in Python, is it possible to reserve memory for a list that will be populated with a known number of items, so that the list will not be reallocated several times while building it? I've looked through the docs for a Python list type, and have not found anything that seems to do this. However, this typ...
Here's four variants: * an incremental list creation * "pre-allocated" list * array.array() * numpy.zeros() ``` python -mtimeit -s"N=10**6" "a = []; app = a.append;"\ "for i in xrange(N): app(i);" 10 loops, best of 3: 390 msec per loop python -mtimeit -s"N=10**6" "a = [None]*N; app = a.append;"\ "for i in x...
537,119
<p>To access the field x of an outer class A from an inner class B, I realize that you can use "A.this.x". But what if the outer class is also anonymous? For example,</p> <pre><code>public class Main1 { public static void main(String[] args) { Comparable c1 = new Comparable(){ int x = 3; ...
[ { "answer_id": 537163, "author": "Tim Frey", "author_id": 1471, "author_profile": "https://Stackoverflow.com/users/1471", "pm_score": 2, "selected": false, "text": "<p>I would avoid hiding the other variable by choosing a name other than x.</p>\n" }, { "answer_id": 537171, "a...
2009/02/11
[ "https://Stackoverflow.com/questions/537119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65110/" ]
To access the field x of an outer class A from an inner class B, I realize that you can use "A.this.x". But what if the outer class is also anonymous? For example, ``` public class Main1 { public static void main(String[] args) { Comparable c1 = new Comparable(){ int x = 3; public i...
I would avoid hiding the other variable by choosing a name other than x.
537,143
<p>I'm having a problem creating a DOM element, appending it to another element and having it fade into place.</p> <p>This doesn't seem to work:</p> <pre><code>$('&lt;div/&gt;').html('hello').appendTo('#parentDiv').fadeIn(); </code></pre> <p>Can anybody put me on the right track</p>
[ { "answer_id": 537156, "author": "Neil Aitken", "author_id": 13803, "author_profile": "https://Stackoverflow.com/users/13803", "pm_score": 0, "selected": false, "text": "<p>Have you tried</p>\n\n<pre><code>$('&lt;div/&gt;').html('hello').appendTo('#parentDiv').hide().fadeIn();\n</code></...
2009/02/11
[ "https://Stackoverflow.com/questions/537143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48655/" ]
I'm having a problem creating a DOM element, appending it to another element and having it fade into place. This doesn't seem to work: ``` $('<div/>').html('hello').appendTo('#parentDiv').fadeIn(); ``` Can anybody put me on the right track
Try: ``` $("<div>hello</div>").hide().appendTo("#parentDiv").fadeIn(); ``` or alternatively set display none instead of hide().
537,161
<p>I have a select query which does some text manipulation to essentially reformat a field so that I can look it up in another table:</p> <p>If my first table if I have a field like "J1/2" it looks up the ID of a record in a different table with J1 and J2 in the appropriate fields.</p> <p>This all works well.</p> <p...
[ { "answer_id": 537281, "author": "Godeke", "author_id": 28006, "author_profile": "https://Stackoverflow.com/users/28006", "pm_score": 4, "selected": true, "text": "<p>A subquery of (SELECT ID FROM t2) can't work unless there is only one record in t2. Which ID are you expecting to be used...
2009/02/11
[ "https://Stackoverflow.com/questions/537161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23461/" ]
I have a select query which does some text manipulation to essentially reformat a field so that I can look it up in another table: If my first table if I have a field like "J1/2" it looks up the ID of a record in a different table with J1 and J2 in the appropriate fields. This all works well. Now I want to update th...
A subquery of (SELECT ID FROM t2) can't work unless there is only one record in t2. Which ID are you expecting to be used? The error message that is being reported normally occurs when you have joins and are not including all of the primary keys necessary to update back to tables in a data bound form (for example, you...
537,173
<p>The <a href="https://ss64.com/nt/netsh.html" rel="nofollow noreferrer">netsh</a> command wants an appid (<a href="http://msdn.microsoft.com/en-us/library/ms733791.aspx" rel="nofollow noreferrer">see here</a>):</p> <pre class="lang-none prettyprint-override"><code>netsh http add sslcert ipport=0.0.0.0:8000 certhash=0...
[ { "answer_id": 537226, "author": "Rasmus Faber", "author_id": 5542, "author_profile": "https://Stackoverflow.com/users/5542", "pm_score": 8, "selected": true, "text": "<p>You can use any valid GUID. It is only used to allow you to identify the binding later.</p>\n" }, { "answer_i...
2009/02/11
[ "https://Stackoverflow.com/questions/537173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47341/" ]
The [netsh](https://ss64.com/nt/netsh.html) command wants an appid ([see here](http://msdn.microsoft.com/en-us/library/ms733791.aspx)): ```none netsh http add sslcert ipport=0.0.0.0:8000 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF} ``` How am I supposed to know the GUI...
You can use any valid GUID. It is only used to allow you to identify the binding later.
537,174
<p>I have a java string, which has a variable length. </p> <p>I need to put the piece <code>"&lt;br&gt;"</code> into the string, say each 10 characters. </p> <p>For example this is my string:</p> <pre><code>`this is my string which I need to modify...I love stackoverlow:)` </code></pre> <p>How can I obtain this str...
[ { "answer_id": 537185, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 6, "selected": false, "text": "<p>Try:</p>\n\n<pre><code>String s = // long string\ns.replaceAll(\"(.{10})\", \"$1&lt;br&gt;\");\n</code></pre>\n\n<p><str...
2009/02/11
[ "https://Stackoverflow.com/questions/537174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39339/" ]
I have a java string, which has a variable length. I need to put the piece `"<br>"` into the string, say each 10 characters. For example this is my string: ``` `this is my string which I need to modify...I love stackoverlow:)` ``` How can I obtain this string?: ``` `this is my<br> string wh<br>ich I nee<br>d to...
Something like: ``` public static String insertPeriodically( String text, String insert, int period) { StringBuilder builder = new StringBuilder( text.length() + insert.length() * (text.length()/period)+1); int index = 0; String prefix = ""; while (index < text.length()) { // ...
537,187
<p>I have a rather large text file that has a bunch of missing newlines, meaning that it's a mess. I need to break it up into appropriate lines.</p> <p>The text looks something like this now:</p> <pre><code>12345 This is a chunk 23456 This is another chunk 34567 This is yet another chunk 45678 This is yet more chunk ...
[ { "answer_id": 537218, "author": "user54650", "author_id": 54650, "author_profile": "https://Stackoverflow.com/users/54650", "pm_score": 5, "selected": true, "text": "<p>Very simple (but not as \"flashy\" as possible, since I'm too lazy to use lookaheads):</p>\n\n<pre><code>s/(\\d{5})/\\...
2009/02/11
[ "https://Stackoverflow.com/questions/537187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62576/" ]
I have a rather large text file that has a bunch of missing newlines, meaning that it's a mess. I need to break it up into appropriate lines. The text looks something like this now: ``` 12345 This is a chunk 23456 This is another chunk 34567 This is yet another chunk 45678 This is yet more chunk 56789 Yet another pie...
Very simple (but not as "flashy" as possible, since I'm too lazy to use lookaheads): ``` s/(\d{5})/\r\n\1/gs ```
537,191
<p>I can't get --random-sort to work with the sort command on a Fedora Linux-system.</p> <p>Some context information:</p> <pre><code>$ cat /etc/fedora-release Fedora release 7 (Moonshine) $ which sort /bin/sort $ man sort | grep -A 2 '\-R' -R, --random-sort sort by random hash of keys $ man sort...
[ { "answer_id": 537222, "author": "Joao da Silva", "author_id": 46329, "author_profile": "https://Stackoverflow.com/users/46329", "pm_score": 4, "selected": false, "text": "<p>It works on my Ubuntu 8.04 machine. Maybe the problem is the source of randoms. From the manual:</p>\n<blockquote...
2009/02/11
[ "https://Stackoverflow.com/questions/537191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I can't get --random-sort to work with the sort command on a Fedora Linux-system. Some context information: ``` $ cat /etc/fedora-release Fedora release 7 (Moonshine) $ which sort /bin/sort $ man sort | grep -A 2 '\-R' -R, --random-sort sort by random hash of keys $ man sort | grep -A 3 '\-R' ...
It works on my Ubuntu 8.04 machine. Maybe the problem is the source of randoms. From the manual: > > --random-source=FILE > > > > ``` > get random bytes from FILE (default /dev/urandom) > > ``` > > ``` # this should give always the same result: echo -e '2\n1\n3\n5\n4' | sort -R --random-source=/dev/ze...
537,198
<p>function Obj1(param) { this.test1 = param || 1; }</p> <pre><code>function Obj2(param, par) { this.test2 = param; this.ob = Obj1; this.ob(par); } </code></pre> <p>now why if I do:</p> <pre><code>alert(new Obj2(44,55).test1); </code></pre> <p>the output is 55? how can 'view' test1 an O...
[ { "answer_id": 537243, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 3, "selected": false, "text": "<p>Well it's not clear what you <em>want</em> but the reason this happens is because here:</p>\n\n<pre><code>this.ob = Ob...
2009/02/11
[ "https://Stackoverflow.com/questions/537198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65120/" ]
function Obj1(param) { this.test1 = param || 1; } ``` function Obj2(param, par) { this.test2 = param; this.ob = Obj1; this.ob(par); } ``` now why if I do: ``` alert(new Obj2(44,55).test1); ``` the output is 55? how can 'view' test1 an Obj2 istance if I haven't link both via prototype chain? Thank...
> > how can 'view' test1 an Obj2 istance if I haven't link both via prototype chain? > > > Methods are not bound in JavaScript. When you write one of: ``` o.method(x); o['method'](x); ``` the value of ‘o’ is assigned to ‘this’ inside the method. But! If you detach the function from its object and call it direct...
537,204
<p>I have status tables in my database, and "localised" tables that contain language-specific versions of those statuses. The point of the main status table is to define the status ID values, and other meta-data about the status. The "localised" table is to display the text representation in a UI, according to the us...
[ { "answer_id": 538830, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 1, "selected": false, "text": "<p>One option could be to maintain a cache of the localised data, using something like Caching Application Block or ...
2009/02/11
[ "https://Stackoverflow.com/questions/537204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26414/" ]
I have status tables in my database, and "localised" tables that contain language-specific versions of those statuses. The point of the main status table is to define the status ID values, and other meta-data about the status. The "localised" table is to display the text representation in a UI, according to the users' ...
Personally, I'd probably leave the EmployeeStatus codes in the DB and move all localization logic into the client. If this is a web app (ASP.NET or ASP.NET MVC) then you'd use the the EmployeeStatus code as a key into a resource file, and then use UICulture="Auto" and Culture="Auto" to tell ASP.NET to pick up the right...
537,214
<p>How do you search a websites source code with C#? hard to explain, heres the source for doing it in python </p> <pre><code>import urllib2, re word = "How to ask" source = urllib2.urlopen("http://stackoverflow.com").read() if re.search(word,source): print "Found it "+word </code></pre>
[ { "answer_id": 537255, "author": "Canavar", "author_id": 55351, "author_profile": "https://Stackoverflow.com/users/55351", "pm_score": 0, "selected": false, "text": "<p>Here is the source for getting HTML code of a page, you can add your search method later : </p>\n\n<pre><code>string ur...
2009/02/11
[ "https://Stackoverflow.com/questions/537214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65122/" ]
How do you search a websites source code with C#? hard to explain, heres the source for doing it in python ``` import urllib2, re word = "How to ask" source = urllib2.urlopen("http://stackoverflow.com").read() if re.search(word,source): print "Found it "+word ```
If you want to access the raw HTML from a web page you need to do the following: 1. Use a HttpWebRequest to connect to the file 2. Open the connection and read the response stream into a string 3. Search the response for your content So code something like: ``` string pageContent = null; HttpWebRequest myReq = (Http...
537,223
<p>I have a database table like this:</p> <pre><code>id version_id field1 field2 1 1 texta text1 1 2 textb text2 2 1 textc text3 2 2 textd text4 2 3 texte text5 </code></pre> <p>If you didn't work it out,...
[ { "answer_id": 537235, "author": "ʞɔıu", "author_id": 41613, "author_profile": "https://Stackoverflow.com/users/41613", "pm_score": 7, "selected": true, "text": "<p>It's called selecting the group-wise maximum of a column. <a href=\"http://kristiannielsen.livejournal.com/6745.html\" rel=...
2009/02/11
[ "https://Stackoverflow.com/questions/537223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39161/" ]
I have a database table like this: ``` id version_id field1 field2 1 1 texta text1 1 2 textb text2 2 1 textc text3 2 2 textd text4 2 3 texte text5 ``` If you didn't work it out, it contains a number of v...
It's called selecting the group-wise maximum of a column. [Here are several different approaches for mysql.](http://kristiannielsen.livejournal.com/6745.html) Here's how I would do it: ``` SELECT * FROM (SELECT id, max(version_id) as version_id FROM table GROUP BY id) t1 INNER JOIN table t2 on t2.id=t1.id and t1.vers...
537,225
<p>There is a service running which monitors files in a folder on a server. Whenever files are copied to this folder, the files are moved and a record is written to a filemaker pro database through an ODBC connection. In that same process I need the ID of the newly created row to create a related record in another ta...
[ { "answer_id": 542520, "author": "Chuck", "author_id": 65659, "author_profile": "https://Stackoverflow.com/users/65659", "pm_score": 3, "selected": true, "text": "<p>I'm not an experienced user of the ODBC interface into FileMaker, but I can suggest a possible solution that might work.</...
2009/02/11
[ "https://Stackoverflow.com/questions/537225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18893/" ]
There is a service running which monitors files in a folder on a server. Whenever files are copied to this folder, the files are moved and a record is written to a filemaker pro database through an ODBC connection. In that same process I need the ID of the newly created row to create a related record in another table (...
I'm not an experienced user of the ODBC interface into FileMaker, but I can suggest a possible solution that might work. I'm assuming you're using an INSERT statement to get the data into FileMaker, that there's an "ID" number field in the table you're creating a record in, and that the ID field is set to auto-enter a...
537,230
<p>The organization I work for has created a small flash widget that we're encouraging supporters to place on their website. I'm trying to determine if there are ways to improve the statistics we get from those embedded widgets.</p> <p>Mostly I would like to get the domain of the site that loaded the widget. Right n...
[ { "answer_id": 537251, "author": "VBNight", "author_id": 63367, "author_profile": "https://Stackoverflow.com/users/63367", "pm_score": 3, "selected": true, "text": "<pre><code>Steps:\n 1. Import external interface into your file: import flash.external.ExternalInterface;\n 2. Initiali...
2009/02/11
[ "https://Stackoverflow.com/questions/537230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24215/" ]
The organization I work for has created a small flash widget that we're encouraging supporters to place on their website. I'm trying to determine if there are ways to improve the statistics we get from those embedded widgets. Mostly I would like to get the domain of the site that loaded the widget. Right now I'm able ...
``` Steps: 1. Import external interface into your file: import flash.external.ExternalInterface; 2. Initialize a variable to store the url path: var urlPath; 3. Create a function to call external interface and assign the html page path to your variable: urlPath = ExternalInterface.call(”window.location.href.to...
537,234
<p>Is there a way to perform a SVN checkout (or export), which would fetch <strong>only the directory structure</strong>; that is to say, no files?</p>
[ { "answer_id": 537268, "author": "Kothar", "author_id": 37416, "author_profile": "https://Stackoverflow.com/users/37416", "pm_score": 0, "selected": false, "text": "<p>I can't see that there is a way to do it from a brief look at <code>svn help co</code>. Something I've done before for u...
2009/02/11
[ "https://Stackoverflow.com/questions/537234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15497/" ]
Is there a way to perform a SVN checkout (or export), which would fetch **only the directory structure**; that is to say, no files?
``` svn ls -R {svnrepo} | grep "/$" | xargs -n 1 mkdir -p ``` Export, not a checkout. [Updated] With checkout: ``` env REPO={repo} sh -c 'svn ls -R $REPO | grep "/\$" | xargs -n 1 svn co --depth=empty $REPO' ``` This will be pretty slow for anything too large.
537,244
<p>Is there a way to have some kind of default constructor (like a C++ one) for C user types defined with a structure?</p> <p>I already have a macro which works like a fast initializer (like the one for <code>pthread_mutex</code>) but I wanted to know if you can by any chance have some (or all) fields of a struct fill...
[ { "answer_id": 537259, "author": "ConcernedOfTunbridgeWells", "author_id": 15401, "author_profile": "https://Stackoverflow.com/users/15401", "pm_score": 3, "selected": false, "text": "<p>No, not directly. The closest you could do is to write a function that allocated an instance and pop...
2009/02/11
[ "https://Stackoverflow.com/questions/537244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61838/" ]
Is there a way to have some kind of default constructor (like a C++ one) for C user types defined with a structure? I already have a macro which works like a fast initializer (like the one for `pthread_mutex`) but I wanted to know if you can by any chance have some (or all) fields of a struct filled at declaration. F...
You can create initializer functions that take a pointer to a structure. This was common practice. Also functions that create a struct and initialize it (like a factory) - so there is never a time where the struct is "uninitialized" in the "client" code. Of course - that assumes people follow the convention and use t...
537,248
<p>I am trying to create a rewrite rule that accomplishes two things:</p> <ol> <li>Redirect <code>(www.)?domain.com</code> to <code>log.domain.com</code></li> <li>Let any other directory or file request on domain.com through without redirection</li> </ol> <p>This not an Apache server (it's LiteSpeed), but supposedly ...
[ { "answer_id": 537277, "author": "chaos", "author_id": 47529, "author_profile": "https://Stackoverflow.com/users/47529", "pm_score": 3, "selected": true, "text": "<pre><code>RewriteCond %{HTTP_HOST} ^(www\\.)?domain\\.com$\nRewriteRule ^$ http://log.domain.com/\n</code></pre>\n" }, {...
2009/02/11
[ "https://Stackoverflow.com/questions/537248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65121/" ]
I am trying to create a rewrite rule that accomplishes two things: 1. Redirect `(www.)?domain.com` to `log.domain.com` 2. Let any other directory or file request on domain.com through without redirection This not an Apache server (it's LiteSpeed), but supposedly it supports `.htaccess` files wholly. This was my sho...
``` RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ RewriteRule ^$ http://log.domain.com/ ```
537,258
<p>We've encountered the following "issue". I like to use the following writing:</p> <pre><code>SELECT Id, Name FROM Table1 JOIN Table2 ON Table1.FK1 = Table2.FK1 </code></pre> <p>but a colleague of mine uses:</p> <pre><code>SELECT Id, Name FROM Table1 JOIN Table2 ON Table1.FK1 = Table2.FK1 </code><...
[ { "answer_id": 537270, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 3, "selected": false, "text": "<p>I prefer the first:</p>\n<pre><code>SELECT Id, Name\nFROM Table1\nJOIN Table2 ON Table1.FK1 = Table2.FK1\n</code><...
2009/02/11
[ "https://Stackoverflow.com/questions/537258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29964/" ]
We've encountered the following "issue". I like to use the following writing: ``` SELECT Id, Name FROM Table1 JOIN Table2 ON Table1.FK1 = Table2.FK1 ``` but a colleague of mine uses: ``` SELECT Id, Name FROM Table1 JOIN Table2 ON Table1.FK1 = Table2.FK1 ``` Is there a best practice for this? I th...
We would actually do: ``` SELECT Id, Name FROM Table1 JOIN Table2 ON Table2.FK1 = Table2.FK1 ```
537,283
<p>In my code I have several macros. Macro A is the main macro. Macro A then calls macro B which in turn calls macro C. </p> <p>In SAS, do I have to define them in backwards order? In other words, do I have to define macro C first, then macro B, then macro A last? Or does it matter since SAS reads all the code in...
[ { "answer_id": 537534, "author": "RWill", "author_id": 65158, "author_profile": "https://Stackoverflow.com/users/65158", "pm_score": 1, "selected": false, "text": "<p>You must define a macro before it is called, so the line with \"%A\" would need to follow the definition of macro A. The...
2009/02/11
[ "https://Stackoverflow.com/questions/537283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65101/" ]
In my code I have several macros. Macro A is the main macro. Macro A then calls macro B which in turn calls macro C. In SAS, do I have to define them in backwards order? In other words, do I have to define macro C first, then macro B, then macro A last? Or does it matter since SAS reads all the code in before it actu...
First, you must define a macro before it is called. Second, it doesn't matter where the macro is invoked as long as you have loaded it before-hand. To elaborate on your issue: The autocall library is your friend. If you SAS administrator won't allow you to put your macros in the autocall library, you can append the ...
537,300
<p>I have a <code>IEnumerable&lt;T&gt;</code> collection with Name, FullName and Address.</p> <p>The Address looks like this:</p> <pre><code>Street1=54, Street2=redfer street, Pin=324234 Street1=54, Street2=fdgdgdfg street, Pin=45654 Street1=55, Street2=tryry street, Pin=65464 </code></pre> <p>I want to loop through...
[ { "answer_id": 537307, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 1, "selected": false, "text": "<p>Try this</p>\n\n<pre><code>var result = collection.Where(x =&gt; x.Address.Street1==54);\nforeach ( var cur in result ...
2009/02/11
[ "https://Stackoverflow.com/questions/537300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55428/" ]
I have a `IEnumerable<T>` collection with Name, FullName and Address. The Address looks like this: ``` Street1=54, Street2=redfer street, Pin=324234 Street1=54, Street2=fdgdgdfg street, Pin=45654 Street1=55, Street2=tryry street, Pin=65464 ``` I want to loop through this collection and print only those Names, FullN...
Based on your update, you can adapt Jared Par's code this way: ``` var result = collection.Where(x => x.Address.Contains("Street1=54")); foreach ( var cur in result ) { Console.WriteLine(string.Format("{0}, {1}", cur.Name, cur.FullName)); } ``` If you want to be able to plug in your Street1 value with a variable, ...