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
269,436
<p>I have set a canvas' background to an image of a company logo. I would like for this image to be aligned to the bottom right corner of the canvas.<br> Is it possible to do this, or would it require for the image to be added into the canvas as a child? That would not work with this program as all children of the ca...
[ { "answer_id": 269514, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 0, "selected": false, "text": "<p>AFAIK The WPF Canvas needs child UI elements to be positioned using absolute co-ordinates. \nTo achieve the right-bottom-an...
2008/11/06
[ "https://Stackoverflow.com/questions/269436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30838/" ]
I have set a canvas' background to an image of a company logo. I would like for this image to be aligned to the bottom right corner of the canvas. Is it possible to do this, or would it require for the image to be added into the canvas as a child? That would not work with this program as all children of the canvas a...
Will this work? (It worked for me, anyway.) ``` <Canvas> <Canvas.Background> <ImageBrush ImageSource="someimage.jpg" AlignmentX="Right" AlignmentY="Bottom" Stretch="None" /> </Canvas.Background> </Canvas> ```
269,440
<p>I have the following query:</p> <pre><code>UPDATE lessonstatus INNER JOIN user ON lessonstatus.user_id = user.user_id SET user_id = (SELECT user_id FROM user WHERE username = 'too_many_accounts') WHERE last_name = 'stupid' AND first_name = 'user' AND username != 'too_many_accounts' AND lessonstatus.lesson_id NOT I...
[ { "answer_id": 269471, "author": "Arvo", "author_id": 35777, "author_profile": "https://Stackoverflow.com/users/35777", "pm_score": 0, "selected": false, "text": "<p>There are more errors (\"user\" table and \"user_rtab\" alias do not match, use of non-qualified field names is not recomm...
2008/11/06
[ "https://Stackoverflow.com/questions/269440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
I have the following query: ``` UPDATE lessonstatus INNER JOIN user ON lessonstatus.user_id = user.user_id SET user_id = (SELECT user_id FROM user WHERE username = 'too_many_accounts') WHERE last_name = 'stupid' AND first_name = 'user' AND username != 'too_many_accounts' AND lessonstatus.lesson_id NOT IN (SELECT less...
You can't `SELECT` from a table (even in a subquery) that you're updating in the same query. That's what the error "can't specify target table" means. But you can join `user` and `lessonstatus` multiple times in the `UPDATE` statement, and use the join criteria creatively to pick out the individual row you want. The ...
269,458
<p>Ages ago when I was a java developer I could make separate ant scripts that I would call from my main ant script. I would put properties unique to each environment where my main script would run. I want to do the same thing in MSBuild but I can't find out how to chain MSBuild scripts together.</p>
[ { "answer_id": 269482, "author": "Scott Dorman", "author_id": 1559, "author_profile": "https://Stackoverflow.com/users/1559", "pm_score": 3, "selected": true, "text": "<p>You need to <a href=\"http://msdn.microsoft.com/en-us/library/92x05xfs.aspx\" rel=\"nofollow noreferrer\">Import</a> ...
2008/11/06
[ "https://Stackoverflow.com/questions/269458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491/" ]
Ages ago when I was a java developer I could make separate ant scripts that I would call from my main ant script. I would put properties unique to each environment where my main script would run. I want to do the same thing in MSBuild but I can't find out how to chain MSBuild scripts together.
You need to [Import](http://msdn.microsoft.com/en-us/library/92x05xfs.aspx) them. ``` <Import Project="MyTargets" Condition="Exists('MyTargets')"/> ```
269,462
<p>I'm doing some small changes to C++ MFC project. I'm .NET developer so Windows programming is new to me.</p> <p>I need to launch some method right after CDialog is completely shown (painted) for the first time, but only once.</p> <p>How can I do this? In .NET I would handle <strong>Form.Shown</strong> event.</p> ...
[ { "answer_id": 269850, "author": "Sumrak", "author_id": 19124, "author_profile": "https://Stackoverflow.com/users/19124", "pm_score": 3, "selected": true, "text": "<p>Found the answer here: <a href=\"https://web.archive.org/web/20190119124649/https://blogs.msdn.microsoft.com/oldnewthing/...
2008/11/06
[ "https://Stackoverflow.com/questions/269462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19124/" ]
I'm doing some small changes to C++ MFC project. I'm .NET developer so Windows programming is new to me. I need to launch some method right after CDialog is completely shown (painted) for the first time, but only once. How can I do this? In .NET I would handle **Form.Shown** event. Do I need to handle some message? ...
Found the answer here: [Waiting until the dialog box is displayed before doing something](https://web.archive.org/web/20190119124649/https://blogs.msdn.microsoft.com/oldnewthing/20060925-02/?p=29603) ``` Short story: INT_PTR CALLBACK DlgProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam) { switch (uiMsg) { ...
269,466
<p>I am having trouble with a very simple Perl process. I am basically querying an Oracle database and I want to load it into Excel. I have been able to use DBIx::Dump and it works. However, I need to be able to use a variety of Excel formatting tools. And I think <a href="http://search.cpan.org/dist/Spreadsheet::W...
[ { "answer_id": 269497, "author": "EvilTeach", "author_id": 7734, "author_profile": "https://Stackoverflow.com/users/7734", "pm_score": 2, "selected": false, "text": "<p>I would guess that it is coming out as a string, and when you try to insert it into the date column, there is no implic...
2008/11/06
[ "https://Stackoverflow.com/questions/269466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am having trouble with a very simple Perl process. I am basically querying an Oracle database and I want to load it into Excel. I have been able to use DBIx::Dump and it works. However, I need to be able to use a variety of Excel formatting tools. And I think [Spreadsheet::WriteExcel](http://search.cpan.org/dist/Spre...
I would guess that it is coming out as a string, and when you try to insert it into the date column, there is no implicit conversion for it. Try selecting the date like this, and it will turn it into a char that you can use to do compares. ``` to_char(date, 'YYYY/MM/DD HH24:MI:SS') ``` then ``` to_date(date, 'YYY...
269,486
<p>I'm trying to change default firstDayOfWeek for java.util.Calendar from SUNDAY to MONDAY. Is it possible to achieve this through JVM configuration instead of adding this piece of code?</p> <pre><code>cal.setFirstDayOfWeek(Calendar.MONDAY); </code></pre>
[ { "answer_id": 269501, "author": "ricafeal", "author_id": 34598, "author_profile": "https://Stackoverflow.com/users/34598", "pm_score": 0, "selected": false, "text": "<p>Have you tried to invoke the JVM with a different locale? But you should be careful with side effects...</p>\n" }, ...
2008/11/06
[ "https://Stackoverflow.com/questions/269486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35172/" ]
I'm trying to change default firstDayOfWeek for java.util.Calendar from SUNDAY to MONDAY. Is it possible to achieve this through JVM configuration instead of adding this piece of code? ``` cal.setFirstDayOfWeek(Calendar.MONDAY); ```
The first day of the week is derived from the current locale. If you don't set the locale of the calendar ([Calendar.getInstance(Locale)](http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html#getInstance(java.util.Locale)), or [new GregorianCalendar(Locale)](http://java.sun.com/j2se/1.5.0/docs/api/java/util/G...
269,496
<p>There are two schools of thought on how to best extend, enhance, and reuse code in an object-oriented system:</p> <ol> <li><p>Inheritance: extend the functionality of a class by creating a subclass. Override superclass members in the subclasses to provide new functionality. Make methods abstract/virtual to force su...
[ { "answer_id": 269526, "author": "Harper Shelby", "author_id": 21196, "author_profile": "https://Stackoverflow.com/users/21196", "pm_score": 5, "selected": false, "text": "<p>The difference is typically expressed as the difference between \"is a\" and \"has a\". Inheritance, the \"is a\"...
2008/11/06
[ "https://Stackoverflow.com/questions/269496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3488/" ]
There are two schools of thought on how to best extend, enhance, and reuse code in an object-oriented system: 1. Inheritance: extend the functionality of a class by creating a subclass. Override superclass members in the subclasses to provide new functionality. Make methods abstract/virtual to force subclasses to "fil...
It's not a matter of which is the best, but of when to use what. In the 'normal' cases a simple question is enough to find out if we need inheritance or aggregation. * If The new class **is** more or less as the original class. Use inheritance. The new class is now a subclass of the original class. * If the new class...
269,523
<p>I've got a Page class in my .edmx ADO.NET Entity Data Model file with with Parent and Children properties. It's for a hierarchy of Pages.</p> <p><em>removed dead ImageShack link - ADO.NET Entity Framework Hierarchical Page Class</em></p> <p>This is handled in my SQL database with a ParentId foreign key in the Pag...
[ { "answer_id": 273535, "author": "Zack Peterson", "author_id": 83, "author_profile": "https://Stackoverflow.com/users/83", "pm_score": 5, "selected": true, "text": "<p>I got this working with help from <a href=\"https://stackoverflow.com/users/9268/abe-heidebrecht\">Abe Heidebrecht</a>. ...
2008/11/06
[ "https://Stackoverflow.com/questions/269523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
I've got a Page class in my .edmx ADO.NET Entity Data Model file with with Parent and Children properties. It's for a hierarchy of Pages. *removed dead ImageShack link - ADO.NET Entity Framework Hierarchical Page Class* This is handled in my SQL database with a ParentId foreign key in the Page table bound to the Id p...
I got this working with help from [Abe Heidebrecht](https://stackoverflow.com/users/9268/abe-heidebrecht). Much thanks to him. Here's my XAML... ``` <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:loca...
269,541
<p>I'm trying to build a HQL that can left join values from a collection, in order to give me the chance of checking "is null" on it.</p> <p>Taken from the example from hibernate manual:</p> <pre> from Cat as cat left join cat.kittens as kitten with kitten.bodyWeight > 10.0 </pre> <p>doesn't seem to wor...
[ { "answer_id": 269709, "author": "Tim Scott", "author_id": 29493, "author_profile": "https://Stackoverflow.com/users/29493", "pm_score": 3, "selected": true, "text": "<p>Unfortunately, this is not supported in NHibernate. It was <a href=\"http://jira.nhibernate.org/browse/NH-514\" rel=\...
2008/11/06
[ "https://Stackoverflow.com/questions/269541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33663/" ]
I'm trying to build a HQL that can left join values from a collection, in order to give me the chance of checking "is null" on it. Taken from the example from hibernate manual: ``` from Cat as cat left join cat.kittens as kitten with kitten.bodyWeight > 10.0 ``` doesn't seem to work in NHibernate, sinc...
Unfortunately, this is not supported in NHibernate. It was [first requested in 2005](http://jira.nhibernate.org/browse/NH-514) and is by far the most popular requested feature.
269,545
<p>With the jQuery datepicker, how does one change the year range that is displayed? On the jQuery UI site it says the default is "10 years before and after the current year are shown". I want to use this for a birthday selection and 10 years before today is no good. Can this be done with the jQuery datepicker or wi...
[ { "answer_id": 269561, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 8, "selected": true, "text": "<p>If you look down the demo page a bit, you'll see a \"Restricting Datepicker\" section. Use the dropdown to specify the \"<code...
2008/11/06
[ "https://Stackoverflow.com/questions/269545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2847/" ]
With the jQuery datepicker, how does one change the year range that is displayed? On the jQuery UI site it says the default is "10 years before and after the current year are shown". I want to use this for a birthday selection and 10 years before today is no good. Can this be done with the jQuery datepicker or will I h...
If you look down the demo page a bit, you'll see a "Restricting Datepicker" section. Use the dropdown to specify the "`Year dropdown shows last 20 years`" demo , and hit view source: ``` $("#restricting").datepicker({ yearRange: "-20:+0", // this is the option you're looking for showOn: "both", buttonIma...
269,566
<p>I have two html pages, when you click on something on the first html, it will go to the second one. What I want to do is to show text according to what you clicked on the first html. different texts are wrapped with different ids. Here's how I wrote:</p> <pre><code>&lt;a href="secondpage.html#one"&gt;&lt;/a&gt; &lt...
[ { "answer_id": 269592, "author": "Keltex", "author_id": 28260, "author_profile": "https://Stackoverflow.com/users/28260", "pm_score": 0, "selected": false, "text": "<p>When you say \"different ids\" how are you setting up your anchors on the 2nd page? The anchor on the 2nd page should lo...
2008/11/06
[ "https://Stackoverflow.com/questions/269566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34797/" ]
I have two html pages, when you click on something on the first html, it will go to the second one. What I want to do is to show text according to what you clicked on the first html. different texts are wrapped with different ids. Here's how I wrote: ``` <a href="secondpage.html#one"></a> <a href="secondpage.html#two"...
What you want to do is simulate a click on your anchor when the page loads. Since you're using jQuery, the simplest approach (but far form best) would be the following: ``` $(window).observe('domready', function () { $(location.hash).click(); }); ``` attach ondomready-event to window. Fetch element with id=one ...
269,577
<p>I am working on a small parser that should accept input in a number of languages. I am going to have maybe 50 strings that will serve as keywords/anchors in parsing the input. In PHP, what would be the best way to organize these translated keywords? </p> <p>One possible solution that comes to my mind is to use an a...
[ { "answer_id": 269865, "author": "Seamus", "author_id": 30443, "author_profile": "https://Stackoverflow.com/users/30443", "pm_score": 0, "selected": false, "text": "<p>Generally people use l10n (or something similar) in their application because it allows for additional languages by addi...
2008/11/06
[ "https://Stackoverflow.com/questions/269577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am working on a small parser that should accept input in a number of languages. I am going to have maybe 50 strings that will serve as keywords/anchors in parsing the input. In PHP, what would be the best way to organize these translated keywords? One possible solution that comes to my mind is to use an associative...
For a complete translation solution, you can look on a solution like [gettext](http://www.php.net/manual/en/intro.gettext.php). you solution is good enough (fast, cheap on resources) for small dictionaries. I didn't understand what you tried to do using the strpos() function. Don't forget to use some kind of fallback...
269,578
<p>I want to get the method <code>System.Linq.Queryable.OrderyBy&lt;T, TKey&gt;(the IQueryable&lt;T&gt; source, Expression&lt;Func&lt;T,TKey&gt;&gt; keySelector)</code> method, but I keep coming up with nulls.</p> <pre><code>var type = typeof(T); var propertyInfo = type.GetProperty(group.PropertyName); var propertyTyp...
[ { "answer_id": 269606, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>I don't believe there's an easy way of doing this - it's basically a missing feature from reflection, IIRC. You have ...
2008/11/06
[ "https://Stackoverflow.com/questions/269578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21909/" ]
I want to get the method `System.Linq.Queryable.OrderyBy<T, TKey>(the IQueryable<T> source, Expression<Func<T,TKey>> keySelector)` method, but I keep coming up with nulls. ``` var type = typeof(T); var propertyInfo = type.GetProperty(group.PropertyName); var propertyType = propertyInfo.PropertyType; var sorterType = ...
Solved (by hacking LINQ)! I saw your question while researching the same problem. After finding no good solution, I had the idea to look at the LINQ expression tree. Here's what I came up with: ``` public static MethodInfo GetOrderByMethod<TElement, TSortKey>() { Func<TElement, TSortKey> fakeKeySelector = element...
269,581
<p>I am attempting to return a collection of departments from a .NET assembly to be consumed by ASP via COM Interop. Using .NET I would just return a generic collection, e.g. <code>List&lt;Department&gt;</code>, but it seems that generics don't work well with COM Interop. So, what are my options?</p> <p>I would like t...
[ { "answer_id": 270025, "author": "Mike Henry", "author_id": 14934, "author_profile": "https://Stackoverflow.com/users/14934", "pm_score": 5, "selected": true, "text": "<p>After some more research and trial-and-error, I think I found a solution by using <code>System.Collections.ArrayList<...
2008/11/06
[ "https://Stackoverflow.com/questions/269581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14934/" ]
I am attempting to return a collection of departments from a .NET assembly to be consumed by ASP via COM Interop. Using .NET I would just return a generic collection, e.g. `List<Department>`, but it seems that generics don't work well with COM Interop. So, what are my options? I would like to both iterate over the lis...
After some more research and trial-and-error, I think I found a solution by using `System.Collections.ArrayList`. However, this does not work with getting a value by index. To do so, I created a new class `ComArrayList` that inherits from `ArrayList` and adds new methods `GetByIndex` and `SetByIndex`. COM Interop comp...
269,590
<p>I just spent half an one our to find out what caused the Error-Message "Ci is not defined" in my JavaScript code. I finally found the reason:</p> <p>It should be (jQuery):</p> <pre><code>$("asd").bla(); </code></pre> <p>It was:</p> <pre><code>("asd").bla(); </code></pre> <p>(Dollar sign gone missing)</p> <p>No...
[ { "answer_id": 269635, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": -1, "selected": false, "text": "<p>Assuming it's CodeIngiter, it can't find the js file.</p>\n" }, { "answer_id": 269636, ...
2008/11/06
[ "https://Stackoverflow.com/questions/269590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
I just spent half an one our to find out what caused the Error-Message "Ci is not defined" in my JavaScript code. I finally found the reason: It should be (jQuery): ``` $("asd").bla(); ``` It was: ``` ("asd").bla(); ``` (Dollar sign gone missing) Now after having fixed the problem I'd like to understand the mes...
I don't know which version of FF you are using, but regardless, the message is probably referring to the fact that `bla()` is not a function available on the String object. Since you were missing the `$`, which means you were missing a function, `("asd")` would evaluate to a string, and then the JavaScript interpreter ...
269,594
<p>I have a website built using Asp.net and LinqToSql for Data Access. In a certain section of the site, LinqToSql produces a query that looks like this (from my dev machine):</p> <pre><code>select ... from table1 left outer join table2 on table1 where ... left outer join table3 on table2 where ... </code></pre> <p>S...
[ { "answer_id": 269928, "author": "DamienG", "author_id": 5720, "author_profile": "https://Stackoverflow.com/users/5720", "pm_score": 0, "selected": false, "text": "<p>Sounds like the LINQ to SQL classes (DBML and/or associated code generation) between the two is not the same - specifical...
2008/11/06
[ "https://Stackoverflow.com/questions/269594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
I have a website built using Asp.net and LinqToSql for Data Access. In a certain section of the site, LinqToSql produces a query that looks like this (from my dev machine): ``` select ... from table1 left outer join table2 on table1 where ... left outer join table3 on table2 where ... ``` Since the connection betwee...
I have checked the following: 1. Both use the same database 2. Both have the identical code 3. Both have the identical dbml file I know that something has to be out of synch somewhere, but I can't find it. So I have implemented the following workaround: I added a view to my database that includes both left outer joi...
269,601
<p>I have a file I need to rename to that of an existing file. This is a copy, modify, replace original operation on an existing JAR file. I've got the first two steps done, I just need help with the replace original bit. What's the best way to rename the new version of the JAR to that of the old. The old JAR doesn't n...
[ { "answer_id": 269641, "author": "Michael Myers", "author_id": 13531, "author_profile": "https://Stackoverflow.com/users/13531", "pm_score": 1, "selected": false, "text": "<p>Is there a problem with <a href=\"http://java.sun.com/javase/6/docs/api/java/io/File.html#delete()\" rel=\"nofoll...
2008/11/06
[ "https://Stackoverflow.com/questions/269601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
I have a file I need to rename to that of an existing file. This is a copy, modify, replace original operation on an existing JAR file. I've got the first two steps done, I just need help with the replace original bit. What's the best way to rename the new version of the JAR to that of the old. The old JAR doesn't need...
You're going to need to create two `java.io.File` objects: one for the new file, one for the old file. Lets call these `oldFile` and `newFile`. ``` oldFile.delete() newFile.renameTo(oldFile); ``` Edit: mmyers beat me to it.
269,605
<p>I've got an MS access database and I would need to create an SQL query that allows me to select all the not distinct entries in one column while still keeping all the values.</p> <p>In this case more than ever an example is worth thousands of words:</p> <p>Table:</p> <pre><code>A B C 1 x q 2 y w 3 y e 4 z r 5 z t...
[ { "answer_id": 269620, "author": "a2800276", "author_id": 27408, "author_profile": "https://Stackoverflow.com/users/27408", "pm_score": 2, "selected": false, "text": "<pre><code>select \n * \nfrom \n my_table t1, \n my_table t2\nwhere \n t1.B = t2.B\nand\n t1.C != t2.C\n\n-- apparen...
2008/11/06
[ "https://Stackoverflow.com/questions/269605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've got an MS access database and I would need to create an SQL query that allows me to select all the not distinct entries in one column while still keeping all the values. In this case more than ever an example is worth thousands of words: Table: ``` A B C 1 x q 2 y w 3 y e 4 z r 5 z t 6 z y ``` *SQL magic* Re...
``` Select B, C From Table Where B In (Select B From Table Group By B Having Count(*) > 1) ```
269,611
<p>"Both DataSource and DataSourceID are defined on 'grdCommunication'. Remove one definition."</p> <p>I just got this error today, the code has been working until this afternoon I published the latest version to our server and it broke with that error both locally and on the server. I don't use "DataSourceID", the ...
[ { "answer_id": 269701, "author": "tsilb", "author_id": 11112, "author_profile": "https://Stackoverflow.com/users/11112", "pm_score": 4, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>DataSet dsActivity = objCompany.GetActivityDetails();\ngrdCommunication.DataSource = dsActivit...
2008/11/06
[ "https://Stackoverflow.com/questions/269611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18893/" ]
"Both DataSource and DataSourceID are defined on 'grdCommunication'. Remove one definition." I just got this error today, the code has been working until this afternoon I published the latest version to our server and it broke with that error both locally and on the server. I don't use "DataSourceID", the application ...
Try this: ``` DataSet dsActivity = objCompany.GetActivityDetails(); grdCommunication.DataSource = dsActivity.Tables[0]; grdCommunication.DataBind(); ```
269,632
<p>Upon a click on an IMG, I would like to get to the next subsequent DIV so that the DIVs content can either be displayed or hidden depending on its current display state.</p> <p>This is an HTML snippet:</p> <pre><code>&lt;div&gt; &lt;span class="expand"&gt;&lt;img src="images/plus.gif"&gt;&lt;/span&gt; &lt;span...
[ { "answer_id": 269681, "author": "WillCodeForCoffee", "author_id": 31197, "author_profile": "https://Stackoverflow.com/users/31197", "pm_score": 1, "selected": false, "text": "<p>One good place to look is in the Visual jQuery Docs under selectors: <a href=\"http://screencasts.visualjquer...
2008/11/06
[ "https://Stackoverflow.com/questions/269632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2755/" ]
Upon a click on an IMG, I would like to get to the next subsequent DIV so that the DIVs content can either be displayed or hidden depending on its current display state. This is an HTML snippet: ``` <div> <span class="expand"><img src="images/plus.gif"></span> <span>Subject Heading</span> </div> <div class="recor...
Here's a working example: ``` <script type="text/javascript" src="../jquery-1.2.6.min.js"></script> <div> <span class="expand"><img src="x.jpg"></span> <span>Subject Heading</span> </div> <div class="record hidden">Display or Hide this text</div> <script type="text/javascript"> $(document).ready(function(){ ...
269,653
<p>Does anybody know if there is a way to make autocompletion work in MySQL Command Line Client under Windows? It's working nicely under Linux for me, but simply moves the cursor under Windows instead.</p>
[ { "answer_id": 269750, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 5, "selected": true, "text": "<p>It ought to work this way:</p>\n\n<pre><code>C:\\&gt; mysql --auto-rehash\n</code></pre>\n\n<p>Or configure your my....
2008/11/06
[ "https://Stackoverflow.com/questions/269653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9777/" ]
Does anybody know if there is a way to make autocompletion work in MySQL Command Line Client under Windows? It's working nicely under Linux for me, but simply moves the cursor under Windows instead.
It ought to work this way: ``` C:\> mysql --auto-rehash ``` Or configure your my.cnf: ``` [mysql] auto-rehash ``` **edit:** My apologies. I have found some references that the tab-completion feature in mysql client works only on UNIX/Linux. It does not work on Windows. **update:** The reason for this is mentione...
269,660
<p>Does anyone know how to iterate over a generic list if the type of that list isn't known until runtime?</p> <p>For example, assume <code>obj1</code> is passed into a function as an <code>Object</code>:</p> <pre><code>Dim t As Type = obj1.GetType If t.IsGenericType Then Dim typeParameters() As Type = t.GetGener...
[ { "answer_id": 269716, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 2, "selected": true, "text": "<p>If you know that obj is a <a href=\"http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx\" rel=\"nofollow noreferrer\">Gene...
2008/11/06
[ "https://Stackoverflow.com/questions/269660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12842/" ]
Does anyone know how to iterate over a generic list if the type of that list isn't known until runtime? For example, assume `obj1` is passed into a function as an `Object`: ``` Dim t As Type = obj1.GetType If t.IsGenericType Then Dim typeParameters() As Type = t.GetGenericArguments() Dim typeParam As Type = t...
If you know that obj is a [Generic List](http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx). Then you're in luck. Generic List implements IList and IEnumerable (both are non-generic). So you could cast to either of those interfaces and then For Each over them. * IList has a count property. * IList also has a Cast...
269,676
<p>I want to make my Python library working with MySQLdb be able to detect deadlocks and try again. I believe I've coded a good solution, and now I want to test it.</p> <p>Any ideas for the simplest queries I could run using MySQLdb to create a deadlock condition would be?</p> <p>system info:</p> <ul> <li>MySQL 5.0...
[ { "answer_id": 270449, "author": "jishi", "author_id": 33663, "author_profile": "https://Stackoverflow.com/users/33663", "pm_score": 1, "selected": false, "text": "<p>you can always run LOCK TABLE tablename from another session (mysql CLI for instance). That might do the trick.</p>\n\n<p...
2008/11/06
[ "https://Stackoverflow.com/questions/269676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13009/" ]
I want to make my Python library working with MySQLdb be able to detect deadlocks and try again. I believe I've coded a good solution, and now I want to test it. Any ideas for the simplest queries I could run using MySQLdb to create a deadlock condition would be? system info: * MySQL 5.0.19 * Client 5.1.11 * Windows...
Here's some pseudocode for how i do it in PHP: Script 1: ``` START TRANSACTION; INSERT INTO table <anything you want>; SLEEP(5); UPDATE table SET field = 'foo'; COMMIT; ``` Script 2: ``` START TRANSACTION; UPDATE table SET field = 'foo'; SLEEP(5); INSERT INTO table <anything you want>; COMMIT; ``` Execute script...
269,692
<p>I have a clock feature in a VB.NET program that displays the time including the seconds. I currently have a timer constantly polling using NOW. I have to poll the system clock quite often because I need to have the second update in sync with the system clock.</p> <p>Is there a more direct to access the time only wh...
[ { "answer_id": 269738, "author": "Jason Z", "author_id": 2470, "author_profile": "https://Stackoverflow.com/users/2470", "pm_score": 4, "selected": true, "text": "<p>Why not use the timer component? This assumes that you are using a GUI and not building a service.</p>\n\n<p>You could ca...
2008/11/06
[ "https://Stackoverflow.com/questions/269692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4856/" ]
I have a clock feature in a VB.NET program that displays the time including the seconds. I currently have a timer constantly polling using NOW. I have to poll the system clock quite often because I need to have the second update in sync with the system clock. Is there a more direct to access the time only when the sec...
Why not use the timer component? This assumes that you are using a GUI and not building a service. You could call a synchronization routine that performed the polling to get the timer very close to the seconds changing, then delegate to the timer. You could call the sync routine once a minute or so to make sure that y...
269,713
<p>We have a current application where user login credentials are stored in a SQL Server DB. These are, basically, stored as a plain text username, a password hash, and an associated salt for this hash.</p> <p>These were all created by built in functions in ASP.NET's membership/role system. Here's a row for a user n...
[ { "answer_id": 269888, "author": "grieve", "author_id": 34329, "author_profile": "https://Stackoverflow.com/users/34329", "pm_score": 0, "selected": false, "text": "<p>Two thoughts as to what could be going wrong.</p>\n\n<p>First the code from the reflection has three paths:</p>\n\n<ul>\...
2008/11/06
[ "https://Stackoverflow.com/questions/269713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13668/" ]
We have a current application where user login credentials are stored in a SQL Server DB. These are, basically, stored as a plain text username, a password hash, and an associated salt for this hash. These were all created by built in functions in ASP.NET's membership/role system. Here's a row for a user named 'joe' a...
It appears python is inserting a byte order marker when you convert a UTF16 string to binary. The .NET byte array contains no BOM, so I did some ghetto python that turns the UTF16 into hex, removes the first 4 characters, then decodes it to binary. There may be a better way to rip out the BOM, but this works for me! ...
269,720
<p>I'm looking for a good way to run a Apache Derby server in network mode. I'm using the NetworkServerControl to start the server and it's working great.</p> <p>I start the server like this:</p> <pre><code>/** * starts the network server * @return true if sucessfull */ public boolean start() { try { ...
[ { "answer_id": 269765, "author": "SCdF", "author_id": 1666, "author_profile": "https://Stackoverflow.com/users/1666", "pm_score": 2, "selected": false, "text": "<p>I did a project awhile ago with derby (including running in network mode), and I seem to remember that there is some SQL you...
2008/11/06
[ "https://Stackoverflow.com/questions/269720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2216428/" ]
I'm looking for a good way to run a Apache Derby server in network mode. I'm using the NetworkServerControl to start the server and it's working great. I start the server like this: ``` /** * starts the network server * @return true if sucessfull */ public boolean start() { try { // just to be sure...
We ended up with using a file that is created when the server is to be killed, then on the server process we periodically check if the file exists, if it's there we kill the server.
269,761
<p>Please consider the following:</p> <pre><code>&lt;td style="width: 500px;"&gt; &lt;div style="width: 400px;"&gt;SomeContent&lt;/div&gt; &lt;/td&gt; </code></pre> <p>For some reason, the column that contains a div will not expand to 500px as the style suggests.</p> <p>Do you know how to get the td to honor the...
[ { "answer_id": 269776, "author": "tsilb", "author_id": 11112, "author_profile": "https://Stackoverflow.com/users/11112", "pm_score": 3, "selected": true, "text": "<p>In theory, you can use the min-width and max-width styles. In practice, some popular browsers ignore these styles. In th...
2008/11/06
[ "https://Stackoverflow.com/questions/269761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10589/" ]
Please consider the following: ``` <td style="width: 500px;"> <div style="width: 400px;">SomeContent</div> </td> ``` For some reason, the column that contains a div will not expand to 500px as the style suggests. Do you know how to get the td to honor the width that I am specifying in the style?
In theory, you can use the min-width and max-width styles. In practice, some popular browsers ignore these styles. In this case you have explicitly declared a width of 400, so it should always equal 400 unless acted upon by a child growing or a parent shrinking. You could runat-"server" and programatically determine th...
269,773
<p>I am using a custom item renderer in a combobox to display a custom drawing instead of the default text label.</p> <p>This works fine for the dropdown list but the displayed item ( when the list is closed) is still the textual representation of my object.</p> <p>Is there a way to have the displayed item rendered t...
[ { "answer_id": 280859, "author": "Matt MacLean", "author_id": 22, "author_profile": "https://Stackoverflow.com/users/22", "pm_score": 4, "selected": true, "text": "<p>By default you cannot do this. However, if you extend ComboBox you can add this functionality easily. Here is a quick exa...
2008/11/06
[ "https://Stackoverflow.com/questions/269773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2011/" ]
I am using a custom item renderer in a combobox to display a custom drawing instead of the default text label. This works fine for the dropdown list but the displayed item ( when the list is closed) is still the textual representation of my object. Is there a way to have the displayed item rendered the same way as th...
By default you cannot do this. However, if you extend ComboBox you can add this functionality easily. Here is a quick example, it is a rough version and probably needs testing / tweaking but it shows how you could accomplish this. ``` package { import mx.controls.ComboBox; import mx.core.UIComponent; publ...
269,774
<p>I've got a solution which I setup / cleanup using batch files ... - there are a pair of MSMQ ports, send and receive, with another application on the end of the queues</p> <p>I'm finding I can't properly stop the orchestration in the batch file ... the error is the send port is unenlisted - I'm using the StopOrch....
[ { "answer_id": 280859, "author": "Matt MacLean", "author_id": 22, "author_profile": "https://Stackoverflow.com/users/22", "pm_score": 4, "selected": true, "text": "<p>By default you cannot do this. However, if you extend ComboBox you can add this functionality easily. Here is a quick exa...
2008/11/06
[ "https://Stackoverflow.com/questions/269774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27756/" ]
I've got a solution which I setup / cleanup using batch files ... - there are a pair of MSMQ ports, send and receive, with another application on the end of the queues I'm finding I can't properly stop the orchestration in the batch file ... the error is the send port is unenlisted - I'm using the StopOrch.vbs script...
By default you cannot do this. However, if you extend ComboBox you can add this functionality easily. Here is a quick example, it is a rough version and probably needs testing / tweaking but it shows how you could accomplish this. ``` package { import mx.controls.ComboBox; import mx.core.UIComponent; publ...
269,781
<p>Is there an easy way to convert a string that contains this:</p> <pre><code>Date: Wed, 5 Nov 2008 13:12:12 -0500 (EST) </code></pre> <p>into a string that contains this:</p> <pre><code>20081105_131212 </code></pre> <p><strong>UPDATE:</strong><br> I ended up using date.tryparse which is similar to tryParseExact e...
[ { "answer_id": 269841, "author": "Salman Kasbati", "author_id": 33931, "author_profile": "https://Stackoverflow.com/users/33931", "pm_score": 0, "selected": false, "text": "<p><code>Format(date, \"yyyyMMdd_HHmmss\")</code></p>\n\n<p>More help on <a href=\"http://msdn.microsoft.com/en-us/...
2008/11/06
[ "https://Stackoverflow.com/questions/269781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24721/" ]
Is there an easy way to convert a string that contains this: ``` Date: Wed, 5 Nov 2008 13:12:12 -0500 (EST) ``` into a string that contains this: ``` 20081105_131212 ``` **UPDATE:** I ended up using date.tryparse which is similar to tryParseExact except you don't have to specify the format string. I did have t...
Even better than `Date.Parse` in this case would be `Date.TryParseExact()`. That would let you tell the framework what format you expect and return a boolean rather than throwing an exception if the parse fails. Then use `.ToString("yyyyMMdd_HHmmss")` to get the desired new string format. Here's the format string ref...
269,782
<p>I have a really simple WPF UserControl:</p> <pre><code>&lt;UserControl x:Class="dr.SitecoreCompare.WPF.ConnectionEntry" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="connEntry" BorderBrush="Navy" BorderThickness="1" Margin="5,0,0,5...
[ { "answer_id": 269813, "author": "dmo", "author_id": 1807, "author_profile": "https://Stackoverflow.com/users/1807", "pm_score": 0, "selected": false, "text": "<p>This works in XamlPad, so I think there is something outside the code you posted that is causing the problem. Is DatabaseNam...
2008/11/06
[ "https://Stackoverflow.com/questions/269782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13627/" ]
I have a really simple WPF UserControl: ``` <UserControl x:Class="dr.SitecoreCompare.WPF.ConnectionEntry" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="connEntry" BorderBrush="Navy" BorderThickness="1" Margin="5,0,0,5" > <StackPanel M...
Try Mode=TwoWay in your binding. I've seen this where the initialization sets the value and the control can not set the the value. ``` <TextBox x:Name="txtDatabase" TabIndex="2" Text="{Binding Path=DatabaseName, Mode=TwoWay}"></TextBox> ```
269,794
<p>I have this code:</p> <pre><code>CCalcArchive::CCalcArchive() : m_calcMap() { } </code></pre> <p><code>m_calcMap</code> is defined as this:</p> <pre><code>typedef CTypedPtrMap&lt;CMapStringToPtr, CString, CCalculation*&gt; CCalcMap; CCalcMap&amp; m_calcMap; </code></pre> <p>When I compile in Visual Studio 2008, ...
[ { "answer_id": 269809, "author": "Torlack", "author_id": 5243, "author_profile": "https://Stackoverflow.com/users/5243", "pm_score": 2, "selected": false, "text": "<p>Unless I'm missing something, since it is a reference, it needs to be initialized to point to something. Reference varia...
2008/11/06
[ "https://Stackoverflow.com/questions/269794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9744/" ]
I have this code: ``` CCalcArchive::CCalcArchive() : m_calcMap() { } ``` `m_calcMap` is defined as this: ``` typedef CTypedPtrMap<CMapStringToPtr, CString, CCalculation*> CCalcMap; CCalcMap& m_calcMap; ``` When I compile in Visual Studio 2008, I get this error: ``` error C2440: 'initializing' : cannot convert fr...
The `int` is coming from the fact that `CTypedPtrMap` has a constructor that takes an `int` argument that is defaulted to 10. The real problem that you're running into is that the `m_calcMap` reference initalization you have there is trying to default construct a temporary `CTypedPtrMap` object to bind the reference t...
269,795
<p>How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux?</p> <p>I'm trying to look for the source of the <code>datetime</code> module in particular, but I'm interested in a more general answer as well.</p>
[ { "answer_id": 269803, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": false, "text": "<p>The <code>sys.path</code> list contains the list of directories which will be searched for modules at runtime:</p>\n\n...
2008/11/06
[ "https://Stackoverflow.com/questions/269795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the `datetime` module in particular, but I'm interested in a more general answer as well.
For a pure python module you can find the source by looking at `themodule.__file__`. The datetime module, however, is written in C, and therefore `datetime.__file__` points to a .so file (there is no `datetime.__file__` on Windows), and therefore, you can't see the source. If you download a python source tarball and e...
269,805
<p>I have been trying to parse Java exceptions that appear in a log for some code I'm working with. My question is, do you parse the exception trace from the top down, or the bottom up? It looks something like this:</p> <pre><code>ERROR [main]&lt;/b&gt; Nov/04 11:03:19,440 [localhost].[/BookmarksPortlet].[] - Exceptio...
[ { "answer_id": 269816, "author": "SCdF", "author_id": 1666, "author_profile": "https://Stackoverflow.com/users/1666", "pm_score": 2, "selected": false, "text": "<p>This stuff is a little hard to explain, but my first step is nearly always starting from the top and skimming down until I s...
2008/11/06
[ "https://Stackoverflow.com/questions/269805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8092/" ]
I have been trying to parse Java exceptions that appear in a log for some code I'm working with. My question is, do you parse the exception trace from the top down, or the bottom up? It looks something like this: ``` ERROR [main]</b> Nov/04 11:03:19,440 [localhost].[/BookmarksPortlet].[] - Exception sending context......
In your particular example, there's a class missing. As soon as you see an error like that, you know what needs fixing (either correcting the class name, or updating the classpath so that the class can be found). In general, though, I look from my code toward the generated code until I find the error. If I get a NullP...
269,837
<p>I have a class derived from <code>CTreeCtrl</code>. In <code>OnCreate()</code> I replace the default <code>CToolTipCtrl</code> object with a custom one:</p> <pre><code>int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CTreeCtrl::OnCreate(lpCreateStruct) == -1) return -1; // Replace tool...
[ { "answer_id": 269873, "author": "ravenspoint", "author_id": 16582, "author_profile": "https://Stackoverflow.com/users/16582", "pm_score": 2, "selected": false, "text": "<p>I believe you still have to enable the tooltip, even though you are replacing the builtin.</p>\n\n<pre><code>Enable...
2008/11/06
[ "https://Stackoverflow.com/questions/269837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27596/" ]
I have a class derived from `CTreeCtrl`. In `OnCreate()` I replace the default `CToolTipCtrl` object with a custom one: ``` int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CTreeCtrl::OnCreate(lpCreateStruct) == -1) return -1; // Replace tool tip with our own which will // ask us for...
Finally! I (partially) solved it: It looks like the CDockablePane parent window indeed caused this problem... First I removed all the tooltip-specific code from the CTreeCtrl-derived class. Everything is done in the parent pane window. Then I edited the parent window's `OnCreate()` method: ``` int CMyPane::OnCreate...
269,839
<p>So odd situation that I ran into today with OrderBy:</p> <pre><code>Func&lt;SomeClass, int&gt; orderByNumber = currentClass =&gt; currentClass.SomeNumber; </code></pre> <p>Then:</p> <pre><code>someCollection.OrderBy(orderByNumber); </code></pre> <p>This is fine, but I was going to create a method instead ...
[ { "answer_id": 269873, "author": "ravenspoint", "author_id": 16582, "author_profile": "https://Stackoverflow.com/users/16582", "pm_score": 2, "selected": false, "text": "<p>I believe you still have to enable the tooltip, even though you are replacing the builtin.</p>\n\n<pre><code>Enable...
2008/11/06
[ "https://Stackoverflow.com/questions/269839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21691/" ]
So odd situation that I ran into today with OrderBy: ``` Func<SomeClass, int> orderByNumber = currentClass => currentClass.SomeNumber; ``` Then: ``` someCollection.OrderBy(orderByNumber); ``` This is fine, but I was going to create a method instead because it might be usable somewhere else other than an or...
Finally! I (partially) solved it: It looks like the CDockablePane parent window indeed caused this problem... First I removed all the tooltip-specific code from the CTreeCtrl-derived class. Everything is done in the parent pane window. Then I edited the parent window's `OnCreate()` method: ``` int CMyPane::OnCreate...
269,840
<p>I've uploaded a bunch of images to Amazon S3, and now want to add a Cache-Control header to them. </p> <p>Can the header be updated without downloading the entire image? If so, how?</p>
[ { "answer_id": 270066, "author": "stevemegson", "author_id": 25028, "author_profile": "https://Stackoverflow.com/users/25028", "pm_score": 6, "selected": true, "text": "<p>It's beta functionality, but you can specify new meta data when you <a href=\"http://docs.amazonwebservices.com/Amaz...
2008/11/06
[ "https://Stackoverflow.com/questions/269840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7399/" ]
I've uploaded a bunch of images to Amazon S3, and now want to add a Cache-Control header to them. Can the header be updated without downloading the entire image? If so, how?
It's beta functionality, but you can specify new meta data when you [copy an object](http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectCOPY.html). Specify the same source and destination for the copy, and this has the effect of just updating the meta data on your object. ``` PUT /myObject HTTP...
269,845
<p>According to the help file that comes with the Spring.NET framework, you can inject a dependancy defined in the local file by using an 'idref' tag along with a 'local' attribute. </p> <p>I have been trying to do this with no success and was hoping someone had the experience to help me out. </p> <p>Below I have a...
[ { "answer_id": 411132, "author": "Erich Eichinger", "author_id": 51264, "author_profile": "https://Stackoverflow.com/users/51264", "pm_score": 2, "selected": false, "text": "<p>I guess gef was on the right way but accidentially mixed it up when pasting the snippet.You are looking for the...
2008/11/06
[ "https://Stackoverflow.com/questions/269845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
According to the help file that comes with the Spring.NET framework, you can inject a dependancy defined in the local file by using an 'idref' tag along with a 'local' attribute. I have been trying to do this with no success and was hoping someone had the experience to help me out. Below I have a snippet from the c...
I guess gef was on the right way but accidentially mixed it up when pasting the snippet.You are looking for the [<ref> element](http://www.springframework.net/docs/1.2.0/reference/html/objects.html#objects-ref-element): ``` <object id="theTargetObject" type="TestClassLibrary.TargetObject, TestClassLibrary"/> <object i...
269,864
<p>So I'm looking for a pattern like this:</p> <blockquote> <p>size='0x0'</p> </blockquote> <p>In a log file, but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW)</p> <pre><code>size='0x[0-9a-fA-F]{4,} </code></pre> <p>But the same RegEx does not...
[ { "answer_id": 269874, "author": "Adam Alexander", "author_id": 33164, "author_profile": "https://Stackoverflow.com/users/33164", "pm_score": 2, "selected": false, "text": "<p>I don't know of any elegant alternatives to the {4,} syntax, but if it is not working in your desired environmen...
2008/11/06
[ "https://Stackoverflow.com/questions/269864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15797/" ]
So I'm looking for a pattern like this: > > size='0x0' > > > In a log file, but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW) ``` size='0x[0-9a-fA-F]{4,} ``` But the same RegEx does not work in awk - seems like the repetition `{4,}` is mess...
You can in fact use awk, with a caveat. As mentioned on the following page, you need a special command-line option (--re-interval) to make it work out, since the interval expression (the {4,}) is not in the standard: <http://kansai.anesth.or.jp/gijutu/awk/gawk/gawk_28.html> So in the end, you'll want something that ...
269,872
<p>I have a collection of unmanaged dlls with a C# wrapper around them that I'm calling from a C# project. I've added a build event line that looks like:</p> <pre><code>mkdir ..\Release mkdir ..\Debug copy ..\..\Includes\*.dll ..\Release\*.dll copy ..\..\Includes\*.dll ..\Debug\*.dll </code></pre> <p>Problem is, whe...
[ { "answer_id": 270414, "author": "mmr", "author_id": 21981, "author_profile": "https://Stackoverflow.com/users/21981", "pm_score": 3, "selected": true, "text": "<p>And the answer is: don't publish this, use the windows installer instead, <a href=\"http://msdn.microsoft.com/en-us/library...
2008/11/06
[ "https://Stackoverflow.com/questions/269872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21981/" ]
I have a collection of unmanaged dlls with a C# wrapper around them that I'm calling from a C# project. I've added a build event line that looks like: ``` mkdir ..\Release mkdir ..\Debug copy ..\..\Includes\*.dll ..\Release\*.dll copy ..\..\Includes\*.dll ..\Debug\*.dll ``` Problem is, when I go to publish the appli...
And the answer is: don't publish this, use the windows installer instead, [as described here.](http://msdn.microsoft.com/en-us/library/e2444w33(VS.80).aspx)
269,876
<p>I've always done web apps and now I need to do a console app. I need to use both an odbc connection and a regular connection. </p> <p>In the past I would have used:</p> <pre><code>&lt;add name="LinkConnectionString" connectionString="Data Source=SERENITY\SQLEXPRESS;Initial Catalog=Link;Integrated Security=True" pr...
[ { "answer_id": 269880, "author": "jonnii", "author_id": 4590, "author_profile": "https://Stackoverflow.com/users/4590", "pm_score": 3, "selected": false, "text": "<p>You should be able to find whatever you need here:</p>\n\n<p><a href=\"http://www.connectionstrings.com/\" rel=\"noreferre...
2008/11/06
[ "https://Stackoverflow.com/questions/269876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
I've always done web apps and now I need to do a console app. I need to use both an odbc connection and a regular connection. In the past I would have used: ``` <add name="LinkConnectionString" connectionString="Data Source=SERENITY\SQLEXPRESS;Initial Catalog=Link;Integrated Security=True" providerName="System.Data....
A cool trick to building connection strings is to right click on your desktop, choose "new text document" - this will make a temporary notepad .txt file. Rename it to .udl and then double click it - you can now create any connection string. Click ok when done and open the file in notepad to see the connectionstring. U...
269,882
<p>If I do this:</p> <pre><code>// In header class Foo { void foo(bar*); }; // In cpp void Foo::foo(bar* const pBar) { //Stuff } </code></pre> <p>The compiler does not complain that the signatures for Foo::foo do not match. However if I had:</p> <pre><code>void foo(const bar*); //In header void Foo::foo(bar*) {} /...
[ { "answer_id": 269889, "author": "Douglas Mayle", "author_id": 8458, "author_profile": "https://Stackoverflow.com/users/8458", "pm_score": 4, "selected": false, "text": "<p>In the first, you've promised the compiler, but not other users of the class that you will not edit the variable.</...
2008/11/06
[ "https://Stackoverflow.com/questions/269882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35227/" ]
If I do this: ``` // In header class Foo { void foo(bar*); }; // In cpp void Foo::foo(bar* const pBar) { //Stuff } ``` The compiler does not complain that the signatures for Foo::foo do not match. However if I had: ``` void foo(const bar*); //In header void Foo::foo(bar*) {} //In cpp ``` The code will fail to c...
The *const* keyword in the first example is meaningless. You are saying that you don't plan on changing the pointer. However, the pointer was passed by value and so it dos not matter if you change it or not; it will not effect the caller. Similarly, you could also do this: ``` // In header class Foo { void foo( int b...
269,906
<p>Hopefully this won't be taken as asking the same question twice...</p> <p>So I'm working on a Flash website (in AS2) which has an outer index swf which loads sub swf files using <code>loadMovie("subfoo1.swf", placeToShowSwf)</code>. These in turn load an xml file which tells it what content to load. Everything work...
[ { "answer_id": 269910, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 0, "selected": false, "text": "<p>I use the <strong>Isolation Storage</strong> for configuration. You can also use the <strong>Temp</strong> f...
2008/11/06
[ "https://Stackoverflow.com/questions/269906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32139/" ]
Hopefully this won't be taken as asking the same question twice... So I'm working on a Flash website (in AS2) which has an outer index swf which loads sub swf files using `loadMovie("subfoo1.swf", placeToShowSwf)`. These in turn load an xml file which tells it what content to load. Everything works peachy, but we'd li...
If you're not using `ConfigurationManager` to manage your application and user settings, you should be. The configuration toolkit in the .NET Framework is remarkably well thought out, and the Visual Studio tools that interoperate with it are too. The default behavior of `ConfigurationManager` puts both invariant (app...
269,918
<p>I'm trying to diff two strings to determine whether or not they solely vary in one numerical subset of the string structure; for example,</p> <pre><code>varies_in_single_number_field('foo7bar', 'foo123bar') # Returns True, because 7 != 123, and there's only one varying # number region between the two strings. </cod...
[ { "answer_id": 270006, "author": "Douglas Mayle", "author_id": 8458, "author_profile": "https://Stackoverflow.com/users/8458", "pm_score": 1, "selected": false, "text": "<p>It's probably a bit of overkill, but you could use boost to interface to python. At the worst, difflib is implemen...
2008/11/06
[ "https://Stackoverflow.com/questions/269918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
I'm trying to diff two strings to determine whether or not they solely vary in one numerical subset of the string structure; for example, ``` varies_in_single_number_field('foo7bar', 'foo123bar') # Returns True, because 7 != 123, and there's only one varying # number region between the two strings. ``` In Python I c...
This might work, it at least passes your demonstration test: EDIT: I've made some modifications to deal with some string indexing issues. I believe it should be good now. ``` #include <iostream> #include <string> #include <vector> #include <algorithm> #include <cctype> bool starts_with(const std::string &s1, const st...
269,931
<p>I have a script that generates data in csv format which is sent to the user along with a set of headers that tell the browser it is a .csv file. Everything works great when users (left)click on the link to the script, they are presented with a download dialog with the filename ending in .csv and it suggests using ex...
[ { "answer_id": 269955, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 2, "selected": false, "text": "<p>Use mod_rewrite to alias the file from file.csv to file.php, this is a browser issue rather than PHP because by saving the f...
2008/11/06
[ "https://Stackoverflow.com/questions/269931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a script that generates data in csv format which is sent to the user along with a set of headers that tell the browser it is a .csv file. Everything works great when users (left)click on the link to the script, they are presented with a download dialog with the filename ending in .csv and it suggests using excel...
Use mod\_rewrite to alias the file from file.csv to file.php, this is a browser issue rather than PHP because by saving the file it isn't running it before it is saving it. So to summarise: 1. Link to `personal_information_date.csv` 2. Create a `mod_rewrite` rule that forwards `personal_information_date.csv` to `down...
269,932
<p>I wrote a managed C++ class that has the following function:</p> <pre><code>void EndPointsMappingWrapper::GetLastError(char* strErrorMessage) { strErrorMessage = (char*) Marshal::StringToHGlobalAnsi(_managedObject-&gt;GetLastError()).ToPointer(); } </code></pre> <p>As you can see, this is a simple method to co...
[ { "answer_id": 269953, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 0, "selected": false, "text": "<p>We use the following C++ Class to do the conversions for us and it works fine. You should be able to modify your met...
2008/11/06
[ "https://Stackoverflow.com/questions/269932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33030/" ]
I wrote a managed C++ class that has the following function: ``` void EndPointsMappingWrapper::GetLastError(char* strErrorMessage) { strErrorMessage = (char*) Marshal::StringToHGlobalAnsi(_managedObject->GetLastError()).ToPointer(); } ``` As you can see, this is a simple method to copy the managed string of the ...
You are assigning the value of the passed parameter (strErrorMessage) instead of copying to that address the content of the buffer returned by Marshal::StringToHGlobalAnsi. A correct implementation should be: ``` void EndPointsMappingWrapper::GetLastError(char* strErrorMessage, int len) { char *str = (char*) Marshal...
269,944
<p>Is there a way to run a one-liner in sas, or do I have to create a file? I'm looking for something like the -e flag in perl.</p>
[ { "answer_id": 270262, "author": "davr", "author_id": 14569, "author_profile": "https://Stackoverflow.com/users/14569", "pm_score": 0, "selected": false, "text": "<p>Never having used sas, what I might try is something like:</p>\n\n<pre><code>echo &lt;insert sas code here&gt; | sas --exe...
2008/11/06
[ "https://Stackoverflow.com/questions/269944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14167/" ]
Is there a way to run a one-liner in sas, or do I have to create a file? I'm looking for something like the -e flag in perl.
My favourite is using the -stdio option Either: ``` sas -stdio ``` Then start typing. Or ... ``` echo "proc options; run;" | sas -stdio ```
269,946
<p>I'm constructing a simple form in ERB but the HTML produced by the text_field tag makes the <em>for</em> attribute in the label tag invalid.</p> <pre><code>&lt;div&gt; &lt;p&gt;&lt;%= label_tag "email[name]", "Name" %&gt;&lt;/p&gt; &lt;%= text_field :email, :name, :class =&gt; "text_field" %&gt; &lt;/div&gt; </...
[ { "answer_id": 270262, "author": "davr", "author_id": 14569, "author_profile": "https://Stackoverflow.com/users/14569", "pm_score": 0, "selected": false, "text": "<p>Never having used sas, what I might try is something like:</p>\n\n<pre><code>echo &lt;insert sas code here&gt; | sas --exe...
2008/11/06
[ "https://Stackoverflow.com/questions/269946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9424/" ]
I'm constructing a simple form in ERB but the HTML produced by the text\_field tag makes the *for* attribute in the label tag invalid. ``` <div> <p><%= label_tag "email[name]", "Name" %></p> <%= text_field :email, :name, :class => "text_field" %> </div> ``` Produces the HTML ``` <div> <p><label for="email[nam...
My favourite is using the -stdio option Either: ``` sas -stdio ``` Then start typing. Or ... ``` echo "proc options; run;" | sas -stdio ```
269,974
<p>Does anyone know how to stop jQuery fromparsing html you insert through before() and after()? Say I have an element:</p> <pre><code>&lt;div id='contentdiv'&gt;bla content bla&lt;/div&gt; </code></pre> <p>and I want to wrap it in the following way: </p> <pre><code>&lt;div id='wrapperDiv'&gt; &lt;div id='befor...
[ { "answer_id": 269981, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 2, "selected": false, "text": "<p>your markup isn't complete...before and after are to take complete nodes only...</p>\n\n<p>what you are trying to do is...
2008/11/06
[ "https://Stackoverflow.com/questions/269974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35197/" ]
Does anyone know how to stop jQuery fromparsing html you insert through before() and after()? Say I have an element: ``` <div id='contentdiv'>bla content bla</div> ``` and I want to wrap it in the following way: ``` <div id='wrapperDiv'> <div id='beforeDiv'></div> <div id='contentDiv'>bla content bla</div>...
``` $('#contentDiv').each(function() { $(this).wrap('<div id="wrapperDiv">'); $(this).before('<div id="beforeDiv">'); $(this).after('<div id="afterDiv">'); }); ``` produces: ``` <div id='wrapperDiv'> <div id='beforeDiv'></div> <div id='contentDiv'>bla content bla</div> <div id='afterDiv'></di...
269,979
<p>I'm developing a web app using Java servlet to access Mysql db, how can I get the number of connections to my DB that is currently open ?</p> <p>Edit :</p> <p>I tried "show processlist", it showed me : 2695159, but that's not right, I'm just developing this new project, I'm the only user, couldn't have that many p...
[ { "answer_id": 270008, "author": "Dmitry Khalatov", "author_id": 18174, "author_profile": "https://Stackoverflow.com/users/18174", "pm_score": 2, "selected": false, "text": "<p>show processlist</p>\n" }, { "answer_id": 270014, "author": "Alnitak", "author_id": 6782, "...
2008/11/06
[ "https://Stackoverflow.com/questions/269979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32834/" ]
I'm developing a web app using Java servlet to access Mysql db, how can I get the number of connections to my DB that is currently open ? Edit : I tried "show processlist", it showed me : 2695159, but that's not right, I'm just developing this new project, I'm the only user, couldn't have that many processes running,...
Depending on your MySQL version, you can perform a select on `SELECT COUNT(*) FROM information_schema.PROCESSLIST;` and you can do a `where` between the user, database, and host IP. For example: ``` USE information_schema; SELECT COUNT(*) FROM PROCESSLIST WHERE db ="mycase" AND HOST LIKE "192.168.11.174%" ```
269,988
<p>I have a .NET class library containing a class with a method that performs some lengthy operation. When a client calls this method it should perform the lengthy operation on a new thread in order to avoid blocking the caller. But once the method finishes it should execute some code on the main thread. In a WinForms ...
[ { "answer_id": 270001, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": false, "text": "<p>If a thread has to be able to execute some bit of code (usually in the form of a delegate) posted to it by another th...
2008/11/06
[ "https://Stackoverflow.com/questions/269988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29407/" ]
I have a .NET class library containing a class with a method that performs some lengthy operation. When a client calls this method it should perform the lengthy operation on a new thread in order to avoid blocking the caller. But once the method finishes it should execute some code on the main thread. In a WinForms app...
I found a simple solution to the problem : My COM object is declared like this: ``` public class Runner { public void Run(string executable, object processExitHandler) { ThreadPool.QueueUserWorkItem(state => { var p = new Process() { StartInfo = new Proc...
269,989
<p><strong>EDIT:</strong> I also have access to <a href="http://www.exslt.org/" rel="nofollow noreferrer">ESXLT</a> functions.</p> <p>I have two node sets of string tokens. One set contains values like these:</p> <pre><code>/Geography/North America/California/San Francisco /Geography/Asia/Japan/Tokyo/Shinjuku </code>...
[ { "answer_id": 273285, "author": "Robert Rossney", "author_id": 19403, "author_profile": "https://Stackoverflow.com/users/19403", "pm_score": 3, "selected": true, "text": "<p>This:</p>\n\n<pre><code>&lt;xsl:variable name=\"matches\" select=\"$set1[starts-with(., $set2)]\"/&gt;\n</code></...
2008/11/06
[ "https://Stackoverflow.com/questions/269989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18265/" ]
**EDIT:** I also have access to [ESXLT](http://www.exslt.org/) functions. I have two node sets of string tokens. One set contains values like these: ``` /Geography/North America/California/San Francisco /Geography/Asia/Japan/Tokyo/Shinjuku ``` The other set contains values like these: ``` /Geography/North America/...
This: ``` <xsl:variable name="matches" select="$set1[starts-with(., $set2)]"/> ``` will set `$matches` to a node-set containing every node in `$set1` whose text value starts with the text value of a node in $set2. That's what you're looking for, right? **Edit:** Well, I'm just wrong about this. Here's why. `start...
269,991
<p>In IIS Manager under Web Service Extensions, ASP.NET v2.0.50727 is set to "Prohibited" by default. I would like to set this to Allow during the install.</p> <p>I am currently using WiX Version 2.</p> <p>I have tried using:</p> <pre><code>&lt;Component Id="Allow_WebServiceExtension_ASP.NET_2.0" DiskId="1" Guid="0...
[ { "answer_id": 270277, "author": "CheGueVerra", "author_id": 17787, "author_profile": "https://Stackoverflow.com/users/17787", "pm_score": 0, "selected": false, "text": "<p>Use the <a href=\"http://www.wixwiki.com/index.php?title=WebApplicationExtension_Element\" rel=\"nofollow noreferre...
2008/11/06
[ "https://Stackoverflow.com/questions/269991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/424/" ]
In IIS Manager under Web Service Extensions, ASP.NET v2.0.50727 is set to "Prohibited" by default. I would like to set this to Allow during the install. I am currently using WiX Version 2. I have tried using: ``` <Component Id="Allow_WebServiceExtension_ASP.NET_2.0" DiskId="1" Guid="02247363-E423-41E1-AC15-BEF589B65...
I ended up putting the following code into a custom action: ``` Dim WebSvcObj As Object Dim LocatorObj As Object = CreateObject("WbemScripting.SWbemLocator") Dim ProviderObj As Object = LocatorObj.ConnectServer(".", "root/MicrosoftIISv2", "", "") WebSvcObj = ProviderObj.get("IIsWebService='w3svc'") WebSvcObj.EnableWeb...
269,999
<p>I want the log to roll over as long as the application is running, but I want the log to start fresh when the application is restarted.</p> <p><em>Updated:</em> Based on <a href="https://stackoverflow.com/questions/269999/how-do-i-make-log4j-clear-a-log-at-startup#270026">erickson's</a> feedback, my appender looks ...
[ { "answer_id": 270026, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 7, "selected": true, "text": "<p>If you set the <code>append</code> parameter to <code>false</code>, the base log file will be \"started fresh\" when the ...
2008/11/06
[ "https://Stackoverflow.com/questions/269999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28991/" ]
I want the log to roll over as long as the application is running, but I want the log to start fresh when the application is restarted. *Updated:* Based on [erickson's](https://stackoverflow.com/questions/269999/how-do-i-make-log4j-clear-a-log-at-startup#270026) feedback, my appender looks like this: ``` <appender...
If you set the `append` parameter to `false`, the base log file will be "started fresh" when the application restarts. Do you mean that you want any "rolled" log files to be deleted too?
270,011
<p>The code is rather long yet simple:</p> <ul> <li>100 leaky JavaScript objects are created.</li> <li>10 leaky elements are created from the JS objects.</li> <li>1 element is removed and 1 is added 10000 times.</li> </ul> <p>I assume that the <code>detachEvent</code> call is not functioning properly. Also, if you chan...
[ { "answer_id": 270082, "author": "Lee Kowalkowski", "author_id": 30945, "author_profile": "https://Stackoverflow.com/users/30945", "pm_score": 3, "selected": true, "text": "<p>looks like you're pushing stuff onto the eventParams array inside CreateLeakyEle, but never removing it? Is tha...
2008/11/06
[ "https://Stackoverflow.com/questions/270011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7423/" ]
The code is rather long yet simple: * 100 leaky JavaScript objects are created. * 10 leaky elements are created from the JS objects. * 1 element is removed and 1 is added 10000 times. I assume that the `detachEvent` call is not functioning properly. Also, if you change `this.eventParams` from an array to a simple var...
looks like you're pushing stuff onto the eventParams array inside CreateLeakyEle, but never removing it? Is that right?
270,029
<p>I am implementing a class to compare directory trees (in C#). At first I implemented the actual comparison in the class's constructor. Like this:</p> <pre><code>DirectoryComparer c = new DirectoryComparer("C:\\Dir1", "C:\\Dir2"); </code></pre> <p>But it doesn't feel "right" to do a possible lengthy operation in th...
[ { "answer_id": 270032, "author": "Burkhard", "author_id": 12860, "author_profile": "https://Stackoverflow.com/users/12860", "pm_score": 3, "selected": false, "text": "<p>I prefer the second one.</p>\n\n<p>I expect the constructor to instanciate the class.\nThe method compare does what it...
2008/11/06
[ "https://Stackoverflow.com/questions/270029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4422/" ]
I am implementing a class to compare directory trees (in C#). At first I implemented the actual comparison in the class's constructor. Like this: ``` DirectoryComparer c = new DirectoryComparer("C:\\Dir1", "C:\\Dir2"); ``` But it doesn't feel "right" to do a possible lengthy operation in the constructor. An alternat...
I would think a combination of the two is the "right" choice, as I would expect the Compare method to return the comparison result, not the comparer itself. ``` DirectoryComparer c = new DirectoryComparer(); int equality = c.Compare("C:\\Dir1", "C:\\Dir2"); ``` ...and as Dana mentions, there is an [IComparer](http:...
270,042
<p>I'm optimizing some frequently run Perl code (once per day per file). </p> <p>Do comments slow Perl scripts down? My experiments lean towards no:</p> <pre><code>use Benchmark; timethese(20000000, { 'comments' =&gt; '$b=1; # comment ... (100 times) ', 'nocomments' =&gt; '$b=1;'}); </code></pre> <p>Gives pre...
[ { "answer_id": 270056, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 3, "selected": false, "text": "<p>Perl compiles a script and then executes it. Comments marginally slow the compile phase, but have zero effect...
2008/11/06
[ "https://Stackoverflow.com/questions/270042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9056/" ]
I'm optimizing some frequently run Perl code (once per day per file). Do comments slow Perl scripts down? My experiments lean towards no: ``` use Benchmark; timethese(20000000, { 'comments' => '$b=1; # comment ... (100 times) ', 'nocomments' => '$b=1;'}); ``` Gives pretty much identical values (apart from noi...
Perl is a just-in-time compiled language, so comments and POD have no effect on run-time performance. Comments and POD have a minuscule effect on compile-time, but they're so easy and fast for Perl to parse it's almost impossible to measure the performance hit. You can see this for yourself by using the `-c` flag to j...
270,074
<p>An application that has been working well for months has stopped picking up the JPA <code>@Entity</code> annotations that have been a part of it for months. As my integration tests run I see dozens of "<code>org.hibernate.MappingException: Unknown entity: com.whatever.OrderSystem</code>" type errors.</p> <p>It isn...
[ { "answer_id": 270137, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 3, "selected": true, "text": "<p>I seem to recall I had a similar issue at one time. </p>\n\n<p>Its a long shot, but if you're not already doing this, have...
2008/11/06
[ "https://Stackoverflow.com/questions/270074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7178/" ]
An application that has been working well for months has stopped picking up the JPA `@Entity` annotations that have been a part of it for months. As my integration tests run I see dozens of "`org.hibernate.MappingException: Unknown entity: com.whatever.OrderSystem`" type errors. It isn't clear to me what's gone wrong ...
I seem to recall I had a similar issue at one time. Its a long shot, but if you're not already doing this, have you explicitly specified the provider you are using? ``` <persistence ...> <persistence-unit ...> <provider>org.hibernate.ejb.HibernatePersistence</provider> <---- explicit setting .... <...
270,080
<p>What are the main differences between a Linked List and a BinarySearchTree? Is BST just a way of maintaining a LinkedList? My instructor talked about LinkedList and then BST but did't compare them or didn't say when to prefer one over another. This is probably a dumb question but I'm really confused. I would appreci...
[ { "answer_id": 270088, "author": "Aaron Silverman", "author_id": 26197, "author_profile": "https://Stackoverflow.com/users/26197", "pm_score": 3, "selected": false, "text": "<p>I would say the MAIN difference is that a binary search tree is sorted. When you insert into a binary search t...
2008/11/06
[ "https://Stackoverflow.com/questions/270080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33203/" ]
What are the main differences between a Linked List and a BinarySearchTree? Is BST just a way of maintaining a LinkedList? My instructor talked about LinkedList and then BST but did't compare them or didn't say when to prefer one over another. This is probably a dumb question but I'm really confused. I would appreciate...
Linked List: ``` Item(1) -> Item(2) -> Item(3) -> Item(4) -> Item(5) -> Item(6) -> Item(7) ``` Binary tree: ``` Node(1) / Node(2) / \ / Node(3) RootNode(4) \ Node(5) \ / Node(6) \ ...
270,091
<p>I cannot understand how this is possible. Please help!!</p> <p>I have an app with a trayicon. I want a form to be show when the user double clicks the trayicon. I have a problem where it is possible to get 2 or more forms showing by quickly triple or quadruple clicking the trayicon. The reason I don't want a singl...
[ { "answer_id": 270106, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>Have an additional boolean variable, \"m_formUnderConstruction\" which you test for before constructing the form, and ...
2008/11/06
[ "https://Stackoverflow.com/questions/270091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077232/" ]
I cannot understand how this is possible. Please help!! I have an app with a trayicon. I want a form to be show when the user double clicks the trayicon. I have a problem where it is possible to get 2 or more forms showing by quickly triple or quadruple clicking the trayicon. The reason I don't want a singleton is tha...
Have an additional boolean variable, "m\_formUnderConstruction" which you test for before constructing the form, and which you set as soon as you've decided to construct it. The re-entrancy makes all of this a little icky, unfortunately. I've removed the lock, as if this ever gets called from a different thread then y...
270,093
<p>I came across this code and wanted others to provide their point of view... is it good or bad ? ;)</p> <pre><code>Class ReportClass { public string ReportName {get; set;} } </code></pre> <p>Then it was used as follows in code:</p> <pre><code>displayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToSt...
[ { "answer_id": 270108, "author": "kenny", "author_id": 3225, "author_profile": "https://Stackoverflow.com/users/3225", "pm_score": -1, "selected": false, "text": "<p>Seems fine to me. It is probably compiled with C# 3.0 and that allows <a href=\"http://msdn.microsoft.com/en-us/library/bb...
2008/11/06
[ "https://Stackoverflow.com/questions/270093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I came across this code and wanted others to provide their point of view... is it good or bad ? ;) ``` Class ReportClass { public string ReportName {get; set;} } ``` Then it was used as follows in code: ``` displayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToString()) ``` That is about the simpl...
I tend to avoid in-place assignment - or indeed any side effects like this - except for one common idiom: ``` string line; while ((line = reader.ReadLine()) != null) { // Do something with line } ``` (And variants for reading streams etc.) I'm also okay with using object initializers in parameter calls, e.g...
270,112
<p>I have an application where the user selects the dates of a first statement and a last statement. Example, first statement = 1/1/08, last statement = 12/1/08, should equal 12 statements.</p> <p>However, when using the following code, the result is 11:</p> <pre><code>numPayments = DateDiff(DateInterval.Month, CDate...
[ { "answer_id": 270119, "author": "Jason", "author_id": 16794, "author_profile": "https://Stackoverflow.com/users/16794", "pm_score": 3, "selected": false, "text": "<p>Add 1, as you write. ;) </p>\n\n<p>The difference between 1/1/2008 and 12/1/2008 is 11 months. No changing that. ;)</p>\n...
2008/11/06
[ "https://Stackoverflow.com/questions/270112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4770/" ]
I have an application where the user selects the dates of a first statement and a last statement. Example, first statement = 1/1/08, last statement = 12/1/08, should equal 12 statements. However, when using the following code, the result is 11: ``` numPayments = DateDiff(DateInterval.Month, CDate(.FeeStartDate), CDat...
Yes, you'd always have to add one though you may be able to add one to the end date or subtract one from the start date to also get this effect. Consider the case where the start and end dates are the same. Their difference is 0 but you'd still want 1 statement to show just to note one odd case.
270,113
<p>I have two Slackware Linux systems on which the POSIX semaphore <code>sem_open()</code> call fails with errno set to 38. Sample code to reproduce below (the code works fine on CentOS / RedHat).</p> <p>Are there any kernel or system configuration options that could cause this? Other suggestions?</p> <p>Systems with...
[ { "answer_id": 270377, "author": "Steve Baker", "author_id": 13566, "author_profile": "https://Stackoverflow.com/users/13566", "pm_score": 4, "selected": true, "text": "<p>Is /dev/shm mounted? Older versions of slackware may not have mounted this filesystem at boot. From /etc/fstab:</p...
2008/11/06
[ "https://Stackoverflow.com/questions/270113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18023/" ]
I have two Slackware Linux systems on which the POSIX semaphore `sem_open()` call fails with errno set to 38. Sample code to reproduce below (the code works fine on CentOS / RedHat). Are there any kernel or system configuration options that could cause this? Other suggestions? Systems with issue are Slackware 10.1.0 ...
Is /dev/shm mounted? Older versions of slackware may not have mounted this filesystem at boot. From /etc/fstab: ``` tmpfs /dev/shm tmpfs defaults 0 0 ``` Edit: That is probably not the problem after all. I think you may just need to upgrade your kernel or maybe even librt. Edit2: I think that for slackware 11...
270,125
<p>I have to pass parameters between two rails apps. In one side (sender) I have an array of hashes. I have a code like the following to send the data:</p> <pre><code> http = Net::HTTP.new('localhost', '3030') result = http.post('/processar_lotes', my_array_of_hashes) </code></pre> <p>Some questions</p> <ul> <l...
[ { "answer_id": 270154, "author": "TravisO", "author_id": 35116, "author_profile": "https://Stackoverflow.com/users/35116", "pm_score": 2, "selected": true, "text": "<p>Considering that these objects can vary per file size, and your computer's specs (bus speed, HD speed) affect this, the ...
2008/11/06
[ "https://Stackoverflow.com/questions/270125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19224/" ]
I have to pass parameters between two rails apps. In one side (sender) I have an array of hashes. I have a code like the following to send the data: ``` http = Net::HTTP.new('localhost', '3030') result = http.post('/processar_lotes', my_array_of_hashes) ``` Some questions * Is there any (kind of) serialize or...
Considering that these objects can vary per file size, and your computer's specs (bus speed, HD speed) affect this, the only way to be sure is to write your own benchmark. Just create a simple for loop, count from 1 to 1000, and read the file inside the loop over and over (but do not create and destroy the objects insi...
270,148
<p>I have these 3 tables + data:</p> <p><strong>items</strong>: itemId, itemName <br />data: 1, my item one</p> <p><strong>categories</strong>: catId, catName <br />data: 1, my cat one. 2, my cat two</p> <p><strong>map</strong>: mapId, itemId, catId</p> <p>When you include item "my item one" in category "my cat one...
[ { "answer_id": 270173, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>Assuming you've already got the category ID for \"my cat two\" and the item ID for \"my item 1\":</p>\n\n<pre><code>DE...
2008/11/06
[ "https://Stackoverflow.com/questions/270148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356/" ]
I have these 3 tables + data: **items**: itemId, itemName data: 1, my item one **categories**: catId, catName data: 1, my cat one. 2, my cat two **map**: mapId, itemId, catId When you include item "my item one" in category "my cat one", you insert [1, 1, 1] into the map. When you add "my item one" to "my cat two"...
Assuming you've already got the category ID for "my cat two" and the item ID for "my item 1": ``` DELETE FROM MAP WHERE ItemID = @MyItem1Id AND CatID <> @MyCat2Id ``` If you have a set of categories you want to keep the item in, you could either: 1. Delete everything from the map for that item and t...
270,177
<p>I have a bunch of images that need to rotate in and out one at a time every 2 seconds with fancy JQuery fadeIn and fadeOut. I have all the images in the HTML to pre-load them and a setInterval timer that fades the current image out, then fades the next image in. Problem is that sometimes when you are clicking or s...
[ { "answer_id": 270249, "author": "RichH", "author_id": 16779, "author_profile": "https://Stackoverflow.com/users/16779", "pm_score": 1, "selected": false, "text": "<p>You have id=\"img2\" twice.</p>\n\n<p>Can you not simpify - calculate the current and next id first. Then do your $().fad...
2008/11/06
[ "https://Stackoverflow.com/questions/270177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396/" ]
I have a bunch of images that need to rotate in and out one at a time every 2 seconds with fancy JQuery fadeIn and fadeOut. I have all the images in the HTML to pre-load them and a setInterval timer that fades the current image out, then fades the next image in. Problem is that sometimes when you are clicking or scroll...
Have you thought about using the [Cycle Plugin](http://malsup.com/jquery/cycle/)? It sounds like this does exactly what you're trying to do, and it offers a lot of flexibility. I've used this plugin myself with great results. Highly recommended.
270,187
<p>Is it possible to create an attribute that can be initialized with a variable number of arguments?</p> <p>For example:</p> <pre><code>[MyCustomAttribute(new int[3,4,5])] // this doesn't work public MyClass ... </code></pre>
[ { "answer_id": 270223, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 3, "selected": false, "text": "<p>Yes, but you need to initialize the array that you are passing in. Here is an example from a row test in our unit te...
2008/11/06
[ "https://Stackoverflow.com/questions/270187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is it possible to create an attribute that can be initialized with a variable number of arguments? For example: ``` [MyCustomAttribute(new int[3,4,5])] // this doesn't work public MyClass ... ```
Attributes will take an array. Though if you control the attribute, you can also use `params` instead (which is nicer to consumers, IMO): ``` class MyCustomAttribute : Attribute { public int[] Values { get; set; } public MyCustomAttribute(params int[] values) { this.Values = values; } } [MyCustomA...
270,190
<p>I have 4 databases with similar schema's, and I'm trying to create a query to return just the table, column pairs that exist ONLY in database 1 and do not exist in database 2, 3, or 4.</p> <p>Currently I can return the symmetric difference between database 1 and 2 via the following query...</p> <pre><code>select t...
[ { "answer_id": 270223, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 3, "selected": false, "text": "<p>Yes, but you need to initialize the array that you are passing in. Here is an example from a row test in our unit te...
2008/11/06
[ "https://Stackoverflow.com/questions/270190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7287/" ]
I have 4 databases with similar schema's, and I'm trying to create a query to return just the table, column pairs that exist ONLY in database 1 and do not exist in database 2, 3, or 4. Currently I can return the symmetric difference between database 1 and 2 via the following query... ``` select table_name, column_nam...
Attributes will take an array. Though if you control the attribute, you can also use `params` instead (which is nicer to consumers, IMO): ``` class MyCustomAttribute : Attribute { public int[] Values { get; set; } public MyCustomAttribute(params int[] values) { this.Values = values; } } [MyCustomA...
270,230
<p>What is the difference between having</p> <pre class="lang-java prettyprint-override"><code>&lt;%# Eval("State") %&gt; </code></pre> <p>in your <code>aspx</code> page, versus having</p> <pre class="lang-java prettyprint-override"><code>&lt;%# DataBinder.Eval(Container.DataItem, "State") %&gt; </code></pre> <p>...
[ { "answer_id": 270242, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 4, "selected": false, "text": "<p>There is no difference. The \"Eval\" method is just a shortcut for the DataBinder.Eval(Container.DataItem, \"bla...
2008/11/06
[ "https://Stackoverflow.com/questions/270230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
What is the difference between having ```java <%# Eval("State") %> ``` in your `aspx` page, versus having ```java <%# DataBinder.Eval(Container.DataItem, "State") %> ``` in your `aspx` page?
`Eval("State")` is a simplified form of the `DataBinder.Eval(Container.DataItem, "State")` syntax. It only works inside of data-bound template controls. For more info, see [the MSDN documentation](http://msdn.microsoft.com/en-us/library/ms178366.aspx).
270,260
<p>Let's imagine I got this:</p> <p>index.php generates form with unpredictable number of inputs with certain IDs/Names and different values that can be edited by user and saved by script.php</p> <pre><code>&lt;form action="script.php" method="post"&gt; &lt;input id="1" name="1" type="text" value="1"/&gt; &lt;input i...
[ { "answer_id": 270279, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 3, "selected": true, "text": "<p>i may be missing something in your question, but the <code>$_POST</code> variable will contain all the name => value pairs yo...
2008/11/06
[ "https://Stackoverflow.com/questions/270260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21209/" ]
Let's imagine I got this: index.php generates form with unpredictable number of inputs with certain IDs/Names and different values that can be edited by user and saved by script.php ``` <form action="script.php" method="post"> <input id="1" name="1" type="text" value="1"/> <input id="24" name="24" type="text" value="...
i may be missing something in your question, but the `$_POST` variable will contain all the name => value pairs you're asking for. for example, in your above HTML snippet: ``` print_r($_POST); // contains: array ( [1] => 1 [24] => 2233 [55] => 231321 ) // example access: foreach($_POST as $name => $value) { ...
270,268
<p>I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI.</p> <pre><code>public RMIClass extends Serializable { public RMIMethod(MyFile file){ // do stuff } } </code></pre> <p>MyFile has a property called "body", which is a byte array. </p> <pre...
[ { "answer_id": 270278, "author": "Geo", "author_id": 31610, "author_profile": "https://Stackoverflow.com/users/31610", "pm_score": 0, "selected": false, "text": "<p>Why don't you create your own class that extends <strong>OutputStream</strong> or , whatever is the archive writing to ?</p...
2008/11/06
[ "https://Stackoverflow.com/questions/270268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34380/" ]
I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI. ``` public RMIClass extends Serializable { public RMIMethod(MyFile file){ // do stuff } } ``` MyFile has a property called "body", which is a byte array. ``` public final class MyFile impl...
Wrap your byte array with a [ByteArrayInputStream](http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html) and feed it into a [GZipInputStream](http://java.sun.com/javase/6/docs/api/java/util/zip/GZIPInputStream.html)
270,287
<p>What is a good way to edit a Web.config file programmatically?</p> <p>I looked into System.Xml but couldn't find any obvious answers.</p>
[ { "answer_id": 270301, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 2, "selected": false, "text": "<p>Depending on what you are doing, the method is really a bit different in each situation. However the most robu...
2008/11/06
[ "https://Stackoverflow.com/questions/270287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4886/" ]
What is a good way to edit a Web.config file programmatically? I looked into System.Xml but couldn't find any obvious answers.
[This fellow](http://www.dotnetspider.com/resources/17562-Edit-Delete-Create-Encrypt-sections.aspx) shows sample code if you still want to do it after all the caveats: ``` protected void EditConfigButton(object sender, EventArgs e) { Configuration objConfig = System.Web.Configuration.WebConfigurationManager.OpenWeb...
270,288
<p>I'm currently optimizing the performance on my company's site; when it was taking 6-10 seconds to download 2MB+ of our homepage and assets (the site is mostly Flash with a lot of media, so it's not 2MB of HTML and viewstate). There are a lot of things that will need to be done to get this download size down; but one...
[ { "answer_id": 270301, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 2, "selected": false, "text": "<p>Depending on what you are doing, the method is really a bit different in each situation. However the most robu...
2008/11/06
[ "https://Stackoverflow.com/questions/270288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10922/" ]
I'm currently optimizing the performance on my company's site; when it was taking 6-10 seconds to download 2MB+ of our homepage and assets (the site is mostly Flash with a lot of media, so it's not 2MB of HTML and viewstate). There are a lot of things that will need to be done to get this download size down; but one th...
[This fellow](http://www.dotnetspider.com/resources/17562-Edit-Delete-Create-Encrypt-sections.aspx) shows sample code if you still want to do it after all the caveats: ``` protected void EditConfigButton(object sender, EventArgs e) { Configuration objConfig = System.Web.Configuration.WebConfigurationManager.OpenWeb...
270,292
<p>For a windows script I am writing, I need to detect if the machine has Apache 2.2 installed, and to find the application path. </p> <p>One solution I came up with is to wget <a href="http://localhost:8080/server-info" rel="nofollow noreferrer">http://localhost:8080/server-info</a> and parse the root and the config...
[ { "answer_id": 270324, "author": "Powerlord", "author_id": 15880, "author_profile": "https://Stackoverflow.com/users/15880", "pm_score": 0, "selected": false, "text": "<p>As I recall, Apache writes some registry keys. If you know how to read them from a script, that might help.</p>\n" ...
2008/11/06
[ "https://Stackoverflow.com/questions/270292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5661/" ]
For a windows script I am writing, I need to detect if the machine has Apache 2.2 installed, and to find the application path. One solution I came up with is to wget <http://localhost:8080/server-info> and parse the root and the config file from it. This would fail if the server does not use port 8080 Another option...
Not a lot of great options if they didn't install it using the installer. If they used the MSI/installer, you can check the registry: ``` HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Apache\2.2.2\ServerRoot HKEY_CURRENT_USER\SOFTWARE\Apache Software Foundation\Apache\2.2.2\ServerRoot ``` You can also chec...
270,309
<p>I want to do something like this:</p> <pre> <code> create table app_users ( app_user_id smallint(6) not null auto_increment primary key, api_key char(36) not null default uuid() ); </code> </pre> <p>However this results in a error, is there a way to call a function for a default value in mysql?</p> <p...
[ { "answer_id": 270332, "author": "TravisO", "author_id": 35116, "author_profile": "https://Stackoverflow.com/users/35116", "pm_score": 3, "selected": false, "text": "<p>Unfortunately no, MySQL 5 requires constants for the default. The issue was discussed in much more detail in the link ...
2008/11/06
[ "https://Stackoverflow.com/questions/270309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
I want to do something like this: ``` create table app_users ( app_user_id smallint(6) not null auto_increment primary key, api_key char(36) not null default uuid() ); ``` However this results in a error, is there a way to call a function for a default value in mysql? thanks.
No, you can't. However, you could easily create a trigger to do this, such as: ``` CREATE TRIGGER before_insert_app_users BEFORE INSERT ON app_users FOR EACH ROW SET new.api_key = uuid(); ```
270,325
<p>We frequently have users that create multiple accounts and then end up storing the same lesson activity data more than once. Once they realize the error, then they contact us to merge the accounts into a single one that they can use. </p> <p>I've been beating myself to death trying to figure out how to write a quer...
[ { "answer_id": 270357, "author": "WW.", "author_id": 14663, "author_profile": "https://Stackoverflow.com/users/14663", "pm_score": 1, "selected": false, "text": "<p>How about this, assuming we are merging user_id 2 into 1.</p>\n\n<p>This updates the lessons done under 2 that have not bee...
2008/11/06
[ "https://Stackoverflow.com/questions/270325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
We frequently have users that create multiple accounts and then end up storing the same lesson activity data more than once. Once they realize the error, then they contact us to merge the accounts into a single one that they can use. I've been beating myself to death trying to figure out how to write a query in MySQL...
One of my current clients is facing a similar problem, except that they have dozens of tables that have to be merged. This is one reason to use a real life primary key (natural key). Your best bet is to try to avoid this problem before it even happens. Another thing to keep in mind, is that two people can share both t...
270,334
<p>I have a class that contains two methods like these:</p> <pre><code>public String getFoo(Int32 a) { return getBar(a, "b", null); } public String getBar(Int32 a, String b, Int32 c) { //do something return ""; } </code></pre> <p>However when I compile my class I get two errors:</p> <ol> <li>The best overload...
[ { "answer_id": 270345, "author": "Jacob Krall", "author_id": 3140, "author_profile": "https://Stackoverflow.com/users/3140", "pm_score": 1, "selected": false, "text": "<p><code>Int32</code> is a value type, which means <code>null</code> is not a valid argument for parameters of type <cod...
2008/11/06
[ "https://Stackoverflow.com/questions/270334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9809/" ]
I have a class that contains two methods like these: ``` public String getFoo(Int32 a) { return getBar(a, "b", null); } public String getBar(Int32 a, String b, Int32 c) { //do something return ""; } ``` However when I compile my class I get two errors: 1. The best overloaded method match for getBar(int,strin...
In .NET, there is a distinct concept between reference types and value types. A reference type is an object that is allocated on the heap (It will be a subclass of System.Object). All that is on the stack is a pointer to this object. Because of that, it is perfectly valid to store a null pointer. A value type is an o...
270,337
<p>I have a page with a GridView on it that launches a popup, using Javascript. The user then selects an item, that updates the data connected to the GridView and closes the popup.</p> <p>How do I refresh the first (ie the Calling page) so that I can refresh the data shown in my Gridview?</p>
[ { "answer_id": 270351, "author": "TonyB", "author_id": 3543, "author_profile": "https://Stackoverflow.com/users/3543", "pm_score": 1, "selected": false, "text": "<p>Try this inside your popup:</p>\n\n<pre><code>&lt;script&gt;\nwindow.opener.location.reload()\n&lt;/script&gt;\n</code></pr...
2008/11/06
[ "https://Stackoverflow.com/questions/270337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29441/" ]
I have a page with a GridView on it that launches a popup, using Javascript. The user then selects an item, that updates the data connected to the GridView and closes the popup. How do I refresh the first (ie the Calling page) so that I can refresh the data shown in my Gridview?
Try this inside your popup: ``` <script> window.opener.location.reload() </script> ``` That should refresh the page that opened the pop-up
270,347
<p><code>std::auto_ptr</code> is broken in VC++ 8 (which is what we use at work). My main gripe with it is that it allows <code>auto_ptr&lt;T&gt; x = new T();</code>, which of course leads to horrible crashes, while being simple to do by mistake.</p> <p>From an <a href="https://stackoverflow.com/questions/106508/what-...
[ { "answer_id": 270363, "author": "MP24", "author_id": 6206, "author_profile": "https://Stackoverflow.com/users/6206", "pm_score": 0, "selected": false, "text": "<p>Use boost::shared_ptr/boost::scoped_ptr. It will be the preferred smart pointer in upcoming C++ standards (is in TR1 already...
2008/11/06
[ "https://Stackoverflow.com/questions/270347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35256/" ]
`std::auto_ptr` is broken in VC++ 8 (which is what we use at work). My main gripe with it is that it allows `auto_ptr<T> x = new T();`, which of course leads to horrible crashes, while being simple to do by mistake. From an [answer](https://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-u...
Move to boost smart pointers. In the meantime, you may want to extract a working auto\_ptr implementation from an old / another STL, so you have working code. I believe that auto\_ptr semantics are fundamentally broken - it saves typing, but the interface actually is not simpler: you still have to track which instanc...
270,350
<p>I have been experimenting with Lambda expressions in Oxygene. Very simple recursive lambda expression to calculate a fibonacci number :</p> <pre><code>var fib : Func&lt;int32, int32&gt;; fib := n -&gt; iif(n &gt; 1, fib(n - 1) + fib(n - 2), n); fib(3); </code></pre> <p>When I run this code I get a nullreferenceexc...
[ { "answer_id": 270559, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 4, "selected": true, "text": "<p>You aren't doing anything wrong. If anything, the compiler should warn you about using fib, an unassigned variable, in...
2008/11/06
[ "https://Stackoverflow.com/questions/270350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22712/" ]
I have been experimenting with Lambda expressions in Oxygene. Very simple recursive lambda expression to calculate a fibonacci number : ``` var fib : Func<int32, int32>; fib := n -> iif(n > 1, fib(n - 1) + fib(n - 2), n); fib(3); ``` When I run this code I get a nullreferenceexception. Any ideas as to what I'm doing...
You aren't doing anything wrong. If anything, the compiler should warn you about using fib, an unassigned variable, inside the body of the lambda. However the compiler ought to be capturing fib as a location, so that when the assignment completes and the delegate is later invoked, fib is properly assigned and recursio...
270,391
<p>I'm using MessageFormat to format some addresses with a template like this:</p> <pre><code>"{0}\n{1}\n{2}\n{3}, {4} {5}" </code></pre> <p>where</p> <ul> <li>0 = street 1</li> <li>1 = street 2</li> <li>2 = street 3</li> <li>3 = city</li> <li>4 = state</li> <li>5 = zip</li> </ul> <p>Most of these fields are option...
[ { "answer_id": 270461, "author": "sk.", "author_id": 16399, "author_profile": "https://Stackoverflow.com/users/16399", "pm_score": 2, "selected": false, "text": "<p>Don't know how lightweight you'd consider it but <a href=\"http://velocity.apache.org/\" rel=\"nofollow noreferrer\">Apache...
2008/11/06
[ "https://Stackoverflow.com/questions/270391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21176/" ]
I'm using MessageFormat to format some addresses with a template like this: ``` "{0}\n{1}\n{2}\n{3}, {4} {5}" ``` where * 0 = street 1 * 1 = street 2 * 2 = street 3 * 3 = city * 4 = state * 5 = zip Most of these fields are optional when captured. How do I avoid having an empty line when for instance, there is not ...
**EDIT: rewrite...** If you *don't care about design*, then you can readily pick a template engine at random, or because you like its name, or whatever. If you don't have criteria for selecting an engine, then who cares which one you pick? On the other hand, if you *do care about design*, such as in using the Model-V...
270,434
<p>In Reporting Services I would like to add a parameter that contains data from a custom code block. Ideally, I would be able to run the following code (this is a simple testing example):</p> <pre><code>Function GetPeriods() As String() Dim values As System.Collections.ArrayList = New System.Collections.ArrayL...
[ { "answer_id": 273746, "author": "Gene", "author_id": 35630, "author_profile": "https://Stackoverflow.com/users/35630", "pm_score": 0, "selected": false, "text": "<p>Everything I've seen requires parameters and their respective settings to be part of the RDL. </p>\n\n<p>That being said, ...
2008/11/06
[ "https://Stackoverflow.com/questions/270434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105/" ]
In Reporting Services I would like to add a parameter that contains data from a custom code block. Ideally, I would be able to run the following code (this is a simple testing example): ``` Function GetPeriods() As String() Dim values As System.Collections.ArrayList = New System.Collections.ArrayList() For i as...
If you're using SQL 2008 Reporting Services then you can have a look at [this page](http://msdn.microsoft.com/en-au/library/ms153561.aspx) which introduces the concept of using custom assemblies. If you're using SQL 2005 Reporting Services then [this link](http://msdn.microsoft.com/en-au/library/ms153561(SQL.90).aspx)...
270,444
<p>I'm getting this error:</p> <pre><code>javax.servlet.ServletException: bean not found within scope </code></pre> <p>on a page with this at the top.</p> <pre class="lang-html prettyprint-override"><code>&lt;jsp:useBean id="bean" type="com.example.Bean" scope="request" /&gt; </code></pre> <p>The class exists in th...
[ { "answer_id": 904223, "author": "victor hugo", "author_id": 70616, "author_profile": "https://Stackoverflow.com/users/70616", "pm_score": 1, "selected": false, "text": "<p>You must add</p>\n\n<pre><code>&lt;jsp:useBean id=\"givingFormBean\" type=\"some.packg.GivingForm\" scope=\"request...
2008/11/06
[ "https://Stackoverflow.com/questions/270444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12386/" ]
I'm getting this error: ``` javax.servlet.ServletException: bean not found within scope ``` on a page with this at the top. ```html <jsp:useBean id="bean" type="com.example.Bean" scope="request" /> ``` The class exists in the classpath, it worked this morning, and I don't get what not found within scope means. H...
You need the `class` attribute instead of the `type` attribute. The following: ```html <jsp:useBean id="bean" type="com.example.Bean" scope="request" /> ``` does *basically* the following behind the scenes: ```java Bean bean = (Bean) pageContext.getAttribute("bean", PageContext.REQUEST_SCOPE); if (bean == null) ...
270,445
<p>Is there a way to compile multiple java source directories in a single maven project? </p>
[ { "answer_id": 270451, "author": "sal", "author_id": 13753, "author_profile": "https://Stackoverflow.com/users/13753", "pm_score": 6, "selected": false, "text": "<p>This worked for me</p>\n\n<pre class=\"lang-xml prettyprint-override\"><code>&lt;build&gt;\n &lt;sourceDirectory&gt;.&lt...
2008/11/06
[ "https://Stackoverflow.com/questions/270445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13753/" ]
Is there a way to compile multiple java source directories in a single maven project?
You can add a new source directory with build-helper: ```xml <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>3.2.0</version> <executions> <execution> ...
270,458
<p>I am building a really basic Cocoa application using WebKit, to display a Flash/Silverlight application within it. Very basic, no intentions for it to be a browser itself.</p> <p>So far I have been able to get it to open basic html links (<code>&lt;a href="..." /&gt;</code>) in a new instance of Safari using </p> ...
[ { "answer_id": 271715, "author": "Louis Gerbarg", "author_id": 30506, "author_profile": "https://Stackoverflow.com/users/30506", "pm_score": 2, "selected": false, "text": "<p>You don't mention what kind of erratic behaviour you are seeing. A quick possibility, is that when implementing t...
2008/11/06
[ "https://Stackoverflow.com/questions/270458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35263/" ]
I am building a really basic Cocoa application using WebKit, to display a Flash/Silverlight application within it. Very basic, no intentions for it to be a browser itself. So far I have been able to get it to open basic html links (`<a href="..." />`) in a new instance of Safari using ``` [[NSWorkspace sharedWorkspa...
I made from progress last night and pinned down part of my problem. I am already using `webView:decidePolicyForNewWindowAction:request:newFrameName:decisionListener:` and I have gotten it to work with anchor tags, however the method never seems to get called when JavaScript is invoked. However when `window.open()` is...
270,468
<p>Can anyone please let me know the procedure to perform silent installation of SQL Server Express 2005 and the way to specify the installation parameters.</p>
[ { "answer_id": 270521, "author": "GeekyMonkey", "author_id": 29900, "author_profile": "https://Stackoverflow.com/users/29900", "pm_score": 3, "selected": false, "text": "<p>Get the MSI and do</p>\n\n<pre><code>string InstallFile = \"SSCERuntime-ENU-x86.msi\"\nstring LogFile = \"C:\\Insta...
2008/11/06
[ "https://Stackoverflow.com/questions/270468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Can anyone please let me know the procedure to perform silent installation of SQL Server Express 2005 and the way to specify the installation parameters.
Get the MSI and do ``` string InstallFile = "SSCERuntime-ENU-x86.msi" string LogFile = "C:\Install.log" Process proc; proc = Process.Start("msiexec", "/l " + LogFile + " /quiet /i " + InstallFile); ```
270,479
<p>My solution includes these two projects:</p> <ul> <li>MyNamespace.Web.UI</li> <li>MyNamespace.Web.Core</li> </ul> <p>UI references Core, and Core references Foobar.dll, which exists nowhere except my library. When I build from Visual Studio 2008 Foobar.dll is in the UI project's Bin folder as expected. I have ma...
[ { "answer_id": 270497, "author": "Rich Reuter", "author_id": 283, "author_profile": "https://Stackoverflow.com/users/283", "pm_score": 0, "selected": false, "text": "<p>In some things that I've worked on, I've resorted to using NAnt's <a href=\"http://nant.sourceforge.net/release/latest/...
2008/11/06
[ "https://Stackoverflow.com/questions/270479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29493/" ]
My solution includes these two projects: * MyNamespace.Web.UI * MyNamespace.Web.Core UI references Core, and Core references Foobar.dll, which exists nowhere except my library. When I build from Visual Studio 2008 Foobar.dll is in the UI project's Bin folder as expected. I have made certain it was not there before th...
You likely have the option in VS to "Copy Local" on, which is implicitly, well, copying it locally before the build. You'll need to emulate that in NAnt. Similar to why you can just do a "Publish" for a web project from Visual Studio, but for the command line you have to both build and then copy out the output to whe...
270,493
<p>I need two divs to look a bit like this: </p> <pre><code> | | ---| LOGO |------------------------ | |_______________| LINKS | | CONTENT | </code></pre> <p>What's the neatest/most elegant way of making them overlap neatly? The logo will ...
[ { "answer_id": 270501, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 3, "selected": false, "text": "<p>With absolute or relative positioning, you can do all sorts of overlapping. You've probably want the logo to be styled as...
2008/11/06
[ "https://Stackoverflow.com/questions/270493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need two divs to look a bit like this: ``` | | ---| LOGO |------------------------ | |_______________| LINKS | | CONTENT | ``` What's the neatest/most elegant way of making them overlap neatly? The logo will have a fixed height and wi...
I might approach it like so (CSS and HTML): ```css html, body { margin: 0px; } #logo { position: absolute; /* Reposition logo from the natural layout */ left: 75px; top: 0px; width: 300px; height: 200px; z-index: 2; } #content { margin-top: 100px; /* Provide buffer for logo */ } #links ...
270,494
<p>I have a form with a textbox and a button. IE is the only browser that will not submit the form when Enter is pressed (works in FF, Opera, Safari, Chrome, etc.). I found this javascript function to try to coax IE into behaving; but no avail:</p> <pre><code>function checkEnter(e){ var characterCode if (e &a...
[ { "answer_id": 270505, "author": "TravisO", "author_id": 35116, "author_profile": "https://Stackoverflow.com/users/35116", "pm_score": 2, "selected": false, "text": "<pre><code>// Use the following Javascript in your HTML view\n// put it somewhere between &lt;head&gt; and &lt;/head&gt;\n...
2008/11/06
[ "https://Stackoverflow.com/questions/270494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
I have a form with a textbox and a button. IE is the only browser that will not submit the form when Enter is pressed (works in FF, Opera, Safari, Chrome, etc.). I found this javascript function to try to coax IE into behaving; but no avail: ``` function checkEnter(e){ var characterCode if (e && e.which) { ...
The other thing I have done in the past is wrap the form area in a Panel and set the DefaultButton attribute to the submit button you have. This effectively maps the enter key to the submission as long as you have a form element in focus in the panel area.
270,510
<p>I am looking to encrypt some data using <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard" rel="noreferrer">Rijndael/AES</a> in <a href="http://en.wikipedia.org/wiki/VBScript" rel="noreferrer">VBScript</a> using a specific key and <a href="http://en.wikipedia.org/wiki/Initialization_vector" rel="nor...
[ { "answer_id": 293716, "author": "Mike Henry", "author_id": 14934, "author_profile": "https://Stackoverflow.com/users/14934", "pm_score": 0, "selected": false, "text": "<p>One option would be to create a simple wrapper class in .NET for the <a href=\"http://msdn.microsoft.com/en-us/libra...
2008/11/06
[ "https://Stackoverflow.com/questions/270510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am looking to encrypt some data using [Rijndael/AES](http://en.wikipedia.org/wiki/Advanced_Encryption_Standard) in [VBScript](http://en.wikipedia.org/wiki/VBScript) using a specific key and [IV](http://en.wikipedia.org/wiki/Initialization_vector) value. Are there any good function libraries or COM components that wou...
One way is to declare encryption classes within vbscript, without needing external added COM objects or wrapper. The following example takes a string, encrypts and decrypts using Rijndael managed class: ``` '----------------------------------------------------- Dim obj,arr,i,r,str,enc,asc dim bytes,bytesd,s,sc,sd set ...
270,531
<p>I've got an arbitrary list of .NET assemblies.</p> <p>I need to programmatically check if each DLL was built for x86 (as opposed to x64 or Any CPU). Is this possible?</p>
[ { "answer_id": 270545, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 8, "selected": false, "text": "<p>You can use the <a href=\"http://msdn.microsoft.com/en-us/library/ms164699%28v=vs.80%29.aspx\" rel=\"nofollow noreferrer\...
2008/11/06
[ "https://Stackoverflow.com/questions/270531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/536/" ]
I've got an arbitrary list of .NET assemblies. I need to programmatically check if each DLL was built for x86 (as opposed to x64 or Any CPU). Is this possible?
Look at `System.Reflection.AssemblyName.GetAssemblyName(string assemblyFile)`. You can examine assembly metadata from the returned AssemblyName instance: Using **PowerShell**: ``` [36] C:\> [reflection.assemblyname]::GetAssemblyName("${pwd}\Microsoft.GLEE.dll") | fl Name : Microsoft.GLEE Version ...
270,541
<p>What algorithms could i use to determine common characters in a set of strings?</p> <p>To make the example simple, I only care about 2+ characters in a row and if it shows up in 2 or more of the sample. For instance:</p> <ol> <li>0000abcde0000 </li> <li>0000abcd00000 </li> <li>000abc0000000</li> <li>00abc000de00...
[ { "answer_id": 270563, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 0, "selected": false, "text": "<p>you can use an analysis of distance matrix. Any diagonal movement (no cost change) is an exact match.</p>\n" }, { ...
2008/11/06
[ "https://Stackoverflow.com/questions/270541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16794/" ]
What algorithms could i use to determine common characters in a set of strings? To make the example simple, I only care about 2+ characters in a row and if it shows up in 2 or more of the sample. For instance: 1. 0000abcde0000 2. 0000abcd00000 3. 000abc0000000 4. 00abc000de000 I'd like to know: 00 was used in 1,2,3...
I'm assuming that this is not homework. (If it is, you're one your own re plagiarism! ;-) Below is a quick-and-dirty solution. The time complexity is `O(m**2 * n)` where `m` is the average string length and `n` is the size of the array of strings. An instance of `Occurrence` keeps the set of indices which contain a g...
270,542
<p>I use the Boost Test framework to unit test my C++ code and wondered if it is possible to test if a function will assert? Yes, sounds a bit strange but bear with me! Many of my functions check the input parameters upon entry, asserting if they are invalid, and it would be useful to test for this. For example:</p>...
[ { "answer_id": 270704, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 4, "selected": true, "text": "<p>I don't think so. You could always write your own assert which throws an exception and then use BOOST_CHECK_NOTHROW() fo...
2008/11/06
[ "https://Stackoverflow.com/questions/270542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
I use the Boost Test framework to unit test my C++ code and wondered if it is possible to test if a function will assert? Yes, sounds a bit strange but bear with me! Many of my functions check the input parameters upon entry, asserting if they are invalid, and it would be useful to test for this. For example: ``` void...
I don't think so. You could always write your own assert which throws an exception and then use BOOST\_CHECK\_NOTHROW() for that exception.
270,561
<p>Developing a website and just trying to get back into the swing of (clever) SQL queries etc, my mind had totally gone tonight!</p> <p>There is a website <a href="http://www.ufindus.com/" rel="nofollow noreferrer">http://www.ufindus.com/</a> which has a textbox allowing you to enter either a place name or a postcode...
[ { "answer_id": 270575, "author": "Ken Pespisa", "author_id": 30812, "author_profile": "https://Stackoverflow.com/users/30812", "pm_score": 4, "selected": true, "text": "<p>You could use an \"OR\" to get the job done. For example,</p>\n\n<p>place = 'YORK' or postcode = 'YORK'</p>\n\n<p>Y...
2008/11/06
[ "https://Stackoverflow.com/questions/270561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175/" ]
Developing a website and just trying to get back into the swing of (clever) SQL queries etc, my mind had totally gone tonight! There is a website <http://www.ufindus.com/> which has a textbox allowing you to enter either a place name or a postcode/zipcode. I am trying to do something similiar but I am rubbish at SQL -...
You could use an "OR" to get the job done. For example, place = 'YORK' or postcode = 'YORK' You might also do better using the LIKE statement, as in WHERE place LIKE 'YORK%' or postcode LIKE 'YORK%' (this assumes both place and postcode are character-based columns)
270,592
<pre><code>class AbstractQuery { virtual bool isCanBeExecuted()=0; public: AbstractQuery() {} virtual bool Execute()=0; }; class DropTableQuery: public AbstractQuery { vector&lt; std::pair&lt; string, string&gt; &gt; QueryContent; QueryValidate qv; public: explicit DropTableQuery(const string&a...
[ { "answer_id": 270599, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 4, "selected": true, "text": "<p>No, in fact for it is unnecessary for the base class to have an explicitly defined constructor (though make sure you ...
2008/11/06
[ "https://Stackoverflow.com/questions/270592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
``` class AbstractQuery { virtual bool isCanBeExecuted()=0; public: AbstractQuery() {} virtual bool Execute()=0; }; class DropTableQuery: public AbstractQuery { vector< std::pair< string, string> > QueryContent; QueryValidate qv; public: explicit DropTableQuery(const string& qr): AbstractQuery(...
No, in fact for it is unnecessary for the base class to have an explicitly defined constructor (though make sure you have a virtual destructor). So for a typical interface you could have something like this: ``` class MyInterface { public: virtual ~MyInterface() {} virtual void execute() = 0; }; ``` EDIT: H...
270,611
<p>Is it a good idea to store my SQL queries in a global resource file instead of having it in my codebehind? I know stored procedures would be a better solution but I don't have that luxury on this project. </p> <p>I don't want queries all over my pages and thought a central repository would be a better idea.</p>
[ { "answer_id": 270621, "author": "Stefan", "author_id": 19307, "author_profile": "https://Stackoverflow.com/users/19307", "pm_score": 0, "selected": false, "text": "<p>I would look up strongly typed datasets with tableadapters and let the tableadapters handle all queries. When you are us...
2008/11/06
[ "https://Stackoverflow.com/questions/270611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18234/" ]
Is it a good idea to store my SQL queries in a global resource file instead of having it in my codebehind? I know stored procedures would be a better solution but I don't have that luxury on this project. I don't want queries all over my pages and thought a central repository would be a better idea.
Resource files are usually used for localization. But a string is just a string is just a string, and do you really want to be sending any old string in a resource file to your database? I completely agree with others that you should be using linq or typed datasets, etc. Personally I've only had to resort to text quer...
270,612
<p>I am creating a chat using Ajax requests and I'm trying to get messages div to scroll to the bottom without much luck.</p> <p>I am wrapping everything in this div:</p> <pre><code>#scroll { height:400px; overflow:scroll; } </code></pre> <p>Is there a way to keep it scrolled to the bottom by default using JS?<...
[ { "answer_id": 270628, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 12, "selected": true, "text": "<p>Here's what I use on my site:</p>\n\n<pre><code>var objDiv = document.getElementById(\"your_div\");\nobjDiv.scrollTop =...
2008/11/06
[ "https://Stackoverflow.com/questions/270612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10258/" ]
I am creating a chat using Ajax requests and I'm trying to get messages div to scroll to the bottom without much luck. I am wrapping everything in this div: ``` #scroll { height:400px; overflow:scroll; } ``` Is there a way to keep it scrolled to the bottom by default using JS? Is there a way to keep it scr...
Here's what I use on my site: ``` var objDiv = document.getElementById("your_div"); objDiv.scrollTop = objDiv.scrollHeight; ```
270,648
<p>How do you invoke a tkinter <code>event</code> from a separate object? </p> <p>I'm looking for something like wxWidgets <code>wx.CallAfter</code>. For example, If I create an object, and pass to it my <code>Tk</code> root instance, and then try to call a method of that root window from my object, my app locks up....
[ { "answer_id": 276069, "author": "Bryan Oakley", "author_id": 7432, "author_profile": "https://Stackoverflow.com/users/7432", "pm_score": 6, "selected": true, "text": "<p>To answer your specific question of \"How do you invoke a TkInter event from a separate object\", use the <code>event...
2008/11/06
[ "https://Stackoverflow.com/questions/270648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16363/" ]
How do you invoke a tkinter `event` from a separate object? I'm looking for something like wxWidgets `wx.CallAfter`. For example, If I create an object, and pass to it my `Tk` root instance, and then try to call a method of that root window from my object, my app locks up. The best I can come up with is to use the t...
To answer your specific question of "How do you invoke a TkInter event from a separate object", use the `event_generate` command. It allows you to inject events into the event queue of the root window. Combined with Tk's powerful virtual event mechanism it becomes a handy message passing mechanism. For example: ``` ...
270,672
<p>Is there anyway to use unicode strings (most probably in UTF-8, but could be any encoding) in PostScript?</p> <p>So far, i've been using this function to transforms fonts to Latin1 encoding:</p> <pre><code>/latinize { findfont dup length dict begin { 1 index /FID ne {def}{pop pop} ifelse }forall /Encoding ...
[ { "answer_id": 920209, "author": "Aaron Digulla", "author_id": 34088, "author_profile": "https://Stackoverflow.com/users/34088", "pm_score": 3, "selected": false, "text": "<p>Not really or in any simple &quot;out of the box&quot; way. See <a href=\"https://web.archive.org/web/20120322112...
2008/11/06
[ "https://Stackoverflow.com/questions/270672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11649/" ]
Is there anyway to use unicode strings (most probably in UTF-8, but could be any encoding) in PostScript? So far, i've been using this function to transforms fonts to Latin1 encoding: ``` /latinize { findfont dup length dict begin { 1 index /FID ne {def}{pop pop} ifelse }forall /Encoding ISOLatin1Encoding def...
Not really or in any simple "out of the box" way. See [this FAQ entry for details](https://web.archive.org/web/20120322112530/http://en.wikibooks.org/wiki/PostScript_FAQ#Does_PostScript_support_unicode_for_CJK_fonts.3F).
270,674
<p>I've generated a pdf using iTextSharp and I can preview it very well in ASP.Net but I need to send it directly to printer without a preview. I want the user to click the print button and automatically the document prints.</p> <p>I know that a page can be sent directly to printer using the javascript window.print() ...
[ { "answer_id": 270733, "author": "Stefan", "author_id": 19307, "author_profile": "https://Stackoverflow.com/users/19307", "pm_score": 1, "selected": false, "text": "<p>Is the pdf embedded in the page with embedd-tag or just opened in a frame or how are you showing it?</p>\n\n<p>If its em...
2008/11/06
[ "https://Stackoverflow.com/questions/270674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1130097/" ]
I've generated a pdf using iTextSharp and I can preview it very well in ASP.Net but I need to send it directly to printer without a preview. I want the user to click the print button and automatically the document prints. I know that a page can be sent directly to printer using the javascript window.print() but I don'...
Finally I made it, but I had to use an IFRAME, I defined an IFrame in the aspx and didn't set the src property, in the cs file I made generated the pdf file and set the src property of the iFrame as the generated pdf file name, like this; ``` Document pdf = new Document(PageSize.LETTER); PdfWriter writer = PdfWriter.G...