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
416,771
<p>I need to create a script that automatically setup a ssh tunnel. I think that a dedicated ssh key without password is a good start but I couldn't find if this is possible and how to do it. This key should have limited privileges (only set the tunnel up) but I need another private key (with a password) for myself.</...
[ { "answer_id": 416792, "author": "Mihai Limbășan", "author_id": 14444, "author_profile": "https://Stackoverflow.com/users/14444", "pm_score": 1, "selected": false, "text": "<p>Try the</p>\n\n<p><code>ssh-keygen</code></p>\n\n<p>command.</p>\n" }, { "answer_id": 416896, "autho...
2009/01/06
[ "https://Stackoverflow.com/questions/416771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49886/" ]
I need to create a script that automatically setup a ssh tunnel. I think that a dedicated ssh key without password is a good start but I couldn't find if this is possible and how to do it. This key should have limited privileges (only set the tunnel up) but I need another private key (with a password) for myself. Tha...
Ok, I've found the answer. First, `ssh-keygen -f theNewPrivateKey` otherwise it will overwrite the old private key. Second, `ssh -i theNewPrivateKey me@mycomputer` the `-i` option changes the private key used for the authentication. Now I can try my script. --- Edit: how does my new key has limited privileges: W...
416,773
<p>I am wondering where and when <a href="http://www.martinfowler.com/bliki/FluentInterface.html" rel="nofollow noreferrer">fluent interfaces</a> are a good idea, so I am looking for examples. So far I have found only 3 useful cases, e.g. Ruby's collections, like</p> <pre><code>unique_words = File.read("words.txt").do...
[ { "answer_id": 416816, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": true, "text": "<p><a href=\"http://jquery.com/\" rel=\"nofollow noreferrer\">jQuery</a>. :)</p>\n" }, { "answer_id": 417086, "a...
2009/01/06
[ "https://Stackoverflow.com/questions/416773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48181/" ]
I am wondering where and when [fluent interfaces](http://www.martinfowler.com/bliki/FluentInterface.html) are a good idea, so I am looking for examples. So far I have found only 3 useful cases, e.g. Ruby's collections, like ``` unique_words = File.read("words.txt").downcase.split.sort.uniq.length ``` and [Fest](http...
[jQuery](http://jquery.com/). :)
416,805
<p>On an HTML page, a link like this:</p> <pre><code>&lt;a href=&quot;#pagelocation&quot;&gt;Location on Page&lt;/a&gt; </code></pre> <p>...should navigate to this spot on the page:</p> <pre><code>&lt;a name=&quot;pagelocation&quot;&gt; </code></pre> <p>But in my experience, it sometimes misses - especially when linkin...
[ { "answer_id": 416819, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 3, "selected": false, "text": "<p>I believe the behavior you are seeing is the result of the browser locating to that spot on the page before all images hav...
2009/01/06
[ "https://Stackoverflow.com/questions/416805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4376/" ]
On an HTML page, a link like this: ``` <a href="#pagelocation">Location on Page</a> ``` ...should navigate to this spot on the page: ``` <a name="pagelocation"> ``` But in my experience, it sometimes misses - especially when linking from another page (like `<a href="somepage.html#pagelocation">`). By "misses," I ...
Quite often the scrolling can occur before the page has finished loading. If you have images without widths and heights, the page will jump, then load the image and re-layout itself, making the place you previously jumped to seem wrong. Edit: Anything else that can change page layout should also be considered with sus...
416,851
<p>Is there any Perl script to get the pages from a PDF file and convert the same to another PDF file?</p>
[ { "answer_id": 416864, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://www.accesspdf.com/pdftk/\" rel=\"noreferrer\">PdfTK</a>.</p>\n\n<pre><code>~$ pdftk multi-page.pdf burst\...
2009/01/06
[ "https://Stackoverflow.com/questions/416851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45284/" ]
Is there any Perl script to get the pages from a PDF file and convert the same to another PDF file?
You asked for Perl, so here's a good solution via [CAM::PDF](http://search.cpan.org/perldoc?deletepdfpage.pl). Say you just want pages 3-6 of orig.pdf to be saved to new.pdf: ``` deletepdfpage.pl orig.pdf 1-2,7- new.pdf ```
416,856
<p>How can I determine if a user, in say Access, is a member of an Active Directory Security Group?</p> <p>I'd rather not build a whole authentication system into my little Access DB.</p> <p>Thanks</p>
[ { "answer_id": 416889, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 2, "selected": false, "text": "<p>Found <a href=\"http://my.advisor.com/doc/08691\" rel=\"nofollow noreferrer\">this online</a></p>\n\n<pre><code>Fu...
2009/01/06
[ "https://Stackoverflow.com/questions/416856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
How can I determine if a user, in say Access, is a member of an Active Directory Security Group? I'd rather not build a whole authentication system into my little Access DB. Thanks
Allain found [this online](http://my.advisor.com/doc/08691) ``` Function IsMember(strDomain As String, strGroup _ As String, strMember As String) As Boolean Dim grp As Object Dim strPath As String strPath = "WinNT://" & strDomain & "/" Set grp = GetObject(strPath & strGroup & ",group") IsMember = grp.IsMe...
416,861
<p>I'm using a list of objects as the data source of my GridView and when I set columns to not be visible the updates fail because the value of those columns is changed to null (and the column doesn't allow nulls). The values do exist when the columns are visible but I really don't want to display these columns becau...
[ { "answer_id": 416884, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 0, "selected": false, "text": "<p>If you aren't doing so already, I'd consider using Template columns for your data and do \"manual\" data binding (either \"i...
2009/01/06
[ "https://Stackoverflow.com/questions/416861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4068/" ]
I'm using a list of objects as the data source of my GridView and when I set columns to not be visible the updates fail because the value of those columns is changed to null (and the column doesn't allow nulls). The values do exist when the columns are visible but I really don't want to display these columns because, f...
I found this solution to simulate hidden columns in .Net 2.0: Implement the GridView.RowCreated event. ``` protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { e.Row.Cells[1].Visible = false; e.Row.Cells[2].Visible = false; } ``` Here's the link: [<http://www.beansoftware.com/ASP.NET...
416,873
<p>I'm using a WebBrowser control in my Visual C# (.net 2.0) application.<br /> Now I'd like to add a print button which shows the page setup dialog and then directly prints when the user presses the OK button or cancels the printing when the user presses the cancel button.<br /> However WebBrowser.ShowPageSetupDialog ...
[ { "answer_id": 416884, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 0, "selected": false, "text": "<p>If you aren't doing so already, I'd consider using Template columns for your data and do \"manual\" data binding (either \"i...
2009/01/06
[ "https://Stackoverflow.com/questions/416873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34022/" ]
I'm using a WebBrowser control in my Visual C# (.net 2.0) application. Now I'd like to add a print button which shows the page setup dialog and then directly prints when the user presses the OK button or cancels the printing when the user presses the cancel button. However WebBrowser.ShowPageSetupDialog doesn't r...
I found this solution to simulate hidden columns in .Net 2.0: Implement the GridView.RowCreated event. ``` protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { e.Row.Cells[1].Visible = false; e.Row.Cells[2].Visible = false; } ``` Here's the link: [<http://www.beansoftware.com/ASP.NET...
416,875
<p>I'm a ClearCase newbie and up until now have been used to SVN. Therefore, I'm a bit confused on the steps I need to take to create a new directory structure containing multiple files to ClearCase.</p> <p>So, say for example there is an existing directory structure within ClearCase as follows:</p> <pre><code>\Paren...
[ { "answer_id": 417090, "author": "philant", "author_id": 18804, "author_profile": "https://Stackoverflow.com/users/18804", "pm_score": 1, "selected": false, "text": "<p>You have to <strong>import</strong> your local directory structure. The command is <a href=\"http://publib.boulder.ibm....
2009/01/06
[ "https://Stackoverflow.com/questions/416875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42435/" ]
I'm a ClearCase newbie and up until now have been used to SVN. Therefore, I'm a bit confused on the steps I need to take to create a new directory structure containing multiple files to ClearCase. So, say for example there is an existing directory structure within ClearCase as follows: ``` \ParentDirectory \Child...
As explained in [How can I use ClearCase to “add to source control …” recursively?](https://stackoverflow.com/questions/138321), you have to use clearfsimport which does what you are saying (checkout the parent directories, mkelem for the elements) ``` clearfsimport -preview -rec -nset c:\sourceDir\ChildDirectory5 m:\...
416,881
<p>Using SQL Server 2005 and Management Studio how do I insert a picture into an <code>Image</code> type column of a table? </p> <p>Most importantly how do I verify if it is there?</p>
[ { "answer_id": 416918, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 8, "selected": true, "text": "<pre><code>CREATE TABLE Employees\n(\n Id int,\n Name varchar(50) not null,\n Photo varbinary(max) not null...
2009/01/06
[ "https://Stackoverflow.com/questions/416881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18631/" ]
Using SQL Server 2005 and Management Studio how do I insert a picture into an `Image` type column of a table? Most importantly how do I verify if it is there?
``` CREATE TABLE Employees ( Id int, Name varchar(50) not null, Photo varbinary(max) not null ) INSERT INTO Employees (Id, Name, Photo) SELECT 10, 'John', BulkColumn FROM Openrowset( Bulk 'C:\photo.bmp', Single_Blob) as EmployeePicture ```
416,897
<p>I want to show a label rotated 90 degrees (so I can put a bunch of them at the top of a table as the headings). Is there an easy way to do this?</p>
[ { "answer_id": 416916, "author": "Bob", "author_id": 45, "author_profile": "https://Stackoverflow.com/users/45", "pm_score": 6, "selected": true, "text": "<p>You will need to write your own or use a custom control.</p>\n\n<p>A <a href=\"http://en.wikipedia.org/wiki/The_Code_Project\" rel...
2009/01/06
[ "https://Stackoverflow.com/questions/416897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26874/" ]
I want to show a label rotated 90 degrees (so I can put a bunch of them at the top of a table as the headings). Is there an easy way to do this?
You will need to write your own or use a custom control. A [The Code Project](http://en.wikipedia.org/wiki/The_Code_Project) article you can start with is *[Customized Text - Orientated Controls in C# - Part I (Label Control)](http://www.codeproject.com/KB/miscctrl/customtext.aspx)*. This contains extra functionality,...
416,904
<p>I am not familiar with this, and can use a kick start.</p> <p>I am using ATL (unmanaged C++) user control and would like to use the ShockWave ActiveX object. I need to know how to declare it so that I can set a property or call a method.</p> <p>For instance, if I could assign a variable to it, then I would like to...
[ { "answer_id": 416929, "author": "gbjbaanb", "author_id": 13744, "author_profile": "https://Stackoverflow.com/users/13744", "pm_score": 0, "selected": false, "text": "<p>I cut&amp;paste the necessary code so many times I can't remember the exact syntax but you have to:</p>\n\n<p>get a CC...
2009/01/06
[ "https://Stackoverflow.com/questions/416904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16794/" ]
I am not familiar with this, and can use a kick start. I am using ATL (unmanaged C++) user control and would like to use the ShockWave ActiveX object. I need to know how to declare it so that I can set a property or call a method. For instance, if I could assign a variable to it, then I would like to call 'variable->...
If you #import the dll (which I recommend when working with COM because it makes your life SO much easier), you can use a smart pointer paired with the CLSID of the object. Remember that smart pointer classes have the post-fix 'Ptr' after the interface name. For instance: ``` ISomeInterfacePtr pSomeInterface( CLSID_S...
416,914
<p>This post is not really a question, but it could be useful to share some coding tips.</p> <p>Here is the one I'd like to share with you. I'm going to show 4 examples that do the same thing. But only the last one will be the best.</p> <pre><code>$foo = 'John SMITH'; echo "Hello $foo, welcome on my website."; echo...
[ { "answer_id": 416941, "author": "Paweł Hajdan", "author_id": 9403, "author_profile": "https://Stackoverflow.com/users/9403", "pm_score": 3, "selected": false, "text": "<p>It's not worth it. You may experience some 0,1% speedup (don't take it literally; a negligible speedup) for your who...
2009/01/06
[ "https://Stackoverflow.com/questions/416914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51760/" ]
This post is not really a question, but it could be useful to share some coding tips. Here is the one I'd like to share with you. I'm going to show 4 examples that do the same thing. But only the last one will be the best. ``` $foo = 'John SMITH'; echo "Hello $foo, welcome on my website."; echo "Hello " . $foo . " ...
**It is completely irrelevant which solution performs better.** Computers are blazing fast and CPU cycles are cheap, therefore millisecond optimizations are pointless. The only real optimization is the one that helps **you** read the code faster, so you can save your precious time and focus on actually delivering worki...
416,944
<p>My problem is that I receive for example a date in a concatenated format:</p> <pre><code>Ex: 20050728 </code></pre> <p>And I have to retrieve it in a readable format through my xslt.</p> <pre><code>Ex. 28 July 2005 </code></pre> <p>I also have a similar question regards time.</p> <pre><code>Ex: 0004 </code></pr...
[ { "answer_id": 416958, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 2, "selected": false, "text": "<p>If you can use XPath 2.0, see this <a href=\"http://www.w3schools.com/Xpath/xpath_functions.asp#datetime\" rel=\"nofollo...
2009/01/06
[ "https://Stackoverflow.com/questions/416944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44649/" ]
My problem is that I receive for example a date in a concatenated format: ``` Ex: 20050728 ``` And I have to retrieve it in a readable format through my xslt. ``` Ex. 28 July 2005 ``` I also have a similar question regards time. ``` Ex: 0004 ``` To be displayed as `00:04` How is this done?
**Use the [XPath](http://www.w3.org/TR/xpath)** `substring()` **function as shown in the solution below**: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <!-- --> <xsl:variable name="vrMonths"> <m>January<...
416,956
<p>I have written the following function.. and executed using WinHugs</p> <pre><code>teneven = [x | x &lt;- [1..10], even x] </code></pre> <p>My output:</p> <pre><code>Main&gt; teneven [2,4,6,8,10] :: [Integer] (63 reductions, 102 cells) </code></pre> <p>is there anyway to print all the reductions.. so I can lear...
[ { "answer_id": 420716, "author": "ADEpt", "author_id": 10105, "author_profile": "https://Stackoverflow.com/users/10105", "pm_score": 2, "selected": false, "text": "<p>Believe me, you dont want to go this way.</p>\n\n<p>Set (and order) of reductions used in each particular case would depe...
2009/01/06
[ "https://Stackoverflow.com/questions/416956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49767/" ]
I have written the following function.. and executed using WinHugs ``` teneven = [x | x <- [1..10], even x] ``` My output: ``` Main> teneven [2,4,6,8,10] :: [Integer] (63 reductions, 102 cells) ``` is there anyway to print all the reductions.. so I can learn the core evaluation happening inside WinHugs?
Some ideas: 1. The debug command-line option (which you can set with `:set +d` in Hugs) is informative, but is very verbose and does not show you the reductions in Haskell syntax. 2. Try [Hat - the Haskell Tracer](http://www.haskell.org/hat/). I just tried it on a simple program and it's pretty cool. I'm not on Window...
416,957
<p>I'm normally a Linux guy, but I need to write a batch script on Windows to change the target of some shortcuts. Is there a command to do that?</p>
[ { "answer_id": 417036, "author": "Tmdean", "author_id": 45084, "author_profile": "https://Stackoverflow.com/users/45084", "pm_score": 6, "selected": true, "text": "<p>I doubt there is a way to do it with a batch script. It's <a href=\"http://msdn.microsoft.com/en-us/library/xk6kst2k(VS.8...
2009/01/06
[ "https://Stackoverflow.com/questions/416957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103052/" ]
I'm normally a Linux guy, but I need to write a batch script on Windows to change the target of some shortcuts. Is there a command to do that?
I doubt there is a way to do it with a batch script. It's [doable](http://msdn.microsoft.com/en-us/library/xk6kst2k(VS.85).aspx) in VBScript, though. ``` Set sh = CreateObject("WScript.Shell") Set shortcut = sh.CreateShortcut("C:\Wherever\Shortcut.lnk") shortcut.TargetPath = "C:\Wherever\Whatever.txt" shortcut.Save `...
416,968
<p>I am receiving dynamic xml where I won't know the attribute names, if you'll look at the xml and code... I tried to make a simple example, I can get the attribute values i.e. "myName", "myNextAttribute", and "blah", but I can't get the attribute names i.e. "name", "nextAttribute", and "etc1". Any ideas, I figure i...
[ { "answer_id": 417020, "author": "Dror", "author_id": 48317, "author_profile": "https://Stackoverflow.com/users/48317", "pm_score": 6, "selected": true, "text": "<p>You can see in <a href=\"http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.movetonextattribute(VS.80).aspx\" rel...
2009/01/06
[ "https://Stackoverflow.com/questions/416968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36614/" ]
I am receiving dynamic xml where I won't know the attribute names, if you'll look at the xml and code... I tried to make a simple example, I can get the attribute values i.e. "myName", "myNextAttribute", and "blah", but I can't get the attribute names i.e. "name", "nextAttribute", and "etc1". Any ideas, I figure it has...
You can see in [MSDN](http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.movetonextattribute(VS.80).aspx): ``` if (reader.HasAttributes) { Console.WriteLine("Attributes of <" + reader.Name + ">"); while (reader.MoveToNextAttribute()) { Console.WriteLine(" {0}={1}", reader.Name, reader.Value); } /...
416,980
<p>I have a generic type:</p> <pre><code>public class Packet&lt;T&gt; where T : IContent { private int id; public int Id { get { return this.id; } } private T content; public T Content { get { return this.content; } } } </code></pre> <p>I want to deserialize/serialize instances of this type from/to X...
[ { "answer_id": 419891, "author": "Sachin Gaur", "author_id": 2572740, "author_profile": "https://Stackoverflow.com/users/2572740", "pm_score": 1, "selected": false, "text": "<p>Yes, you can implement a custom class directly with IXmlSerializable. <br/>\nFor more information, see <a href=...
2009/01/06
[ "https://Stackoverflow.com/questions/416980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4687/" ]
I have a generic type: ``` public class Packet<T> where T : IContent { private int id; public int Id { get { return this.id; } } private T content; public T Content { get { return this.content; } } } ``` I want to deserialize/serialize instances of this type from/to XML. `IContent` is defined like t...
Yes, you can implement a custom class directly with IXmlSerializable. For more information, see [this](http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx) article.
416,983
<p>I have a tcl script which 'exec' rpmbuild. When doing so, the 'topdir' used by rpmbuild is wrong. I have a .rpmmacros file in my home directory and if I call manually rpmbuild, it works fine, ie. the 'topdir' is not the default one. </p> <p>I added a <em>[exec rpmbuild "--showrc" ]</em> in the tcl script to check t...
[ { "answer_id": 417572, "author": "Joseph Bui", "author_id": 3275, "author_profile": "https://Stackoverflow.com/users/3275", "pm_score": 1, "selected": false, "text": "<p>TCL will exec in the current directory by default. You can change the current directory by using the TCL command <a hr...
2009/01/06
[ "https://Stackoverflow.com/questions/416983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20986/" ]
I have a tcl script which 'exec' rpmbuild. When doing so, the 'topdir' used by rpmbuild is wrong. I have a .rpmmacros file in my home directory and if I call manually rpmbuild, it works fine, ie. the 'topdir' is not the default one. I added a *[exec rpmbuild "--showrc" ]* in the tcl script to check the value of *topd...
There's two ways to change the default rpmbuild topdir: 1. Per-User: By configuring the RPM topdir in $HOME/.rpmmacros ``` %_topdir %{getenv:HOME}/rpmbuild ``` 2. Per-Project: By configuring the RPM topdir in the Makefile or on the command line ``` rpmbuild --define '_topdir build' -ba package.spec ``` Note: i...
417,000
<p>I am a bit stuck on the design of my seo friendly urls for mvc....Take for example the following url: <a href="http://myapp/venues/resturants.aspx?location=central&amp;orderBy=top-rated" rel="nofollow noreferrer">http://myapp/venues/resturants.aspx?location=central&amp;orderBy=top-rated</a></p> <p>With my mvc app i...
[ { "answer_id": 417038, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 0, "selected": false, "text": "<p>Why don't you create a property in the page for each possible querystring parameter?</p>\n\n<p>This way you can handle i...
2009/01/06
[ "https://Stackoverflow.com/questions/417000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am a bit stuck on the design of my seo friendly urls for mvc....Take for example the following url: <http://myapp/venues/resturants.aspx?location=central&orderBy=top-rated> With my mvc app i have mapped it as follows: <http://myapp/venues/list/resturants/central/top-rated> {controller}/{action}/{category}/{locati...
Assuming that the allowed values for location and order are unique (i.e. when they come in, you can tell them apart, or else if they only supply one, how are you going to know if it's a location or an order?), then you could just take two parameters and work out what they are in the controller. Route: `{controller}/{a...
417,024
<p>Suppose someone (other than me) writes the following code and compiles it into an assembly:</p> <pre><code>using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using (var transaction = conn.BeginTransaction()) { /* Update something in the database */ /* Then call an...
[ { "answer_id": 417080, "author": "lvaneenoo", "author_id": 24101, "author_profile": "https://Stackoverflow.com/users/24101", "pm_score": 2, "selected": false, "text": "<p>The command object can only be assigned a transaction object using one of its constructors. You can go for the .NET 2...
2009/01/06
[ "https://Stackoverflow.com/questions/417024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40348/" ]
Suppose someone (other than me) writes the following code and compiles it into an assembly: ``` using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using (var transaction = conn.BeginTransaction()) { /* Update something in the database */ /* Then call any registered O...
Wow I didn't believe this at first. I am surprised that `CreateCommand()` doesn't give the command it's transaction when using local SQL Server transactions, and that the transaction is not exposed on the `SqlConnection` object. Actually when reflecting on `SqlConnection` the current transaction is not even stored in t...
417,039
<p>I have some configuration data that I'd like to model in code as so:</p> <pre><code>Key1, Key2, Key3, Value null, null, null, 1 1, null, null, 2 9, null, null, 21 1, null, 3, 3 null, 2, 3, 4 1, 2, 3, 5 </code></pre> <p>With this configuration set, I then need to do l...
[ { "answer_id": 417125, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>EDIT: This code is apparently not what's required, but I'm leaving it as it's interesting anyway. It basically treats...
2009/01/06
[ "https://Stackoverflow.com/questions/417039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18941/" ]
I have some configuration data that I'd like to model in code as so: ``` Key1, Key2, Key3, Value null, null, null, 1 1, null, null, 2 9, null, null, 21 1, null, 3, 3 null, 2, 3, 4 1, 2, 3, 5 ``` With this configuration set, I then need to do lookups on bazillion (give ...
I'm assuming that there are few rules, and a large number of items that you're going to check against the rules. In this case, it might be worth the expense of memory and up-front time to pre-compute a structure that would help you find the object faster. The basic idea for this structure would be a tree such that at ...
417,062
<p>It is often useful to have a field in a DAO whose value comes from a Java enumeration. A typical example is a login DAO where you usually have a field that characterises the user as "NORMAL" or "ADMIN". In Hibernate, I would use the following 2 objects to represent this relationship in a (semi-)typesafe way:</p> <p...
[ { "answer_id": 417127, "author": "Craig", "author_id": 1611, "author_profile": "https://Stackoverflow.com/users/1611", "pm_score": 4, "selected": false, "text": "<p>From the Hibernate documentation: <a href=\"http://www.hibernate.org/272.html\" rel=\"nofollow noreferrer\">http://www.hibe...
2009/01/06
[ "https://Stackoverflow.com/questions/417062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51681/" ]
It is often useful to have a field in a DAO whose value comes from a Java enumeration. A typical example is a login DAO where you usually have a field that characterises the user as "NORMAL" or "ADMIN". In Hibernate, I would use the following 2 objects to represent this relationship in a (semi-)typesafe way: ``` class...
using hibernate or JPA annotations: ``` class User { @Enumerated(EnumType.STRING) UserType type } ``` UserType is just a standard java 5 enum. I can't imagine this is just limited to just annotations but I don't actually know how to do this with hbm files. It may be very version dependant, I'm guessing but I...
417,078
<p>I have used ValidatorEnable to disable a RequiredFieldValidator in javascript. However on postback the control being validated by the validator is still validated ... even though I disabled the validator on the client.</p> <p>I understand why this is happening since I've only disabled the client validation ... howe...
[ { "answer_id": 417191, "author": "HectorMac", "author_id": 1400, "author_profile": "https://Stackoverflow.com/users/1400", "pm_score": 2, "selected": false, "text": "<p>It's not clear from your question, what you are disabling. The RequiredFieldValidator has an both an Enabled and an Ena...
2009/01/06
[ "https://Stackoverflow.com/questions/417078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47036/" ]
I have used ValidatorEnable to disable a RequiredFieldValidator in javascript. However on postback the control being validated by the validator is still validated ... even though I disabled the validator on the client. I understand why this is happening since I've only disabled the client validation ... however is the...
Peanut, I just encounted the same issue you are. On the client-side I have javascript that disables required field validators depending on their selections in the UI. However, the server side validation was still firing. During load, I added a method to disable my validators using the same rules I have on the javascri...
417,087
<p>I have a listbox of names, I want to click one of the names so that it is highlighted and then click a button that runs some code for the selected item. How do I call this selected item?</p> <pre><code> private void btnEcho_Click(object sender, EventArgs e) { listbox1.SelectedItem...... } </code...
[ { "answer_id": 417107, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 0, "selected": false, "text": "<pre><code>String s = listbox1.SelectedItem.Value.ToString();\n</code></pre>\n\n<p>Don't forget to do a null check, because t...
2009/01/06
[ "https://Stackoverflow.com/questions/417087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a listbox of names, I want to click one of the names so that it is highlighted and then click a button that runs some code for the selected item. How do I call this selected item? ``` private void btnEcho_Click(object sender, EventArgs e) { listbox1.SelectedItem...... } ``` Many thanks
The listbox isn't very intuitive because it contains objects instead of something like ListItem, but if you just want the text you can do this: ``` string selectedText = listbox1.SelectedItem.ToString(); ```
417,097
<p>Hey. I've got some code from Agile Web Development that wraps some HTML around a method call as so:</p> <pre><code> # from tagged_builder.rb, included as a FormBuilder helper def self.create_tagged_field(method_name) define_method(method_name) do |label, *args| @template.content_tag("p", @templa...
[ { "answer_id": 417107, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 0, "selected": false, "text": "<pre><code>String s = listbox1.SelectedItem.Value.ToString();\n</code></pre>\n\n<p>Don't forget to do a null check, because t...
2009/01/06
[ "https://Stackoverflow.com/questions/417097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52092/" ]
Hey. I've got some code from Agile Web Development that wraps some HTML around a method call as so: ``` # from tagged_builder.rb, included as a FormBuilder helper def self.create_tagged_field(method_name) define_method(method_name) do |label, *args| @template.content_tag("p", @template.content_tag...
The listbox isn't very intuitive because it contains objects instead of something like ListItem, but if you just want the text you can do this: ``` string selectedText = listbox1.SelectedItem.ToString(); ```
417,108
<p>Why are there dashes in a .NET GUID? Are there dashes in most implementations of a GUID, or is it just a Microsoft thing?</p> <p>Signed,</p> <p>741ecf77-9c92-4435-8e6b-85975bd13452</p>
[ { "answer_id": 417123, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 3, "selected": false, "text": "<p>It's just a convenience.</p>\n\n<p><a href=\"http://en.wikipedia.org/wiki/GUID\" rel=\"noreferrer\">http://en.wiki...
2009/01/06
[ "https://Stackoverflow.com/questions/417108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
Why are there dashes in a .NET GUID? Are there dashes in most implementations of a GUID, or is it just a Microsoft thing? Signed, 741ecf77-9c92-4435-8e6b-85975bd13452
Technically, there are no "dashes" in a [GUID](http://en.wikipedia.org/wiki/GUID). A GUID is a 128-bit value which is usually stored in the following manner (using C# here to represent the structure): ``` public struct Guid { public ulong Data1; public ushort Data2; public ushort Data3; public fixed byte Data4...
417,112
<p>I have an ASP.NET 2.0 application under IIS that has the functionnality of exporting some data to a software called HFM (Oracle Hyperion Financial Management). To perform that export, the .net application uses an API based on COM objects provided by the HFM client (the client is installed on the same machine that t...
[ { "answer_id": 417441, "author": "HTTP 410", "author_id": 13118, "author_profile": "https://Stackoverflow.com/users/13118", "pm_score": 2, "selected": false, "text": "<p>Can you put a generic wrapper type that implements <strong>IDisposable</strong> around each of these COM instances? </...
2009/01/06
[ "https://Stackoverflow.com/questions/417112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28544/" ]
I have an ASP.NET 2.0 application under IIS that has the functionnality of exporting some data to a software called HFM (Oracle Hyperion Financial Management). To perform that export, the .net application uses an API based on COM objects provided by the HFM client (the client is installed on the same machine that the ...
> > But there are a lot of complex actions performed and I am not able to release all created object. > > > There's your problem. You're looking for an easy way out. But you're working with COM. The only easy way out you get is when your process/appdomain is shut down.
417,121
<p>The <strike>Windows default instalation comes with</strike> MSSQL client has a cliconfg application that is used to set aliases to Servers IP addresses and ports. Sometimes we use in our ConnectionStrings some of those aliases instead of IP address,port. How can I programatically translate that alias to an address u...
[ { "answer_id": 420648, "author": "inferis", "author_id": 51998, "author_profile": "https://Stackoverflow.com/users/51998", "pm_score": 0, "selected": false, "text": "<p>As long as you don't need the port, it's fairly trivial to get the IP address using the System.Net.Dns class :</p>\n\n<...
2009/01/06
[ "https://Stackoverflow.com/questions/417121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
The Windows default instalation comes with MSSQL client has a cliconfg application that is used to set aliases to Servers IP addresses and ports. Sometimes we use in our ConnectionStrings some of those aliases instead of IP address,port. How can I programatically translate that alias to an address using .NET? **Update...
I found the following solution for 32 bit versions of Windows: ``` using Microsoft.Win32; static void Main(string[] args) { var Aliases = Registry.LocalMachine.OpenSubKey( @"SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo"); Aliases.GetValue("Alias"); } ```
417,122
<p>I have this string: <code>" Mimi loves Toto and Tata hate Mimi so Toto killed Tata"</code></p> <p>I want to write a code that print only the words that begin with capital letters, avoiding repetition</p> <p>the Output should be like</p> <pre><code>Mimi Toto Tata </code></pre> <p>I tried to do so but I'm sure its...
[ { "answer_id": 417153, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 3, "selected": false, "text": "<p>I'm not sure why I'm posting this...</p>\n\n<pre><code> string[] foo = \"Mimi loves Toto and Tata hate Mimi so Toto kil...
2009/01/06
[ "https://Stackoverflow.com/questions/417122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this string: `" Mimi loves Toto and Tata hate Mimi so Toto killed Tata"` I want to write a code that print only the words that begin with capital letters, avoiding repetition the Output should be like ``` Mimi Toto Tata ``` I tried to do so but I'm sure its wrong even though no errors are showing. The code...
I'm not sure why I'm posting this... ``` string[] foo = "Mimi loves Toto and Tata hate Mimi so Toto killed Tata".Split(' '); HashSet<string> words = new HashSet<string>(); foreach (string word in foo) { if (char.IsUpper(word[0])) { ...
417,131
<p>I have a page with two ContentPlaceHolders. One has a DropDown and another UpdatePanel with content. </p> <p>How can I trigger update to the UpdatePanel by the DropDown's selectedItemChanged event when they are in different ContentPlaceholders?</p> <p>The following would not work since UpdatePanel1 doesn't know a...
[ { "answer_id": 417352, "author": "Robert C. Barth", "author_id": 9209, "author_profile": "https://Stackoverflow.com/users/9209", "pm_score": 2, "selected": false, "text": "<p>In the code-behind file, you should be able to do:</p>\n\n<pre><code>ScriptManager.RegisterAsyncPostBackControl(d...
2009/01/06
[ "https://Stackoverflow.com/questions/417131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37759/" ]
I have a page with two ContentPlaceHolders. One has a DropDown and another UpdatePanel with content. How can I trigger update to the UpdatePanel by the DropDown's selectedItemChanged event when they are in different ContentPlaceholders? The following would not work since UpdatePanel1 doesn't know about DropDown1: `...
From <http://msdn.microsoft.com/en-us/library/system.web.ui.asyncpostbacktrigger.aspx> > > The control that the > AsyncPostBackTrigger references must > be in the same naming container as > the update panel for which it is a > trigger. Triggers that are based on > controls in other naming containers > are not ...
417,133
<p>Is it possible to add rows to a dataset?</p>
[ { "answer_id": 417155, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 5, "selected": true, "text": "<p>yes. </p>\n\n<pre><code>dim row as DataRow \nrow = ds.tables(0).NewRow \n' Add Values to Row here \nds.tables(0...
2009/01/06
[ "https://Stackoverflow.com/questions/417133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26087/" ]
Is it possible to add rows to a dataset?
yes. ``` dim row as DataRow row = ds.tables(0).NewRow ' Add Values to Row here ds.tables(0).rows.add(row) ```
417,142
<p>What is the maximum length of a URL for each browser?</p> <p>Is a maximum URL length part of the HTTP specification?</p>
[ { "answer_id": 417167, "author": "Brian", "author_id": 18192, "author_profile": "https://Stackoverflow.com/users/18192", "pm_score": 7, "selected": false, "text": "<p><em><a href=\"https://web.archive.org/web/20180308145804/http://www.boutell.com/newfaq/misc/urllength.html\" rel=\"norefe...
2009/01/06
[ "https://Stackoverflow.com/questions/417142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2172/" ]
What is the maximum length of a URL for each browser? Is a maximum URL length part of the HTTP specification?
Short answer - de facto limit of 2000 characters ------------------------------------------------ If you keep URLs under 2000 characters, they'll work in virtually any combination of client and server software. If you are targeting particular browsers, see below for more details on specific limits. Longer answer - f...
417,152
<p>How do I set Java's min and max heap size through environment variables?</p> <p>I know that the heap sizes can be set when launching java, but I would like to have this adjusted through environment variables on my server.</p>
[ { "answer_id": 417183, "author": "a2800276", "author_id": 27408, "author_profile": "https://Stackoverflow.com/users/27408", "pm_score": 3, "selected": false, "text": "<p>You can't do it using environment variables. It's done via \"non standard\" options. Run: <code>java -X</code> for det...
2009/01/06
[ "https://Stackoverflow.com/questions/417152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14920/" ]
How do I set Java's min and max heap size through environment variables? I know that the heap sizes can be set when launching java, but I would like to have this adjusted through environment variables on my server.
You can't do it using environment variables directly. You need to use the set of "non standard" options that are passed to the java command. Run: java -X for details. The options you're looking for are -Xmx and -Xms (this is "initial" heap size, so probably what you're looking for.) Some products like Ant or Tomcat mi...
417,178
<p>I have this problem I'm hoping someone knows the answer to. I have an oracle stored procedure that takes a customer id and returns all the customer's orders in a ref_cursor. Oversimplifying it, this is what I have:</p> <pre><code>Orders - orderId - siteID Customers - siteID - Name GetOrder(siteID, outCursor) /* r...
[ { "answer_id": 417573, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 3, "selected": false, "text": "<p>You can't do it like that - cursors cannot be appended or merged. Just do this instead:</p>\n\n<pre><code>PROCEDU...
2009/01/06
[ "https://Stackoverflow.com/questions/417178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19314/" ]
I have this problem I'm hoping someone knows the answer to. I have an oracle stored procedure that takes a customer id and returns all the customer's orders in a ref\_cursor. Oversimplifying it, this is what I have: ``` Orders - orderId - siteID Customers - siteID - Name GetOrder(siteID, outCursor) /* returns all or...
If the query is simple, I would say go with Tony's answer. This is not only simple but likely to perform better than executing one query for each siteID. If it is fairly complex then it might be worth some extra effort to reuse the GetOrder procedure so you only have to maintain one query. To do this, you would need ...
417,179
<p>Here is one more newbie question:</p> <pre><code>require 'tasks/rails' </code></pre> <p>I saw this line in Rakefile in the root path of every rails project. I guess this line is used to require vendor/rails/railties/lib/tasks/rails.rb to get all rake tasks loaded:</p> <pre><code>$VERBOSE = nil # Load Rails rakefi...
[ { "answer_id": 417200, "author": "The Pied Pipes", "author_id": 52092, "author_profile": "https://Stackoverflow.com/users/52092", "pm_score": 2, "selected": false, "text": "<p>I believe because your paths are set up in your /config/environment.rb file:</p>\n\n<pre><code>require File.join...
2009/01/06
[ "https://Stackoverflow.com/questions/417179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44512/" ]
Here is one more newbie question: ``` require 'tasks/rails' ``` I saw this line in Rakefile in the root path of every rails project. I guess this line is used to require vendor/rails/railties/lib/tasks/rails.rb to get all rake tasks loaded: ``` $VERBOSE = nil # Load Rails rakefile extensions Dir["#{File.dirname(__F...
When you start your rails app it runs config/boot.rb which calls [`Rails::Initializer.set_load_path`](http://github.com/rails/rails/tree/master/railties/lib/initializer.rb#L231) and thatsets up the `$LOAD_PATH`. Ruby uses that list of directories to find the files specified on a `require` line. If you give it an absol...
417,187
<p>Here's a standard scenario:</p> <pre><code>if(string.IsNullOrEmpty(Configuration.AppSettings["foobar"])) throw new SomeStandardException("Application not configured correctly, bozo."); </code></pre> <p>The problem is, I am not entirely certain <em>which</em> exception <code>SomeStandardException</code> should b...
[ { "answer_id": 417201, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 1, "selected": false, "text": "<p>I'd suck it up and roll my own... but before you do that, Is it possible to have the system assume a default va...
2009/01/06
[ "https://Stackoverflow.com/questions/417187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47580/" ]
Here's a standard scenario: ``` if(string.IsNullOrEmpty(Configuration.AppSettings["foobar"])) throw new SomeStandardException("Application not configured correctly, bozo."); ``` The problem is, I am not entirely certain *which* exception `SomeStandardException` should be. I perused the 3.5 Framework and found t...
You're not limited in your exception-throwing to existing exceptions in the Framework. If you do decide to use existing exceptions, you don't absolutely have to follow the documentation to the letter. The documentation will describe how the *framework* uses a given exception, but doesn't imply any limitation on how *yo...
417,214
<p>I'm using the ValidatorCalloutExtender found in AjaxControlToolkit version 3.0.20299.9. The validation is occuring in a browser window that has resizable=0 set. The popout box is getting positioned mostly outside of the viewable window - off to the right.</p> <p>It had positioned correctly with AjaxControlToolkit...
[ { "answer_id": 421211, "author": "ManiacPsycho", "author_id": 23576, "author_profile": "https://Stackoverflow.com/users/23576", "pm_score": 0, "selected": false, "text": "<p>Does this happen in all browsers? IE6 is known for rendering issues and I highly recommend using something else. ...
2009/01/06
[ "https://Stackoverflow.com/questions/417214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24908/" ]
I'm using the ValidatorCalloutExtender found in AjaxControlToolkit version 3.0.20299.9. The validation is occuring in a browser window that has resizable=0 set. The popout box is getting positioned mostly outside of the viewable window - off to the right. It had positioned correctly with AjaxControlToolkit version 1.0...
I figured this one out. Thought I'd post an answer for anyone interested. The rendering is different between the two versions of AjaxControlToolkit. In order to reposition the ValidatorCallout window I found the following to work best. You have to override all of the .ajax\_\_validatorcallout\_\* css classes that the ...
417,236
<p>I'm currently using the usual technique in my Makefile to install individual files:</p> <pre><code>install: install -D executable ${BIN_DIR} </code></pre> <p>But I just ran across a situation where I need to move a whole directory and all files underneath it into place. </p> <p>Is <code>cp -r</code> the best ...
[ { "answer_id": 417321, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 4, "selected": true, "text": "<p>Yeah, it's hard to think of a more unix-ish way that <code>cp -r</code>, although the -r is a relatively late add...
2009/01/06
[ "https://Stackoverflow.com/questions/417236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7985/" ]
I'm currently using the usual technique in my Makefile to install individual files: ``` install: install -D executable ${BIN_DIR} ``` But I just ran across a situation where I need to move a whole directory and all files underneath it into place. Is `cp -r` the best way or is there a more linux-y/unix-y way to...
Yeah, it's hard to think of a more unix-ish way that `cp -r`, although the -r is a relatively late addition to `cp`. I can tell you the way we *used* to do it, and that works neatly across filesystems and such: Let `src` be the source directory you want to move, and `/path/to/target` be an absolute path to the target....
417,246
<p>I've got a list of People that are returned from an external app and I'm creating an exclusion list in my local app to give me the option of manually removing people from the list. </p> <p>I have a composite key which I have created that is common to both and I want to find an efficient way of removing people from...
[ { "answer_id": 417258, "author": "Jason Jackson", "author_id": 13103, "author_profile": "https://Stackoverflow.com/users/13103", "pm_score": 1, "selected": false, "text": "<p>I couldn't figure out how to do this in pure MS LINQ, so I wrote my own extension method to do it:</p>\n\n<pre><c...
2009/01/06
[ "https://Stackoverflow.com/questions/417246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've got a list of People that are returned from an external app and I'm creating an exclusion list in my local app to give me the option of manually removing people from the list. I have a composite key which I have created that is common to both and I want to find an efficient way of removing people from my List us...
Have a look at the [Except](http://msdn.microsoft.com/en-us/library/bb336390.aspx) method, which you use like this: ``` var resultingList = listOfOriginalItems.Except(listOfItemsToLeaveOut, equalityComparer) ``` You'll want to use the overload I've linked to, which lets you specify a custom IEqualityComparer. T...
417,249
<p>Is there a way to make all character sequences UNICODE by default? For instance, now I have to say:</p> <pre><code>std::wstring wstr(L"rofl"); </code></pre> <p>instead, I'd like to say</p> <pre><code>std::wstring wstr("rofl"); </code></pre> <p>Thanks!</p> <p>Visual C++ 8.0</p>
[ { "answer_id": 417255, "author": "dalle", "author_id": 19100, "author_profile": "https://Stackoverflow.com/users/19100", "pm_score": 3, "selected": false, "text": "<p>No, you have to use <code>L\"\"</code> in order to specify a wide-string literal.</p>\n" }, { "answer_id": 417274...
2009/01/06
[ "https://Stackoverflow.com/questions/417249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47937/" ]
Is there a way to make all character sequences UNICODE by default? For instance, now I have to say: ``` std::wstring wstr(L"rofl"); ``` instead, I'd like to say ``` std::wstring wstr("rofl"); ``` Thanks! Visual C++ 8.0
No, you have to use `L""` in order to specify a wide-string literal.
417,254
<p>I'm very new to creating macros and programming in general. I have a worksheet of 38 tabs. 31 tabs are for the days of the month. I would like to create a macro that will prompt users with a warning message any time "MCO" is selected in column N for each of these 31 tabs. Is that possible?</p> <p>Thanks</p>
[ { "answer_id": 418047, "author": "Jon Fournier", "author_id": 5106, "author_profile": "https://Stackoverflow.com/users/5106", "pm_score": 2, "selected": false, "text": "<p>It is possible, using a workbook level SheetSelectionChange event. In the ThisWorkbook module in your VBA project p...
2009/01/06
[ "https://Stackoverflow.com/questions/417254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm very new to creating macros and programming in general. I have a worksheet of 38 tabs. 31 tabs are for the days of the month. I would like to create a macro that will prompt users with a warning message any time "MCO" is selected in column N for each of these 31 tabs. Is that possible? Thanks
It is possible, using a workbook level SheetSelectionChange event. In the ThisWorkbook module in your VBA project paste the following code: ``` Option Compare Text Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Dim SelectedCellsInColN As Range ' Make a range of the cells i...
417,261
<p>It should first be noted that I am trying to avoid rewriting all my scripts to use msbuild.</p> <p>I have noticed that there are several problems when using NAnt with the VBC task and compiling a WinForms application. The main problem seems to be that VBC can't find Sub Main. This is odd, since from within VS, th...
[ { "answer_id": 417399, "author": "Scott Saad", "author_id": 4916, "author_profile": "https://Stackoverflow.com/users/4916", "pm_score": 1, "selected": false, "text": "<p>It appears like the problem is coming from the <strong>main</strong> and <strong>rootnamespace</strong> attributes. Wh...
2009/01/06
[ "https://Stackoverflow.com/questions/417261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8505/" ]
It should first be noted that I am trying to avoid rewriting all my scripts to use msbuild. I have noticed that there are several problems when using NAnt with the VBC task and compiling a WinForms application. The main problem seems to be that VBC can't find Sub Main. This is odd, since from within VS, there is no in...
It appears like the problem is coming from the **main** and **rootnamespace** attributes. What happens when you switch them to be something like the following: ``` <vbc target="winexe" output="C:\Test.exe" main="MyApplication" verbose="true" rootnamespace="WindowAppNantTest.My"> <imports> <import namespace...
417,275
<p>So I was playing around a little more with attributes in .NET, and realized that every call to Type.GetCustomAttributes() creates a new instance of my attribute. Why is that? I would think that the attribute instance would basically be a singleton-per-MemberInfo, with 1 instance bound to the Type, PropertyInfo, etc....
[ { "answer_id": 417281, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": false, "text": "<p>Attributes aren't stored in memory as objects, they're only stored as metadata in the assembly. When you query for...
2009/01/06
[ "https://Stackoverflow.com/questions/417275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28278/" ]
So I was playing around a little more with attributes in .NET, and realized that every call to Type.GetCustomAttributes() creates a new instance of my attribute. Why is that? I would think that the attribute instance would basically be a singleton-per-MemberInfo, with 1 instance bound to the Type, PropertyInfo, etc... ...
Object-creation is cheap. If you had an attribute like ``` public class MyAttribute : Attribute { public virtual string MyText { get; set; } } ``` and applied it to a class like ``` [MyAttribute(MyText="some text")] public class MyClass { } ``` and you retrieved one like ``` var attr = typeof(MyClass).G...
417,285
<p>While discussing a Java synchronization <a href="https://stackoverflow.com/questions/416183/in-java-critical-sections-what-should-i-synchronize-on#416324">question</a>, someone made a comment that the following snippets are not equivalent (and may compile to different bytecodes):</p> <pre><code>public synchronized ...
[ { "answer_id": 417313, "author": "Steve B.", "author_id": 19479, "author_profile": "https://Stackoverflow.com/users/19479", "pm_score": 0, "selected": false, "text": "<p>I can't see any functional difference - both synchronize their entire method bodies on (this). How did the person who ...
2009/01/06
[ "https://Stackoverflow.com/questions/417285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30316/" ]
While discussing a Java synchronization [question](https://stackoverflow.com/questions/416183/in-java-critical-sections-what-should-i-synchronize-on#416324), someone made a comment that the following snippets are not equivalent (and may compile to different bytecodes): ``` public synchronized void someMethod() { //s...
They are equivalent in function, though the compilers I tested (Java 1.6.0\_07 and Eclipse 3.4) generate different bytecode. The first generates: ``` // access flags 33 public synchronized someMethod()V RETURN ``` The second generates: ``` // access flags 1 public someMethod()V ALOAD 0 DUP MONITORENTER MO...
417,309
<p>I need to use an ID in a URL hyperlink like this example:</p> <blockquote> <p><a href="http://www.wotnots.co.uk/property/images/property2402_image1.jpg" rel="nofollow noreferrer">http://www.wotnots.co.uk/property/images/property2402_image1.jpg</a> </p> </blockquote> <p>The ID here is <em>2402</em>. I want to cha...
[ { "answer_id": 417325, "author": "Adam Lerman", "author_id": 673, "author_profile": "https://Stackoverflow.com/users/673", "pm_score": 1, "selected": false, "text": "<p>Here you go.</p>\n\n<p><code>=Concatenate(\"<a href=\"http://www.wotnots.co.uk/property/images/property\" rel=\"nofollo...
2009/01/06
[ "https://Stackoverflow.com/questions/417309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to use an ID in a URL hyperlink like this example: > > <http://www.wotnots.co.uk/property/images/property2402_image1.jpg> > > > The ID here is *2402*. I want to change it to the ID number which is in the first column and is different on every row. I want to have the ID number to be the same as the number ...
I would use the HYPERLINK cell function to generate the link. For example: ``` Cell A2: 2402 Cell B2: =HYPERLINK("http://www. ... /property" & A2 & "_image1.jpg","Click to see ...") ``` You can then copy the formula into all of the following rows, and the reference to cell A2 will change to be relative to the curren...
417,320
<p>Another basic Rails question:</p> <p>I have a database table that needs to contain references to exactly two different records of a specific data type.</p> <p>Hypothetical example: I'm making a video game database. I have a table for "Companies." I want to have exactly one developer and exactly one publisher for e...
[ { "answer_id": 417520, "author": "mlibby", "author_id": 13468, "author_profile": "https://Stackoverflow.com/users/13468", "pm_score": 3, "selected": false, "text": "<p>I have no idea how to do this with script/generate.</p>\n\n<p>The underlying idea is easier to show without using script...
2009/01/06
[ "https://Stackoverflow.com/questions/417320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34795/" ]
Another basic Rails question: I have a database table that needs to contain references to exactly two different records of a specific data type. Hypothetical example: I'm making a video game database. I have a table for "Companies." I want to have exactly one developer and exactly one publisher for each "Videogame" e...
Just to tidy things up a bit, in your migration you can now also do: ``` create_table :videogames do |t| t.belongs_to :developer t.belongs_to :publisher end ``` And since you're calling the keys developer\_id and publisher\_id, the model should probably be: ``` belongs_to :developer, :class_name => "Company" be...
417,334
<pre><code>var alias:String = 'models.User'; registerClassAlias(alias, models.User); // If I have the alias, then // I can get the class like this: var klass:Class = flash.net.getClassByAlias(alias); // How do I do the reverse // (get the alias from the class)? // // I want to do this, but I can't find a // 'getAlia...
[ { "answer_id": 418070, "author": "Antti", "author_id": 6037, "author_profile": "https://Stackoverflow.com/users/6037", "pm_score": 1, "selected": false, "text": "<p>Take a look at <a href=\"http://livedocs.adobe.com/flex/3/langref/flash/utils/package.html#describeType()\" rel=\"nofollow ...
2009/01/06
[ "https://Stackoverflow.com/questions/417334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45476/" ]
``` var alias:String = 'models.User'; registerClassAlias(alias, models.User); // If I have the alias, then // I can get the class like this: var klass:Class = flash.net.getClassByAlias(alias); // How do I do the reverse // (get the alias from the class)? // // I want to do this, but I can't find a // 'getAliasByClas...
Take a look at [flash.utils.describeType()](http://livedocs.adobe.com/flex/3/langref/flash/utils/package.html#describeType())
417,363
<p>For a database assignment I have to model a system for a school. Part of the requirements is to model information for staff, students and parents. </p> <p>In the UML class diagram I have modelled this as those three classes being subtypes of a person type. This is because they will all require information on, amo...
[ { "answer_id": 417408, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 4, "selected": true, "text": "<p>4 tables staff, students, parents and person for the generic stuff.\nStaff, students and parents have forign keys...
2009/01/06
[ "https://Stackoverflow.com/questions/417363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52116/" ]
For a database assignment I have to model a system for a school. Part of the requirements is to model information for staff, students and parents. In the UML class diagram I have modelled this as those three classes being subtypes of a person type. This is because they will all require information on, among other thi...
4 tables staff, students, parents and person for the generic stuff. Staff, students and parents have forign keys that each refer back to Person (not the other way around). Person has field that identifies what the subclass of this person is (i.e. staff, student or parent). **EDIT:** As pointed out by HLGM, addresse...
417,370
<p>Hey, is there any built in functions or something like that in php that will allow me to turn HTML special code like: &lt;(;), >(;), Á(;) and ©(;) etc... into &lt;, >, Á and ©</p> <p>Lets say I have the value: </p> <pre><code>$fileName = "Gibt es eine schö(;)ne Offroadstrecke? (;)"; </code></pre> <p>And I want th...
[ { "answer_id": 417386, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>Is there a reason you can't simply do a RegEx (or some other tool) to search and replace for \"(;)\" ?</p>\n" }, { ...
2009/01/06
[ "https://Stackoverflow.com/questions/417370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43209/" ]
Hey, is there any built in functions or something like that in php that will allow me to turn HTML special code like: <(;), >(;), Á(;) and ©(;) etc... into <, >, Á and © Lets say I have the value: ``` $fileName = "Gibt es eine schö(;)ne Offroadstrecke? (;)"; ``` And I want this: ``` $fileName = "Gibt es eine schö...
I think you want [html\_entity\_decode](http://uk3.php.net/manual/en/function.html-entity-decode.php)
417,371
<p>First check out this code. I seems like it should work for me, but it doesn't! (surprise!)</p> <p>Anyway, this is what I tried first:</p> <pre><code>SELECT Status as status, Address as ip, PCName as pc_name, (Numbers.Phone = 'CPU/' + PCName) as cpu_contact, (Numbers.Phone = 'PC/' + PCName) as pc_contact, (Number...
[ { "answer_id": 417431, "author": "George Mastros", "author_id": 1408129, "author_profile": "https://Stackoverflow.com/users/1408129", "pm_score": 1, "selected": false, "text": "<p>You need to use Case/When for the comparisons. In this case, I am hardcoding a 1 or 0, but T-SQL will conve...
2009/01/06
[ "https://Stackoverflow.com/questions/417371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
First check out this code. I seems like it should work for me, but it doesn't! (surprise!) Anyway, this is what I tried first: ``` SELECT Status as status, Address as ip, PCName as pc_name, (Numbers.Phone = 'CPU/' + PCName) as cpu_contact, (Numbers.Phone = 'PC/' + PCName) as pc_contact, (Numbers.Phone = 'LOGIN/' + PC...
You could use a `GROUP BY` and `SUM` to collapse the rows: ``` SELECT Status as status, Address as ip, PCName as pc_name, cast(sum(case when (Numbers.Phone = 'CPU/' + PCName) then 1 else 0 end) as bit) as cpu_contact, cast(sum(case when (Numbers.Phone = 'PC/' + PCName) then 1 else 0 end)) as bit) as pc_c...
417,373
<p>I have a function (for ease, I'll just use count()) that I want to apply to maybe 4-5 different variables. Right now, I am doing this:</p> <pre><code>$a = count($a); $b = count($b); $c = count($c); $d = count($d); </code></pre> <p>Is there a better way? I know arrays can use the array_map function, but I want the ...
[ { "answer_id": 417395, "author": "Ben", "author_id": 11522, "author_profile": "https://Stackoverflow.com/users/11522", "pm_score": 3, "selected": true, "text": "<p>I know you said you don't want the values to be in an array, but how about just creating an array specifically for looping t...
2009/01/06
[ "https://Stackoverflow.com/questions/417373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29595/" ]
I have a function (for ease, I'll just use count()) that I want to apply to maybe 4-5 different variables. Right now, I am doing this: ``` $a = count($a); $b = count($b); $c = count($c); $d = count($d); ``` Is there a better way? I know arrays can use the array\_map function, but I want the values to remain as separ...
I know you said you don't want the values to be in an array, but how about just creating an array specifically for looping through the values? i.e.: ``` $arr = Array($a, $b, $c, $d); foreach ($arr as &$var) { $var = count($var); } ``` I'm not sure if that really is much tidier than the original way, though.
417,396
<p><a href="https://stackoverflow.com/questions/417265/what-does-sign-mean-in-django">This question</a> originally asked (wrongly) what does "|" mean in Python, when the actual question was about Django. That question had a wonderful answer by Triptych I want to preserve. </p>
[ { "answer_id": 417402, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>Bitwise OR</p>\n" }, { "answer_id": 417438, "author": "Kenan Banks", "author_id": 43089, "author_profil...
2009/01/06
[ "https://Stackoverflow.com/questions/417396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5190/" ]
[This question](https://stackoverflow.com/questions/417265/what-does-sign-mean-in-django) originally asked (wrongly) what does "|" mean in Python, when the actual question was about Django. That question had a wonderful answer by Triptych I want to preserve.
In Python, the `'|'` operator is defined by default on integer types and set types. If the two operands are integers, then it will perform a [bitwise or](http://en.wikipedia.org/wiki/Bitwise_operation#OR), which is a mathematical operation. If the two operands are `set` types, the `'|'` operator will return the unio...
417,428
<p>Why do we need to create custom exceptions in <code>.NET?</code></p>
[ { "answer_id": 417437, "author": "masfenix", "author_id": 50312, "author_profile": "https://Stackoverflow.com/users/50312", "pm_score": 2, "selected": false, "text": "<p>I am not sure why \"technically\" but lets say I have a app/website that uses permissions. If someone does not have th...
2009/01/06
[ "https://Stackoverflow.com/questions/417428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50974/" ]
Why do we need to create custom exceptions in `.NET?`
Specific customs exceptions allow you to segregate different error types for your catch statements. The common construct for exception handling is this: ``` try {} catch (Exception ex) {} ``` This catches *all* exceptions regardless of type. However, if you have custom exceptions, you can have separate handlers for ...
417,429
<p>I need to display something such as below.</p> <h2>Type A</h2> <ol> <li>Type A Item 1</li> <li>Type A Item 2</li> <li>Type A Item 3</li> </ol> <h2>Type B</h2> <ol> <li>Type B Item 1</li> <li>Type B Item 2</li> <li>Type B Item 3</li> </ol> <h2>Type C</h2> <ol> <li>Type C Item 1</li> <li>Type C Item 2</li> <li>T...
[ { "answer_id": 417464, "author": "Ty.", "author_id": 8873, "author_profile": "https://Stackoverflow.com/users/8873", "pm_score": 0, "selected": false, "text": "<p>Ok, I just came up with a solution. Though it is pretty dirty.</p>\n\n<p>I created a global variable to track the headers. Th...
2009/01/06
[ "https://Stackoverflow.com/questions/417429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8873/" ]
I need to display something such as below. Type A ------ 1. Type A Item 1 2. Type A Item 2 3. Type A Item 3 Type B ------ 1. Type B Item 1 2. Type B Item 2 3. Type B Item 3 Type C ------ 1. Type C Item 1 2. Type C Item 2 3. Type C Item 3 All of the data comes from a dataset with columns 'Type' and 'ItemName'. No...
Instead of creating a repeater for each type, how about a nested repeater? <http://www.codeproject.com/KB/aspnet/AspNetNestedRepeaters.aspx> Try that out. You still will need more than one repeater, but in this case it'd only be two that you need, and you wouldn't have to make one for each type (as you were fearing) ...
417,430
<p>In the following code I want to replace every occurrence of <code>"U.S.A"</code> with <code>"united states of America"</code> and every occurrence of <code>"uk"</code> with <code>"united kingdom"</code> in a string, but it does not seem to work. How do I fix it? </p> <pre><code>class Program { static vo...
[ { "answer_id": 417447, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 2, "selected": false, "text": "<p>Well, look at the search pattern in your regex.</p>\n\n<p>The <code>^</code> has a specific meaning. (as do the <code>...
2009/01/06
[ "https://Stackoverflow.com/questions/417430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In the following code I want to replace every occurrence of `"U.S.A"` with `"united states of America"` and every occurrence of `"uk"` with `"united kingdom"` in a string, but it does not seem to work. How do I fix it? ``` class Program { static void Main(string[] args) { string s = "t...
For simple replacements, you don't need Regular expressions: ``` string s = "the U.S.A love UK"; s = s.Replace("U.S.A", "United States of America").Replace("UK", "United Kingdom"); ```
417,435
<p>I have a configuration XML file which contains an encrypted password. From time to time we need to reset this password, and the methodology for doing so involves stripping out the string which is effectively the password from the XML file and saving the file.</p> <p>The process also involves stopping and restartin...
[ { "answer_id": 417462, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "<p>Perhaps a <a href=\"http://msdn.microsoft.com/en-us/library/ms974570.aspx\" rel=\"nofollow noreferrer\">regular exp...
2009/01/06
[ "https://Stackoverflow.com/questions/417435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a configuration XML file which contains an encrypted password. From time to time we need to reset this password, and the methodology for doing so involves stripping out the string which is effectively the password from the XML file and saving the file. The process also involves stopping and restarting a couple ...
Perhaps a [regular expression](http://msdn.microsoft.com/en-us/library/ms974570.aspx)? I normally wouldn't recommend them for parsing xml/html files, but if your xml is very specific you might be okay.
417,446
<p>I am storing objects in a buffer. Now I know that I cannot make assumptions about the memory layout of the object.</p> <p>If I know the overall size of the object, is it acceptible to create a pointer to this memory and call functions on it?</p> <p>e.g. say I have the following class:</p> <pre><code>[int,int,int,...
[ { "answer_id": 417463, "author": "Steve Fallows", "author_id": 18882, "author_profile": "https://Stackoverflow.com/users/18882", "pm_score": 2, "selected": false, "text": "<p>Non-virtual function calls are linked directly just like a C function. The object (this) pointer is passed as the...
2009/01/06
[ "https://Stackoverflow.com/questions/417446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16177/" ]
I am storing objects in a buffer. Now I know that I cannot make assumptions about the memory layout of the object. If I know the overall size of the object, is it acceptible to create a pointer to this memory and call functions on it? e.g. say I have the following class: ``` [int,int,int,int,char,padding*3bytes,unsi...
You can create a constructor that takes all the members and assigns them, then use placement new. ``` class Foo { int a;int b;int c;int d;char e;unsigned short int*f; public: Foo(int A,int B,int C,int D,char E,unsigned short int*F) : a(A), b(B), c(C), d(D), e(E), f(F) {} }; ... char *buf = new char[sizeof(Fo...
417,472
<p>I have an asp.net app and I am trying to save a text file to a folder that changes with each client. How can I write it to save the files to a folder that changes. For example one customer might be C:\inetpub\wwwroot\site1\ another might be C:\inetpub\wwwroot\site2. Relative paths don't seem to work, and I've tried ...
[ { "answer_id": 417489, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 0, "selected": false, "text": "<p>Take a look at <code>Path.GetDirectoryName(Request.ServerVariables(\"SCRIPT_NAME\"))</code>.</p>\n" }, { ...
2009/01/06
[ "https://Stackoverflow.com/questions/417472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45429/" ]
I have an asp.net app and I am trying to save a text file to a folder that changes with each client. How can I write it to save the files to a folder that changes. For example one customer might be C:\inetpub\wwwroot\site1\ another might be C:\inetpub\wwwroot\site2. Relative paths don't seem to work, and I've tried Get...
You should try : In the \*.aspx.cs file : ``` string currentPath = Server.MapPath("~"); ``` I don't have the tools to test here, but I think the code is right.
417,510
<h3>Question</h3> <hr /> <p>I'm trying to build a quick and easy ASP.NET page that redirects a user to a new URL using a meta redirect. Only trouble is that I need to also pass along the GET values of the current request. I've found a way to do this programatically in the code behind using the HtmlMeta object. How...
[ { "answer_id": 419076, "author": "Jorge Alves", "author_id": 6195, "author_profile": "https://Stackoverflow.com/users/6195", "pm_score": 1, "selected": false, "text": "<p>Have you tried adding the whole meta tag programmatically?<br/>\nOnce you get the to run server-side, add your new t...
2009/01/06
[ "https://Stackoverflow.com/questions/417510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23869/" ]
### Question --- I'm trying to build a quick and easy ASP.NET page that redirects a user to a new URL using a meta redirect. Only trouble is that I need to also pass along the GET values of the current request. I've found a way to do this programatically in the code behind using the HtmlMeta object. However, I'd like...
Maybe this code inside the head tag will be what you need: ``` <%= string.Format("<meta http-equiv='refresh' content='10;url=http://contact.test.net/main.aspx?{0}' />", Request.QueryString.ToString()) %> ``` **However**, I wouldn't advise you to do it this way. For example, this URL: ``` http:/mysite.with.metaredir...
417,549
<p>I have 100 million lines of data, the data is a word no longer than 15 chars,one word per line. Those data are stored in multiple files. </p> <p>My goal to to find the unique words among all files.</p> <p>One solution is to import all words into database and add a unique key for the field. but this is too slow for...
[ { "answer_id": 417562, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 0, "selected": false, "text": "<p>If you have to stick with the file structure, then you need some way of indexing the files and then maintaining the i...
2009/01/06
[ "https://Stackoverflow.com/questions/417549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52132/" ]
I have 100 million lines of data, the data is a word no longer than 15 chars,one word per line. Those data are stored in multiple files. My goal to to find the unique words among all files. One solution is to import all words into database and add a unique key for the field. but this is too slow for this large data ...
I'm not sure that there'll be many faster ways than using a database. Personally, I usually use UNIX shell script for this: ``` cat * | sort | uniq ``` I don't know how fast that would be with 100,000,000 words, and I'm not sure how fast you want it to be. (E.g., do you need to run it lots of times or just once? If ...
417,584
<p>I'm creating an app that I want to have an expandable set of properties (each a RatingProperty) I also want to validate that any dynamic properties are of the RatingProperty type. </p> <p>In the Expando documentation it says:</p> <blockquote> <p>Tip: If you want to validate a dynamic property value using a Prope...
[ { "answer_id": 418905, "author": "pat", "author_id": 46436, "author_profile": "https://Stackoverflow.com/users/46436", "pm_score": 1, "selected": false, "text": "<p>After a bit more research (damn you lazyweb!) I've found a solution that I think is acceptable: </p>\n\n<p>A dynamic prope...
2009/01/06
[ "https://Stackoverflow.com/questions/417584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46436/" ]
I'm creating an app that I want to have an expandable set of properties (each a RatingProperty) I also want to validate that any dynamic properties are of the RatingProperty type. In the Expando documentation it says: > > Tip: If you want to validate a dynamic property value using a Property class, you can instanti...
After a bit more research (damn you lazyweb!) I've found a solution that I think is acceptable: A dynamic property can't be of a db subclassed property type. Thus, there are two distinct steps that must be taken. First you need to create an instance of your property class and validate your value: ``` test = db.Rati...
417,590
<p>I have class B, which inherits from class A. The superclass A is abstract, containing one abstract method. I don't want to implement the abstract method in class B, therefore I need to declare class B as abstract as well. Declaring class B abstract, two things are working for me (the programs compile and run correct...
[ { "answer_id": 417604, "author": "Yoni Roit", "author_id": 34161, "author_profile": "https://Stackoverflow.com/users/34161", "pm_score": 3, "selected": false, "text": "<p>They are functionally equal, but the first one is preferred because it's shorter and isn't weird.</p>\n" }, { ...
2009/01/06
[ "https://Stackoverflow.com/questions/417590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42155/" ]
I have class B, which inherits from class A. The superclass A is abstract, containing one abstract method. I don't want to implement the abstract method in class B, therefore I need to declare class B as abstract as well. Declaring class B abstract, two things are working for me (the programs compile and run correctly)...
In Java, the `abstract` class annotation indicates that the class cannot be directly instantiated. A class could be declared `abstract` simply because it should never be instantiated (perhaps it contains only static methods), or because its subclasses should be instantiated instead. It is **not** a requirement that `a...
417,632
<p>Using WCF in a RESTful way seems great. I’m a big fan of the big guns like simplicity and flexibility, but I also love the way the Urls end up looking. What can I say, I’m a programmer.</p> <p>The simple API for retrieving and editing resources is matched by an almost equally simple set of possible error responses, ...
[ { "answer_id": 417642, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 4, "selected": true, "text": "<p>Send the proper response code and you can supply the custom error message in the body of the response.</p>\n" }, { ...
2009/01/06
[ "https://Stackoverflow.com/questions/417632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3362/" ]
Using WCF in a RESTful way seems great. I’m a big fan of the big guns like simplicity and flexibility, but I also love the way the Urls end up looking. What can I say, I’m a programmer. The simple API for retrieving and editing resources is matched by an almost equally simple set of possible error responses, and I can...
Send the proper response code and you can supply the custom error message in the body of the response.
417,634
<p>I am having trouble with <a href="http://msdn.microsoft.com/en-us/library/ms182144.aspx" rel="noreferrer" title="FxCop warning CA1006">FxCop warning CA1006</a>, Microsoft.Design "DoNotNestGenericTypesInMemberSignatures". Specifically, I am designing a <code>ReportCollection&lt;T&gt;</code> class that inherits from <...
[ { "answer_id": 417704, "author": "mhenry1384", "author_id": 24267, "author_profile": "https://Stackoverflow.com/users/24267", "pm_score": 5, "selected": false, "text": "<p>I would take FxCop's warnings as if they were suggestions from an extremely anal-retentive coworker. It's perfectly...
2009/01/06
[ "https://Stackoverflow.com/questions/417634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3121/" ]
I am having trouble with [FxCop warning CA1006](http://msdn.microsoft.com/en-us/library/ms182144.aspx "FxCop warning CA1006"), Microsoft.Design "DoNotNestGenericTypesInMemberSignatures". Specifically, I am designing a `ReportCollection<T>` class that inherits from `ReadOnlyCollection<Report<T>>`, and its `public` const...
I agree, another good time to ignore this rule is when you need to say: ``` Func<IEnumerable<T>> ``` of course you could use the non-generic IEnumerable, but then any type can be used as long as it implements IEnumerable (non-generic). The purpose of generics (in part) is to restrict the types that are permisable to...
417,645
<p>Is there a way to convert variable names to strings in javascript? To be more specific:</p> <pre><code>var a = 1, b = 2, c = 'hello'; var array = [a, b, c]; </code></pre> <p>Now at some point as I go through the array, I need to get variable names (instead of their values) as strings - that would be 'a' or 'b' or ...
[ { "answer_id": 417652, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 6, "selected": true, "text": "<p>Use a Javascript object literal:</p>\n\n<pre><code>var obj = {\n a: 1,\n b: 2,\n c: 'hello'\n};\n</code></p...
2009/01/06
[ "https://Stackoverflow.com/questions/417645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2033475/" ]
Is there a way to convert variable names to strings in javascript? To be more specific: ``` var a = 1, b = 2, c = 'hello'; var array = [a, b, c]; ``` Now at some point as I go through the array, I need to get variable names (instead of their values) as strings - that would be 'a' or 'b' or 'c'. And I really need it ...
Use a Javascript object literal: ``` var obj = { a: 1, b: 2, c: 'hello' }; ``` You can then traverse it like this: ``` for (var key in obj){ console.log(key, obj[key]); } ``` And access properties on the object like this: ``` console.log(obj.a, obj.c); ```
417,648
<p>I've been using <a href="http://wakoopa.com" rel="nofollow noreferrer">Wakoopa</a> recently, and I find it quite amusing. </p> <p>I had no idea ( well I had an idea but never got real data about it ) on how much time I spend in SO until this:</p> <p><a href="http://img396.imageshack.us/img396/4699/wakoopaim1.png" ...
[ { "answer_id": 417652, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 6, "selected": true, "text": "<p>Use a Javascript object literal:</p>\n\n<pre><code>var obj = {\n a: 1,\n b: 2,\n c: 'hello'\n};\n</code></p...
2009/01/06
[ "https://Stackoverflow.com/questions/417648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
I've been using [Wakoopa](http://wakoopa.com) recently, and I find it quite amusing. I had no idea ( well I had an idea but never got real data about it ) on how much time I spend in SO until this: [alt text http://img396.imageshack.us/img396/4699/wakoopaim1.png](http://img396.imageshack.us/img396/4699/wakoopaim1.pn...
Use a Javascript object literal: ``` var obj = { a: 1, b: 2, c: 'hello' }; ``` You can then traverse it like this: ``` for (var key in obj){ console.log(key, obj[key]); } ``` And access properties on the object like this: ``` console.log(obj.a, obj.c); ```
417,657
<p>I have this legacy code that I am working with and there is code like this all over the place:</p> <pre> #If PRE611 = True Then 'Do Something #Else 'Something Else #End If </pre> <p>I am pretty sure the PRE611 has something to do with versioning, but I would like to know what specifical...
[ { "answer_id": 417667, "author": "dr. evil", "author_id": 40322, "author_profile": "https://Stackoverflow.com/users/40322", "pm_score": 4, "selected": true, "text": "<p>Those are directives, and allows you to do conditional compiling. # sign used for directives.</p>\n\n<p>In this case It...
2009/01/06
[ "https://Stackoverflow.com/questions/417657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42574/" ]
I have this legacy code that I am working with and there is code like this all over the place: ``` #If PRE611 = True Then 'Do Something #Else 'Something Else #End If ``` I am pretty sure the PRE611 has something to do with versioning, but I would like to know what specifically the # sign...
Those are directives, and allows you to do conditional compiling. # sign used for directives. In this case It will compiled either part of the code based on the evaluation of "PRE611 = True" You can see this article for some examples : <http://visualbasic.about.com/od/usingvbnet/a/vbdirectives01_2.htm>
417,658
<p>How can i use Tomcat to serve image files from a public folder outside webapps? I dont want to use a 2nd Apache fileserver on a different port since the image files are part of the same app. And i dont want to create a symlink to the public folder inside webapps since my app is deployed as a war file....Is there a s...
[ { "answer_id": 417695, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 6, "selected": true, "text": "<p>You could have a redirect servlet. In you web.xml you'd have:</p>\n\n<pre><code>&lt;servlet&gt;\n &lt;servlet-name&gt;i...
2009/01/06
[ "https://Stackoverflow.com/questions/417658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51402/" ]
How can i use Tomcat to serve image files from a public folder outside webapps? I dont want to use a 2nd Apache fileserver on a different port since the image files are part of the same app. And i dont want to create a symlink to the public folder inside webapps since my app is deployed as a war file....Is there a simp...
You could have a redirect servlet. In you web.xml you'd have: ``` <servlet> <servlet-name>images</servlet-name> <servlet-class>com.example.images.ImageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>images</servlet-name> <url-pattern>/images/*</url-pattern> </servlet-mapping> ``` A...
417,664
<p>I'm forced to upgrade to Python 2.6 and am having issues using Numerical Python (<a href="http://en.wikipedia.org/wiki/NumPy" rel="nofollow noreferrer">NumPy</a>) with Python 2.6 in Windows. I'm getting the following error...</p> <pre><code>Traceback (most recent call last): File "&lt;pyshell#0&gt;", line 1, in ...
[ { "answer_id": 417674, "author": "Autoplectic", "author_id": 49994, "author_profile": "https://Stackoverflow.com/users/49994", "pm_score": 4, "selected": true, "text": "<p>How did you install it? NumPy doesn't currently have a Python 2.6 binary.</p>\n\n<p>If you have <a href=\"http://en...
2009/01/06
[ "https://Stackoverflow.com/questions/417664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191808/" ]
I'm forced to upgrade to Python 2.6 and am having issues using Numerical Python ([NumPy](http://en.wikipedia.org/wiki/NumPy)) with Python 2.6 in Windows. I'm getting the following error... ``` Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from numpy.core.numeric import array,dot,all ...
How did you install it? NumPy doesn't currently have a Python 2.6 binary. If you have [LAPACK](http://en.wikipedia.org/wiki/LAPACK)/[ATLAS](http://en.wikipedia.org/wiki/Automatically_Tuned_Linear_Algebra_Software)/[BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms), etc. and a development environment...
417,677
<p>I did the following to upper case the first letter in each word but it's only working on the first word. Could someone explain why?</p> <pre><code>static void Main(string[] args) { string s = "how u doin the dnt know about medri sho min shan ma baref shu"; string a = tocap(s); Console.WriteLine(a); } p...
[ { "answer_id": 417680, "author": "Chris Farmer", "author_id": 404, "author_profile": "https://Stackoverflow.com/users/404", "pm_score": 1, "selected": false, "text": "<p>You somehow need to tokenize your initial string. You're currently not even looking past the first character of the w...
2009/01/06
[ "https://Stackoverflow.com/questions/417677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I did the following to upper case the first letter in each word but it's only working on the first word. Could someone explain why? ``` static void Main(string[] args) { string s = "how u doin the dnt know about medri sho min shan ma baref shu"; string a = tocap(s); Console.WriteLine(a); } public static s...
I guess you'll get this better if you understand actually what you're doing: ``` public static string tocap(string s) { // This says: "if s length is 1 then returned converted in upper case" // for instance if s = "a" it will return "A". So far the function is ok. if (s.Length == 1) re...
417,690
<p>When I call Server.CreateObject(), from my Classic ASP page, I get</p> <pre><code>Microsoft VBScript runtime (0x800A01B6) Object doesn't support this property or method </code></pre> <p>I've tried the following (separately):</p> <pre><code>Server.CreateObject("Microsoft.XMLHTTP") Server.CreateObject("MSXML2.XMLHT...
[ { "answer_id": 417705, "author": "Kyle B.", "author_id": 6158, "author_profile": "https://Stackoverflow.com/users/6158", "pm_score": 1, "selected": false, "text": "<p>How about this one?</p>\n\n<p>Set xml = Server.CreateObject(\"MSXML2.ServerXMLHTTP\")</p>\n\n<p>Or downloading this compo...
2009/01/06
[ "https://Stackoverflow.com/questions/417690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
When I call Server.CreateObject(), from my Classic ASP page, I get ``` Microsoft VBScript runtime (0x800A01B6) Object doesn't support this property or method ``` I've tried the following (separately): ``` Server.CreateObject("Microsoft.XMLHTTP") Server.CreateObject("MSXML2.XMLHTTP") Server.CreateObject("MSXML.DOMDo...
If you do the following: ``` Dim x: x = Server.CreateObject("My.ProgID.Here") ``` ...VBScript creates the object and then attempts to access the default property for storing in 'x'. Since none of these objects have a default property defined (specifically an IDispatch-based property with [id(DISPID\_VALUE)]), this f...
417,699
<p>code snippet:</p> <pre><code>//byte[] myByteArray = byte array from database (database BLOB) myByteArray = (byte[]) ((dbCommand.Parameters["parameter"].Value)); string myString =System.Text.Encoding.UTF8.GetString(myByteArray); Xmldocument doc = new Xmldocument(); doc.Load(myString); </code></pre> <p>==========...
[ { "answer_id": 417711, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 1, "selected": false, "text": "<p>XmlDocument.Load(String) tries to load the XML document from the URL given as parameter, i.e. it tries to int...
2009/01/06
[ "https://Stackoverflow.com/questions/417699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32670/" ]
code snippet: ``` //byte[] myByteArray = byte array from database (database BLOB) myByteArray = (byte[]) ((dbCommand.Parameters["parameter"].Value)); string myString =System.Text.Encoding.UTF8.GetString(myByteArray); Xmldocument doc = new Xmldocument(); doc.Load(myString); ``` ============ I am getting `System.O...
If you've got a string containing XML text, you actually want [XmlDocument.LoadXML](http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.loadxml.aspx). XmlDocument.Load treats the string as a URL. That said, [XmlDocument.Load](http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.load.aspx) has over...
417,703
<p>Is there a pythonic way of reading - say - mixed integer and char input without reading the whole input at once and without worrying about linebreaks? For example I have a file with whitespace-separated data of which I only know that there are x integers, then y chars and then z more integers. I don't want to assume...
[ { "answer_id": 417741, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "<p>Like this?</p>\n\n<pre><code>&gt;&gt;&gt; data = \"1 2 3 4 5 6 abcdefg 9 8 7 6 5 4 3\"\n</code></pre>\n\n<p>For example,...
2009/01/06
[ "https://Stackoverflow.com/questions/417703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52142/" ]
Is there a pythonic way of reading - say - mixed integer and char input without reading the whole input at once and without worrying about linebreaks? For example I have a file with whitespace-separated data of which I only know that there are x integers, then y chars and then z more integers. I don't want to assume an...
How about a small generator function that returns a stream of tokens and behaves like `cin`: ``` def read_tokens(f): for line in f: for token in line.split(): yield token x = y = z = 5 # for simplicity: 5 ints, 5 char tokens, 5 ints f = open('data.txt', 'r') tokens = read_tokens(f) X = [] for i ...
417,707
<p>I need help with an SSIS package. I have a server that populates a DB table as a part of a daily job. Then the server writes to a process status table to let me know that its done.</p> <p>The process status table looks like this:</p> <pre><code>Job | Ready | Downloaded myJob True False </code></pre> <p>I...
[ { "answer_id": 417741, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "<p>Like this?</p>\n\n<pre><code>&gt;&gt;&gt; data = \"1 2 3 4 5 6 abcdefg 9 8 7 6 5 4 3\"\n</code></pre>\n\n<p>For example,...
2009/01/06
[ "https://Stackoverflow.com/questions/417707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8664/" ]
I need help with an SSIS package. I have a server that populates a DB table as a part of a daily job. Then the server writes to a process status table to let me know that its done. The process status table looks like this: ``` Job | Ready | Downloaded myJob True False ``` I want to create a process that wi...
How about a small generator function that returns a stream of tokens and behaves like `cin`: ``` def read_tokens(f): for line in f: for token in line.split(): yield token x = y = z = 5 # for simplicity: 5 ints, 5 char tokens, 5 ints f = open('data.txt', 'r') tokens = read_tokens(f) X = [] for i ...
417,726
<p>I have a "docs" folder in a Subversion repository named "project". I've come to the conclusion that it should really be kept under a separate Subversion repository named "project_docs".</p> <p>I'd like to move the "docs" folder (<strong>and all of its revisions</strong>) to the "project_docs" repository. Is there a...
[ { "answer_id": 417734, "author": "Peter Stone", "author_id": 1806, "author_profile": "https://Stackoverflow.com/users/1806", "pm_score": 2, "selected": false, "text": "<p>I don't believe you can do it remotely (i.e., without a local copy). But this should work: <code>svn export</code> t...
2009/01/06
[ "https://Stackoverflow.com/questions/417726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11460/" ]
I have a "docs" folder in a Subversion repository named "project". I've come to the conclusion that it should really be kept under a separate Subversion repository named "project\_docs". I'd like to move the "docs" folder (**and all of its revisions**) to the "project\_docs" repository. Is there a way to do this?
If you have access the repository itself (not a working copy), you should be able to dump the current repository, filter it to only include information about the docs folder, and load it into the other repository. Would be something like this: ``` svnadmin dump /svn/old_repos > ./repository.dump svndumpfilter include...
417,729
<p>I think I have a solution to this, but is there a better way, or is this going to break on me?</p> <p>I am constructing a localized web site using global/local resx files. It is a requirement that non-technical users can edit the strings and add new languages through the web app.</p> <p>This seems easy enough -- ...
[ { "answer_id": 417767, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 3, "selected": true, "text": "<p>I've used a similar method before for a very basic \"CMS\". The site wasn't massively used but it didn't cause me...
2009/01/06
[ "https://Stackoverflow.com/questions/417729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945/" ]
I think I have a solution to this, but is there a better way, or is this going to break on me? I am constructing a localized web site using global/local resx files. It is a requirement that non-technical users can edit the strings and add new languages through the web app. This seems easy enough -- I have a form to d...
I've used a similar method before for a very basic "CMS". The site wasn't massively used but it didn't cause me any problems. I don't think changing a resx will cause a recycle.
417,745
<p>I'm examining the feasibility of porting an existing Windows MFC control to OS X/Carbon. My test bed is a C++ Carbon application generated using the XCode 3 Wizard.</p> <p>I'm looking for a quick way to dump some trace info to the debugger or the OS X equivalent of DbgView. On Win32 I'd use OutputDebugString() - w...
[ { "answer_id": 417846, "author": "Jason Coco", "author_id": 34218, "author_profile": "https://Stackoverflow.com/users/34218", "pm_score": 5, "selected": true, "text": "<p>There is no real equivalent. Xcode uses GDB under the hood, so you're basically dealing with that. You could, however...
2009/01/06
[ "https://Stackoverflow.com/questions/417745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52146/" ]
I'm examining the feasibility of porting an existing Windows MFC control to OS X/Carbon. My test bed is a C++ Carbon application generated using the XCode 3 Wizard. I'm looking for a quick way to dump some trace info to the debugger or the OS X equivalent of DbgView. On Win32 I'd use OutputDebugString() - what's the ...
There is no real equivalent. Xcode uses GDB under the hood, so you're basically dealing with that. You could, however, implement it yourself. The code sample below will produce output to standard out only when the debugger is present. You could further protect this by wrapping it in preprocessor directives as a macro a...
417,755
<p>How do I tell NAnt to use the same VB compiler VS2008 uses when it creates .NET 2.0-targeting applications?</p> <p>I have switched a web application to VS2008 back-targetted to .NET 2.0. I can run NAnt (0.85rc4, 0.85, and 0.86b1) just fine once I do this. When I try to use some of the VB9 syntax, that still compile...
[ { "answer_id": 417846, "author": "Jason Coco", "author_id": 34218, "author_profile": "https://Stackoverflow.com/users/34218", "pm_score": 5, "selected": true, "text": "<p>There is no real equivalent. Xcode uses GDB under the hood, so you're basically dealing with that. You could, however...
2009/01/06
[ "https://Stackoverflow.com/questions/417755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48700/" ]
How do I tell NAnt to use the same VB compiler VS2008 uses when it creates .NET 2.0-targeting applications? I have switched a web application to VS2008 back-targetted to .NET 2.0. I can run NAnt (0.85rc4, 0.85, and 0.86b1) just fine once I do this. When I try to use some of the VB9 syntax, that still compiles just fin...
There is no real equivalent. Xcode uses GDB under the hood, so you're basically dealing with that. You could, however, implement it yourself. The code sample below will produce output to standard out only when the debugger is present. You could further protect this by wrapping it in preprocessor directives as a macro a...
417,763
<p>I have a python script that can approach the 2 GB process limit under Windows XP. On a machine with 2 GB physical memory, that can pretty much lock up the machine, even if the Python script is running at below normal priority.</p> <p>Is there a way in Python to find out my own process size?</p> <p>Thanks, Gerry</...
[ { "answer_id": 418533, "author": "Igal Serban", "author_id": 25737, "author_profile": "https://Stackoverflow.com/users/25737", "pm_score": 3, "selected": true, "text": "<p>try:</p>\n\n<pre><code>import win32process\nprint win32process.GetProcessMemoryInfo(win32process.GetCurrentProcess()...
2009/01/06
[ "https://Stackoverflow.com/questions/417763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372664/" ]
I have a python script that can approach the 2 GB process limit under Windows XP. On a machine with 2 GB physical memory, that can pretty much lock up the machine, even if the Python script is running at below normal priority. Is there a way in Python to find out my own process size? Thanks, Gerry
try: ``` import win32process print win32process.GetProcessMemoryInfo(win32process.GetCurrentProcess()) ```
417,776
<p>I have a webservice that is called by up to 10 clients. The webservice is built up of 7 differnet asmx-pages and have about 100-200 functions in each page.</p> <p>All those functions are working against a MSSQL2005 or MS SQL2000 database. Some periods of the day its heavy traffic from the clients and it seems like ...
[ { "answer_id": 417897, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 0, "selected": false, "text": "<p>So that's 700-1400 functions in a single web service? Sounds too big to me. Time to refactor.</p>\n\n<p>I don't know ...
2009/01/06
[ "https://Stackoverflow.com/questions/417776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19307/" ]
I have a webservice that is called by up to 10 clients. The webservice is built up of 7 differnet asmx-pages and have about 100-200 functions in each page. All those functions are working against a MSSQL2005 or MS SQL2000 database. Some periods of the day its heavy traffic from the clients and it seems like I run out ...
I agree on the comment about refactoring, but that's not the pertinent issue here. You definitely should use a connection in each function, and it sounds like you aren't disposing of them correctly. Assuming the database operations are contained to the function you are calling, your code should look something like thi...
417,788
<p>I tried to compile the example posted (<a href="https://stackoverflow.com/questions/412165/c-service-providers">C++ Service Providers</a>) and failed to VS8 VC9. I have little experience with template.<br> Any suggestions?<br> Tanks.</p> <p>These are the errors :<br> dictionarystl.cpp(40) : error C2663: 'std::_Tree...
[ { "answer_id": 417804, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 3, "selected": true, "text": "<p>For this code to compile, the following line:</p>\n\n<pre><code>typedef map&lt;type_info *, void *, type_info_less&gt; Type...
2009/01/06
[ "https://Stackoverflow.com/questions/417788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47733/" ]
I tried to compile the example posted ([C++ Service Providers](https://stackoverflow.com/questions/412165/c-service-providers)) and failed to VS8 VC9. I have little experience with template. Any suggestions? Tanks. These are the errors : dictionarystl.cpp(40) : error C2663: 'std::\_Tree<\_Traits>::find' : 2 o...
For this code to compile, the following line: ``` typedef map<type_info *, void *, type_info_less> TypenameToObject; ``` should be: ``` typedef map<const type_info *, void *, type_info_less> TypenameToObject; ```
417,793
<p>I'm attempting to capture the output of <code>fputcsv()</code> in order to use <code>gzwrite()</code> to actually write to a tab-delimited file. Basically, I'm querying a database and I want to put these rows into a gzipped CSV file and I'd rather use <code>fputcsv()</code> than actually append <code>"\t"</code> an...
[ { "answer_id": 417833, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 1, "selected": false, "text": "<p>You can do it by writing your own <a href=\"http://ca.php.net/manual/en/book.stream.php\" rel=\"nofollow noreferre...
2009/01/06
[ "https://Stackoverflow.com/questions/417793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30133/" ]
I'm attempting to capture the output of `fputcsv()` in order to use `gzwrite()` to actually write to a tab-delimited file. Basically, I'm querying a database and I want to put these rows into a gzipped CSV file and I'd rather use `fputcsv()` than actually append `"\t"` and `"\n"` everywhere. Can I somehow do this with ...
Maybe I'm misunderstanding the question but [`fputcsv()`](http://www.php.net/fputcsv) operates on a file handle, which is what gzopen returns, so you can do this: ``` $results = get_data_from_db(); $fp = gzopen($file_name, 'w'); if($fp) { foreach ($results as $row) { fputcsv($fp, $row); } gzclose($...
417,795
<p>So IE (6, at least) won't help me with <code>$_SERVER["HTTP_REFERER"]</code> that I request with PHP.</p> <p>But I'm new to JavaScript and have just used a little routine in a pop-up to <em>refresh</em> the page from which the popup was called (i.e. parent). Works beautifully in Firefox, Safari, etc. </p> <p>Ther...
[ { "answer_id": 417810, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": 2, "selected": false, "text": "<p>You can't rely on any browser sending the HTTP_REFERER.</p>\n\n<p>To refresh a parent window, do:</p>\n\n<pre><code>window...
2009/01/06
[ "https://Stackoverflow.com/questions/417795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52148/" ]
So IE (6, at least) won't help me with `$_SERVER["HTTP_REFERER"]` that I request with PHP. But I'm new to JavaScript and have just used a little routine in a pop-up to *refresh* the page from which the popup was called (i.e. parent). Works beautifully in Firefox, Safari, etc. There's NO security issue - I'd just lik...
You can't rely on any browser sending the HTTP\_REFERER. To refresh a parent window, do: ``` window.opener.location.reload() ``` In other cases, use a PHP session instead of relying on the referrer.
417,798
<p>I'm parsing simple (no sections) INI file in PowerShell. Here code I've came up with, is there any way to simplify it?</p> <pre><code>convertfrom-stringdata -StringData ( ` get-content .\deploy.ini ` | foreach-object ` -Begin { $total = "" } ` { $total += "`n" + $_.ToString() } ` -End { $total } ` ...
[ { "answer_id": 418528, "author": "Don Jones", "author_id": 40405, "author_profile": "https://Stackoverflow.com/users/40405", "pm_score": 1, "selected": false, "text": "<p>I'm not exactly sure what your source data looks like, or what your goal is. What exactly are you parsing for? Can yo...
2009/01/06
[ "https://Stackoverflow.com/questions/417798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2313/" ]
I'm parsing simple (no sections) INI file in PowerShell. Here code I've came up with, is there any way to simplify it? ``` convertfrom-stringdata -StringData ( ` get-content .\deploy.ini ` | foreach-object ` -Begin { $total = "" } ` { $total += "`n" + $_.ToString() } ` -End { $total } ` ).Replace("\",...
After searching internet on this topic I've found a handful of solutions. All of them are hand parsing of file data so I gave up trying to make standard cmdlets to do the job. There are fancy solutions as [this](http://www.leeholmes.com/blog/2007/10/02/managing-ini-files-with-powershell/) which support writing scenario...
417,813
<p>Anyone known how to polulate a combo with values that depends on the user seleccion, I have to combo, Country and Region, When the user select contry I need to go to the database and get the region of the country, Anyone knwows how to do this, if posibile using AJAX.</p> <p>Thanks.</p>
[ { "answer_id": 418115, "author": "Adam Lassek", "author_id": 1249, "author_profile": "https://Stackoverflow.com/users/1249", "pm_score": 4, "selected": true, "text": "<p>Do you need to use a particular Ajax libarary?</p>\n\n<p>The Ajax.Net Control Toolkit has the <a href=\"http://www.asp...
2009/01/06
[ "https://Stackoverflow.com/questions/417813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1154/" ]
Anyone known how to polulate a combo with values that depends on the user seleccion, I have to combo, Country and Region, When the user select contry I need to go to the database and get the region of the country, Anyone knwows how to do this, if posibile using AJAX. Thanks.
Do you need to use a particular Ajax libarary? The Ajax.Net Control Toolkit has the [Cascading Dropdown](http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/CascadingDropDown.aspx) control pre-built for this functionality. --- Missed the MVC part, in which case the Ajax Control Toolkit won't work. j...
417,823
<p>I'm at a loss to explain this one:</p> <p>I am getting an error:</p> <blockquote> <p>Error "91" (Object or With block not set) </p> </blockquote> <p>on the second line below: </p> <pre><code>Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("SELECT * FROM employees") </code></pre> <p>The following als...
[ { "answer_id": 418123, "author": "Philippe Grondier", "author_id": 11436, "author_profile": "https://Stackoverflow.com/users/11436", "pm_score": 2, "selected": false, "text": "<p>you should assign your .openRecordset method to a dao.recordset object or a generic object ('late binding' te...
2009/01/06
[ "https://Stackoverflow.com/questions/417823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
I'm at a loss to explain this one: I am getting an error: > > Error "91" (Object or With block not set) > > > on the second line below: ``` Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("SELECT * FROM employees") ``` The following also causes it: ``` `Set rs = CurrentDb.OpenRecordset("employees...
If you are working with an ADP project, you should use CurrentProject instead of CurrentDB.
417,831
<p>I have a list of objects and I want to reorder them randomly on each request. What is the best way of doing this?</p>
[ { "answer_id": 417844, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 1, "selected": false, "text": "<p>My favorite solution to shuffling stuff is use an N*log N sort and pass it a sort predicate that returns a random result. It ...
2009/01/06
[ "https://Stackoverflow.com/questions/417831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16628/" ]
I have a list of objects and I want to reorder them randomly on each request. What is the best way of doing this?
How about some kind of [Knuth-Fisher-Yates shuffle algorithm](http://en.wikipedia.org/wiki/Knuth_shuffle) ? ``` for (int i = cards.Length - 1; i > 0; i--) { int n = rand.Next(i + 1); Swap(ref cards[i], ref cards[n]); } ``` Code taken from [Coding Horror](http://www.codinghorror.com/blog/archives/001015.html...
417,835
<p>I have a stored procedure that uses output parameters like this:</p> <pre><code>ALTER PROCEDURE [GetAmount] ( @orderID [int], @totalcost decimal(18,2) OUTPUT ) SELECT @totalcost = cost FROM mytable WHERE orderID = @orderID </code></pre> <p>When I drag the stored procedure onto the designer, the resulting c...
[ { "answer_id": 422735, "author": "Lance Fisher", "author_id": 571, "author_profile": "https://Stackoverflow.com/users/571", "pm_score": 3, "selected": true, "text": "<p>Can you use the money type rather than the decial(18,2) type?</p>\n" }, { "answer_id": 424883, "author": "A...
2009/01/06
[ "https://Stackoverflow.com/questions/417835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52161/" ]
I have a stored procedure that uses output parameters like this: ``` ALTER PROCEDURE [GetAmount] ( @orderID [int], @totalcost decimal(18,2) OUTPUT ) SELECT @totalcost = cost FROM mytable WHERE orderID = @orderID ``` When I drag the stored procedure onto the designer, the resulting code in the designer.cs fil...
Can you use the money type rather than the decial(18,2) type?
417,840
<p>I have a couple of <code>&lt;p&gt;</code> tags that I want to right align. Does anyone know how to do this?</p>
[ { "answer_id": 417848, "author": "enobrev", "author_id": 14651, "author_profile": "https://Stackoverflow.com/users/14651", "pm_score": 6, "selected": true, "text": "<p>CSS:</p>\n\n<pre><code>p {\n text-align: right;\n}\n</code></pre>\n\n<p>INLINE:</p>\n\n<pre><code>&lt;p style=\"text-...
2009/01/06
[ "https://Stackoverflow.com/questions/417840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
I have a couple of `<p>` tags that I want to right align. Does anyone know how to do this?
CSS: ``` p { text-align: right; } ``` INLINE: ``` <p style="text-align: right">Some Text</p> ``` jQuery: ``` $('p').css('text-align', 'right'); ``` Javascript: ``` var aElements = document.getElementsByTagName('p'); for (var i = 0; i < aElements.length; i++) { aElements[i].style.textAlign = 'right'; }...
417,842
<p>InternalsVisibleTo is not working for my managed C++ projects, but it is for my C# projects. Any help would be appreciated. Here is a simplified layout.</p> <p>Project <strong>A</strong> - C#, has an internal property I want to access from <strong>B/C</strong>.<br> Project <strong>B</strong> - Managed C++. Referenc...
[ { "answer_id": 420642, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 6, "selected": true, "text": "<p>I found the answer to this. C++ works differently than the other languages. In addition to the InternalsVisibleTo, yo...
2009/01/06
[ "https://Stackoverflow.com/questions/417842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30827/" ]
InternalsVisibleTo is not working for my managed C++ projects, but it is for my C# projects. Any help would be appreciated. Here is a simplified layout. Project **A** - C#, has an internal property I want to access from **B/C**. Project **B** - Managed C++. References **A**. Project **C** - C#, references **A**....
I found the answer to this. C++ works differently than the other languages. In addition to the InternalsVisibleTo, you must reference assembly **A** with the **as\_friend** keyword. Since as\_friend is not an option in the Add References dialog, you cannot add a project reference, instead, you need to add a reference i...
417,843
<p>I am encountering an exception cause by the CFINVOKEARGUMENT line of the following snippet:</p> <pre><code>&lt;CFOUTPUT query="cfmx.Messages"&gt;&lt;CFSILENT&gt; &lt;CFINVOKE component="com_VUI_RemoveIllegalChars" method="formatString" returnvariable="cfmx.formattedMessage"&gt; &lt;CFINVOKEARGUMENT name="inStrin...
[ { "answer_id": 417921, "author": "Raymond Camden", "author_id": 52160, "author_profile": "https://Stackoverflow.com/users/52160", "pm_score": 2, "selected": false, "text": "<p>Are you sure about that line #? I'm thinking the error is in the CFC method itself. Can you check that, and if I...
2009/01/06
[ "https://Stackoverflow.com/questions/417843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22670/" ]
I am encountering an exception cause by the CFINVOKEARGUMENT line of the following snippet: ``` <CFOUTPUT query="cfmx.Messages"><CFSILENT> <CFINVOKE component="com_VUI_RemoveIllegalChars" method="formatString" returnvariable="cfmx.formattedMessage"> <CFINVOKEARGUMENT name="inString" value="#TTSText#"> </CFINVOKE> <...
The setting "Enable Application Variables" was not enabled in the ColdFusion configuration.
417,876
<p><strong>EDIT:</strong> I suppose I should clarify, in case it matters. I am on a AIX Unix box, so I am using VAC compilers - no gnu compilers. <strong>End edit</strong></p> <hr /> <p>I am pretty rusty in C/C++, so forgive me if this is a simple question.</p> <p>I would like to take common functions out of a few...
[ { "answer_id": 417903, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": "<p>You've got a third option. In general, your C++ compiler should be able to link C routines. The necessary opti...
2009/01/06
[ "https://Stackoverflow.com/questions/417876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40619/" ]
**EDIT:** I suppose I should clarify, in case it matters. I am on a AIX Unix box, so I am using VAC compilers - no gnu compilers. **End edit** --- I am pretty rusty in C/C++, so forgive me if this is a simple question. I would like to take common functions out of a few of my C programs and put them in shared librari...
Yeah you are correct. The first is called a *static library*, while the second is called a *shared library*, because the code is not bound to the executable at compile time, but everytime again when your program is loaded. Static library -------------- Compile your library's code as follows: ``` gcc -c *.c ``` Th...
417,878
<p>I have a file with the following text inside</p> <pre> mimi,m,70 tata,f,60 bobo,m,100 soso,f,30 </pre> <p>I did the reading from file thing and many many other methods and functions, but how I can get the best male name and his grade according to the grade.</p> <p>here is the code I wrote. Hope it's not so long</...
[ { "answer_id": 417892, "author": "jcollum", "author_id": 30946, "author_profile": "https://Stackoverflow.com/users/30946", "pm_score": 0, "selected": false, "text": "<p>I think the fastest and least-code way would be to transform the txt to xml and then use Linq2Xml to select from it. <a...
2009/01/06
[ "https://Stackoverflow.com/questions/417878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a file with the following text inside ``` mimi,m,70 tata,f,60 bobo,m,100 soso,f,30 ``` I did the reading from file thing and many many other methods and functions, but how I can get the best male name and his grade according to the grade. here is the code I wrote. Hope it's not so long ``` using System; us...
Well, I like LINQ (update: excluded via comments) for querying, especially if I can do it without buffering the data (so I can process a huge file efficiently). For example below (update: removed LINQ); note the use of iterator blocks (`yield return`) makes this fully "lazy" - only one record is held in memory at a tim...
417,898
<p>My understanding of Linq to Sql is it will take my Linq statement and convert it into an equivalent SQL statement.</p> <p>So</p> <pre><code>var products = from p in db.Products where p.Category.CategoryName == "Beverages" select p </code></pre> <p>Just turns into </p> <pre><code>Sel...
[ { "answer_id": 417906, "author": "GlitterMonkey", "author_id": 20680, "author_profile": "https://Stackoverflow.com/users/20680", "pm_score": 2, "selected": false, "text": "<p>There are significant associated performance improvements on the SQL Server side of things if you use stored proc...
2009/01/06
[ "https://Stackoverflow.com/questions/417898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My understanding of Linq to Sql is it will take my Linq statement and convert it into an equivalent SQL statement. So ``` var products = from p in db.Products where p.Category.CategoryName == "Beverages" select p ``` Just turns into ``` Select * from Products where CategoryName = 'Be...
Sprocs are another tool in the box. You might use your fancy automatically-adjusting wrench for 90% of your tasks, but you can't use that shiny thing on stripped nuts. For that a good ol' monkey wrench is your best friend. Unless you break the bolt, in which case you're stuck with assembly.
417,916
<p>I need to rename files names like this</p> <pre><code>transform.php?dappName=Test&amp;transformer=YAML&amp;v_id=XXXXX </code></pre> <p>to just this</p> <pre><code>XXXXX.txt </code></pre> <p>How can I do it?</p> <p>I understand that i need more than one <code>mv</code> command because they are at least 25000 fil...
[ { "answer_id": 417965, "author": "brien", "author_id": 4219, "author_profile": "https://Stackoverflow.com/users/4219", "pm_score": 3, "selected": false, "text": "<p>Try the <a href=\"http://linux.die.net/man/1/rename\" rel=\"noreferrer\">rename command</a></p>\n\n<p>Or you could pipe the...
2009/01/06
[ "https://Stackoverflow.com/questions/417916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to rename files names like this ``` transform.php?dappName=Test&transformer=YAML&v_id=XXXXX ``` to just this ``` XXXXX.txt ``` How can I do it? I understand that i need more than one `mv` command because they are at least 25000 files.
Easiest solution is to use ["mmv"](http://manpages.ubuntu.com/manpages/precise/man1/mmv.1.html) You can write: ``` mmv "long_name*.txt" "short_#1.txt" ``` Where the "#1" is replaced by whatever is matched by the first wildcard. Similarly #2 is replaced by the second, etc. So you do something like ``` mmv "index...
417,954
<p>When doing a string comparison in C#, what is the difference between doing a </p> <pre><code>string test = "testvalue"; test.Equals("TESTVALUE", StringComparison.CurrentCultureIgnoreCase); </code></pre> <p>and</p> <pre><code>string test = "testvalue"; test.Equals("TESTVALUE", StringComparison.InvariantCultureIgno...
[ { "answer_id": 417992, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 6, "selected": true, "text": "<p>Microsoft gives some decent guidance for when to use the <code>InvariantCulture</code> property:</p>\n\n<p><a href=...
2009/01/06
[ "https://Stackoverflow.com/questions/417954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19020/" ]
When doing a string comparison in C#, what is the difference between doing a ``` string test = "testvalue"; test.Equals("TESTVALUE", StringComparison.CurrentCultureIgnoreCase); ``` and ``` string test = "testvalue"; test.Equals("TESTVALUE", StringComparison.InvariantCultureIgnoreCase); ``` ... and is it importan...
Microsoft gives some decent guidance for when to use the `InvariantCulture` property: [MSDN: CultureInfo.InvariantCulture Property](http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.invariantculture.aspx) > > ... an application should use the > invariant culture only for processes > that req...
417,988
<p>I have a datatable which returns around 30,000 records. I am displaying these records in an ASP:GridView control. I have a dropdown control in which I want the user to be able to select the number of records to display in the GridView. The default should be All, but it could also have values such as 20, 50, 100 fo...
[ { "answer_id": 418000, "author": "jcollum", "author_id": 30946, "author_profile": "https://Stackoverflow.com/users/30946", "pm_score": 2, "selected": false, "text": "<p>Use the PageSize property of the gridview. <a href=\"http://www.codeproject.com/KB/grid/GridView_pager.aspx\" rel=\"nof...
2009/01/06
[ "https://Stackoverflow.com/questions/417988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
I have a datatable which returns around 30,000 records. I am displaying these records in an ASP:GridView control. I have a dropdown control in which I want the user to be able to select the number of records to display in the GridView. The default should be All, but it could also have values such as 20, 50, 100 for exa...
If you want that PageSize works you **have** to set AllowPaging of GridView to true. Obviously you have to create the method to manage the event PageIndexChanging. Like this: ``` protected void myGvw_OnPageIndexChanging(object sender, GridViewPageEventArgs e) { myGvw.PageIndex = e.NewPageIndex; // then rec...
417,999
<p>Java does not allow multiple inheritance, meaning that a class cannot inherit from two classes, which does not have anything in common, meaning that they are not on the same inheritance path. However, a class can inherit from more classes, if these classes are super classes of the direct super class of the class. Bu...
[ { "answer_id": 418014, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 2, "selected": false, "text": "<p>As you say, C's constructor invokes B's constructor which invokes A's constructor. You can call any \"A\" methods o...
2009/01/06
[ "https://Stackoverflow.com/questions/417999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42155/" ]
Java does not allow multiple inheritance, meaning that a class cannot inherit from two classes, which does not have anything in common, meaning that they are not on the same inheritance path. However, a class can inherit from more classes, if these classes are super classes of the direct super class of the class. But t...
As you say, C's constructor invokes B's constructor which invokes A's constructor. You can call any "A" methods on a C object, and a C object can see non-private fields in A. Even if you override A's method "foo" in C, you can get the A version with "super.foo()", assuming B doesn't also override it.
418,006
<p>Is there a way to disable a tab in a <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol(v=vs.110).aspx" rel="noreferrer">TabControl</a>?</p>
[ { "answer_id": 418033, "author": "Cédric Guillemette", "author_id": 43701, "author_profile": "https://Stackoverflow.com/users/43701", "pm_score": 7, "selected": false, "text": "<p>Cast your TabPage to a Control, then set the Enabled property to false.</p>\n\n<pre><code>((Control)this.tab...
2009/01/06
[ "https://Stackoverflow.com/questions/418006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43907/" ]
Is there a way to disable a tab in a [TabControl](https://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol(v=vs.110).aspx)?
The [TabPage](https://msdn.microsoft.com/en-us/library/system.windows.forms.tabpage(v=vs.110).aspx) class hides the Enabled property. That was intentional as there is an awkward UI design problem with it. The basic issue is that disabling the page does not also disable the tab. And if try to work around that by disabli...
418,027
<p>Let's say I have a text file created using <a href="http://perldoc.perl.org/Data/Dumper.html" rel="nofollow noreferrer"><code>Data::Dumper</code></a>, along the lines of:</p> <pre><code>my $x = [ { foo =&gt; 'bar', asdf =&gt; undef }, 0, -4, [ [] ] ]; </code></pre> <p>I'd like to read that file back in and get <co...
[ { "answer_id": 418041, "author": "Rich Reuter", "author_id": 283, "author_profile": "https://Stackoverflow.com/users/283", "pm_score": 4, "selected": false, "text": "<p>Here's a thread that provides a couple different options: <em><a href=\"http://www.perlmonks.org/?node_id=92509\" rel=\...
2009/01/06
[ "https://Stackoverflow.com/questions/418027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91385/" ]
Let's say I have a text file created using [`Data::Dumper`](http://perldoc.perl.org/Data/Dumper.html), along the lines of: ``` my $x = [ { foo => 'bar', asdf => undef }, 0, -4, [ [] ] ]; ``` I'd like to read that file back in and get `$x` back. I tried this: ``` my $vars; { undef $/; $vars = <FILE>; } eval $va...
Here's a thread that provides a couple different options: *[Undumper](http://www.perlmonks.org/?node_id=92509)* If you're just looking for data persistence the Storable module might be your best bet.