instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>The .NET Setup project seems to have a lot of options, but I don't see an "Uninstall" option. </p>
<p>I'd prefer if people could "uninstall" from the standard "start menu" folder rather than send them to the control panel to uninstall my app, so can someone please tell me how to do this?</p>
<p>Also, I am aware o... | <p>You can make shortcut to:</p>
<pre><code>msiexec /uninstall [path to msi or product code]
</code></pre>
| <p>Visual Studio 2013 allows you to create an Uninstall shortcut in the shortcut design page if you use the Installshield Add-on.</p>
| 8,694 |
<p>I'm seeing this exception message coming from XslCompiledTransform.Transform(), but after handling the exception the XSL transform still appears to have been successful. The full exception message is:</p>
<blockquote>
<p>Token Text in state EndRootElement
would result in an invalid XML
document. Make sure tha... | <p>The exception is trying to tell you that you have attempted to output text after the close element of the root element. The reason your output looks ok is that the exception <em>prevented</em> the invalid XML from being generated.</p>
<p>The reason is simple: you don't have a transform for the root of the document.... | <p>Your output does constitute a well-formed XML fragment. In other words, it looks okay and so does your XSLT.</p>
<p>It seems the error message tries to tell you the following:</p>
<blockquote>
<p>Applying this XSLT produces a document that is invalid according to the DTD or Schema, or whatever I am using to vali... | 25,719 |
<p>There are various ways to maintain user state using in web development.</p>
<p>These are the ones that I can think of right now:</p>
<ol>
<li><p>Query String</p></li>
<li><p>Cookies</p></li>
<li><p>Form Methods (Get and Post)</p></li>
<li><p>Viewstate (ASP.NET only I guess)</p></li>
<li><p>Session (InProc Web serv... | <p>While this is a very complicated question to answer, I have a few quick-bite things I think about when considering implementing state.</p>
<ul>
<li>Query string state is only useful for the most basic tasks -- e.g., maintaining the position of a user within a wizard, perhaps, or providing a path to redirect the use... | <p>It's not some much a question of what to use & what to avoid, but when to use which. Each has a particular circumstances when it is the best, and a different circumstance when it's the worst.</p>
<p>The deciding factor is generally lifetime of the data. Session state lives longer than form fields, and so on. ... | 12,121 |
<p>Many websites have the concept of sending messages from user to user. When you send a message to another user, the message would show up in their inbox. You could respond to the message, and it would show up as a new entry in that message thread. </p>
<p>You should be able to see if you've read a given message a... | <pre><code>user
id
name
messages
id
to_user_id
from_user_id
title
date
message_post
id
message_id
user_id
message
date
</code></pre>
<p>classes would reflect this sort of schema</p>
| <p>It's a rather simple table structure. A to/from, subject and then the message. Now the important thing is the date fields. The DateSent tells when it was sent, the DateRead tells that the message was read, and the DateDeletedTo tells that the TO user deleted it, and the DateDeletedFROM tells that the FROM user delet... | 15,055 |
<p>A web app our group has put together uses the ASP.NET Wizard control. Each step in the wizard contains a corresponding custom UserControl.</p>
<p>The trouble is that as you go through the wizard steps, <em>all</em> the UserControls are loaded on each step, rather than just the one used in that step. That doesn't ... | <p>One thing that could help you a bit is not putting any code in your UserControls's Page_Load function but instead putting that same code in it's Page_PreRender. That's crucial when using a MultiView and probably applies to the wizard as well.</p>
| <p>mspmsp has a good recommendation about PreRender, another option that I have noticed used before is to simply move all configuration code inside the control to a ConfigureControl method.</p>
<p>Then when switching views, you can call the ConfigureControl() method to explicitly create/load your control. It has the ... | 27,376 |
<p>Using classic ASP VBScript, coupled to MS SQL Server, we have a function that takes 3 integers, <code>page_id</code>, <code>heading_id</code>, <code>language_id</code></p>
<p>it looks up the page heading in a translation table...</p>
<p>This table contains roughly 10,000 rows...</p>
<p>The heading column is nvarc... | <p>Probably, save the calls.</p>
<p>Also, 34 database calls don't have to be 34 round trips. Batch your database calls.</p>
| <p>For most data driven applications, the part that is usually most expensive is the database connection. At 2k per row and 10k rows, that's still only 20 meg. If the data is used very frequently than that seems like a very small price to pay to eliminate unnecessary database hits.</p>
| 30,931 |
<p>I have a PHP app that needs to run bash scripts, and provide a username & password (for remote systems).
I need to store these credentials somewhere that is accessible by my PHP (web) app.
The logical place is the database (currently MySQL, but will be agnostic).
The problem with the "standard" way of hashing an... | <p>First, to state the (hopefully) obvious, if you can in any way at all avoid storing usernames and passwords do so; it's a big responsibility and if your credential store is breached it may provide access to many other places for the same users (due to password sharing).</p>
<p>Second, if you must store credentials ... | <p>If you go the PKI, and I would, make sure you safe guard your private keys! The strong encryption provided by PKI is only as secure as your keys.</p>
| 32,591 |
<p>In WPF, I want to create a hyperlink that navigates to the details of an object, and I want the text of the hyperlink to be the name of the object. Right now, I have this:</p>
<pre><code><TextBlock><Hyperlink Command="local:MyCommands.ViewDetails" CommandParameter="{Binding}">Object Name</Hyperlink&g... | <p>It looks strange, but it works. We do it in about 20 different places in our app. <code>Hyperlink</code> implicitly constructs a <code><Run/></code> if you put text in its "content", but in .NET 3.5 <code><Run/></code> won't let you bind to it, so you've got to explicitly use a <code>TextBlock</code>.</p... | <p>On Windows Store app (and Windows Phone 8.1 RT app) above example does not work, use HyperlinkButton and bind Content and NavigateUri properties as ususal.</p>
| 17,030 |
<p>What site(s) do you recommend for looking at complimentary colors for site design? It would also be beneficial to enter a hex or RGB value and have the color wheel spit back complimentary colors.</p>
<p>Most popular:</p>
<ul>
<li><a href="http://kuler.adobe.com/" rel="noreferrer">Kuler</a></li>
</ul>
<p>Others in... | <p>Adobe's Kuler - <a href="http://kuler.adobe.com/" rel="noreferrer">http://kuler.adobe.com/</a></p>
<p>is widely considered to be the best color palette selector out there, as it also lets you share color palettes other users have created. Sign in, click create, and you'll have options including "complementary" that... | <p>I like <a href="http://www.colr.org/" rel="nofollow noreferrer">Colr.org</a> a lot. It doesn't have a color wheel, but it has some really interesting features. You can choose a color scheme from an image, tag colors--and color schemes and even search on the tags. It's good for inspiration. </p>
| 24,299 |
<p>I want to find 2<sup>nd</sup>, 3<sup>rd</sup>, ... n<sup>th</sup> maximum value of a column.</p>
| <p>You could sort the column into descending format and then just obtain the value from the nth row.</p>
<p>EDIT::</p>
<p>Updated as per comment request. <strong><em>WARNING</em></strong> completely untested!</p>
<pre><code>SELECT DOB FROM (SELECT DOB FROM USERS ORDER BY DOB DESC) WHERE ROWID = 6
</code></pre>
<p>S... | <p>Table employee</p>
<pre><code>salary
1256
1256
2563
8546
5645
</code></pre>
<p>You find the second max value by this query</p>
<pre><code>select salary
from employee
where salary=(select max(salary)
from employee
where salary <(select max(salary) from employee));
</code></p... | 10,625 |
<p>We create new sites in IIS 6 (Windows Server 2003) using IIS Manager. When these sites are created in IIS 6, the ASP.NET version defaults to ASP.NET 1.1. We would like it to default to ASP.NET 2.0. The reason this is a problem for us is that when you take any site on the server and switch the ASP.NET version from... | <p>As already mentioned by another, I reference this <a href="http://weblogs.asp.net/owscott/archive/2006/05/30/ASPNet_5F00_regiis.exe-tool_2C00_-setting-the-default-version-without-forcing-an-upgrade-on-all-sites.aspx" rel="noreferrer">post</a> whenever I need to change the .NET settings for a site.</p>
<p>As for you... | <p>Simple answer: Open IIS Manager. In navigation pane, find the .NET2 web site and right click on it. Select "Properties". Then select "ASP.NET" tab. First dropdown on that screen gives you option to select a different version of .NET.</p>
<p>Please be aware -- when I did this, all of the web sites on the web se... | 8,979 |
<p>My program run fine from anywhere else on my drive apart from the Program Files directory (windows XP), I am logged on as administrator so I have full permissions to the drive. It runs fine from the root of c: the windows directory basically anywhere else apart from Program Files. I have recreated this problem on 4 ... | <p>Just guessing, but if your program tries to save data to the program-directory, Vista will prevent this and change the path dynamically to something like c:\users[user]\AppData. Maybe this gives you a hint on whats going on.</p>
<p>Otherwise we need more info on your program to help you.</p>
| <p>The program does run from other folders with a space in the path such as Documents and Settings, the program does create a temporary file in the user profile\appdata folder. </p>
<p>If I run the app several time from somewhere it will run from I've just noticed I get an error with the option to debug but VS won't s... | 46,822 |
<p>I'd like to do the equivalent of the following in LINQ, but I can't figure out how:</p>
<pre><code>IEnumerable<Item> items = GetItems();
items.ForEach(i => i.DoStuff());
</code></pre>
<p>What is the real syntax?</p>
| <p>There is no ForEach extension for <code>IEnumerable</code>; only for <code>List<T></code>. So you could do</p>
<pre><code>items.ToList().ForEach(i => i.DoStuff());
</code></pre>
<p>Alternatively, write your own ForEach extension method:</p>
<pre><code>public static void ForEach<T>(this IEnumerable&... | <p>Yet another <code>ForEach</code> Example </p>
<pre><code>public static IList<AddressEntry> MapToDomain(IList<AddressModel> addresses)
{
var workingAddresses = new List<AddressEntry>();
addresses.Select(a => a).ToList().ForEach(a => workingAddresses.Add(AddressModelMapper.MapToDomain... | 24,473 |
<p>Given an <code>Item</code> that has been appended to a <code>Form</code>, whats the best way to find out what index that item is at on the Form?</p>
<p><code>Form.append(Item)</code> will give me the index its initially added at, but if I later insert items before that the index will be out of sync.</p>
| <p>This was the best I could come up with:</p>
<pre><code>private int getItemIndex(Item item, Form form) {
for(int i = 0, size = form.size(); i < size; i++) {
if(form.get(i).equals(item)) {
return i;
}
}
return -1;
}
</code></pre>
<p>I haven't actually tested this but it sho... | <p>Well, there are just two ways to do this, since the API does not have an <code>indexOf(Item)</code> method:</p>
<ol>
<li>You update the index you get when you add an <code>Item</code>. So when you insert another <code>Item</code> before other items, you'll have to update the indices of those items. You could keep s... | 15,592 |
<p>Can anyone out there recommend a good online resource for CSS 'design patterns'?</p>
<p>I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, clean solutions to common problems / tasks.</p>
<p>An example of ... | <p><strong>Some websites that address web design patterns are listed below</strong>. They do not specifically provide the HTML and/or CSS in order to achieve the desired results, but they do provide examples of live sites that you can <em>view source</em> on (or, even better, use <a href="http://getfirebug.com/" rel="n... | <p>The already mentioned <a href="http://www.alistapart.com/" rel="nofollow noreferrer">A List Apart</a> is really good. Another site I've used since I started web development is SitePoint.com. Here is their <a href="http://reference.sitepoint.com/css" rel="nofollow noreferrer">CSS Reference</a>. If you want a good ... | 5,616 |
<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... | <p>You can't <code>SELECT</code> 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.</p>
<p>But you can join <code>user</code> and <code>lessonstatus</code> multiple times in the <code>UPDATE</code> statement, and use the join criteria cr... | <p>There are more errors ("user" table and "user_rtab" alias do not match, use of non-qualified field names is not recommended), but UPDATE syntax itself should be similar:</p>
<pre><code>UPDATE lessonstatus
SET user_id = (SELECT TOP 1 user_id FROM user WHERE username = 'too_many_accounts')
FROM lessonstatus
INNER... | 33,845 |
<p>How would I implement a binary search using just an array? </p>
| <p>Ensure that your array is sorted since this is the crux of a binary search. </p>
<p>Any indexed/random-access data structure can be binary searched. So when you say using "just an array", I would say arrays are the most basic/common data structure that a binary search is employed on. </p>
<p>You can do it recurs... | <p>The single comparison version is fast and concise</p>
<pre><code>int bsearch_double(const double a[], int n, double v) {
int low = 0, mid;
while (n - low > 1) {
mid = low + (n - low) / 2;
if (v < a[mid]) n = mid;
else low = mid;
}
return (low < n && a[low] == v) ? l... | 31,006 |
<p>Does anyone know how sites that have a real-time feed of a lot of data work? I am referring to something like a stock site, where they can tell you in real time (well, 20 minute delay mostly, but still real-time - 20 minutes as I understand it). </p>
<p>They have thousands of data pieces delivered to them every s... | <p>Generally there is a server/client protocol defined between the 2 parties. In the company I work for the connection is maintained at all times.</p>
<p>Here is info on real time data feeds to go with your stock example</p>
<p><a href="http://www.nyxdata.com/" rel="nofollow noreferrer">NYSE</a>,<a href="http://www.n... | <p>I've done this making an attempt to retrieve the stock quote from the source, and falling back to a timestamped on-disk cache of the quote when the main source fails or times out.</p>
| 20,661 |
<p>I have been running my i3 MK3 for about 12 hours now and the motor on the extruder is fairly hot, not too hot to touch but I'd guess its about 60c on the outside. Is this within normal operating temperatures or should I let it cool down before starting more prints?</p>
| <p>The maximum operating temperature can be found in the specifications of your steppers. Usually the ambient temperature operating conditions are limited to 50 °C with a maximum operating temperature in the range of 70 - 100 °C. For instance, the steppers I use are limited to a temperature of 80 °C. It is ... | <p>I've run my Prusa3D i3m3s for 50 hour prints. My motors get hot-ish but on my instance of the machine, they are not too hot.</p>
| 1,076 |
<p>I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity* functions.</p>
| <p>Ok, I figured it out:</p>
<pre><code>SetSecurityInfo(hDir, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);
</code></pre>
<p>This will give all permissions to all users for the given directory handle.</p>
| <p>Ok, I figured it out:</p>
<pre><code>SetSecurityInfo(hDir, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);
</code></pre>
<p>This will give all permissions to all users for the given directory handle.</p>
| 26,169 |
<p>What are the best practices for using Java's <code>@Override</code> annotation and why? </p>
<p>It seems like it would be overkill to mark every single overridden method with the <code>@Override</code> annotation. Are there certain programming situations that call for using the <code>@Override</code> and others... | <p>Use it every time you override a method for two benefits. Do it so that you can take advantage of the compiler checking to make sure you actually are overriding a method when you think you are. This way, if you make a common mistake of misspelling a method name or not correctly matching the parameters, you will be... | <p>It does allow you (well, the compiler) to catch when you've used the wrong spelling on a method name you are overriding.</p>
| 11,999 |
<p>I'm wondering if there are any simple ways to get a list of all fixed-width (monospaced) fonts installed on a user's system in C#?</p>
<p>I'm using .net 3.5 so have access to the WPF System.Windows.Media namespace and LINQ to get font information, but I'm not sure what I'm looking for.</p>
<p>I want to be able to ... | <p>Have a look at:</p>
<p><a href="http://www.pinvoke.net/default.aspx/Structures/LOGFONT.html" rel="noreferrer">http://www.pinvoke.net/default.aspx/Structures/LOGFONT.html</a></p>
<p>Use one of the structures in there, then loop over families, instantiating a Font, and getting the LogFont value and checking lfPitchA... | <p>AFAIK you can't do it using BCL libraries only. You have to use WinAPI interop.</p>
<p>You need to analyze 2 lowest bits of <a href="https://msdn.microsoft.com/en-us/library/dd145037(v=vs.85).aspx" rel="nofollow noreferrer">LOGFONT</a>.lfPitchAndFamily member. There is a constant FIXED_PITCH (means that font is fix... | 27,796 |
<p>I'm using the <a href="http://www.componentace.com/zlib_.NET.htm" rel="noreferrer">zlib.NET</a> library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing:</p>
<pre><code>zlib.ZInputStream zinput =
new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAcces... | <p>It appears I made the mistake of assuming all virtual methods were overridden, which wasn't the case. I was using zlib.ZInputStream.ReadByte(), which is just the inherited Stream.ReadByte(), which doesn't do any inflate.</p>
<p>I used zlib.ZInputStream.Read() instead, and it worked like it should.</p>
| <p>Look at the sample code more closely, it is copying data from a regular Filestream to the ZOutputStream. The decompression must be happening through that layer.</p>
<pre><code>private void decompressFile(string inFile, string outFile)
{
System.IO.FileStream outFileStream = new System.IO.FileStream(outFile, Syst... | 22,465 |
<p>What is the simplest SQL query to find the second largest integer value in a specific column? </p>
<p>There are maybe duplicate values in the column.</p>
| <pre><code>SELECT MAX( col )
FROM table
WHERE col < ( SELECT MAX( col )
FROM table )
</code></pre>
| <pre><code>select top 1 MyIntColumn from MyTable
where
MyIntColumn <> (select top 1 MyIntColumn from MyTable order by MyIntColumn desc)
order by MyIntColumn desc
</code></pre>
| 5,205 |
<p>I'm using jQuery to hide and show elements when a radio button group is altered/clicked. It works fine in browsers like Firefox, but in IE 6 and 7, the action only occurs when the user then clicks somewhere else on the page.</p>
<p>To elaborate, when you load the page, everything looks fine. In Firefox, if you clic... | <p>Try using <a href="http://api.jquery.com/click" rel="noreferrer"><code>.click</code></a> instead of <a href="http://api.jquery.com/change" rel="noreferrer"><code>.change</code></a>.</p>
| <p>imo using click instead of change makes the ie behaviour be different.
I'd rather emulate the change event behaviour using a timer (setTimout).</p>
<p>something like (warning - notepad code):</p>
<pre><code>if ($.browser.msie) {
var interval = 50;
var changeHack = 'change-hac';
var select = $("#viewByOrg");
... | 25,577 |
<p>I was delivered several hundred source files for a web app original written in classic ASP, but somewhat ported to VisualBasic.NET and ASP.NET</p>
<p>It didn't come with any form of project or solution files.</p>
<p>I'm trying to get it setup to build, but am struggling. If I try to open it as a WebSite (ala Web S... | <p>You could create a new ASP.NET Web Application Project in Visual Studio, delete the default files that are created, then add all the existing files to the project. This seems like the easiest way to get started that I would try first.</p>
| <p>If you just want to migrate a web project to a web application project, there's still bunches of articles around from 2005, maybe there are some tips that can apply for your situation:</p>
<p><a href="http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx" rel="nofollow noreferrer">http://webproject.scottg... | 23,031 |
<p>I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:</p>
<pre><code>sqlstring = string.Format("set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};", mlat, mlong, userid);
_session.CreateSQLQuery(sqlstring).ExecuteUpdate();
</code></pre>
<p>However I ... | <p>I'm pretty sure I can tell you what is happening, but I don't know if there is a fix for it.</p>
<p>I think the problem is that the ':' character is used by NHibernate to create a named parameter. Your expression is getting changed to:</p>
<pre><code>set nocount on;update myusers set geo=geography@p0({0}, {1}, 43... | <p>"{whatever} is not a recognized built-in function name" is a SQL Server error message, not sure what Hibernate is doing there but SQL Server is the one complaining about it.</p>
| 29,448 |
<p>I have a problem in integrating PHP and JQuery:</p>
<p>My main file is <code>MyFile.html</code> and the AJAX call file is <code>ajax.php</code>.</p>
<p>The <code>ajax.php</code> function returns links to <code>myFile.html</code> as </p>
<p><code><a href Link.php?action=Function ></a></code> (i.e <cod... | <p>You're missing the <code>=</code> and quotes:</p>
<pre><code><a href Link.php?action=Function >
</code></pre>
<p>should be</p>
<pre><code><a href="Link.php?action=Function">
</code></pre>
<p>You'll need to escape these in PHP like so: </p>
<pre><code>echo "<a href=\"Link.php?action=Function\">... | <p>It sounds like you are trying to simply set the contents of an HTML element to the result of executing a PHP script. Here is a sample PHP script that will just print an HTML link depending on what parameter you pass it in the 'foo' parameter.</p>
<pre><code><?
// Get the parameter "foo" from the URL string.
... | 48,050 |
<blockquote>
<p>This question has been preserved for historical reasons, but it is not
considered on-topic, so don't use it as an excuse to post something
similar.</p>
<p>More info at <a href="https://stackoverflow.com/faq">https://stackoverflow.com/faq</a>.</p>
</blockquote>
<hr>
<p>For me to read code an... | <p><a href="http://www.wesnoth.org/" rel="nofollow noreferrer">Battle for Wesnoth</a></p>
<p>That said, you can devote some time reading <a href="http://en.wikipedia.org/wiki/List_of_open_source_games" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/List_of_open_source_games</a></p>
<p>It also depends what exa... | <p>Do unintentional source releases count? If so, Half-Life 2 and EVE (though it was only the client code)</p>
| 28,076 |
<p>What are some resources in use for marketing downloadable desktop software online? AdWords, certainly, and "organic" search engine results but is anyone having any luck making sales through sites like Tucows and/or Download.com anymorE?</p>
| <p><code>ClientDatasets</code> can contain fields that are themselves other datasets. So if you want to create three tables in a single dataset, create three <code>ClientDatasets</code> holding the three result sets that you want, and then you can put them into a single <code>ClientDataSet</code>.</p>
<p>This article... | <p>There is not a way to have multiple table data in the same TClientDataSet like you referenced. The TClientDataSet holds a single cursor for a single dataset.</p>
| 13,644 |
<p>I want a workflow that, when an entry is created in List A, will generate one entry in List B for each entry in List C. Is this possible? If so, how?</p>
| <p>Does numpy.dstack do what you want? The first two indexes are the same as the original array, and the new third index is "depth".</p>
<pre><code>>>> import numpy as N
>>> a = N.array([[1,2,3],[4,5,6],[7,8,9]])
>>> a
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
>>> b = N... | <p>I propose:</p>
<pre><code> numpy.resize(my_ar, (3,3)).transpose()
</code></pre>
<p>You can of course adapt the shape <code>(my_ar.shape[0],)*2</code> or whatever</p>
| 40,002 |
<p>Why would the following query return "Error converting data type varchar to bigint"? Doesn't IsNumeric make the CAST safe? I've tried every numeric datatype in the cast and get the same "Error converting..." error. I don't believe the size of the resulting number is a problem because overflow is a different error... | <p>IsNumeric returns 1 if the varchar value can be converted to ANY number type. This includes int, bigint, decimal, numeric, real & float.</p>
<p>Scientific notation could be causing you a problem. For example:</p>
<pre><code>Declare @Temp Table(Data VarChar(20))
Insert Into @Temp Values(NULL)
Insert Into @Te... | <p>I came across this blog post that might help. I've not run into this issue before and not sure if it'll help you in this instance:</p>
<p><a href="http://dotmad.blogspot.com/2007/02/cannot-call-methods-on-bigint-error.html" rel="nofollow noreferrer">http://dotmad.blogspot.com/2007/02/cannot-call-methods-on-bigint-... | 43,880 |
<p>How do you ensure, that you can checkout the code into Eclipse or NetBeans and work there with it?</p>
<p>Edit: If you not checking in ide-related files, you have to reconfigure buildpath, includes and all this stuff, each time you checkout the project. I don't know, if ant (especially an ant buildfile which is cre... | <p>The smart ass answer is "by doing so" - unless you aren't working with multiple IDEs you don't know if you are really prepared for working with multiple IDEs. Honest. :)</p>
<p>I always have seen multiple platforms as more cumbersome, as they may use different encoding standards (e.g. Windows may default to ISO-885... | <p>For the most part I'd agree with seldaek, but I'm also inclined to say that you should at least give a file that says what the dependencies are, what Java version to use to compile, etc, and anything extra that a NetBeans/Eclipse developer might need to compile in their IDE.</p>
<p>We currently only use Eclipse and... | 10,729 |
<p>What would be the best way to implement a simple crash / error reporting mechanism? </p>
<p>Details: my app is <strong>cross-platform (mac/windows/linux) and written in Python</strong>, so I just need something that will send me a small amount of text, e.g. just a timestamp and a traceback (which I already generate... | <p>The web service is the best way, but there are some caveats:</p>
<ol>
<li>You should always ask the user if it is ok to send error feedback information.</li>
<li>You should be prepared to fail gracefully if there are network errors. Don't let a failure to report a crash impede recovery!</li>
<li>You should avoid in... | <p>Whether you use SMTP or HTTP to send the data, you need to have a username/password in the application to prevent just anyone from sending random data to you.</p>
<p>With that in mind, I suspect it would be easier to use SMTP rather than HTTP to send the data.</p>
| 11,144 |
<p>MS Access allows the numeric type GUID (in German it's called 'Replikations-ID', so I guess in English that would be 'replication id') which is stored as a 16 byte binary field in the database.</p>
<p>I found how to access these fields in Delphi with <a href="http://docwiki.embarcadero.com/Libraries/Tokyo/en/Data.W... | <p>That's correct way to set parameters with ADO. The message you get is most probably due to typo with some of fields (you get same message if field does not exist).</p>
| <p>If you are sure the parameter is a TGuid, then the following should work :</p>
<pre><code>TGuidField(TheQuery.ParamByName('AGuid')).AsGuid
</code></pre>
<p>Although this does a GuidToString internally, so the problem maybe the same. Worth a try!</p>
| 37,766 |
<p>Help!</p>
<p>I have a PHP (PHP 5.2.5) script on HOST1 trying to connect to an MySql database HOST2. Both hosts are in Shared Host environments controlled through CPanel.</p>
<p>HOST2 is set to allow remote database connections from HOST1.</p>
<p>The PHP connect I'm using is:-
$h2 = IPADDRESS;
$dbu = DBUSE... | <p>somestring is probably the reverse-lookup for your web-server.</p>
<p>Can you modify privileges from your cPanel? Have you done anything to allow access from your workstation (ODBC)?</p>
<p>The error-message seems to indicate that you have network-access to the mysql-server, but not privileges for your username fr... | <p>The error message means that you can contact the mySql server, but the user you are trying to log in as, does not have access.</p>
<p>Either the user does not have access at all, or it has access locally, but not from the host you are connecting from.</p>
| 35,711 |
<p>The comment to <a href="https://stackoverflow.com/questions/200090/how-do-you-convert-a-c-string-to-an-int#200099">this answer</a> got me wondering. I've always thought that C was a proper subset of C++, that is, any valid C code is valid C++ code by extension. Am I wrong about that? Is it possible to write a val... | <p>In general, yes C code is considered C++ code.</p>
<p>But C is not a proper subset in a strict sense. There are a couple of exceptions. </p>
<p>Here are some valid things in C that are not valid in C++:</p>
<pre><code>int *new;//<-- new is not a keyword in C
char *p = malloc(1024); //void * to char* without ... | <p>I think it may be more correct to say that ANSI C is a subset of C++. Not K&R C.</p>
| 39,070 |
<p>I have a third-party app that creates HTML-based reports that I need to display. I have <em>some</em> control over how they look, but in general it's pretty primitive. I <em>can</em> inject some javascript, though. I'd like to try to inject some jQuery goodness into it to tidy it up some. One specific thing I wo... | <p>Given a html page like this:</p>
<pre><code><body><br/>
<table id="my-table">`<br/>
<tr><br/>
<td><div>This is the contents of Column One</div></td><br/>
<td><div>This is the contents of Column Two</... | <p>You could do this with jQuery but it may make additional maintenance a nightmare. I would recommend against doing this / screen scraping because if the source ever changes so does your work around.</p>
| 7,773 |
<p>I have a long running insert transaction that inserts data into several related tables. </p>
<p>When this insert is running, I cannot perform a select * from MainTable. The select just spins its wheels until the insert is done. </p>
<p>I will be performing several of these inserts at the same/overlapping time. ... | <p>You may want to rethink your process before you use READ UNCOMMITTED. There are many good reasons for isolated transactions. If you use READ UNCOMMITTED you may still get duplicates because there is a chance both of the inserts will check for updates at the same time and both not finding them creating duplicates. Tr... | <p>The only isolation level that allows one transaction to read changes executed by another transaction in progress (before it commits) is:</p>
<pre><code>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
</code></pre>
| 31,394 |
<p>I'm trying to create a standard way of rolling out web applications for our company. Currently we do it with zip files, vbscript/javascript, and manual some steps. </p>
<p>For thick client installs we generate MSI installers using Wise/Wix. We don't create installers currently for websites as in general they are... | <p>I recently spent a few days working on automating deployments at my company. </p>
<p>We use a combination of CruiseControl, NAnt, MSBuild to generate a release version of the app. Then a separate script uses MSDeploy and XCopy to backup the live site and transfer the new files over. </p>
<p>Our solution is briefly... | <p>You may want to look at:</p>
<ol>
<li><a href="https://stackoverflow.com/questions/55323/aspnet-web-application-build-output-how-do-i-include-all-deployment-files">How do I get a deployable output from a build script with ASP.NET</a></li>
<li><a href="https://stackoverflow.com/questions/57762/step-by-step-aspnet-au... | 8,381 |
<p>I am trying to use TemplateToolkit instead of good ole' variable interpolation and my server is giving me a lot of grief. Here are the errors I am getting:</p>
<pre><code>*** 'D:\Inetpub\gic\source\extjs_source.plx' error message at: 2008/09/30 15:27:37 failed to create context: failed to create context: failed to... | <p>I figured this one out after a long time. Apparently the ActiveState people didn't check much into the package because it requires Template::Stash::XS, but that's not actually available in PPM. To fix this issue just edit the Template/Config.pm and change Template::Stash::XS to Template::Stash.</p>
| <p>From what I hear, if Template Toolkit is available for Strawberry Perl, you should definitely look into switching to Strawberry.</p>
| 19,107 |
<p>Recently I noticed a small issue with my Creality Ender 3, where I would come home and find one of the bed leveling wheels had fallen off. This one wheel keeps vibrating loose. It's not really affecting my prints for some reason, so I just kind of let it happen.</p>
<p>Yesterday I started an 8 hour print and left. W... | <p>From the excellent Thingiverse link, <a href="https://www.thingiverse.com/thing:4967931" rel="nofollow noreferrer">Customizable QR Keyring or Tag</a> by <a href="https://www.thingiverse.com/outwardb/designs" rel="nofollow noreferrer"><em>OutwardB</em></a> - which was provided in the (now deleted) <a href="https://3d... | <p>From the excellent Thingiverse link, <a href="https://www.thingiverse.com/thing:4967931" rel="nofollow noreferrer">Customizable QR Keyring or Tag</a> by <a href="https://www.thingiverse.com/outwardb/designs" rel="nofollow noreferrer"><em>OutwardB</em></a> - which was provided in the (now deleted) <a href="https://3d... | 2,045 |
<p>Let's say I have two tables: </p>
<ul>
<li>Report</li>
<li>Comment</li>
</ul>
<p>And assuming I have a database context:</p>
<pre><code>var reports = db.Reports();
</code></pre>
<p>How can I make sure all Comments for each report are loaded as well?</p>
<p>At this point I want to disconnect from the database bu... | <p>I assume you have multiple projects in a Group e.g. a dll and a dependent exe and you want to set the exe as the 'start up' project. Do so this, select the exe project in the Project Explorer, right click and choose 'Set as Start Up' from the context menu. The 'start up' project's name will be shown as bold text in ... | <p>I'm not aware of a "startup Project" settting in VB6, but you can select the "Startup Object" by opening the Project menu, choosing the last menu item ("X properties", where X is the name of your project), and then selecting the General tab in the Project Properties window. The selector you seek is in the upper-righ... | 46,759 |
<p>There is a long running habit here where I work that the connection string lives in the web.config, a Sql Connection object is instantiated in a using block with that connection string and passed to the DataObjects constructor (via a CreateInstance Method as the constructor is private). Something like this:</p>
<pr... | <p>I like to code the classes in my data access layer so that they have one constructor that takes an IDbConnection as a parameter, and another that takes a (connection) string.</p>
<p>That way the calling code can either construct its own SqlConnection and pass it in (handy for integration tests), mock an IDbConnecti... | <p>this being a "smell" is relative. if you are pretty sure about coupling this particular piece of code to SQL Server and a web.config connection string entry then it's perfectly OK. if you are not into this kind of coupling, I agree that it is a code smell and is undesirable.</p>
| 21,971 |
<p>I am working in Visual Studio 2008 on an ASP.NET application, which has been deployed to a test server. I would like to make a build without debug information to place in production, but the configuration manager only shows "Debug" in the configuration dropdown for my project.</p>
<p>My other Visual Studio project... | <p>ASP.NET web sites do not use the configuration manager to determine if debug information is included in the compile. You must set it in the <code>web.config</code> file. Visual Studio will never change debug to "false" for you automactially, as far as I know.</p>
<p>Find this section in your <code>web.config</code>... | <p>The Configuration Manager for the Solution allows you to delete either (or both) of these default build configurations (through the Edit... option you mention above). I would bet that someone deleted the Release configuration.</p>
<p>You can get it back by recreating it, or copy the appropriate lines from a solutio... | 32,391 |
<p>I've got two Django projects on the same server. The first launched several months ago, and has since collected hundreds of user accounts. The second project is launching in a few days, and we'd like the second project to allow users of the first app to authenticate using the same credentials.</p>
<p>At first, I ... | <p>If you wait awhile, eventually Django will get multiple database support.</p>
<p>But as of right now, I think the best solution to your problem would be to synchronize the two database's user tables after changes to either are made. You can use the signals support to handle this:</p>
<pre><code>from django.db imp... | <p>Django currently does not have support for multiple databases (there is a <a href="http://code.djangoproject.com/wiki/MultipleDatabaseSupport" rel="nofollow noreferrer">wikipage</a> about that subject).</p>
<p>Another approach would be to write a custom <a href="http://docs.djangoproject.com/en/dev/topics/auth/#oth... | 44,444 |
<p>I've looked at <a href="http://clientside.cnet.com/cnet-js-standards/ciui-cnet-iphone-ui/" rel="nofollow noreferrer">ciui</a> and really liked the way that certain links will slide out the existing content and load new content into the DOM, or slide back.</p>
<p>Is there a way to quickly create a work-a-like with t... | <p>For anyone coming to this very old discussion, <a href="http://www.jqtouch.com/" rel="nofollow noreferrer">http://www.jqtouch.com/</a> is a more recent solution that works very well for this. It's a jQuery plugin.</p>
| <p>I would take a look at the jQuery UI project and see if anything there does what you need. The best code is code you don't have to write. :)</p>
<p><a href="http://ui.jquery.com/repository/latest/demos/functional/" rel="nofollow noreferrer">http://ui.jquery.com/repository/latest/demos/functional/</a></p>
| 25,130 |
<p>I understand that there are several ways to blend XNA and WPF within the same application. I find it enticing to use WPF for all GUI and HUD stuff in my XNA games. Does anyone have any practical experience on how well this approach works in real life using .NET 3.5 SP1 ? Any pitfalls (such as the <a href="http://blo... | <p>There is an addition in 3.5 SP1 that allows better interaction between DirectX and WPF (D3DImage), and one way to get to that is through XNA.</p>
<p>Here are some details:</p>
<p><a href="http://jmorrill.hjtcentral.com/Default.aspx?tabid=428&EntryID=259" rel="nofollow noreferrer">http://jmorrill.hjtcentral.com... | <p>I personally would advise against trying to do this integration. I know what you're going for ... the ease of defining GUI/HUD elements in WPF greatly outweighs trying to do the same in just plain old XNA. However, think realistically of the time you'll spend trying to enable this scenario vs. how much you'd save ... | 6,521 |
<p>What I would like to do is add dynamically HTML input fields in one page, and each one of them correspond to an element of a struts array property. Let's say I have a number of identical fields in an HTML page:</p>
<blockquote>
<p>< input type="file" name="myfile" /></p>
</blockquote>
<p>and when the form is ... | <p>OK, here is a "would work for me" solution:</p>
<p>First of all, in your html/jsp file the name attribute should be indexed:</p>
<blockquote>
<p>File 1: < input type="file" name="myfile[0]" /></p>
<p>File 2: < input type="file" name="myfile[1]"/ ></p>
<p>... | <p>what you are looking for is called "indexed properties". Since there are better "how to's" than I can describe it, take a look <a href="http://struts.apache.org/1.x/struts-taglib/indexedprops.html" rel="nofollow noreferrer">here</a>.</p>
| 48,475 |
<p>Using the Python Documentation I found the <a href="http://docs.python.org/lib/module-HTMLParser.html" rel="noreferrer">HTML parser</a> but I have no idea which library to import to use it, how do I find this out (bearing in mind it doesn't say on the page).</p>
| <p>Try:</p>
<pre><code>import HTMLParser
</code></pre>
<p>In Python 3.0, the HTMLParser module has been renamed to html.parser
you can check about this <a href="http://docs.python.org/library/htmlparser.html" rel="noreferrer">here</a></p>
<p>Python 3.0</p>
<pre><code>import html.parser
</code></pre>
<p>Python 2.2 ... | <p>There's a link to an example on the bottom of (<a href="http://docs.python.org/2/library/htmlparser.html" rel="nofollow noreferrer">http://docs.python.org/2/library/htmlparser.html</a>) , it just doesn't work with the original python or python3. It has to be python2 as it says on the top.</p>
| 9,660 |
<p>I am trying to load <code>UIImage</code> object from <code>NSData</code>, and the sample code was to <code>NSImage</code>, I guess they should be the same. But just now loading the image, I am wondering what's the best to troubleshoot the <code>UIImage</code> loading <code>NSData</code> issue.</p>
| <p>I didn't try <code>UIImageJPEGRepresentation()</code> before, but <code>UIImagePNGRepresentation</code> works fine for me, and conversion between <code>NSData</code> and <code>UIImage</code> is dead simple:</p>
<pre><code>NSData *imageData = UIImagePNGRepresentation(image);
UIImage *image=[UIImage imageWithData:ima... | <p>For safe execution of code, use if-let block with Data, as function UIImagePNGRepresentation returns, optional value. </p>
<pre><code>if let img = UIImage(named: "Hello.png") {
if let data:Data = UIImagePNGRepresentation(img) {
// Handle operations with data here...
}
}
</code></pre>
<block... | 32,120 |
<p>I see that I can declare a function with (say)</p>
<pre><code>public double Function(double parameter)
</code></pre>
<p>but what if I do want to take the derivative of that function?</p>
| <p>You can't calculate the exact derivative of a function using a computer program (unless you're doing symbolic math... but that's another, way more complicated, topic).</p>
<p>There are several approaches to computing a <i>numerical</i> derivative of a function. The simplest is the centered three-point method:</p>
... | <p>If you have written the function, it's already been derived.</p>
<p>And given that it's an int function, I'll assume you don't mean the calculus definition of "derive".</p>
| 48,798 |
<p>Does anyone know of a good, extensible source code analyzer that examines JavaScript files? </p>
| <p>In the interest of keeping this question up-to-date, there is a fork of JSLint called <a href="http://jshint.com/">JSHint</a>. An explanation of why JSHint was created can be found <a href="http://anton.kovalyov.net/2011/02/20/why-i-forked-jslint-to-jshint/">here</a>, but to summarize:</p>
<blockquote>
<p>JSHint ... | <p>I have found JSLint which helps correct a lot of common errors and such; however, I'm hoping to find something that I can add my own rules and such to help automate some coding standards stuff that my company is wanting to implement into JavaScript.</p>
<p><a href="http://www.jslint.com/" rel="nofollow noreferrer">... | 42,925 |
<p>What are the steps in the production process that factories that produce filament have to take to get from pellets to a full spool of filament.</p>
<p>Which of these steps are critical for quality (thickness, roundness, long shelf life,..) ?</p>
| <p>Some general comments about the process used (plastic extrusion):</p>
<p>The plastic extrusion process is not simple- many textbooks dense with equations have been written about it. The lowest cost industrial extrusion processes do not use pellets at all- because pellets have already gone through an extrusion proce... | <p>Each step is critical for quality. It's refined plastic mass. And in oil-based-products, every step is crucial for quality.</p>
<p>In <strong><a href="https://www.youtube.com/watch?time_continue=1&v=OEkksADFjP8" rel="nofollow">this</a></strong> vieo, everything is explained.</p>
| 241 |
<p>PHP doesn't get much love but is still a winner at easy deployment (for cheap hosting).</p>
<p>Are there any programming languages (besides <a href="http://haxe.org/" rel="nofollow noreferrer">Haxe</a>) that target PHP? Writing applications in this language and then translating it into PHP, like some languages targ... | <p><a href="http://github.com/scriptor/pharen" rel="nofollow noreferrer">Pharen</a>, a Lisp variant.</p>
| <p>Why?</p>
<p>php up to v 3.0 was pretty much a utility to hack html, version 4.0 was a very decent alternative to Perl or any other scripting language. Version 5.0 and up is a fully flegged OO language capable of solving many problems elegantly and efficiently.</p>
<p>The ' array() ' construct which behaves like an... | 49,147 |
<p>If I create an event using <code>CreateEvent</code> in Windows, how can I check if that event is signaled or not using the debugger in Visual Studio? <code>CreateEvent</code> returns back a handle, which doesn't give me access to much information. Before I call <code>WaitForSingleObject()</code>, I want to check t... | <p>You can use the Process Explorer tool (<a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer">http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx</a>) to manually check the event outside of the debugger. It helps if the event is named, so that you can find it easier.</p>
| <p>If the event is signaled and you use WaitForSingleObject(), it will return immediately. Also, you can call WaitForSingleObject() with a wait time of 0 to determine if it is signaled or not. However, that should not be necessary -- set the initial state in the CreateEvent() call (what has elapsed so far is unclear ... | 15,598 |
<ul>
<li>What's the optimal level of concurrency that the C++ implementation of BerkeleyDB can reasonably support?</li>
<li>How many threads can I have hammering away at the DB before throughput starts to suffer because of resource contention?</li>
</ul>
<p>I've read the manual and know how to set the number of locks,... | <p>It depends on what kind of application you are building. Create a representative test scenario, and start hammering away. Then you will know the definitive answer.</p>
<p>Besides your use case, it also depends on CPU, memory, front-side bus, operating system, cache settings, etcetera.</p>
<p>Seriously, just test y... | <p>What I did when working against a database of unknown performance was to measure turnaround time on my queries. I kept upping the thread count until turn-around time dropped, and dropping the thread count until turn-around time improved (well, it was processes in my environment, but whatever). </p>
<p>There were ... | 2,277 |
<p>There's a lot of advice out there that you shouldn't expose your fields publically, and instead use trivial properties. I see it over & over.</p>
<p>I understand the arguments, but <a href="https://stackoverflow.com/questions/174198/c35-automatic-properties-why-not-access-the-field-directly#205567">I don't thi... | <p>It may be hard to make code work in an uncertain future, but that's no excuse to be lazy. Coding a property over a field is convention and it's pragmatic. Call it defensive programming. </p>
<p>Other people will also complain that there's a speed issue, but the JIT'er is smart enough to make it just about as fast a... | <p>IMHO there is no such thing as a trivial property as people have been calling them. Via the way things such as databinding work, Microsoft has implied that any bit of data that is a part of the public interface of an object should be a property. I don't think they meant it merely to be a convention like it is in som... | 25,185 |
<p>Without getting into the details of <em>why</em>, I'm looking for a clean (as possible) way to replace kernel functions and system calls from a loadable module. My initial idea was to write some code to override some functions, which would take the original function (perhaps, if possible, <em>call</em> the function... | <p>I realise that the question is three years old, but for the benefit of other people trying to do this sort of thing, the kernel has an interface called <a href="http://www.mjmwired.net/kernel/Documentation/kprobes.txt" rel="noreferrer" title="kprobes">kprobes</a> to do just what you needed.</p>
| <p>Most filesystem work is done in modules already, presuming that the filesystem code was built as a module, rather than built into the kernel (which means the 'real' answer depends on kernel build options). </p>
<p>Assuming that the bits you want to log are all filesystem-related, and that those filesystem routines ... | 37,094 |
<p>I know the range name of the start of a list - <code>1</code> column wide and <code>x</code> rows deep.</p>
<p>How do I calculate <code>x</code>?</p>
<p>There is more data in the column than just this list. However, this list is contiguous - there is nothing in any of the cells above or below or either side beside... | <pre><code>Sheet1.Range("myrange").Rows.Count
</code></pre>
| <p>That single last line worked perfectly @GSerg.</p>
<p>The other function was what I had been working on but I don't like having to resort to UDF's unless absolutely necessary.</p>
<p>I had been trying a combination of excel and vba and had got this to work - but its clunky compared with your answer.</p>
<pre><cod... | 13,978 |
<p>I've updated my TortoiseSVN client and now I'm getting the error when trying to update or commit to different repositories:</p>
<blockquote>
<p>The requested name is valid, but no data of the requested type was
found</p>
</blockquote>
<p>Any ideas on how I can solve this? Internet Explorer shows up appropriate... | <p>Guys, thanks for your answers. Everything was fixed by yet another reboot (2 reboots after TSVN update).</p>
<p>Still I can't explain what happened. :)</p>
| <p>I got this error when trying to run both TeamCity and Visual SVN Server on the same virtual pc. Turning of the TeamCity services solved the problem for me. It is possible that the two web servers was having a little struggle with each other.</p>
| 20,711 |
<p>I frequently encounter some definitions for Win32API structures (but not limited to it) that have a <code>cbSize</code> member as in the following example.</p>
<pre><code>typedef struct _TEST {
int cbSize;
// other members follow
} TEST, *PTEST;
</code></pre>
<p>And then we use it like this:</p>
<pre><cod... | <blockquote>
<p>My initial guess is that this could
potentially be used for versioning.</p>
</blockquote>
<p>That's one reason. I think it's the more usual one.</p>
<p>Another is for structures that have variable length data.</p>
<p>I don't think that checking for correct packing or bugs in the caller are a par... | <p>Partially versioning, mostly safety... to prevent the called function from poking into memory that wasn't part of the struct passed in.</p>
| 23,004 |
<p>My MakerBot printer supports only two filaments at the same time.</p>
<p>What are techniques to print objects with more than two colors for one object?</p>
| <p>The most obvious solution is to pause the print and swap filament for another color.</p>
<p>Another option is to <a href="https://www.youtube.com/watch?v=RdlqGR5n9Zk">splice pieces of filament</a> together, though this does not allow very precise control of when the switch happens. There is also a device that can a... | <p>Answering this question fully depends on the type of printer you have. Some printers have a pause capability, while others do not. Some have multiple extruders, while most do not. Some have a tube leading to the extruder and others do not. You specifically are asking about dealing with more than two colors when you ... | 87 |
<p>Any ideas why this won't validate here:</p>
<p><a href="http://validator.w3.org/#validate_by_input" rel="nofollow noreferrer">http://validator.w3.org/#validate_by_input</a></p>
<p>It seems the form input tags are wrong but reading through the XHTML spec they should validate fine. Any ideas?</p>
<pre><code><!DO... | <p>Try putting a <code>fieldset</code> tag around the inputs. I think the idea of forms in XHTML is that they can't have direct descendants that aren't div, fieldset, etc.</p>
| <pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div class="Header">
<table class="HeaderTab... | 31,574 |
<p>I'm a little new to the Java 5 annotations and I'm curious if either of these are possible:</p>
<p>This annotation would generate a simple getter and setter for you.</p>
<pre><code>@attribute
private String var = "";
</code></pre>
<p>The <code>@NotNull</code> annotation indicates that a variable connot be null so... | <p>Annotation processing occurs on the abstract syntax tree. This is a structure that the parser creates and the compiler manipulates.</p>
<p>The current specification (link to come) says that annotation processors cannot alter the abstract syntax tree. One of the consequences of this is that it is not suitable to do ... | <p>Although they are sometimes useful, if you are seriously missing attributes then you are probably a little unsteady on the whole OO design thing.</p>
<p>The idea of OO Design is that methods are "Actions" where you are asking the object to do something for you--not just setting or getting a value--that's not an obj... | 45,331 |
<p>I'm trying to checkout a repository via command line (the 'svn co' command), using the svn+ssh protocol. I need to checkout as a different user than what I currently am. The command <code>svn co svn+ssh://username@server/repo/</code> would make sense, however when it prompts for a password, it never accepts it.</p>
... | <p>You might be confusing your SVN user name with your account name: svn+ssh is to be used only when you have a real account on the server that contains the repository. Is it the case? Can you log in with ssh on that server? If so, it probably is a configuration problem on the server.</p>
<p>On the other hand, if y... | <p>Try this:</p>
<pre><code>svn checkout svn+ssh://your.remote-server.com/home/svn/test
</code></pre>
| 49,293 |
<p>I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined with in a class and use non-static private member variables. So I need to be able to create an instance of this class to... | <p>There is no way to directly use a C++ class in C# code. You can use PInvoke in an indirect fashion to access your type. </p>
<p>The basic pattern is that for every member function in class Foo, create an associated non-member function which calls into the member function. </p>
<pre><code>class Foo {
public:
i... | <p>You may need to write an intermediary DLL (in C++, perhaps) that handles this for you and exposes the interface you need. Your DLL would be in charge of loading the 3rd party DLL, creating an instance of this C++ object, and exposing its member functions as needed via whatever API you design. You would then use P/... | 40,665 |
<p>I'm writing a direct3d application and after noticing strange bugs such as anti-aliasing occurring even when it was turned off and the mouse pointer not lining up to things with the same coordinates as itself I discovered that when creating a window the width and height parameters include the border. The program wa... | <p>It sounds like you are looking for the GetSystemMetrics function. For example, the border width in pixels is returned by</p>
<pre><code>GetSystemMetrics(SM_CXBORDER)
</code></pre>
<p><strong>ADDED:</strong> For the total size you will need to add together the various "pieces" of the non-client area: border, fram... | <p>Another option would be to make sure the D3D surface is the same size as the client rectangle size (<a href="http://msdn.microsoft.com/en-us/library/ms633503(VS.85).aspx" rel="nofollow noreferrer">GetClientRect()</a>). Then you know you'll render to the appropriate size and not have to worry at all about the width o... | 38,545 |
<p>Why does a Boolean consume 4 bytes and a char 2 bytes in the .NET framework? A Boolean should take up 1bit or at least be smaller than a char.</p>
| <p>It is a question of memory alignment. 4-byte variables work faster than 2-byte ones. This is the reason why you should use int instead of byte or short for counters and the like.</p>
<p>You should use 2-byte variables only when memory is a bigger concern than speed. And this is the reason why char (which is Unic... | <p>Its because Windows and .Net have used <a href="http://en.wikipedia.org/wiki/Unicode" rel="nofollow noreferrer">Unicode</a> <a href="http://en.wikipedia.org/wiki/UTF-16" rel="nofollow noreferrer">(UTF 16)</a> since inception as their internal character set. <a href="http://en.wikipedia.org/wiki/UTF-16" rel="nofollo... | 24,992 |
<p>I have a list of variable names, like this:</p>
<pre><code>['foo', 'bar', 'baz']
</code></pre>
<p>(I originally asked how I convert a list of variables. See Greg Hewgill's answer below.)</p>
<p>How do I convert this to a dictionary where the keys are the variable names (as strings) and the values are the values ... | <p>Forget filtering <code>locals()</code>! The dictionary you give to the formatting string is allowed to contain unused keys:</p>
<pre><code>>>> name = 'foo'
>>> zip = 123
>>> unused = 'whoops!'
>>> locals()
{'name': 'foo', 'zip': 123, ... 'unused': 'whoops!', ...}
>>> '%(... | <p>Not efficient, but without invoking <code>eval</code>:</p>
<pre><code>dict((k,v) for (k,v) in globals().iteritems() if k in list_of_variable_names)
</code></pre>
<p>or</p>
<pre><code>dict((k,v) for (k,v) in vars().iteritems() if k in list_of_variable_names)
</code></pre>
<p>depending on what you want.</p>
| 28,580 |
<p>I need a tool for collecting feedback and new ideas inside our company regarding our internal IS product. The problem is the acceptance level for such a tool.<br>
Most of our colleagues are not IT oriented, so a solution like BugZilla or Jira is way to complicated for them to use. You need to create an account, take... | <p>Is the feedback you are seeking possible to collect through a questionnaire? There are many free solutions that provide you with questionnaire forms very easy to use, and if none apply it is also something relatively easy to implement.</p>
<p>I also do not understand why a wiki will not be a good solution, but rega... | <p>How about using for example Google groups? I've found a mailing list works quite well for this kind of purpose.</p>
<p>Edit: or how about <a href="http://getsatisfaction.com/" rel="nofollow noreferrer">http://getsatisfaction.com/</a></p>
| 33,691 |
<p>At work, I running Vista Business on a lavishly new PC, which runs great excepting two issues. In order of annoyance, but not importance:</p>
<ol>
<li><p>When I reboot the machine, the Windows Splash is presented asking me to Press Ctrl + ALT + DELETE so I can logon. It takes three to five minutes and seceral key... | <p>as for 2 - this happens with some proprietary VPN software (i.e. Cisco). My solution was to perform my work duties in a Virtual PC (which doesn't need its normal LAN abilities) and do my other network/internet tasks in the physical machine.</p>
| <p>I have to chalk this up to "something wierd with my laptop" as I was able to download RoyalTS and connect to the machine just fine. I had Remote connections permitted, firewall disabled, McAffee gone and others could access the machine.</p>
<p>The advice garnered above is excellent and useful for your typical rdp ... | 34,485 |
<p>There is this great hotend called a <a href="http://reprap.org/wiki/Diamond_Hotend#Benefits_of_this_design" rel="noreferrer">diamond hotend</a>, which can be used to print in 3 colors and mix them into hundreds? of colors. This can for example be used with Red, Green and Blue filament to mix a RGB palette. They don'... | <p>You may be a bit misled here. First of all, you do <strong>not</strong> want "RGB" , as those are additive colors such as used when combining light sources. You <strong>do</strong> want "RYB" (red-yellow-blue) or the more accurate CMY(plus K just to get a 'truer' black) for subtractive colors.</p>
<p>Next, there'... | <p>So whilst this is not quite what you were talking about I think this is the closest to the effect you’re looking for that I’ve seen.</p>
<p><a href="https://www.xyzprinting.com/en-US/product/da-vinci-color" rel="nofollow noreferrer">https://www.xyzprinting.com/en-US/product/da-vinci-color</a></p>
<p>This da Vinci ... | 402 |
<p>Using jQuery, how do I delete all rows in a table except the first? This is my first attempt at using index selectors. If I understand the examples correctly, the following should work:</p>
<pre><code>$(some table selector).remove("tr:gt(0)");
</code></pre>
<p>which I would read as "Wrap some table in a jQuery o... | <p>This should work: </p>
<pre><code>$(document).ready(function() {
$("someTableSelector").find("tr:gt(0)").remove();
});
</code></pre>
| <p>-Sorry this is very late reply. </p>
<p>The easiest way i have found to delete any row (and all other rows through iteration) is this</p>
<p>$('#rowid','#tableid').remove();</p>
<p>The rest is easy.</p>
| 48,332 |
<p>All the articles I've found via google are either obsolete or contradict one another.</p>
<p>What's the easiest way to print a form or, say, a richtextbox in c#? I think it's using the <code>PrintDiaglog</code> class by setting the <code>Document</code>, but how does this get converted?</p>
| <p>At least in VS 2008, its very easy. It took me about a couple of minutes to code the answer after reading your question. Here's where I borrowed it from:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/6he9hz8c.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/6he9hz8c.aspx</a></p>
<p>I tested... | <p>Someone I know created a component that extends controls with a lot of properties that give you a lot of control over how the form prints. It's worth a look.</p>
<p><a href="http://www.xtremevbtalk.com/showthread.php?t=279707" rel="nofollow noreferrer">MCL PrintForm Helper Component</a></p>
| 2,726 |
<p>I've got a CAkePHP 1.2 site. I've got three related Models/tables:
A Comment has exactly one Touch, a Touch has exactly one Touchtype.</p>
<p>In each model, I have a belongs to, so I have
Comments belongs to Touch, Touch belongs to Touchtype.</p>
<p>I'm trying to get a list of comments that includes information ab... | <p>Pipe output to:</p>
<pre><code>cut -b 1-LIMIT
</code></pre>
<p>Where LIMIT is the desired line width.</p>
| <p>The usual way to do this would be</p>
<pre><code>perl -wlne'print substr($_,0,80)'
</code></pre>
<p>Golfed (for 5.10):</p>
<pre><code>perl -nE'say/(.{0,80})/'
</code></pre>
<p>(Don't think of it as programming, think of it as using a command line tool with a huge number of options.) (Yes, the <a href="http://ww... | 16,608 |
<p>I have a rather classic UI situation - two ListBoxes named <code>SelectedItems</code> and <code>AvailableItems</code> - the idea being that the items you have already selected live in <code>SelectedItems</code>, while the items that are available for adding to <code>SelectedItems</code> (i.e. every item that isn't a... | <p>Here's your solution.</p>
<pre><code><Button Name="btn1" >click me
<Button.Style>
<Style>
<Style.Triggers>
<DataTrigger
Binding ="{Binding ElementName=list1, Path=SelectedIndex}"
... | <p>Less code solution:</p>
<pre><code><Button Name="button1" IsEnabled="{Binding ElementName=listBox1, Path=SelectedItems.Count}" />
</code></pre>
<p>If count is 0 that seems to map to false, > 0 to true.</p>
| 3,849 |
<p>When I give Java and C large floats and doubles (in the billion range), they convert them to scientific notation, losing precision in the process. How can I stop this behavior?</p>
| <p>For Java, check out <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html" rel="noreferrer">BigDecimal</a></p>
| <p>The conversion to scientific notation is purely an effect of how it's displayed. Changing the display is a matter of how you output it (format specifiers)</p>
<p>floats generally have about 6 digits of precision, which would make them inappropriate to hold a number in the billions. Doubles have about 15 digits of ... | 23,530 |
<p>(Not related to versioning the database schema)</p>
<p>Applications that interfaces with databases often have domain objects that are composed with data from many tables. Suppose the application were to support versioning, in the sense of CVS, for these domain objects.</p>
<p>For some arbitry domain object, how wo... | <p>Think carefully about the requirements for revisions. Once your code-base has pervasive history tracking built into the operational system it will get very complex. <a href="http://www.xchanging.com/Sectors/Software.htm" rel="noreferrer">Insurance</a> <a href="http://www.roomsolutions.net/insurance-software/policy... | <p>A simple fool-proof way, is to add a version column to your tables and store the Object's version and choose the appropriate application logic based on that version number.
This way you also get backwards compatibility for little cost. Which is always good</p>
| 15,308 |
<p>I have a container element which I need to resize as its contents change. It contains 2 absolutely positioned divs which can both change height. If I don't specify the height of the container then anything after the container disappears under the contents. </p>
<p>At the moment I am doing the following but I'd be p... | <p>This is a very odd question, as div's height is always the height of its children. </p>
<p>Are you floating content in your container div? When you float child content the containing div doesn't act the same anymore.</p>
<p>If you're floating content that extends past the bottom of the container div, add the fol... | <p><code>Overflow:visible;</code> That's the ticket. <code>overflow:auto</code> will create a scroll bar, if needed.</p>
| 41,011 |
<p>Has anyone had this problem. You install Silverlight 2 RTW, and open your old project. Everything loads fine in the designer. You have to change a few properties of your DataGrid because "DisplayMemberBinding" was changed to "Binding". Press F5, and receive a Win32 exception in IEXPLORE.EXE. You go check out th... | <p>TextWrapping is not removed its just a property of the TextWrapping.. The document states that the "WrapWithOverflow" is no longer supported and should be changed to just "Wrap". I have it on my Silverlight 2 RTW and it works fine... </p>
| <p>Ok,</p>
<p>I'm happy to report I figured it out. There are many breaking changes in Silverlight 2 RTW, I suggest you read this <a href="http://blogs.msdn.com/silverlight_sdk/attachment/8995057.ashx" rel="nofollow noreferrer">document</a>. The compiler doesn't tell you everything you need to know when you compile ... | 24,767 |
<p>When writing a class do you group members variables of the same type together? Is there any benefit to doing so? For example:</p>
<pre><code>class Foo
{
private:
bool a_;
bool b_;
int c_;
int d_;
std::string e_;
std::string f_;
...
};
</code></pre>
<p>As opposed to:</p>
<pre><code>cl... | <p>I group them according to semantics, i.e.</p>
<pre><code>class Foo
{
private:
std::string peach;
bool banana;
int apple;
int red;
std::string green;
std::string blue;
...
};
</code></pre>
<p>The more readable, the better.</p>
| <p>In most cases you should not have too many members in a structure. </p>
<p>If you do, maybe you should think about substructures...</p>
<p>I know there are exceptions, but as a general rule of thumb, try to keep your structures small.</p>
| 42,195 |
<p>Does anybody use Scrum & Sprint for Infrastructure.</p>
<p>I'm struggling with the concept of a Sprint that never finishes i.e. a Network enhancement project.</p>
<p>Also any suggestions on how Item time can be built up to a Product Backlog, so that I can sanity check that resources are not overcommited on th... | <p>I would suggest that you might start by refreshing your memory about the whole concept of Scrum (<a href="http://en.wikipedia.org/wiki/Scrum" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Scrum</a> might be a good place to start).</p>
<p>For example I don't believe that there should be such thing as a 'nev... | <p>A Sprint that never finishes is not a Sprint...it's a career. JK. Make sure you have clearly defined sub-goals if a major goal is not reachable and/or constantly shifting. Estimate man hours on each task and break it down into sub-tasks if those hours get to be more than half a day or so (very loose rule). Track... | 27,415 |
<p>I am working at a client site where there is a proxy server (<code>HTTP</code>) in place. If I do a hard reset of the emulator it forgets network connection settings for the emulator and settings in the hosted Windows Mobile OS. If I 'save state and exit' it will lose all of these settings. I need to do hard resets ... | <p>This is explained in the Perl <a href="http://perldoc.perl.org/perlop.html#Conditional-Operator" rel="noreferrer">documentation</a>.</p>
<p>Because of Perl operator precedence the statement is being parsed as</p>
<pre><code>($condition ? $a= 2 : $a ) = 3 ;
</code></pre>
<p>Because the ?: operator produces an ass... | <p>One suggestion to Tithonium's answer above:</p>
<p>If you are want to assign different values to the same variable, this might be better (the copy-book way): </p>
<p>$a = ($condition) ? 2 : 3;</p>
| 3,048 |
<p>I want to store the current URL in a session variable to reference the previous visited page.</p>
<p>If I store every URL (via a before_filter on ApplicationController), also actions which end in a redirect (create, update, etc) are considered as last visited page.</p>
<p>Is there a way to tell Rails only to execu... | <p>Not sure why <code>@performed_redirect</code> isn't working, you can see that it does exist and have the desired values by calling the actions on this test controller:</p>
<pre><code>class RedirController < ApplicationController
after_filter :redir_raise
def raise_true
redirect_to :action => :whateve... | <p>Can be a bit more specific? I cant get your question- by template you means render :view, the layout? or only when called with render :template?</p>
<p>Rendering a page? render :action=>:new is a page too... Can you be a bit more specific on which you want to capture and which you want to exclude?</p>
<p>Saw the a... | 12,952 |
<p>I am looking for an example of how to do the following in VB.net with Parallel Extensions.</p>
<pre><code>Dim T As Thread = New Thread(AddressOf functiontodowork)
T1.Start(InputValueforWork)
</code></pre>
<p>Where I'm getting stuck is on how to pass into the task my parameter InputValueforWork</p>
<pre><code>Dim ... | <p>I solved my own question. you have to pass in an array with the values.</p>
<pre><code>Dim A(0) as Int32
A(0) = 1
Tasks.Task.Create(AddressOf TransferData, A)
</code></pre>
| <p>Not necessarily the most helpful answer I know, but in C# you could do this with a closure:</p>
<pre><code>var T = Tasks.Task.Create( () => functionToDoWork(SomeParameter) )
</code></pre>
| 34,058 |
<p>I am thinking of using a PHP framework called <a href="http://codeigniter.com/" rel="noreferrer">CodeIgniter</a>. </p>
<p>One of the things I am interested in is its speed. I have, however, no way to find out how fast it is, and would rather not simply take the word of their website for it. Does anybody know how I ... | <p>Code Igniter also has some built-in benchmarking tools:
<a href="http://codeigniter.com/user_guide/general/profiling.html" rel="noreferrer">http://codeigniter.com/user_guide/general/profiling.html</a></p>
| <p>CodeIgniter is plenty fast for most projects. Some have posted here and if you Google, you will find that it compares favorably to other frameworks with respect to speed.</p>
<p>I would agree with another poster that performance is usually not a big concern when it comes to framework choice. The major frameworks al... | 3,425 |
<p>I am using forms authentication. My users are redirected to a page (written in web.config) when they login, but some of them may not have the privilages to access this default page. In this case, I want them to redirect to another page but RedirectFromLoginPage method always redirects to the default page in web.conf... | <p>The <code>SetAuthCookie</code> allows you to issue the auth cookie but retain control over the navigation. After that method is called you can run your logic to do a typical ASP.NET redirect to wherever you want.</p>
| <pre><code>if(mc.GetfaalUsers(mm.UserName.ToString())=="True")
{
this.Page.ClientScript.
RegisterClientScriptBlock(this.GetType(), "key",
"alert('این نام کاربری فعال نشده است');", false);
FormsAuthentication.SignOut();
Response.Redirect("default.aspx");
}
</code></pr... | 5,746 |
<p>I have recently purchased an AVR USB programmer from robokits.co.in, was trying to program atmeg8 using AVR studio4 and I get the following when I click on the program options:</p>
<blockquote>
<p>a problem occurred when executing the command. make sure u are using
the correct programming method. current mode i... | <p>Double check that the jumpers on the programming board that you are using (if you are) are set correctly.</p>
| <p>Is the Target "fresh"? i.e. Never been programmed? Regardless: have you tried more than one?<BR>
Do you have any power being applied to the ISP header (target) prior to connecting the programmer?</p>
<p>You may also want to verify there are no shorts on your Target pulling the ISP Supply down, see the pinout link... | 29,612 |
<p>I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the status notification implementation because it seemed easier to have the reachablity updated ... | <p>Reachability notificataions didn't seem to be reliable for me either, for detecting Wi-Fi. So I just use polling instead. Checking every 5 seconds seems to do no harm.</p>
<pre><code>- (void) checkReachability {
BOOL connected = ([[Reachability sharedReachability] localWiFiConnectionStatus] == ReachableViaWiFiN... | <p>There is a nice reachability example on the net. it works wonderfully well:
<a href="http://servin.com/iphone/iPhone-Network-Status.html" rel="nofollow">http://servin.com/iphone/iPhone-Network-Status.html</a></p>
<p>But you see, when I try to use it my own way, it just bombs.</p>
<p>Tried to implement it using:</p... | 21,905 |
<p>My company uses StarTeam for source control and CR management, but I would really like to switch to Subversion for source control. For those of you that know ClearQuest and ClearCase, StarTeam has the ability to create tickets, which can later be associated with code changes.</p>
<p>Are there any similar products ... | <p><a href="http://www.atlassian.com/software/jira/" rel="nofollow noreferrer">Jira</a> integrates well, with a little effort, with Subversion.</p>
<p>Using <a href="http://www.atlassian.com/software/bamboo/" rel="nofollow noreferrer">Bamboo</a> together with Subversion and <a href="http://www.atlassian.com/software/j... | <p>At work we use redmine and are very pleased with it...</p>
<p>Integrating it with subversion is really a no brainer...</p>
| 34,346 |
<p>I am the programmer for the Education department at a county hospital. I would like to be able to see some real-time stats on an IIS6 web server that is only accessible in-house. I'm looking for something similar to what 1and1.com provides for their customers (if you're familiar with what they offer).</p>
<p>I have... | <p>To the best o my knowledge, <a href="http://www.splunk.com/article/2000" rel="nofollow noreferrer">Splunk</a> is one of the best players in that area. You can use it for free up to about 500MB of logs per day. <a href="http://www.ossec.net/" rel="nofollow noreferrer">OSSec</a> has a slightly different focus (intrusi... | <p>This is the product I use to analyze my web logs... It's not 'real-time' per se, but it can be configured to run a service and produce reports at regular intervals...</p>
<p><a href="http://www.nihuo.com/web-log-analyzer.html" rel="nofollow noreferrer">http://www.nihuo.com/web-log-analyzer.html</a></p>
<p>Best of ... | 44,836 |
<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... | <p>I got this working with help from <a href="https://stackoverflow.com/users/9268/abe-heidebrecht">Abe Heidebrecht</a>. Much thanks to him.</p>
<p>Here's my XAML...</p>
<pre><code><Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft... | <p>Second solution worked best for me. I have a list of recursive objects, so this is the XAML that I used:</p>
<pre><code><TreeView Height="Auto" HorizontalAlignment="Stretch" Name="trvVaults" VerticalAlignment="Stretch" Width="Auto" Grid.Column="0" Margin="5">
<!-- Treeview ItemsSource is loaded progr... | 33,857 |
<p>I need to compare 2 strings in C# and treat accented letters the same as non-accented letters. For example:</p>
<pre><code>string s1 = "hello";
string s2 = "héllo";
s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);
s1.Equals(s2, StringComparison.OrdinalIgnoreCase);
</code></pre>
<p>These 2 strings need ... | <p><em>FWIW, <a href="https://stackoverflow.com/a/7720903/12379">knightfor's answer</a> below (as of this writing) should be the accepted answer.</em></p>
<p>Here's a function that strips diacritics from a string:</p>
<pre><code>static string RemoveDiacritics(string text)
{
string formD = text.Normalize(Normalization... | <p>try this overload on the String.Compare Method. </p>
<p>String.Compare Method (String, String, Boolean, CultureInfo)</p>
<p>It produces a int value based on the compare operations including cultureinfo. the example in the page compares "Change" in en-US and en-CZ. CH in en-CZ is a single "letter".</p>
<p>examp... | 46,947 |
<p>I'm familiar with Sybase / SQL server, where I can create a temp. table like this: </p>
<pre><code>SELECT *
INTO #temp
FROM tab1 ,
tab2
WHERE tab1.key = tab2.fkey
SELECT *
FROM #temp
WHERE field1 = 'value'
</code></pre>
<p>#temp only exists for the duration of this session, and can only be se... | <p>Your first approach ought to be to do this as a single query:</p>
<pre><code>SELECT *
FROM
(
SELECT *
FROM tab1 ,
tab2
WHERE tab1.key = tab2.fkey
)
WHERE field1 = 'value';
</code></pre>
<p>For very complex situations or where temp# is very large, try a subquery factoring clause, optionally with t... | <p>Yes, carson has it right. Global temporary tables are only visible to the session that creates them, and disappear either at the first commit or rollback, or at the end of the session. You can set that when you create the gtt.</p>
| 27,349 |
<p>I have a java class which fires custom java events. The structure of the code is the following:</p>
<pre><code>public class AEvent extends EventObject {
...
}
public interface AListener extends EventListener {
public void event1(AEvent event);
}
public class A {
public synchronized void addAListener(AListe... | <p>I don't see a reason why <code>BListener</code> should extend <code>AListener</code>.</p>
<p>Do you really want to force everyone interested in <code>B</code> events to also implement <code>event1()</code>?</p>
<p>Also you can't add <code>addAListener()</code>, since a derived class can not reduce the visibility o... | <p>If </p>
<pre><code>public class BEvent extends AEvent {
...
}
public interface BListener extends AListener {
public void event2(BEvent event);
}
</code></pre>
<p>can't you do somethin like:</p>
<pre><code>public class B extends A {
@Override
public synchronized void addAListener(AListener l) {
if (l ... | 48,429 |
<p>How can I check <code>file permissions</code>, without having to run operating system specific command via <code>passthru()</code> or <code>exec()</code>?</p>
| <p>Use <a href="http://php.net/fileperms" rel="noreferrer">fileperms()</a> function</p>
<pre><code>clearstatcache();
echo substr(sprintf('%o', fileperms('/etc/passwd')), -4);
</code></pre>
| <p>What do you want to do by checking file permissions?</p>
<p>When writing secure code, it's almost always incorrect to "check, then do" anything. The reason is that between the checking whether you can do something and actually doing it, the state of the system could change such that doing it would have a different... | 3,995 |
<p>I want to assign default values to a column in my select sql query so that if the value of that column is null I get that default value in my recordset. Is there anyway to do this?</p>
<p>Example:</p>
<pre><code>select col1 (some default value) from tblname;
</code></pre>
| <p>The preferable way is to use ANSI compatible function <a href="http://msdn.microsoft.com/en-us/library/ms190349.aspx" rel="noreferrer">COALESCE</a>:</p>
<pre><code>SELECT COALESCE(column_name, default_value) FROM table_name;
</code></pre>
<p>You also could read <a href="http://databases.aspfaq.com/database/coalesc... | <p>if you are using SqlServer you can use the CASE statement </p>
<p>example:</p>
<p>select case col1 when null then defaultval else col1 end from tblname</p>
<p>where defaultval is the default value. the data type of defaultval must be the same as that of col1.</p>
| 35,874 |
<p>I have a WCF service that has been hosted on a Windows Service and uses the BasicHttp endpoint to serve Windows Mobile devices that has been connected to it.</p>
<p>The problem is that with the Device Emulator. I can connect to the service and using it without any problems, but with an actual device. I receive the ... | <p>Check your IIS extensions, particularly those for .wsdl are valid:</p>
<p>In IIS:</p>
<ul>
<li>Look at the properties for your site.</li>
<li>In the Home Directory tab, click
configuration. </li>
<li>Click add (my path is
"C:\Program Files (x86)\Common
Files\MSSOAP\BINARIES\SOAPIS30.DLL" )</li>
<li>Set the extensi... | <p>When using WCF you might also need to map the .svc file type to aspnet_isapi.dll in IIS.</p>
| 48,111 |
<p>I have:</p>
<pre><code><?php
$file=fopen(date("Y-m-d").".txt","r+") or exit("Unable to open file!");
if ($_POST["lastname"] <> "")
{
fwrite($file,$_POST["lastname"]."\n");
}
fclose($file);
?>
</code></pre>
<p>but it overwrites the beginning of the file. How do I make it insert?</p>
| <p>I'm not entirely sure of your question - do you want to write data and not have it over-write the beginning of an existing file, or write new data to the start of an existing file, keeping the existing content after it?</p>
<p><strong>To insert text without over-writing the beginning of the file</strong>, you'll ha... | <p>If you want to put your text at the beginning of the file, you'd have to read the file contents first like:</p>
<pre><code><?php
$file=fopen(date("Y-m-d").".txt","r+") or exit("Unable to open file!");
if ($_POST["lastname"] <> "")
{
$existingText = file_get_contents($file);
fwrite($file, $exi... | 12,924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.