instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'd like to host custom items in a ToolBar in an ItemsControl. However, the buttons I add are rendered below the toolbar and as regular buttons rather than in the ToolBar with the ToolBar look and feel.</p> <p>This can be reproduced with a few lines of Xaml (I've excluded the default content). The custom ItemsCon...
<p>set the style on the button like this:</p> <pre><code>Style="{DynamicResource {x:Static ToolBar.ButtonStyleKey}}" </code></pre>
<p>I ended up getting the behavior I wanted by naming the custom ToolBar, then adding a property in the code-behind that could be used by consumers of the control to add items through code.</p>
47,005
<p>The 'attach to process' dialogue box on VC6 running on win 2003 (I believe vista as well) has no processes to attach to in it... I've tried logging on as an administrator and running as an administrator but no luck. Any other ideas?</p>
<p>I do not believe this is possible using WinForms, at least without drawing your own nodes. You may be able to use an "owner-drawn" treenode to accomplish this in WinForms, though, I don't know. </p> <p>This is natively supported with WPF, though.</p>
<p>It is not possible to use the tabulator effectively inside a TreeNode. Anyways, I have a workaround:</p> <p>The Font "Consolas" has equal space of each letter so you can space easily with blanks. The method GetEmptyInfoByIndex returns a custom lenght string of spaces to fill the gap until a specified length. Here =...
38,698
<p>When I drag &amp; drop a dll to the assembly folder on vista, I get the error "Access is denied: mydll.dll". How can I bypass the error message and add my dll to gac?</p>
<p>My guess would be that you have to do it as an administrator...try either disabling UAC, or using gacutil.exe to add your assembly.</p>
<p>You may not locate gacutil.exe in your windows folder while using vista. It's not included because of vista's "Logo Program blah blah" thing. Try to use windows installer to add your assemblies into gac. This is the recommended way.</p> <p>And never forget this traditional ogrish proverb: "Bi siktir git cay koy".</...
7,645
<p>I am building an application using Spring MVC. I want to make certain changes to my Model for every Controller in the application. In particular, I want to insert certain extra data into the model which will be present for all pages of the application.</p> <p>I could do this several ways: just add the data at the e...
<p>Aspects are a good approach, but Spring MVC makes it even easier -- you can define a <a href="http://static.springframework.org/spring/docs/2.5.x/reference/mvc.html#mvc-handlermapping-interceptor" rel="nofollow noreferrer">HandlerInterceptor</a> that will be called before or after every time a request is handled. I...
<p>I might be wrong, but I suspect that you may have described your requirements incorrectly.</p> <p>You seem to be saying 'I want certain data to be added to my model, for all controllers'.</p> <p>I suspect that you mean 'I want certain data to be available for all views'.</p> <p>If my suspicions are correct, then ...
20,247
<p>How to pack python libs I'm using so I can distribute them with my app and have as few dependencies as possible and also not to conflict with different lib/version that is already on my system.</p> <p>L.E.: Sorry i forgot to specify. I will be doing this on linux. And I'm not referring in making my app a installabl...
<p>You can have your users run the system from a startup script, and that script can fix the pythonpath ahead of time to put your versions first. For example if you put CherryPy, SQLAlchemy, etc. in an "external" subdirectory, you could try:</p> <pre><code># startproj.sh script_path=`dirname $0` export PYTHONPATH=${sc...
<p>Try <a href="http://www.py2exe.org/" rel="nofollow noreferrer">py2exe</a>.</p>
42,933
<p>I have just installed a build server with a 64 bit windows server 2008 for continuous integration. </p> <p>The reason I choose a 64 bit server was to have more than ~3Gb of RAM. I had hopes that this machine would provide blazing fast builds.</p> <p>Unfortunately, the result are lacking greatly to say the least. M...
<p>@LanceSc</p> <p>I don't think MsiFileHash table will help here. See this <a href="http://blogs.msdn.com/astebner/archive/2005/08/30/458295.aspx" rel="nofollow noreferrer" title="How Windows Installer handles file replacement logic for versioned and unversioned files">excellent post</a> by Aaron Stebner. Most likely...
<p>Since it sounds like you don't have properly versioned resources, have you tried changing the REINSTALLMODE property?</p> <p>IIRC, in the default value of 'omus', it's the 'o' flag that's only allowing you to install if you have an older version. You may try changing this from 'o' to 'e'. Be warned that this will...
12,790
<p>Some years ago I was on a panel that was interviewing candidates for a relatively senior embedded C programmer position.</p> <p>One of the standard questions that I asked was about optimisation techniques. I was quite surprised that some of the candidates didn't have answers.</p> <p>So, in the interests of putting...
<p>First things first - don't optimise too early. It's not uncommon to spend time carefully optimising a chunk of code only to find that it wasn't the bottleneck that you thought it was going to be. Or, to put it another way "Before you make it fast, make it work"</p> <p>Investigate whether there's any option for opti...
<p>I would recommend optimizing using more efficient algorithms and not do it as an afterthought but code it that way from the start. Let the compiler work out the details on the small things as it knows more about the target processor than you do.</p> <p>For one, I rarely use loops to look things up, I add items to a...
13,589
<p>Here's my code:</p> <pre><code>&lt;asp:TemplateField HeaderText="* License Setup Date"&gt; &lt;EditItemTemplate&gt; &lt;asp:RequiredFieldValidator ID="LicenseSetupDateRequired" ErrorMessage="License Setup Date can't be blank." ValidationGroup="EditClientDetails" Con...
<p>I don't think you should supply a Gui for active directory. Most organization that use active directory manage it with the standard active directory tools.</p> <p>If you want to handle the case of small shops. Then make the groups internal to the application DB. You will still be able to use the active directory us...
<p>This really depends on who owns the AD, and who is going to be responsible for managing user accounts. If this AD is isolated from your coporate domain, and you want your support or sales, or other business person to manage the accounts then by all means create them an admin tool.</p> <p>If your trying to tie into ...
47,610
<p>I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The <a href="http://developer.yahoo.com/maps/ajax/V3.8/index.html#YMap" rel="nofollow noreferrer"><code>addMarker()</code> method</a> on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps mu...
<p>You can ask the map object to do the geoCoding, and catch the callback:</p> <pre><code>&lt;script type="text/javascript"&gt; var map = new YMap(document.getElementById('map')); map.drawZoomAndCenter("Algeria", 17); map.geoCodeAddress("Cambridge, UK"); YEvent.Capture(map, EventsList.onEndGeoCode, function(geoCode...
<p>If you're working with U.S. addresses, you can use <a href="http://geocoder.us/" rel="nofollow noreferrer">geocoder.us</a>, which has <a href="http://geocoder.us/help/" rel="nofollow noreferrer">APIs</a>.</p> <p>Also, <em>Google Maps Hacks</em> has a hack, <a href="http://safari.oreilly.com/0596101619/googlemapshks...
9,925
<p>I'm using the MySQL Query Browser (part of the <a href="http://dev.mysql.com/downloads/gui-tools/" rel="noreferrer">MySQL GUI Tools</a>) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to <code>''</code>. Typing "NULL" makes it try to update to <c...
<p>In MySQL Query Browser, right click on the cell and select 'Clear field content' while the focus is in another cell.</p> <p>In MySQL Workbench, right click on the cell and select 'Set Field to NULL'.</p>
<p>I'd try Ctrl-0 (zero), because that works in some tools.</p>
36,847
<p>Here is a snippet of the code :</p> <pre><code>HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(request.RawUrl); WebRequest.DefaultWebProxy = null;//Ensure that we will not loop by going again in the proxy HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse(); string charSet = response.Ch...
<p>Firstly, the easier way of writing that code is to use a StreamReader and ReadToEnd:</p> <pre><code>HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(myURL); using (HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse()) { using (Stream resStream = response.GetResponseStream()) { ...
<p>I studied the same problem with the help of WireShark, a great protocol analyser. I think that there are some design short coming to the httpWebResponse class. In fact, the whole message entity was downloaded the first time you invoking the GetResponse() method of the HttpWebRequest class, but the framework have no ...
28,165
<p>I've been seeing the 330 m and 110 m length estimates for 1.75 and 3.0 mm spools (of PLA, presumably). But a moment's thought staring at that will raise an obvious question.</p> <p>Using πr², we get the area of the filament in square millimeters (rounding to two decimal points)</p> <p>For 1.75 it's 2.41 mm²</p> <...
<p>Let's go about this scientific:</p> <p>$A_r=\pi{r}^{2}=\pi{\frac{d}{2}}^{2}$</p> <p>As a result the crossections are $A_{3}=7.06858\text{mm}^2=0.0707\text{cm}^2$, $A_{2.85}=6.3794\text{mm}^2=0.0638\text{cm}^2$ and $A_{1.75}=2.40528\text{mm}^2=0.024\text{cm}^2$.</p> <p>Volume of a cylinder is $V_{A_d,l}=\times {A_...
<p>Let's go about this scientific:</p> <p>$A_r=\pi{r}^{2}=\pi{\frac{d}{2}}^{2}$</p> <p>As a result the crossections are $A_{3}=7.06858\text{mm}^2=0.0707\text{cm}^2$, $A_{2.85}=6.3794\text{mm}^2=0.0638\text{cm}^2$ and $A_{1.75}=2.40528\text{mm}^2=0.024\text{cm}^2$.</p> <p>Volume of a cylinder is $V_{A_d,l}=\times {A_...
986
<p>I have recently been thinking about the difference between the two ways of defining an array:</p> <ol> <li><code>int[] array</code></li> <li><code>int array[]</code></li> </ol> <p>Is there a difference?</p>
<p>They are semantically identical. The <code>int array[]</code> syntax was only added to help C programmers get used to java.</p> <p><code>int[] array</code> is much preferable, and less confusing.</p>
<p>Both are ok. I suggest to pick one and stick with it. (I do the second one)</p>
15,706
<p>I'm planning to write a web service aka api for my application which was developed with .Net and SQLServer. .Net provides a simple way to create webservices by creating asmx files. But i need to know how best it can be designed or what are the best practices in creating a web service in .net or some pointers to good...
<p>It's not easy to remember all the best practices out there, but here is my advice:</p> <ul> <li>Avoid using data types which aren't easily serializable or aren't compatible with the WS standards (and thus you won't be able to consume the service using different languages). Most notably are RecordSets and other MS-o...
<p>If you're using .NET 3.0 or later I would encourage you to consider implementing your service using WCF.</p> <p>The learning curve is steeper, but you'll benefit from the <a href="http://msdn.microsoft.com/en-us/library/ms730214.aspx" rel="nofollow noreferrer">flexibility and features that WCF offers</a>. With WCF ...
19,000
<p>I'm looking for a few talking points I could use to convince coworkers that it's NOT OK to run a 24/7 production application by simply opening Visual Studio and running the app in debug mode.</p> <p>What's different about running a compiled console application vs. running that same app in debug mode? </p> <p>Are t...
<p>You will suffer from reduced performance when running under the debugger (not to mention the complexity concerns <a href="https://stackoverflow.com/questions/136674/reasons-to-not-run-a-business-critical-c-console-application-via-the-debugger#136699">mentioned by Bruce</a>), and there is nothing to keep you from get...
<p>We never run it via the debugger. There are compiler options which may accidentally be turned on/off. Optimizations aren't turned on, and running it in production is a huge security risk. </p>
16,538
<p>A Monoprice Maker Select V2, upgraded incrementally with a <a href="https://store.micro-swiss.com/products/all-metal-hotend-with-slotted-cooling-block-for-wanhao-i3" rel="nofollow noreferrer">Micro Swiss all metal hot-end</a>, machined lever, and <a href="https://www.wanhaouk.com/products/extruder-drive-gear" rel="n...
<p>The Micro Swiss hotend uses an all metal hotend. These type of hotends are more difficult to operate considering they do not have a Teflon liner that shields the filament from heat exchange from the cold end (the Teflon/PTFE tube acts as an insulator). From <a href="https://www.proto-pasta.com/blogs/how-to/avoid-clo...
<p>The Micro Swiss hotend uses an all metal hotend. These type of hotends are more difficult to operate considering they do not have a Teflon liner that shields the filament from heat exchange from the cold end (the Teflon/PTFE tube acts as an insulator). From <a href="https://www.proto-pasta.com/blogs/how-to/avoid-clo...
1,062
<p>I've recently had my PC upgraded to Vista, which means it includes IIS7. The problem is that the ASP.NET website we're working on doesn't work anymore. I get an error because the application is trying to connect to the SQL Server with NT AUTHORITY/ANONYMOUS LOGON instead of my domain user, and anonymous isn't author...
<p>I believe I have found a/the solution. At least it's working now. This is what I did:</p> <ul> <li>The website is now running in a seperate application pool with Managed Pipeline mode set to classic, Load userprofile set to False and Identity set to custom and using a domain user (and password) that has access to t...
<p>I'm sorry to say I can't look into the issue any further. Indeed, it probably is something with the way we connected to SQL Server (Win Auth) because we've changed it now. Now we connect with username and password in the connection string and it's solved. So I can't really say if you provided the answer, msvcyc, but...
36,868
<p>Is it quicker to make one trip to the database and bring back 3000+ plus rows, then manipulate them in .net &amp; LINQ or quicker to make 6 calls bringing back a couple of 100 rows at a time?</p>
<p>It will entirely depend on the speed of the database, the network bandwidth and latency, the speed of the .NET machine, the actual queries etc.</p> <p>In other words, we can't give you a truthful general answer. I know which sounds easier to code :)</p> <p>Unfortunately this is the kind of thing which you can't ea...
<p>Well, the answer is always "it depends". Do you want to optimize on the database load or on the application load? </p> <p>My general answer in this case would be to use as specific queries as possible at the database level, therefore using 6 calls. </p>
28,373
<p>Calling <code>Validate()</code> on an <strong>XmlDocument</strong> requires passing in a <code>ValidationEventHandler</code> delegate. That event function gets a <code>ValidationEventArgs</code> parameter which in turn has an <code>Exception</code> property of the type <code>XmlSchemaException</code>. Whew!</p> <...
<p>Because the Validate method takes the ValidationEventHandler delegate, it is left up to the developer to decide what to do with the excpetion. What you are doing is correct.</p>
<p>Passing <code>null</code> for the <code>validationEventHandler</code> parameter will throw an exception if there are any errors.</p> <p>The MSDN documentation for the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.xml.schema.extensions.validate?#System_Xml_Schema_Extensions_Validate_System_Xml_Linq_XD...
18,861
<p>I need to access a network resource on which only a given Domain Account has access. I am using the LogonUser call, but get a "User does not have required priviliege" exception, as the web application is running with the asp.net account and it does not have adequate permissions to make this call.</p> <p>Is there a ...
<p>Just calling LogonUser is not enough. You need to impersonate that user. You can impersonate for just the access to the network resource.</p> <p>Sample code can be found on <a href="http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx" rel="noreferrer">MSDN</a>.</p>
<p>I've only had intimate experience with this under 1.1, so things might hav changed in the 2.0 days but... We've got an app that gets deployed in intranet scenarios, and we strike the same thing. We run with identity impersonate turned on, forms mode authentication, anonymous access turned off. The easiest way to con...
28,902
<p>I am using the <a href="http://www.sqlite.org/" rel="nofollow noreferrer">SQLite</a> database and have the following persistent class (simplified):</p> <pre><code>public class Project { public virtual int Id { get; set; } public virtual DateTime StartDate { get; set; } } </code></pre> <p>which is mapped to...
<p>If you're regularly querying against months, days, years, you shouldn't really be storing your date as a DateTime column - it makes the queries incredibly inefficient. You could easily create a "Month" column and query against that (and your DBA would love you again)</p>
<p>from Project p where p.StartDate.ToString("M");</p>
40,968
<p>I'm using Visual C++ (VS2005) and compiling the project in Multibyte Character Set (MBCS). However, the program needs to communicate with a webapp (which is in utf-8) via XMLRPC. So I'm thinking maybe I can use MBCS internally and convert the strings to utf-8 before sending them to the xmlrpc module and converting t...
<p>You could try <a href="http://msdn.microsoft.com/en-us/library/5d7tc9zw(VS.80).aspx" rel="nofollow noreferrer">wcstombs</a> / <a href="http://msdn.microsoft.com/en-us/library/k1f9b8cy(VS.71).aspx" rel="nofollow noreferrer">mbstowcs</a>.</p>
<p>You can also use CT2A and pass CP_UTF8 as the code page, e.g.:</p> <pre><code>CT2A pszUTF8(_T("My DBCS string"), CP_UTF8); // pszUTF8.m_psz contains the UTF8 string. </code></pre> <p>To go back again:</p> <pre><code>CA2T pszT(_T("My UTF8 string"), CP_UTF8); // pszT.m_psz contains the TCHAR string. </code></pre>
49,022
<p>I have objects that are defined by the Entity Framework that I have then added additional methods and properties to via partial classes. I think I understand most of the limitations around doing this, but wanted to confirm something I am seeing (or hopefully learn what I need to do to make this work).</p> <p>I hav...
<p>From a Microsoft Forums Post: (<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4133701&amp;SiteID=1&amp;mode=1" rel="nofollow noreferrer">see full post here</a>)</p> <blockquote> <p>"I think you are asking "How to add a read-only property to an existing entity that is exposed by the EF provid...
<p>I think the problem is that with XML serialization, it only serializes properties with get and set methods. Otherwise it couldn't de-serialize. Add an empty set method to your property and see how you go.</p> <p>Rob</p>
37,642
<p>How do I add the Swedish interactive user, </p> <pre><code>NT INSTANS\INTERAKTIV </code></pre> <p>or the English interactive user, </p> <pre><code>NT AUTHORITY\INTERACTIVE </code></pre> <p>or any other localised user group with <strong>write</strong> permissions to a program folder's ACL?</p> <p>Is this q...
<p>With recent releases of Wix, you can retrieve the localized names of often-used built-in user and group names via a property. For example, <code>WIX_ACCOUNT_NETWORKSERVICE</code> contains the localized name of the Network Service account. Unfortunately, as of 3.0.4513 <code>NT AUTHORITY\INTERACTIVE</code> is not amo...
<p>There is no way <em>as such</em> to add both account names to an ACL since they are one and the same. The name you see corresponds to a SID, and that SID is identical in both the English and Swedish localizations. In the case of the INTERACTIVE group, that SID is <code>S-1-5-4</code>.</p> <p>I haven't followed WiX ...
20,533
<p>When uploading a file (jpeg) via a form in IE7 I am seeing a mime-type of "image/pjpeg" instead of "image/jpeg" (as I see in Firefox or similar). It's easy enough to work around this problem, but I'm just wondering why IE7 is behaving differently in this case?</p>
<p>I believe it's because the JPEG you're working with is a progressive JPEG, which has a different mime-type.</p>
<p>There is same problem with png:</p> <p>IE7: image/x-png Normal browsers: image/png</p> <p>;)</p>
14,107
<p>I've been trying to code a Perl script to substitute some text on all source files of my project. I'm in need of something like:</p> <pre><code>perl -p -i.bak -e "s/thisgoesout/thisgoesin/gi" *.{cs,aspx,ascx} </code></pre> <p>But that parses <strong>all</strong> the files of a directory <strong>recursively</strong...
<p>If you assign <code>@ARGV</code> before using <code>*ARGV</code> (aka the diamond <code>&lt;&gt;</code>), <code>$^I</code>/<code>-i</code> will work on those files instead of what was specified on the command line.</p> <pre><code>use File::Find::Rule; use strict; @ARGV = (File::Find::Rule-&gt;file()-&gt;name('*.cs...
<p>Thanks to ephemient on this question and on <a href="https://stackoverflow.com/questions/125171/passing-a-regex-substitution-as-a-variable-in-perl#125329">this answer</a>, I got this:</p> <pre><code>use File::Find::Rule; use strict; sub ReplaceText { my $regex = shift; my $replace = shift; @ARGV = (Fi...
30,904
<p>I'm interested in building a PC for a car that will boot off of a USB flash drive. I'm planning on using <a href="http://en.wikipedia.org/wiki/Windows_Preinstallation_Environment" rel="nofollow noreferrer">Windows PE</a> 2.0 for it with the GUI being written in C# or VB.NET.</p> <p>Obviously, for this to work, I'd ...
<p><strong>auto</strong> keyword for variable type inferencing</p>
<p>for the moment I have liked much of C++0x that I have played with:</p> <ul> <li>nullptr</li> <li>static_assert</li> <li>lambdas</li> <li>shared_ptr and weak_ptr </li> <li>unique_ptr</li> <li>decltype and auto</li> </ul> <p>I havent tried <code>&lt;regexp&gt;</code>... I thought it was a huge idea... but I didn't e...
16,670
<p>How does one combine several resources for an application (images, sounds, scripts, xmls, etc.) into a single/multiple binary file so that they're protected from user's hands? What are the typical steps (organizing, loading, encryption, etc...)?</p> <p>This is particularly common in game development, yet a lot of t...
<p>do as Java: pack it all in a zip, and use an filesystem-like API to read directly from there.</p>
<p>Short answer: yes.</p> <p>In Mac OS 6,7,8 there was a substantial API devoted to this exact task. Lookup the "Resource Manager" if you are interested. Edit: So does the <A href="http://root.cern.ch/" rel="nofollow noreferrer">ROOT</A> physics analysis package.</p> <p>Not that I know of a good tool right now. What ...
25,224
<p>I talked to a few friends who say that Drupal is amazing, and it is a way better than Joomla. What are the major differences/advantages?</p>
<p>The general consensus is that programmers prefer Drupal whereas mere mortals prefer Joomla. Joomla is praised for having a simpler user interface. (I personally don't agree with that; I think Joomla's UI is pretty painful to use. But then again, I'm looking at it with a programmer's eye.) Drupal, on the other hand, ...
<p>What I like about Drupal is the plugin model: you have your core of drupal, and you can customize it however you want it by creating your own seperate template directory and modules (the plugins).</p> <p>For a complete technical overview you can also tick Drupal and Joomla in <a href="http://www.cmsmatrix.org/matri...
8,924
<p>I'm looking for some good ideas for a simple 3d graphics program as my final project for an intro to computer graphics class. As for some background information, we'll be using opengl and will have a little over a month to work on it, so nothing too far-fetched. The simpler and "prettier" looking, the better. It ...
<p>A 3D text/code editor. Text is 3D, errors stand out, code indentations not only indent, but protrude on z axis, pages/files are 3D and can be flipped like a ringpad.</p> <p>Probably not useful, but fun and more interesting than a game IMO.</p> <p><img src="https://i.stack.imgur.com/i7fRf.jpg" alt="Alt text"></p>
<p>I would check <a href="https://en.wikipedia.org/wiki/Panda3D" rel="nofollow noreferrer">Panda3D</a> or <a href="https://en.wikipedia.org/wiki/Pygame" rel="nofollow noreferrer">Pygame</a>.</p> <p>Panda3D is probably close to what you are looking for, and one idea that always works is to put the user's face in the ma...
23,503
<p>I have a multi-user ASP.NET app running against SQL Server and want to have StoredProcA create a #temptable temp table - not a table variable - to insert some data, then branch to StoredProcB, StoredProcC, and StoredProcD to manipulate the data in #temptable per business rules. </p> <p>The web app uses connection p...
<p>Connection pooling (with any modern version of SQL Server) will call <a href="http://msdn.microsoft.com/en-us/library/ms187961.aspx" rel="noreferrer"><code>sp_reset_connection</code></a> when reusing a connection. This stored proc, among other things, <a href="https://stackoverflow.com/questions/596365/what-does-sp-...
<p>Temp tables get created with name mangling under the hood so there shouldn't be conflicts between different stored procedure calls.</p> <p>If you need to manipulate the same temp data in subsequent stored procedure calls, it's best to just go with a real table and use some sort of unique identifier to make sure you...
17,130
<p>I would like to set up a localhost server to test my site on in sql server 2005. I just installed sql server 2005 and I have never set up a database in this before. There is a login screen and I tried everything and it will not let me log into anything. What are the steps I need to do to get this to work. Thanks</p>...
<p>I was getting the same error message and it was resolved when i put server name as "(local)\SQLEXPRESS" (SQLEXPRESS is the default named instance for SQL Server installation. If you have changed it you can use that instead of this) and keeping windows authentication as the default authentication method.</p> <p>Rega...
<p>Assumptions:</p> <ul> <li>sql2005 is installed on your localhost</li> <li>u can connect to it via Query analyzer or Sql Server Management Studio?</li> <li>when the login prompt starts up, u have two options for authentication -> Windows authentication or Sql Server Authentication.</li> </ul> <p>If those assumptio...
37,608
<p>I want to create a serve resampled (downsized) version of images using jsp. The original images are stored in the database as blobs. I want to to create a jsp that serves a downsampled image with decent quality (not pixelated) as per the passed image width/height (e.g. getimage.jsp?imageid=xxxx&amp;maxside=200) . Ca...
<p>I bet real Perl hackers will tear this apart, but here it goes nonetheless.</p> <pre><code>use strict; use warnings; use List::Util 'shuffle'; my @lines = (); my $bufsize = 512; while(&lt;STDIN&gt;) { push @lines, $_; if (@lines == $bufsize) { print shuffle(@lines); undef @lines; } } pr...
<p>This perl snippet does the trick : </p> <pre><code>#! /usr/bin/perl # randomize cat # fisher_yates_shuffle code copied from Perl Cookbook # (By Tom Christiansen &amp; Nathan Torkington; ISBN 1-56592-243-3) use strict; my @lines = &lt;&gt;; fisher_yates_shuffle( \@lines ); # permutes @array in place foreach m...
36,443
<p>I want to create maintainable code, but this inheritance situation is causing me problems.</p> <p>The issue is with my 2nd database helper class named <b>InitUserExtension</b>.</p> <p>Since UserExtension inherits from User, I have to make sure that I <b>mirror</b> any changes in my InitUser helper to InitUserExten...
<p>How about moving the processing of Name etc into a method (accepting either a User or a T : User), and call that from both?</p> <pre><code>private static void InitUser(User user, SqlDataReader dr) { // could also use an interface here, or generics with T : User user.Name = Convert.ToString(dr["name"]); user.Age...
<p>I'm not sure why you haven't placed the assignation code within the classes themselves, but it may have to do with how you're getting the information to store it...</p> <p>My solution would be to rewrite it something like:</p> <pre><code>public class User { public string Name {get; set; } public string Age...
41,936
<p>I have a "Date of Birth" field, and trying to use the <code>timespan()</code> method to get the age in years. But returns "28 Years, 2 Months, 2 Weeks, 3 Days, 15 Hours, 16 Minutes".</p> <p>Any idea how I can just get the "28 Years" portion?</p>
<p>I suggest you use PHP's strftime() function. Instead of using the CI's timespan().</p> <p><code>echo strftime('%Y', 1226239392);</code></p>
<h2>There are many ways to do this, with the string in $date, like so:</h2> <pre><code>$date = '28 Years, 2 Months, 2 Weeks, 3 Days, 15 Hours, 16 Minutes'; </code></pre> This will give you &quot;28 Years&quot; <pre><code>$yearsPart = substr($date, 0, strpos($date, 'Years') + 5); </code></pre> So will this: <pre><code>$...
20,216
<p>(Jeopardy-style question, I wish the answer had been online when I had this issue)</p> <p>Using Java 1.4, I have a method that I want to run as a thread some of the time, but not at others. So I declared it as a subclass of Thread, then either called start() or run() depending on what I needed.</p> <p>But I found ...
<p>This is a known bug in Java 1.4: <a href="http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=5869e03fee226ffffffffc40d4fa881a86e3:WuuT?bug_id=4533087" rel="noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=5869e03fee226ffffffffc40d4fa881a86e3:WuuT?bug_id=4533087</a></p> <p>It's fixed in Java 1....
<p>Let's see if we could get nearer to the core of the problem:</p> <p>If you start your program (lets say) 1000 x using start(), then 1000 x using run() in a thread, do both loose memory? If so, then your algorithm should be checked (i.e. for outer objects such as Vectors used in your Runnable).</p> <p>If there is n...
13,320
<p>For the purpose of cleaning, I need an aggressive solvent for cured or partially cured resin that will degrade resin down to its liquid state. I'm looking for one that would eat out specifically resin (I'm using regular Anycubic green resin) in a rapid fashion but would leave painted / metallic parts and screen of m...
<p>Concentrated nitric acid will remove all organics, including your skin, wire insulation, etc. It will work on a glass plate, but the fumes would eventually damage the plastics on your printer unless you remove the glass plate to clean it. Nitric acid will destroy most build surfaces that are added to glass. To a ...
<p>I would try hexane, and then Dichloromethane and if those did not work, I would heat up sodium hydroxide to about 70-90 °C. These would work better if you print in PLA resin, it's available from a few sources now.</p> <p>Bucktown polymers and 3Dresyns both have a water-soluble resin. You could also print, make a sof...
1,789
<p>I'm trying to compile/link a <strong>very</strong> old piece of software on a linux system and I can't for some reason link with a shared library that's installed on my system.</p> <p>I get the following error from the linker:</p> <pre><code>/usr/bin/ld: cannot find -lXaw </code></pre> <p>However, the lib itself ...
<p>The linker may be looking, literally, for "libXaw.so". Is that in /usr/lib? If not, you could try adding it as another soft link from libXaw7.so.7.0.0.</p>
<p>To link it, you need the .a file, NOT the .so file, which is the runtime library. The shared object is only useful to a program already linked against the non-shared parts of a library. This is typically distributed in a ".a" file.</p>
23,786
<p>I'm already using SVN 1.5, both sever(VisualSVN 1.5.1) and client-side(TortoiseSVN 1.5.1) but we are using a fairly lengthy SVN Branch-Merge dance.</p> <p>How ready is the Merge-Tracking facility of SVN 1.5.x and is it yet possible to use it from TortoiseSVN?</p>
<p>Subversion releases are generally pretty solid, version 1.5 has been in the works for 2 years. That being said, there are always some <a href="http://subversion.tigris.org/svn_1.5_releasenotes.html#mt-known-issues" rel="noreferrer">known issues</a>.</p>
<p>It is productive. You can see the merged revision in the Log-Dialog and the reintegrate merge works fine.</p> <p>However, there is no graphical representation of the merges inside revision graph and according to stephan Küng there will be no merge info in revision graph due to performance reasons.</p> <p>The merge...
20,940
<p>How do I pass an array I have created on the server side onto the client side for manipulation by Javascript?</p> <p>Any pseudo code will help</p>
<p>You'll need to embed it as a javascript array declaration into the page. There are a number of ways to do this, but it generally means turning the array into text that you write to the page, probably using the ClientScriptManager.</p> <p>I'm hoping for better javascript integration in a upcoming verison of ASP.Net...
<p>Easiest way is to convert it to json. Then just put it at the top of the page in a variable. I've found this the best json implementation for .net: <a href="http://litjson.sourceforge.net/" rel="nofollow noreferrer">http://litjson.sourceforge.net/</a></p>
42,891
<p>I've heard from someone that they´re using a business process automation tool (like Weblogic Integration) as a programming language (what sounds like something kind of stupid) to make things declarative. Then they put all the logic inside a process, every single <code>if</code> and <code>while</code>.</p> <p>But, i...
<p>Orchestration languages are in fact <a href="http://en.wikipedia.org/wiki/Imperative_programming" rel="nofollow noreferrer">imperative scripting languages</a> with conditionals, looping and other traditionally imperative constructs, typically expressed through a flowchart-based user interface. They certainly do not...
<p>Orchestration languages are in fact <a href="http://en.wikipedia.org/wiki/Imperative_programming" rel="nofollow noreferrer">imperative scripting languages</a> with conditionals, looping and other traditionally imperative constructs, typically expressed through a flowchart-based user interface. They certainly do not...
42,192
<p>I am working on an ASP.NET application. I need to use some third party component (do not have the source code) that is unverifiable (I think it is written in managed c++).</p> <p>I am wondering if this can cause problems for the customers. The ASP.NET application can be installed on the customers servers or potenti...
<p>You have to test these yourself. Potentially the problems that can crop up are:</p> <ul> <li>Improper registering of COM DLLs -- you have to test your application installer to make sure this doesn't happen</li> <li>Registry complications - some third party components set registry entries that can only be entered us...
<p>First of all you have to ensure that you're using the same .NET Framework version as your customer. Also note the dependencies/requirements of that third party component; if those are not present in your customer's machines then it won't work.</p>
17,765
<p>When I call a SSIS package using LoadPackage() from a .aspx page (or windows service), how do I setup permissions for it to work?</p> <p>Event viewer is reporting a Sql server error:</p> <p>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Reason: Failed to open the explicitly specified database. [CLIENT: 192....
<p>I don't think you should change permissions for NETWORK SERVICE. That will increase the security risks of your Sql Server, as compromise of ASP.NET or any other service running as NETWORK SERVICE will compromise Sql Server. There are also reliability issues with running SSIS inside ASP.NET process.</p> <p>I would s...
<p>Grant it access <a href="http://msdn.microsoft.com/en-us/library/ms998320.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms998320.aspx</a></p>
49,169
<p>What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Application? Similar to <a href="https://stackoverflow.com/questions/18421/best-way-to-bind-windows-forms-properties-to-applicationsettings-in-c">this question</a>, how (and is it possible to)...
<p>You can directly bind to the static object created by Visual Studio.</p> <p>In your windows declaration add:</p> <pre><code>xmlns:p="clr-namespace:UserSettings.Properties" </code></pre> <p>where <code>UserSettings</code> is the application namespace.</p> <p>Then you can add a binding to the correct setting:</p> ...
<p>Also read <a href="http://www.hanselman.com/blog/LearningWPFWithBabySmashConfigurationWithDataBinding.aspx" rel="nofollow noreferrer">this</a> article on how it is done in BabySmash</p> <p>You only need to back the Settings with DO (Like Alan's example) if you need the change notification! binding to the POCO Setti...
18,676
<p>The leaving your wireless network open question reminded me of this.</p> <p>I typically share the root drive on my machines across my network, and tie login authorization to the machines NT ID, so there is at least some form of protection.</p> <p>My question, how easy is it to gain access to these drives for ill g...
<p>If this is a home network with no wifi or secured wifi, it's probably not an issue. Your isp will almost certainly prevent anyone from trying anything via the larger web.</p> <p>If you have open wifi, then there's a little more cause for concern. If it's properly secured so that some authentication is required, y...
<p>I can't answer the main question, but do keep in mind that Windows, by default, is always sharing the roots of your drives. Try:</p> <pre><code>\\yourmachine\c$ </code></pre> <p>(And then try not to freak out.)</p>
5,298
<p>Everywhere I look always the same explanation pop ups.<br/> Configure the view resolver.</p> <pre><code>&lt;bean id="viewMappings" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"&gt; &lt;property name="basename" value="views" /&gt; &lt;/bean&gt; </code></pre> <p>And then put a fil...
<p>ResourceBundleViewResolver uses the key/vals in views.properties to create view beans (actually created in an internal application context). The name of the view bean in your example will be "logout" and it will be a bean of type JstlView. JstlView has an attribute called URL which will be set to "WEB-INF/jsp/logout...
<p>To answer your question <code>logout</code> is the view name obtained from the ModelAndView object returned by the controller. If your are having problems you many need the following additional configuration.</p> <p>You need to add a servlet mapping for <code>*.htm</code> in your <code>web.xml</code>:</p> <p><pre>...
13,019
<p>Being relatively new to functional programming, I expend lots of energy wondering “is this the functional way to do things?” Obviously recursion vs. iteration is pretty straightforward and it’s obvious that recursion is the functional way of doing things. But take closures for instance. I’ve learned about closures ...
<p>You're right, using closures to manipulate state is not purely functional. Lisp allows you to program in a functional style, but it doesn't force you to. I actually prefer this approach because it allows me to strike a pragmatic balance between purely functional and the convenience of modifying state.</p> <p>What y...
<p>Common Lisp and Scheme are not purely functional. Clojure is mostly functional, but still not purely. Haskell is the only language I know that is purely functional, I can't even mention the name of another one.</p> <p>The truth is that working in a purely functional environment is very hard (go, learn Haskell and t...
37,466
<p>Is there any advantage of using</p> <p><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html" rel="noreferrer"><strong>java.util.concurrent.CountdownLatch</strong></a> </p> <p>instead of</p> <p><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Semaphore....
<p><code>CountDownLatch</code> is frequently used for the exact opposite of your example. Generally, you would have many threads blocking on <code>await()</code> that would all start simultaneously when the countown reached zero.</p> <pre><code>final CountDownLatch countdown = new CountDownLatch(1); for (int i = 0; i ...
<p><code>CountdownLatch</code> makes threads wait on the <code>await()</code> method, until such a time as the count has reached zero. So maybe you want all your threads to wait until 3 invocations of something, then all the threads can go. A <code>Latch</code> generally can not be reset.</p> <p>A <code>Semaphore</c...
22,271
<p>I have a table "A" with 2 columns "Foo" and "Bar". I have a formula with the structured reference A[Foo]. When I fill this formula horizontally I want the reference to stay A[Foo] but now, in the second column, the reference turns to A[Bar]. Is there a way to make this structured reference absolute? </p> <p>It'd be...
<p>there is a difference between copying and dragging. Dragging is also called "filling" formulas. On <a href="https://support.office.com/en-us/article/Using-structured-references-with-Excel-tables-a547e45e-3589-4417-b611-abb7e5d3f912" rel="nofollow noreferrer">Microsoft's support website</a> you will find the followin...
<p>It seems that if you hold down Ctrl while copying the formulas, it will remain static/absolute.</p> <p><a href="http://office.microsoft.com/en-us/excel/HA101556861033.aspx" rel="nofollow noreferrer">http://office.microsoft.com/en-us/excel/HA101556861033.aspx</a></p>
47,529
<p>I got a Wanhao Duplicator 6 printer branded as a Monoprice Ultimate about a year an and a half ago, 6 months after I got it I decided I hated the buildplate (I had to use a gluestick on every print to get it to stay down) so I removed the original fake buildtak, and got a piece of borosilicate glass and a sheet of P...
<p>Looking at the picture, the first thing that came to mind was, "are you sure it's the bed?". </p> <p>The height variance looks very regular, and while I'm unfamiliar with this printer's specific mechanics, my thought process trended to the Ender 3 and other v-wheel extruder mounts. If the extruder and gantry carria...
<p>From experience, my PEI sheet did not stay flat after multiple use, this may be causing the problems you are facing. It could be the adhesive is failing on different locations. </p> <p>As you mention, a new sheet of PEI may work for you; indeed the glass will not be necessary then, glueing it directly onto the alum...
1,501
<p>Per this page <a href="http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx" rel="noreferrer">http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx</a> "Top-down deletion" is an implementation of a red-black tree node removal that pro-actively balances a tree by pushing a ...
<p>From what I gather: "top-down deletion" avoids traversing the same node in a path more than once during the operation. So, given the simple path from the root to a given node, if you're going to do some thing to a node that's in that path anyway, why not just do it on the way down? It avoids having to traverse over ...
<p>From what I gather: "top-down deletion" avoids traversing the same node in a path more than once during the operation. So, given the simple path from the root to a given node, if you're going to do some thing to a node that's in that path anyway, why not just do it on the way down? It avoids having to traverse over ...
47,600
<p>The e3D volcano features an extended heater block of length 20&nbsp;mm with the cartridge heater running parallel to the filament.</p> <p>The purpose of this is to increase the speeds at which filament can be printed (of course the extruder and other factors may still be limiting factors).</p> <p>My question is ho...
<p>Speaking from first hand experience running a Volcano hotend, mostly using a 0.6&nbsp;mm nozzle, but I have used 0.4&nbsp;mm as well. I can't really complain about any lower printing speed limit (low speeds are usually a solution to high speeds problems for me).</p> <p>Just for completeness: I am using a DaVinci 1....
<p>The worry must be about oozing and stringing. In general, no worries! Nothing a bit of tuning would not fix.</p> <p>I have experience printing with Volcano with 0.4, 0.6, 0.8, and 1.0&nbsp;mm diameter. PLA, PETG, Nylon, TPE, and TPU. (Volcano nozzles have been my default style for several years now. I don't even o...
1,582
<p>How can I mount a floppy image file using cygwin. I would like to mount the image, copy a file to the mounted drive, and then unmount it from the command line. </p> <p>I know you can use <a href="http://chitchat.at.infoseek.co.jp/vmware/vfd.html#beta" rel="nofollow noreferrer">Virtual Floppy Drive</a> in windows,...
<p>Can't you just use Virtual Floppy Drive? Cygwin doesn't really do filesystems; it lets Windows take care of that.</p>
<p>Cygwin is just a standard Win32 DLL, it relies on windows kernel for everything related to file-systems. This means it cannot <em>mount</em> or <em>unmount</em> anything by itself. However, you can still read and write to floppy images from the command line using <a href="https://www.gnu.org/software/mtools/" rel="n...
14,934
<p>Using MS SQL Server Management Studio 2005 - To Restore a Database:</p> <ul> <li>Restore Database</li> <li><code>(*) From Device:</code></li> <li>Click "<code>...</code>" Button</li> <li><code>Backup media: File</code> </li> <li>Click "<code>Add</code>" Button</li> <li>Popup Window: "<code>Locate Backup File</cod...
<p>In the registry, edit the <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\BackupDirectory</code> value to point to <code>d:\data\databases</code></p>
<p>For convenience, here's a reg file entry to do this:</p> <pre><code>Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer] "BackupDirectory"="D:\\data\\databases\\" </code></pre>
15,085
<p>I have a multi-threaded application that is hanging on a call to _dl_sysinfo_int80(). According to gdb, all threads are stuck in this call.</p> <p>The top of the stack trace looks like:</p> <pre><code>#0 0x002727a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x004f23de in __lll_mutex_lock_wait () from /l...
<p>int 80 is the software interrupt to make a kernel level system call. My guess is that pthread is doing a call in to the kernel that is hanging. There could be any number of reasons for why all of your threads would hang on a mutex like this:<br> - The mutex is locked by another thread that exited without releasi...
<p>SoapBox is right - you're going to have to hook up a kernel debugger to figure out the kernel half of the callstack and find out what's really blocking</p>
39,061
<p>I am totally new to <code>SQL</code>. I have a simple select query similar to this:</p> <pre><code>SELECT COUNT(col1) FROM table1 </code></pre> <p>There are some 120 records in the table and shown on the <code>GUI</code>. For some reason, this query always returns a number which is less than the actual count.</p> ...
<p>You might have some null values in col1 column. Aggregate functions ignore nulls. try this </p> <pre><code>SELECT COUNT(ISNULL(col1,0)) FROM table1 </code></pre>
<p>You are getting the correct count</p> <p>As per <a href="https://learn.microsoft.com" rel="nofollow noreferrer">https://learn.microsoft.com</a> </p> <p>COUNT(*) returns the number of items in a group. This includes NULL values and duplicates.</p> <p>COUNT(ALL expression) evaluates an expression for each row in a ...
20,489
<p><a href="/questions/61400/what-makes-a-good-unit-test">What Makes a Good Unit Test?</a> says that a test should test only one thing. What is the benefit from that?</p> <p>Wouldn't it be better to write a bit bigger tests that test bigger block of code? Investigating a test failure is anyway hard and I don't see hel...
<p>I'm going to go out on a limb here, and say that the "only test one thing" advice isn't as actually helpful as it's sometimes made out to be.</p> <p>Sometimes tests take a certain amount of setting up. Sometimes they may even take a certain amount of <em>time</em> to set up (in the real world). Often you can test t...
<p>Disclaimer: This is an answer highly influenced by the book "xUnit Test Patterns".</p> <p>Testing only one thing at each test is one of the most basic principles that provides the following benefits:</p> <ul> <li><strong>Defect Localization</strong>: If a test fails, you immediately know why it failed (ideally wit...
29,088
<p>I need a (php) regex to match Yahoo's username rules:</p> <blockquote> <p>Use 4 to 32 characters and start with a letter. You may use letters, numbers, underscores, and one dot (.).</p> </blockquote>
<pre><code>/^[A-Za-z](?=[A-Za-z0-9_.]{3,31}$)[a-zA-Z0-9_]*\.?[a-zA-Z0-9_]*$/ </code></pre> <p>Or a little shorter:</p> <pre><code>/^[a-z](?=[\w.]{3,31}$)\w*\.?\w*$/i </code></pre>
<p>Using lookaheads you could do the following: </p> <pre><code>^(?=[A-Za-z](?:\w*(?:\.\w*)?$))(\S{4,32})$ </code></pre> <p>Because you didn't specify what type of regex you needed I added a lot of Perl 5 compatible stuff. Like <code>(?: ... )</code> for non-capturing parens.</p> <p><strong>Note:</strong> I added th...
20,393
<p>I am looking for a query that will work on Sharepoint 2003 to show me all the documents created/touched by a given userID.</p> <p>I have found tables with the documents (Docs) and tables for users (UserInfo, UserData) but the relationship between seems a bit odd - there are 99,000 records in our userdata table, and...
<p>I've never looked at the database in SharePoint 2003, but in 2007 UserInfo is connected to Sites, which means that every user has a row in UserInfo for each site collection (or the equivalent 2003 concept). So to identify what a user does you need both the site id and the user's id within that site. In 2007, I wou...
<p>You really shouldn't be doing SELECTs with Locks either i.e. adding WITH (NOLOCK) to your queries. Some parts of the system are very timeout sensitive and if you start introducing locks that the system wasn't expecting you can see the system freak out.</p> <p>But really, you should be doing this via the object mod...
35,601
<p>I am analyzing a .dmp file that was created and I have a call stack which gives me a lot of info. But I'd like to double click on the call stack and have it bring me to the source code. </p> <p>I can right click on the call stack and select symbol settings.. where I can put the location to the PDB. But there is ...
<p>The source code directory is unfortunately hard coded into the pdb's however if you know the folders required you can use windows concept of symbolic links, junctions.</p> <p>I use the tool <a href="http://www.rekenwonder.com/linkmagic.htm" rel="nofollow noreferrer">Junction Link Magic</a></p>
<p>After loading the PDB, manually navigate to the source file that matches the current execution location. A PDB contains the path and filename of the source files that built its associated binary, and I suspect the debugger is smart enough to hook things up when it notices that the filename being displayed and the f...
20,008
<p>Ok, this is a curly one. I'm working on some Delphi code that I didn't write, and I'm encountering a very strange problem. One of my stored procedures' parameters is coming through as <code>null</code>, even though it's definitely being sent <code>1</code>.</p> <p>The Delphi code uses a TADOQuery to execute the sto...
<p>In my programs, I have <strong>lots</strong> of code very similar to your first snippet, and I haven't encountered this problem.</p> <p>Is that <strong>actually</strong> your code, or is that how you've represented the problem for us to understand? Is the text for the SQL stored in your DFM or populated dynamically...
<p>caveat: i don't know delphi, but this issue rings a faint bell and so i'm interested in it</p> <p>do you get the same result if you use a TADOStoredProc instead of a TADOQuery? <a href="http://www.podgoretsky.com/ftp/Docs/Delphi/D5/dg/ado_comp.html" rel="nofollow noreferrer">see delphi 5 developers guide</a></p> <...
16,635
<p>I'm trying to do a custom button to my form (which has FormBorderStyle = none) using Visual Studio 2005. I have my 3 states button images in an ImageList linked to the button.</p> <pre><code>this.btnClose.AutoSize = false; this.btnClose.BackColor = System.Drawing.Color.Transparent; this.btnClose.BackgroundImageLayo...
<p>The grey background is due to the setting of "System.Windows.Forms.FlatStyle.Flat", it's the default behaviour, since it need to highlight the button when you hover. To eliminate that, you might have to write a custom button class, inherit from the original button and do some custom painting to achieve that.</p> <p...
<p>To solve the problem, Set the MouseOverBackColor to transparent inorder to remove the grey backgroud.</p>
23,702
<p>I often use the "top" command to see what is taking up resources. Mostly it comes up with a long list of Apache httpd processes, which is not very useful. Is there any way to see a similar list, but such that I could see which PHP scripts etc. those httpd processes are actually running?</p>
<p>If you're concerned about long running processes (i.e. requests that take more than a second or two to execute), you'll be able to get an idea of them using Apache's mod_status. See the <a href="http://httpd.apache.org/docs/2.0/mod/mod_status.html" rel="nofollow noreferrer">documentation</a>, and an <a href="http:/...
<p>The php scripts happen so fast, top wouldn't show you very much. Or it would zip by quite quickly. Most webrequests are quite quick.</p> <p>I think your best bet would be to have some type of real time log processor, that kept an eye on your access logs and updates stats for you of average run time, memory usage an...
17,686
<p>I need to calculate <code>Math.exp()</code> from java very frequently, is it possible to get a native version to run faster than <strong>java</strong>'s <code>Math.exp()</code>??</p> <p>I tried just jni + C, but it's slower than just plain <strong>java</strong>.</p>
<p>+1 to writing your own exp() implementation. That is, if this is <em>really</em> a bottle-neck in your application. If you can deal with a little inaccuracy, there are a number of extremely efficient exponent estimation algorithms out there, some of them dating back centuries. As I understand it, Java's exp() imp...
<p>Since the Java code will get compiled to native code with the just-in-time (JIT) compiler, there's really no reason to use JNI to call native code.</p> <p>Also, you shouldn't cache the results of a method where the input parameters are floating-point real numbers. The gains obtained in time will be very much lost ...
9,191
<p>The <a href="http://code.google.com/p/v8/wiki/BuildingOnWindows" rel="nofollow noreferrer">build instructions of V8 JavaScript Engine</a> mention only Visual Studio 2005 and 2008. Has anybody been successful with <a href="http://mingw.org/" rel="nofollow noreferrer">MinGW</a> on Windows XP/Vista?</p>
<p>You just need to change Scons a bit.<br> Take a look at C:\YourPythonFolder\Lib\site-packages\scons-YourSconsVersion\SCons\Script__ init__.py and go to line 560.<br> Change the linker to gnulink, the c compiler to mingw and the c++ compiler to g++.<br> Eventually it should look like this:</p> <pre><code>linkers = [...
<p>I've tried, but seems it automatically detect the WIN32 platform and tries to invoke the vc++ compiler, I tried to adding to the PATH the mingw-gcc compiler (I've not vc++ installed) and the build script correctly sees it, but doesn't compile out of the box.</p> <p>I suppose deleting the "WIN32 flag" will do the wo...
42,589
<p>Since the Amazon MP3 store launched in the UK, I really want to write a downloader application for my phone so I can buy mp3s wherever I am and listen to them without hassle. However, first I need to reverse engineer the amazon .azn file format it supplies to the downloader app. The outer layer is obvious, it is sim...
<p>I may well have answered my own question anyway. The software uses OpenSSL for various things, including BIO base 64 decode. I believe the inner layer is actually encrypted (wtf?) However, while the windows version of the downloader statically links to OpenSSL, the Linux version dynamically links to it. This should ...
<p>Be careful here - I'm not sure what kind of laws are enforced in the UK, but in the US an attempt to circumvent copyright protection schemes (in this instance Digital Rights Management) is a violation of the DCMA.</p> <p>That being said, if you are doing this solely for personal/academic use I doubt anyone would mi...
48,847
<p>What object do you query against to select all the table names in a schema in Oracle?</p>
<p>To see all the tables you have access to</p> <pre><code>select table_name from all_tables where owner='&lt;SCHEMA&gt;'; </code></pre> <p>To select all tables for the current logged in schema (eg, your tables)</p> <pre><code>select table_name from user_tables; </code></pre>
<p>You may use:</p> <pre><code>select tabname from tabs </code></pre> <p>to get the name of tables present in schema.</p>
7,427
<p>I need to store app specific configuration in rails. But it has to be:</p> <ul> <li>reachable in any file (model, view, helpers and controllers</li> <li>environment specified (or not), that means each environment can overwrite the configs specified in environment.rb</li> </ul> <p>I've tried to use environment.rb a...
<p>Look at Configatron: <a href="http://github.com/markbates/configatron/tree/master" rel="noreferrer">http://github.com/markbates/configatron/tree/master</a></p> <p>I have yet to use it, but he's actively developing it now, and looks quite nice.</p>
<p>I found a good way <a href="http://kpumuk.info/ruby-on-rails/flexible-application-configuration-in-ruby-on-rails/" rel="nofollow noreferrer">here</a></p>
13,531
<p>I am using LLBL Gen Pro v2.6 and am attempting to create a means of auditing changes made to the database. Now, I know that LLBL Gen has auditing built into it using AuditorBase and dependency injection. The question I have is; I need to track not only the stuff that LLBL Gen exposes as auditable, but also the User ...
<p>I have used LLBLGens Auditing classes. Determining the user is really something that you will have to handle. There are too many variables for LLBLGen to actually do this for you. How are your users handled? Is this a winforms or asp.net application? </p> <p>The best solution would be to store the UserId in a sessi...
<p>We're also about to implement auditing of changes to the db, and have the same issue of adding the user_id to the auditlog. I can see you can do the pull-approach, e.g. fetchingn the user_id from the web session (we're building a web application), but this would completely mess up the layering of the application, as...
39,304
<p>I have an app that executes commands on a Linux server via SSH just fine. When I connect to a Solaris server, things don't work. It seems that the Solaris command line is limited to 267 characters.</p> <p>Is there a way to change this?</p> <p>Update: As was pointed out before, this is a limit to the default she...
<p>I believe (though may be wrong) that's related to the default shell you're connecting to. If you make the change on Solaris to the same shell you're using on Linux, does that fix the problem?</p> <p>Please comment if there's a better route to a solution, and I'll make the change in my answer.</p>
<p>When I run configure on Solaris 10 and the configure script comes up with a figure for the length of the command line, the answer is normally in the 256 KB range. The standard shells on Solaris most certainly do not have a limit under 300 bytes.</p> <p>That said, I'm not sure what your problem is. I might hazard ...
24,720
<p>I have a script that parses the filenames of TV episodes (show.name.s01e02.avi for example), grabs the episode name (from the www.thetvdb.com API) and automatically renames them into something nicer (Show Name - [01x02].avi)</p> <p>The script works fine, that is until you try and use it on files that have Unicode s...
<p>Use a subrange of <code>[\u0000-\uFFFF]</code> for what you want.</p> <p>You can also use the <code>re.UNICODE</code> compile flag. <a href="http://docs.python.org/lib/re-syntax.html" rel="nofollow noreferrer">The docs</a> say that if <code>UNICODE</code> is set, <code>\w</code> will match the characters <code>[0-9...
<p>\X seems to be available as a generic word-character in some languages, it allows you to match a single character disregarding of how many bytes it takes up. Might be useful.</p>
3,517
<p>Are there any good solutions to represent a parameterized enum in <code>C# 3.0</code>? I am looking for something like <a href="http://www.ocaml.org" rel="nofollow noreferrer">OCaml</a> or <a href="http://www.haxe.org" rel="nofollow noreferrer">Haxe</a> has. I can only think of class hierarchy with a simple enum fie...
<p>Not being familiar with OCaml or Haxe, and not being clever enough to understand the other explanations, I went and looked up the <a href="https://haxe.org/manual/types-enum-instance.html" rel="nofollow noreferrer">Haxe enum documentation</a> - the 'Enum Type Parameters' bit at the bottom seems to be the relevant pa...
<p>C# (the .NET framework in general, as far as I know) doesn't support parametrized enums like Java does. That being said, you might want to look at Attributes. Some of the features that Java enums are capable of are somewhat doable through Attributes.</p>
9,237
<p>I want to start using .NET 3.5 features in an app that is currently stuck in the past - how can I write in support for selected features like JSON serialization in a forward-compatible way?</p> <p>In the case of JSON serialization I need to reference System.ServiceModel.Web - is it OK to reference a .NET 3.5 dll in...
<p>Referencing a .NET 3.5 DLL is not a good idea if your application targets .NET 2.0, as the library you're referencing will likely reference other .NET 3.5 libraries that will not be available on a user's computer if they do not have the .NET 3.5 runtime installed.</p> <p>You can set your project to target .NET 3.5 ...
<p>You can reference any DLL you want, but you may want to explore the reference property setting "Copy Local=True" if you are not going to require the version of framework that the dll came from. </p>
30,590
<p>Suppose you are implementing a publication database and creating migrations to represent different publications. Each publication has a "year" associated with it.</p> <p><code>t.column :year, ???</code></p> <p>Would this year be best represented as an integer, date, or datetime?</p>
<p>I would recommend just going with Rails conventions and doing a <code>Date</code> data type. This way, if you ever <em>do</em> need the month and day, you can retrieve it. Plus, it's simple to do:</p> <pre><code>YourModel.date.year # =&gt; "1999" </code></pre>
<p>Well, if you only care about the <strong>year</strong>, an integer will do just right. If you're not certain that you will never, ever, need month and day, then date, and if you also may need the hour/minute/second, then datetime, but if you need a datetime, it should not be called year :-)</p>
44,145
<p>Does Xcode support anything akin to Visual Studio style <code>#region</code> directives for arbitrary code folding?</p>
<p>No, you can only fold code on various defined scoping levels in Xcode.</p> <p>You can use little tricks to make navigating via the function menu easier, though.</p> <pre><code>#pragma mark </code></pre> <p>Allows you to create a grouping where the label following mark will show up in the function menu. If the lab...
<p>One nice solution I just found:</p> <p>Put your project into one big namespace. Close and reopen this namespace for the individual sections of your source file:</p> <pre><code>namespace myproj { // members of class MyClassA void MyClassA::dosomething() { } void MyClassA::dosomethingelse() { } } // members of cl...
36,726
<p>do you have idea, if there would be some nice way to browse/log JMS queues? (I'm using OpenJMS)</p> <p>For topics I can just add one consumer more and that's about it but with queues I haven't finished with a solution yet. I would like to log all the messages in certain queues and topics without "popping" them from...
<pre><code>/?q=query&amp;fl=field1,field2,field3 </code></pre>
<p>The best way is to run the query from Admin concole. When we run it, it also provides the actuall SQL query executed. Just copy the query and use it.</p> <p>About the question: select specific fields from the table. In the admin console look for 'FL' text box. write the field names you want to retrieve, comma saper...
33,191
<p><a href="http://www.nasa.gov/mission_pages/station/research/experiments/1115.html">This article</a> states that 3D printing has been accomplished in outer space, on the International Space Station.</p> <p>I'm curious as to how this works differently from 3D printing on Earth. Are there any extra measures that neede...
<p>Most likely, the 3D-printers used on ISS does not incorporate some fundamental difference that allow them to print in zero gravity.</p> <p>Some people over at <a href="http://3dprint.com/62797/3d-printing-upside-down/" rel="noreferrer">3Dprint.com</a> raised a very similar question, and figured that when turning th...
<p>To answer your question, you have to consider how the melted filament sticks to the print bed and to other layers, and if gravity has any affect on how it sticks. The answer is that gravity does <em>not</em> have any real affect on the stick-to-itivity of the filament. Instead, the plastic bonds to the print bed sur...
151
<p>I know I can cycle through my tabs using cmd+{ or cmd+}, but is it possible to select a specific tab (i.e. cmd+3 for the third tab in iTerm) in Leopards' Terminal.app? </p>
<p>This is an option. <a href="http://ciaranwal.sh/2007/12/10/tab-switching-in-terminal" rel="noreferrer" title="Tab Switching in Terminal">Tab Switching in Terminal</a></p>
<p>I would highly suggest using <a href="http://www.gnu.org/software/screen/" rel="nofollow noreferrer">GNU Screen</a> if you really need tabs that much. I have a particular .screenrc file that makes life easier, just put the following in your home directory in a file called <code>.screenrc</code>:</p> <pre><code>defs...
20,133
<p>I'm writing a mobile phone game using j2me. In this game, I am using multiple Canvas objects. For example, the game menu is a Canvas object, and the actual game is a Canvas object too. I've noticed that, on some devices, when I switch from one Canvas to another, e.g from the main menu to the game, the screen momenta...
<p>I would say, that using multiple canvases is generally bad design. On some phones it will even crash. The best way would really be using one canvas with tracking state of the application. And then in paint method you would have</p> <pre><code>protected void paint(final Graphics g) { if(menu) { paintMenu(g); ...
<p>Do you use double buffering? If the device itself does not support double buffering you should define a off screen buffer (Image) and paint to it first and then paint the end result to the real screen. Do this for each of your canvases. Here is an example:</p> <pre><code>public class MyScreen extends Canvas { pr...
9,195
<p>I am working on a winforms html editor with multiple editor windows as each editor window will be written to a database field.</p> <p>I am creating the editor windows as a control array and was hoping to just have one toolbar above them that would handle the events such as apply bold, italic... based on the window ...
<p>I think that storing the windows, the HTML editor control or even just an index is the simplest option.</p>
<p>I'm not familiar with the types of events you mention, and I'm probably missing something, but it's common in WinForms development to have events fire and provide information about the sender as well as the event, conforming to the <a href="http://msdn.microsoft.com/en-us/library/system.eventhandler.aspx" rel="nofol...
26,488
<p>Sometimes when running selenium, it displays a message similar to:</p> <blockquote> <p>WARN - Invalid length: Content-Length=798242 written=8192</p> </blockquote> <p>And then Selenium stops responding. The website under automation runs on ASP.NET, and served up via IIS.</p> <p>How do I prevent Selenium from sto...
<p>URLs can be only so long. There are hard limits defined in the RFC. I suspect you're issuing a command that results in a URL that exceeds these limits. You need to debug your Selenium scripts and figure out what's causing the problem rather than suppressing this symptom. </p>
<p>The issue that Selenium Server is complaining about is that the page that was requested included a Content-Length header of 798242 bytes but Selenium only received 8192 bytes of data. I've found that this usually happens when one of your web pages manually writes to the Response stream instead of using the ASP.NET l...
37,843
<p>on any element in the webpage. I need to look at what the element and children elements are.</p> <p>For e.g.</p>
<p><a href="http://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow noreferrer">Firebug's</a> Inspect tool sounds like what you're looking for.</p>
<p>You may also use the Firefox <a href="https://addons.mozilla.org/en-US/firefox/addon/1806" rel="nofollow noreferrer">DOM Inspector</a>. In the app click the icon at the very top left, then on the desired element on the page, and it should scroll automatically to the relevant node in the DOM tree.</p>
30,892
<p>I want to keep multiple web site projects in one solution and I want to publish them all together in one folder. What are the steps to do that? Can I publish the whole solution? I am guessing the solution is only a container that is holding different web site projects. I want to publish all these small web site proj...
<p>It sounds like what you really need is a single web project (and I'd recommend web application projects rather than web "site" projects... but that's another topic).</p> <p>If they all share common authentication and root folder, why separate them?</p>
<p>I would seriously consider merging the projects into 1, especially if they will be using the same authentication system. Once merged, you would be able to use inherited MasterPages to easily give each section it's own "look-and-feel", while still maintaining the site's style.</p>
15,133
<p>Is it possible to, for instance, replace and free a TEdit with a subclassed component instantiated (conditionally) at runtime? If so, how and when it should be done? I've tried to set the parent to nil and to call free() in the form constructor and AfterConstruction methods but in both cases I got a runtime error.</...
<p>This more generic routine works either with a Form or Frame (updated to use a subclass for the new control):</p> <pre><code>function ReplaceControlEx(AControl: TControl; const AControlClass: TControlClass; const ANewName: string; const IsFreed : Boolean = True): TControl; begin if AControl = nil then begin ...
<p>You can actually use RTTI (look in the TypInfo unit) to clone all the matching properties. I wrote code for this a while back, but I can't find it now. I'll keep looking.</p>
14,695
<p>I've been trying to wrap my head around how threads work in Python, and it's hard to find good information on how they operate. I may just be missing a link or something, but it seems like the official documentation isn't very thorough on the subject, and I haven't been able to find a good write-up.</p> <p>From wha...
<p>Yes, because of the Global Interpreter Lock (GIL) there can only run one thread at a time. Here are some links with some insights about this:</p> <ul> <li><a href="http://www.artima.com/weblogs/viewpost.jsp?thread=214235" rel="noreferrer">http://www.artima.com/weblogs/viewpost.jsp?thread=214235</a></li> <li><a href...
<p>Try to remember that the GIL is set to poll around every so often in order to do show the appearance of multiple tasks. This setting can be fine tuned, but I offer the suggestion that there should be work that the threads are doing or lots of context switches are going to cause problems.</p> <p>I would go so far as...
5,127
<p>How can I set the background color of a specific item in a <em>System.Windows.Forms.ListBox</em>?</p> <p>I would like to be able to set multiple ones if possible.</p>
<p>Probably the only way to accomplish that is to draw the items yourself.</p> <p>Set the <code>DrawMode</code> to <code>OwnerDrawFixed</code> and code something like this on the DrawItem event:</p> <pre><code>private void listBox_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); Graphics g = e...
<pre><code>public MainForm() { InitializeComponent(); this.listbox1.DrawItem += new DrawItemEventHandler(this.listbox1_DrawItem); } private void listbox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { e.DrawBackground(); Brush myBrush = Brushes.Black; var item = listbox1.Items[...
11,718
<p>Here's something I know is probably possible but I've never managed to do<br> In VS2005(C++), While debugging, to be able to invoke a function from the code which I'm debugging.<br> This feature is sometimes essential when debugging complex data structures which can't be explored easily using just the normal capabil...
<p>Ok, Here's what I found<br> CXX0040 means that "<code>The C expression evaluator does not support implicit conversions involving constructor calls.</code>"<br> CXX0047 means that "<code>Overloaded functions can be called only if there is an exact parameter match or a match that does not require the construction of a...
<p>The watch window is limited by the context wherein your current code is, e.g., when your code enters a function and you try to access another function that is hidden from the scope of your current function, it won't work.</p> <p>If you invoke a function in the watch window, make sure that it is visible and accessib...
34,079
<p>Currently, I have a UIView subclass that "stamps" a single 2px by 2px CGLayerRef across the screen, up to 160 x 240 times.</p> <p>I currently animate this by moving the UIView "up" the screen 2 pixels (actually, a UIImageView) and then drawing the next "row".</p> <p>Would using multiple CALayer layers speed up per...
<p>Okay, well, if you want something that has some good examples of CA good that draws things like that and works on the phone, I recommend the <a href="http://mooseyard.com/Jens/2008/03/geekgameboard-getting-closer-to-iphone-ready/" rel="nofollow noreferrer">GeekGameBoard</a> code that Jens Aflke published (it is an i...
<p><em>What CALayer methods are you seeing that don't work on iPhone?</em></p> <p>As one example, I tried implementing the grid demo <a href="http://devblog.brautaset.org/2008/10/01/calayer-grid-with-caconstraintlayoutmanager/" rel="nofollow noreferrer">here</a>, without much luck. It looks like <code>CAConstraintLayo...
32,242
<p>Can people point me to resources on lexing, parsing and tokenising with Python?</p> <p>I'm doing a little hacking on an open source project (<a href="http://www.hotwire-shell.org/" rel="noreferrer">hotwire</a>) and wanted to do a few changes to the code that <a href="http://code.google.com/p/hotwire-shell/source/br...
<p>I'm a happy user of <a href="http://www.dabeaz.com/ply/" rel="noreferrer">PLY</a>. It is a pure-Python implementation of Lex &amp; Yacc, with lots of small niceties that make it quite Pythonic and easy to use. Since Lex &amp; Yacc are the most popular lexing &amp; parsing tools and are used for the most projects, PL...
<p>I suggest <a href="http://www.canonware.com/Parsing/" rel="nofollow noreferrer">http://www.canonware.com/Parsing/</a>, since it is pure python and you don't need to learn a grammar, but it isn't widely used, and has comparatively little documentation. The heavyweight is ANTLR and PyParsing. ANTLR can generate java a...
5,756
<p>I'm a hobbyist programmer with couple of database driven mobile web sites and I finally have decided to switch from classic asp to .net. But after couple of days reading I couldn’t decide which way I should go. Shall I learn c# or continue to vb in .net?</p>
<p>For hobbyist programming (i.e. a non-commercial endeavour you will only work on yourself), it really doesn't make any real difference.</p> <p><strong>Go with whichever you are more comfortable with</strong>.</p>
<p>The two languages are very similar, just what I call syntactic sugar differences. Choose what you are more happy with. I too would echo others in saying if you have do not feel strongly then you should go c# as this is more prolific language. </p> <p>A couple of other hints while you are here.</p> <ul> <li>No more...
24,993
<p>I want to override the default CreateObject() function in VBScript with my own.</p> <p>Basically this example in VB6:</p> <p><a href="http://www.darinhiggins.com/the-vb6-createobject-function/" rel="nofollow noreferrer">http://www.darinhiggins.com/the-vb6-createobject-function/</a></p> <p>I cannot figure out is t...
<p>This quick test seems to work...</p> <pre><code>Function CreateObject(className, serverName) '---- override the CreateObject ' function in order to register what ' object is being created in any error message ' that's generated Dim source, descr, errNum WScript.echo "In custom CreateO...
<p>I don't think you can override it so that all code will use it, only YOUR code.</p> <p>In which case, it doesn't matter what it's called (unless you have tons of existing code you can't change). Can you call it CreateObjectEx() or ExCreateObject() or something like that? Have this function add all your error hand...
28,670
<p>How can I get a single keyboard character from the terminal with Ruby without pressing enter? I tried <code>Curses::getch</code>, but that didn't really work for me.</p>
<p><a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/2999" rel="noreferrer">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/2999</a></p> <pre><code>#!/usr/bin/ruby begin system("stty raw -echo") str = STDIN.getc ensure system("stty -raw echo") end p str.chr </code></pre> <p>(Test...
<p>And if you are building <strong>curses</strong> application, you need to call </p> <pre><code>nocbreak </code></pre> <p><a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/curses/rdoc/Curses.html#method-c-cbreak" rel="nofollow">http://www.ruby-doc.org/stdlib-1.9.3/libdoc/curses/rdoc/Curses.html#method-c-cbreak</a...
21,095
<p>What is the preferred/easiest way to manipulate TDesC strings, for example to obtain a substring.</p> <p>I will give you an example of my scenario.</p> <pre><code>RBuf16 buf; ... CEikLabel label; ... label-&gt;SetTextL(buf); // (SetTextL takes a const TDesC&amp;) </code></pre> <p>I want to get a substring from bu...
<p>Read descriptors.blogspot.com (scroll down once loaded).</p> <p>You can use TDes::LeftTPtr, TDes::RightTPtr or TDes::MidTPtr which will give you a substring as a TPtr (i.e. a descriptor which manipulates the original data).</p> <p>You can use the TDes::Copy function if you want to create a copy of your substring.<...
<p>If you want a substring from an RBuf16, that's straightforward - just use <code>TDes16::MidTPtr</code></p> <p>You can convert a const char* by doing this:</p> <pre><code>TPtr8 narrowBuf; // Create a buffer with enough space to store every character, plus one for // a null terminator narrowBuf.AllocL( buf.Length(...
43,339
<p>An example of what I'm talking about is on some political candidate websites, like BJ Lawson or Ron Paul's old site.</p> <p>When you donate, it shows your name in Flash as a recent donor. It might also show a "goal" and how far along you are. Just curious if you can give me ideas on how to accomplish something si...
<p>The safest method is to have the application(s) that put files in the directory first put them in a different, temporary directory, and then move them to the real one (which should be an atomic operation even when using FTP or file shares). You could also use naming conventions to achieve the same result within one ...
<p>What is your OS. In unix you can use the "lsof" utility to determine if a user has the file open for write. Apparently somewhere in the MS Windows Process Explorer there is the same functionality.</p> <p>Alternativly you could just try an exclusive open on the file and bail out of this fails. But this can be a litt...
44,656
<p>A lot of the time I will have a Business object that has a property for a user index or a set of indexes for some data. When I display this object in a form or some other view I need the users full name or some of the other properties of the data. Usually I create another class myObjectView or something similar. Wha...
<p><strong>The façade pattern.</strong></p> <p>I think your approach, creating a façade pattern to abstract the complexities with multiple datasources is often appropriate, and will make your code easy to understand. </p> <p>Care should be taken to create too many layers of abstractions, because the level of indirect...
<p>Here's some guidelines to help you with deciding how to handle this (pretty common, IMO) pattern:</p> <ol> <li><p>If you all you need is a quickie link to a lookup table that does not change often (e.g. a table of addresses that links to a table of states and/or countries), you can keep a lazy-loaded, static copy o...
14,413
<p>It seems like the generation of SQL scripts from the SQL Server Management Studio is terribly slow. I think that the old Enterprise Manager could run laps around the newer script generation tool. I've seen a few posts here and there with other folks complaining about the speed, but I haven't seen much offered in the...
<p>See the <a href="http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard" rel="nofollow noreferrer">Database Publishing Wizard</a> that is part of the <strong>SQL Server Hosting Toolkit</strong>. It generates a single SQL file for both schema and data.</p>
<p>I don't know what is "terribly slow" for you, but I have a decent performance with SQL 2005 Management Studio. In either case, <a href="http://www.red-gate.com/" rel="nofollow noreferrer">RedGate</a> products are very cool. Unfortunately they are not free.</p>
5,121
<p>So I've setup an Ubuntu server running the 8.04 release. I set it up to authenticate with our Active Directory using the likewise-open package using <a href="http://devarthur.blogspot.com/2008/05/integrating-ubuntu-hardy-heron-804-with.html" rel="nofollow noreferrer">these instructions</a>. Part of that setup was gi...
<p>I get to answer my own question! Jim's train of thought seemed promising but I experimented with it and it doesn't look like the likewise-open LDAP authentication uses anything from the /etc/passwd file.</p> <p>The correct way I got this to work was by editing /etc/security/pam_lwidentity.conf and un-commenting and...
<p>On windows, this is done through group policy. Samba currently doesn't have any support for managing *nix clients with group policy (Samba 4 maybe??).</p> <p>You can try allowing full control of the computer object for "Domain Admins", and removing all of the permissions for "everyone", but I don't think that will ...
36,562
<p>Attempt to send a message through a socket failed with WinSock error 10038. After around 40 seconds, messages are received successfully from the same socket and subsequently the send() is also succeeding in the same socket. This behaviour has been witnessed in Windows Server 2003. Is this any known behaviour with Wi...
<p>Winsock error 10038 means "An operation was attempted on something that is not a socket".</p> <p>Little trick to find info about error codes (usefull for all sorts of windows error codes):</p> <ul> <li>Open a command prompt</li> <li>Type "net helpmsg 10038"</li> </ul> <p>What language is your application written ...
<p>Not a platform issue, I can guarantee that. Most likely, whatever variable you are using to access the socket handle is not thread-safe and is being used in the send() call before the actual socket is created.</p> <p>Another possible cause is the presence of layered winsock providers. "netsh winsock show" at a cmd ...
12,528
<p>Using the WCF web programming model one can specify an operation contract like so:</p> <pre><code>[OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "SomeRequest?qs1={qs1}&amp;qs2={qs2}")] XElement SomeRequest1(string qs1, string qs2); </code></pre> <p>Now if we had to make a contract...
<p>I've implemented a simple custom QueryStringConverter so that you can make qs1 an string[] then have the query string variable be comma delimited (e.g. <a href="http://server/service/SomeRequest?qs1=val1,val2,val3,val4" rel="noreferrer">http://server/service/SomeRequest?qs1=val1,val2,val3,val4</a>)</p> <pre><code>[...
<p>Be aware that in WCF 3.5 you must specify the full qualified assembly name in:</p> <pre><code> &lt;extensions&gt; &lt;behaviorExtensions&gt; &lt;add name="customWebHttp" type="NameSpace.CustomHttpBehaviorExtensionElement, MyAssemblyName, NOT SUFFICIENT HERE" /&gt; &lt;/behaviorExtensions&gt; &lt;/...
46,217
<p>What is the best way to limit the number of (concurrent) users accessing a web application that any one can introduce for selling website/application to client and how to increase the number of users accessing it remotely?</p>
<p>If you use the in-process session state management, you can use the <a href="http://msdn.microsoft.com/en-us/library/system.web.httpapplicationstate.aspx" rel="noreferrer">HttpApplicationState</a> class, by introducing the Global.asax file and putting something like this in the code behind:</p> <pre><code>void Appl...
<p>One way would be to track active sessions in a database, and each time a user logs in, check the number of active sessions. If it is below a threshold, let them in, if not, bounce them.</p> <p>To administer this number remotely, a simple admin form that lets you update the threshold in the database is simple enough...
49,821