instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm currently working at a small web development company, we mostly do campaign sites and other promotional stuff. For our first year we've been using a "server" for sharing project files, a plain windows machine with a network share. But this isn't exactly future proof. </p> <p>SVN is great for code (it's what we ...
<p>SVN is great for binaries, too. If you're afraid you can't compare revisions, I can tell you that it is possible for Word docs, using Tortoise.<br> But I do not know, what you mean with "expanding the versioning". SVN is no document management system. </p> <p>Edit:</p> <blockquote> <p>but I feel it might be a b...
<p>You might want to consider using a Mac as your server and using <a href="http://www.apple.com/macosx/features/timemachine.html" rel="nofollow noreferrer">Time Machine</a> to backup your shared folders. Doing this gives you automatic backups and allows you to share through Samba so everyone can have a <a href="http:/...
3,508
<p>binary question :)</p>
<p>The answer is 4 bits. 2 nibbles make a byte.</p> <p><a href="http://www.geneziegler.com/clocktower/DrSeuss.html" rel="nofollow noreferrer">See here</a> for a cute poem.</p>
<p>4 bits = 1 nibble</p> <p>8 bits = 1 byte</p>
12,673
<p>I have been printing toy cars for about a month now and my Ender 3 has stopped extruding plastic even when I insert filament, it has been about a day since it stopped working. Is there any tips for getting it working again?</p> <p>I tried manual feeding which worked.</p>
<p>You need to figure out what is not working</p> <ul> <li>Is the hotend getting hot? If not, melted filament won't come out.</li> <li>Is the nozzle clogged? In your toolkit was a bit of thin wire for poking into the nozzle - try that and see what happens.<br> You may need to heat the hotend, extract the filament, ...
<p>My comment refuses to upload so I think it’ll be ok if I just put it here:</p> <p>Thanks this fixed it I had to replace my hot end as the one had broken for some reason but now it is fully working again, thank you so much!</p> <p>Sorry for all the mistakes in formatting, I am new I joined 3 days ago.</p>
2,033
<p>I am writing a little application to download files over http (as, for example, described <a href="https://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python#22776">here</a>).</p> <p>I also want to include a little download progress indicator showing the percentage of the download pro...
<p>There's a text progress bar library for python at <a href="http://pypi.python.org/pypi/progressbar/2.2" rel="noreferrer">http://pypi.python.org/pypi/progressbar/2.2</a> that you might find useful:</p> <blockquote> <p>This library provides a text mode progressbar. This is tipically used to display the progress of a ...
<p>For small files you may need to had this lines in order to avoid crazy percentages:</p> <p>sys.stdout.write("\r%2d%%" % percent)</p> <p>sys.stdout.flush()</p> <p>Cheers</p>
7,420
<p>I have an aspx page with 1 table containing 2 rows:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;style&gt; html, body { ...
<p>Try removing the 'Height' and 'Width' properties in your control, if you've defined the internal XAP's height and width correctly to scale (i.e. you've used "Auto"), then it should respect what DOM boundaries it's contained within on the page.</p>
<p>Try to use some kind of script to determine the total height of your page... something like this:</p> <pre><code> function getWindowHeight() { var windowHeight = 0; if (typeof(window.innerHeight) == 'number') { windowHeight = window.innerHeight; } else { if (document.documentElement ...
49,176
<p>I re-image one of my machines regularly; and have a script that I run after the OS install completes to configure my machine; such that it works how I like.</p> <p>I happen to have my data on another drive...and I'd like to add code to my script to change the location of the Documents directory from "C:\Users\bryan...
<p>in the aspx page:</p> <pre><code>&lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; </code></pre> <p>in the codebehind (c#):</p> <pre><code>string contentType = FileUpload1.PostedFile.ContentType </code></pre>
<p>Get MIME type from a file in ASP.NET Core</p> <pre><code>public string GetMimeType(string filePath) { var provider = new FileExtensionContentTypeProvider(); if (!provider.TryGetContentType(filePath, out var contentType)) contentType = &quot;application/octet-stream&quot;; // fallback: unknown binary...
10,689
<p>I am trying to generate a Sandcastle help file for a website. In the properties window for project, there aren't any options for creating the XML Documentation File required for Sandcastle.</p> <p>The Build tab in the property pages only contains options for: Start Action, Build Solution Action, and Accessibility v...
<p>The problem with websites in VS2k5 is that, when they get compiled, the resulting dlls are a mess. No namespaces, weird names, etc. </p> <p>If you truly want to generate a Sandcastle Help File, look at converting your website into a web application. You can definitely generate source code docs for that.</p>
<p>I haven't tried it yet, but you might want to try the following <a href="http://www.ewoodruff.us/shfbdocs/html/94c7f744-9b90-4254-93ab-9b15f47d9f42.htm" rel="nofollow">Documenting Web Sites / Projects</a> from Eric Woodruff's site. It gives the specifics on how it can be done. </p> <p>Update: I did try it and it...
12,854
<p>Is there an event like onLoad? </p> <p>just at closing the Site (onClose)?</p>
<p>Not in the sense that I suspect you're thinking. All your code in ASP.net runs on the server which doesn't inherently "know" when the site is closed by the user. To achieve what you're after, you'd need to use Javascript to handle the window.onunload / window.onbeforeunload events and trigger some form of request to...
<p>The closest you can get it UnLoad.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms178472.aspx</a></p>
22,545
<p>I have a Delphi 7 app using <code>ADO/MSDASQL.1</code> provider and I wonder if it is possible to "log" the SQL queries sent to the DB in a easy way? Just like the SQL profiler in SQL Server?</p>
<p>Inside your application you can log the commands in TADOConnection.OnWillExecute event, you only have to save the CommandText, but you can also log a lot of other options.</p> <pre><code>procedure TForm23.ADOConnection1WillExecute(Connection: TADOConnection; var CommandText: WideString; var CursorType: TCursorTyp...
<p>I do something similar, but all my queries go through a single point. It was a simple change to add logging at this point. Another option would be to create a TLogADOQuery class which descends from TADOQuery, and override <strong>ExecuteSQL</strong> and <strong>Open</strong> to log the SQL going to the database. You...
45,030
<p>If a person is looking to batch convert a large number of raster images into vector graphics, are there any tools out there that do that well?</p> <p>For an example, think of just about any diagram that has standard shapes (ellipses, rectangles) and text.</p>
<p><a href="http://www.inkscape.org/doc/tracing/tutorial-tracing.html" rel="noreferrer">Inkscape uses</a> the Potrace engine to trace raster graphics. You usually have to play with it a bit to get useful output, but it does surprisingly well and is easy to use.</p>
<p>As of today 2021.1.13,</p> <p>I think Vector Magic is still the best tool on the market, they are pround to declare that on their website:</p> <p><a href="https://i.stack.imgur.com/Dkz7w.png" rel="nofollow noreferrer">&quot;Simply the Best Auto-Tracer in the World&quot;</a><br> You can test out their online raster t...
22,879
<p>I was using a CASE called <a href="http://www.magicsoftware.com/" rel="nofollow noreferrer">MAGIC</a> for a system I'm developing, I've never used this kind of tool before and at first sight I liked, a month later I had a lot of the application generated, I felt very productive and ... I would say ... satisfied.</p>...
<p>We use a CASE tool at my current company for code generation and we are trying to move away from it.</p> <p>The benefits that it brings - a graphical representation of the code making components 'easier' to pick up for new developers - are outweighed by the disadvantges in my opinion.</p> <p>Those main disadvantag...
<p>Just a couple questions for you:</p> <p>How much productivity do you gain compared to the control that you use? How testable and reliant is the code you create? How well can you implement a new pattern into your design?</p> <p>I can't imagine that there is a CASE out there that I could write a test first and then ...
3,448
<p>In asp.net mvc, I want to create a action for login.</p> <p>So this is how I am doing it:</p> <ol> <li><p>create a action/view named login that simply displays the view.</p></li> <li><p>create another action, named login2 that will be the page that handles the form post and checks the database if the username/pass...
<p>You can create two Login actions one for viewing and one for form posting. Then decorate them with AcceptVerbs attribute to describe which method they will accept. See here for an example <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx" rel="nofollow n...
<p>I agree with Craig; however, if you want to do it some other way you should come up with some naming conventions to differentiate your ActionMethods and stick to them.</p> <p>Before preview 5 i used </p> <p>login => authenticate create => insert edit => update</p> <p>etc.</p>
36,765
<p>I am looking for any and all suggestions of the <strong>best and effective resources</strong> that the StackOverflow community has used to better learn <strong>MSBuild with an emphasis on integrating unit tests</strong> and later static code analysis tools such as FxCop and StyleCop into the build process.</p> <p>I...
<p><a href="http://dotnet.org.za/cjlotz/archive/2008/01/15/continuous-integration-from-theory-to-practice-2nd-edition.aspx" rel="nofollow noreferrer">Continuous Integration From Theory to Practice</a> by Carel Lotz. It covers the entire scope of your problem, and then some. Well written, complete, and a full sample a...
<p>I guess I need to ask if you are <em>sure</em> you want to use MSBuild directly? Might want to check out <a href="http://wix.sourceforge.net/" rel="nofollow noreferrer">WIX</a> as the MSI producing tool - there is an extensive manual and it is built on top of MSBuild.</p> <p>As for the automating of your tests wit...
32,930
<p>I'm trying to figure out the best way to insert a record into a single table but only if the item doesn't already exist. The KEY in this case is an NVARCHAR(400) field. For this example, lets pretend it's the name of a <em>word</em> in the Oxford English Dictionary / insert your fav dictionary here. Also, i'm guessi...
<p>Your solution:</p> <pre><code>INSERT INTO Words (Word) SELECT @Word WHERE NOT EXISTS (SELECT WordID FROM Words WHERE Word = @Word) </code></pre> <p>...is about as good as it gets. You could simplify it to this:</p> <pre><code>INSERT INTO Words (Word) SELECT @Word WHERE NOT EXISTS (SELECT * FROM Words WHER...
<pre><code>declare @Error int begin transaction INSERT INTO Words (Word) values(@word) set @Error = @@ERROR if @Error &lt;&gt; 0 --if error is raised begin goto LogError end commit transaction goto ProcEnd LogError: rollback transaction </code></pre>
33,592
<p>This may not be strictly programming related but more OS-structure related.</p> <p>Running Vista 32 bit on a brand new laptop with 3GB of memory, Running idle the system consumes about 40% of its memory. Other then the fact that this is outrageous on its own right, the OS <strong>should be able to fit all of the pr...
<p>A page fault doesn't necessarily mean that something was paged to disk. A modern OS has many levels of state that a page might be in, for example Windows will probably distinguish between a page of memory that is being actively used, and a page of memory that hasn't been touched in a while and could be paged to disk...
<p>Of course Vista uses the memory your computer has to boot and run faster. It will release/swap the memory when some other program needs it.</p> <p>Why not use the ressource if it is there and available and can be released later on without problems?</p> <p>About the page faults, see this explanation, the task manag...
23,100
<p>If you try to launch a .NET 3.5 application on a Windows computer which does not have this version of the .NET framework installed, you get a <code>FileNotFoundException</code> for some system assemblies (for example System.Core 3.5.0.0).</p> <p>Is it possible to catch this exception and tell the user to upgrade th...
<p>How are you currently deploying the app? ClickOnce can do assembly (GAC) checks before launch, and with msi you should have a whole range of pre-check options available... although not always feasible, you might consider one of these deployment options?</p> <p>Re catching the exception - just be sure to split the M...
<p>The simplest thing would just be to try it. (I don't have any non-3.5 machines to test it on, but I assume you do.)</p> <p>Make your entry point a very simple one which just tries to load <code>System.Core.dll</code> and handles the exception appropriately. If it passes, move on to another class which can then use ...
37,708
<p>I am trying to rename all the files present in a Windows directory using <strong>FOR</strong> command as follows at the command prompt:</p> <pre><code>for %1 in (*.*) do ren %1 test%1 </code></pre> <p>E.g. This renames a file <strong>enc1.ctl</strong> to <strong>testenc1.ctl</strong> <strong>enc2.ctl</strong> to...
<p>If you know the number of files, (say 10), you can use</p> <pre><code>for /L %1 in (1,1,10) do ren enc%1.ctl test%1.ctl </code></pre>
<p>This renames all files in directory for filter file types with PREFIX and today's date and time</p> <pre><code>@echo ON cls for %%a in (*.pdf) do (set myfiledate=%%~ta echo !myfiledate!) echo Date format = %myfiledate% echo dd = %myfiledate:~0,2% echo mm = %myfiledate:~3,2% echo yyyy = %myfiledate:~6,4% echo. echo...
23,235
<p>So, I have 2 database instances, one is for development in general, another was copied from development for unit tests.</p> <p>Something changed in the development database that I can't figure out, and I don't know how to see what is different.</p> <p>When I try to delete from a particular table, with for example:...
<p>Hmm, applying the great oracle to this question, I came up with:</p> <p><a href="http://bytes.com/forum/thread830774.html" rel="nofollow noreferrer">http://bytes.com/forum/thread830774.html</a></p> <p>It seems to suggest that another table has a foreign key pointing at the problematic one, when that FK on the othe...
<p>You might have an open transaction on the dev db...that gets me sometimes on SQL Server</p>
7,634
<p>Does anyone have some sample code showing how to POST to a URL using wxWidgets? The documentation and discussion forums imply that it's possible but the methods in wxHTTP are very low-level compared to what you find in .NET and scripting languages like Perl and Ruby. Do I actually have to create the HTTP request mys...
<p>I came across a similar problem initially and ended up using Curl instead as it's also cross platform and is very easy to use.</p> <p>Tim</p>
<p>Atually, same here. Tried using wxHTTP and ended up using Curl. And Curl is a charm to work with...</p> <p>J-O</p>
36,928
<p>I'm new to ASP.NET MVC so this may be a stupid question.</p> <p>I have an account object that has many parameters. I've figured out a strategy to break this down into a "wizard"-like interface that will walk a user through collecting the required fields to create the initial business objects. It will then step thr...
<p>Have a look at Scott Gu's post on <a href="http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx" rel="nofollow noreferrer">form posting scenarios</a>. In particular you want to look at model binders.</p>
<p>There is always the old...</p> <pre><code>Request.Form("key"); </code></pre>
31,299
<p>I have a flex application that needs the ability to generate and execute JavaScript. When I say this, I mean I need to execute raw JavaScript that I create in my Flex application (not just an existing JavaScript method)</p> <p>I am currently doing this by exposing the following JavaScript method:</p> <pre><code>fu...
<p>There's no need for the JavaScript function, the first argument to <code>ExternalInterface</code> can be any JavaScript code, it doesn't have to be a function name (the documentation says so, but it is wrong).</p> <p>Try this:</p> <pre><code>ExternalInterface.call("alert('hello')"); </code></pre>
<pre><code>ExternalInterface.call("eval", "alert('hello');"); </code></pre>
4,086
<p>I have searched the forum, and google for this topic. Most of the articles are talking about using JSON to call the controller/action on the server and do ajax effect on the result.</p> <p>I am trying to use some very basic JQuery features, like the JQuery UI/Tabs, and JQuery UI/Block for a dialog window. I cannot ...
<p>Actually I just got it working. The problem is that I need to modify the path to an absolute path to the view page because the relative path doesn't work with the MVC routes {controller}/{action}/{id}.</p> <p>Thanks!</p>
<p>I just implemented the jquery autocomplete textbox in one of my asp.net project. I only had to import the js file and drop some code into my aspx page. Could you be more detailled about what sample you are trying to run?</p>
12,043
<p>I would like to migrate from Oracle to MySQL, and one of the important steps is to replace the actual job built on an Oracle environment.</p> <p>Basically, every day I receive some 'oracle' dump files from another Oracle environment (mainly CTL or Oracle table exports). Today my Oracle jobs loaded the received data...
<p>I think it's because the matching starts at the first character and moves on from there... </p> <p>For your first regular expression:</p> <pre><code>Does "AMEVDIEERPK + 7 Oxidation (M)" match "\s*(\d*).*?Oxidation\s+(M)"? Yes.. stop matching. </code></pre> <p>For your second regular expression:</p> <pre><code>D...
<p>". * ?" in this example will always match zero characters, since "* ?" does shortest possible match. As a result, since the thing right before the 'O' is a space, "\ d *" can match 0 digits.</p> <p>(Sorry about the spaces in the quotes; the auto-formatter was eating my syntax.)</p> <p>Reference: <em><a href="http:...
43,233
<p>I need to implement the classic Factory Method pattern in ASP.NET to create server controls dynamically.</p> <p>The only way I've found to create .ascx controls is to use the LoadControl method of the Page/UserControl classes. I find it messy however to link my factory with a page or to pass a page parameter to the...
<p>In the end, I decided to pass the page as a parameter to the factory. To make calls to the factory method easier, I changed the factory class from a singleton to a common class, and I passed the page to the constructor:</p> <pre><code>public ControlsFactory { private Page _containingPage; public ControlsFa...
<p>Well after opening up reflector, the LoadControl function that is being used in Page is available in any TemplateControl.</p> <p>Inside the actual LoadControl uses internal methods in BuildManager, so I don't think there's a way to use static methods without using reflection.</p> <p>Well at least you don't need to...
35,181
<p>Is there a tool which tells you (or gives you a hint) why a particular select statement dose not return any rows given the current data in your database. </p> <p>eg if you had the following 4 table join</p> <pre><code>select * from a, b, c, d where a.b_id = b.id and b.c_id = c.id and c.d_id = d.id </code></pre> ...
<p>I never have this problem, but I also use explicit joins so it's usually as simple as running parts of the query until I find out which one is restricting my results incorrectly.</p> <p>In your case</p> <pre><code>SELECT * FROM a -- First run just to here, are there records? INNER JOIN b ON a.b_id = b.id -- Th...
<p>You should be able to study the execution plan (if you are using SQL Server, otherwise a similar feature in your database) to see where the joins produce an empty set. </p>
38,029
<p>Since C# is strongly typed, do we really need to prefix variables anymore?</p> <p>e.g.</p> <pre><code>iUserAge iCounter strUsername </code></pre> <p>I used to prefix in the past, but <b>going forward I don't see any benefit</b>.</p>
<blockquote> <p>Are variable prefixes ( Hungarian ) really necessary anymore?</p> </blockquote> <h1>NO!</h1> <p>In fact, Microsoft's own <a href="http://msdn.microsoft.com/en-us/library/ms229042.aspx" rel="noreferrer">style guidelines</a> (where the practice originated) now recommend against it. In particular, see the...
<p>No, if your methods are so long that you cant read the definition at the same time as the use, or the name doesnt imply the type then you have more serious design issues than just naming.</p> <p>However, i INSIST that you do prefix controls with their type, such as txtName.</p>
39,840
<p>What is meant by "Constant Amortized Time" when talking about time complexity of an algorithm?</p>
<p>Amortised time explained in simple terms:</p> <p>If you do an operation say a million times, you don't really care about the worst-case or the best-case of that operation - what you care about is how much time is taken in total when you repeat the operation a million times.</p> <p>So it doesn't matter if the opera...
<p>Amortized Running Time: This refers to the calculation of the algorithmic complexity in terms of time or memory used <strong>per operation</strong>. It's used when mostly the operation is fast but on some occasions the operation of the algorithm is slow. Thus sequence of operations is studied to learn more about the...
24,441
<p>I cant' figure out how to reference the current instance object defined by the XAML file in the XAML file.</p> <p>I have a converter that I want to send in the current instance as the parameter object.</p> <pre><code>{Binding Path=&lt;bindingObject&gt;, Converter={x:Static namespace:Converter.Instance}, ConverterP...
<p>According to the <a href="http://msdn.microsoft.com/en-us/library/ms752347.aspx#current_record_pointers" rel="nofollow noreferrer">Data Binding Overview</a>, you can use the "/" to indicate the current item. You can then navigate up and down the tree as needs be using the following type syntaxes:</p> <pre><code>&lt...
<p>Have you tried using the <a href="http://msdn.microsoft.com/en-us/library/ms743599.aspx" rel="nofollow noreferrer"><code>RelativeSource</code> markup extension</a>? You can use <code>Self</code> there.</p>
28,633
<p>Given a path such as <code>&quot;mydir/myfile.txt&quot;</code>, how do I find the file's absolute path in Python? E.g. on Windows, I might end up with:</p> <pre><code>&quot;C:/example/cwd/mydir/myfile.txt&quot; </code></pre>
<pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; os.path.abspath("mydir/myfile.txt") 'C:/example/cwd/mydir/myfile.txt' </code></pre> <p>Also works if it is already an absolute path:</p> <pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; os.path.abspath("C:/example/cwd/mydir/myfile.txt") 'C:/example/cwd/mydir/myfile.txt' </...
<p>In case someone is using python and linux and looking for full path to file:</p> <pre><code>&gt;&gt;&gt; path=os.popen("readlink -f file").read() &gt;&gt;&gt; print path abs/path/to/file </code></pre>
7,460
<p>I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this. </p>
<p>There are some things in XSLT 2.0 that aren't supported in the built in libraries (there was discussion on the mono mailing list about this but I can't find the information anymore). But most people never run into the corner cases that aren't supported.</p> <p>Another option is to check out the open source <a href...
<p>Yes, 3.5 XPathNavigator supports XSLT 2.0.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathnavigator.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathnavigator.aspx</a></p> <p>"The XPathNavigator class in the System.Xml.XPath namespace is a...
11,968
<p>If I were looking to create my own language are there any tools that would help me along? I have heard of yacc but I'm wondering how I would implement features that I want in the language.</p>
<p>The first tool I would recommend is the Dragon Book. That is the reference for building compilers. Designing a language is no easy task, implementing it is even more difficult. The dragon book helps there. The book even reference to the standard unix tools lex and yacc. The gnu equivalent tools are called flex and ...
<p>I never finished the complete language, I had used rply and llvmlite implements a simple foxbase language, in <a href="https://github.com/acekingke/foxbase_compiler" rel="nofollow noreferrer">https://github.com/acekingke/foxbase_compiler</a></p> <p>so if you want use python, <code>rply</code> or <code>llvmlite</code...
47,731
<p>Can someone show me a regex to select <strong>#OnlinePopup_AFE53E2CACBF4D8196E6360D4DDB6B70</strong> its okay to assume <code>#OnlinePopup</code></p> <pre><code>~DCTM~dctm://aicpcudev/37004e1f8000219e?DMS_OBJECT_SPEC=RELATION_ID#OnlinePopup_AFE53E2CACBF4D8196E6360D4DDB6B70_11472026_1214836152225_6455280574472127786...
<p>NB: The following is .NET Regex syntax, modify for your flavour.</p> <p>The following:</p> <pre><code>#[^_]+_[^_]+ </code></pre> <p>will match:</p> <ul> <li>Hash</li> <li>One or more characters until an underscore</li> <li>Underscore</li> <li>One or more characters until an underscore</li> </ul> <p>If the first bit ...
<p>Simply matching anything between the first '#' and the first or last '_' will not work for your example since the string that you want returned has an underscore in it. If all the text that you want to match has only <strong>one</strong> underscore in it, you could use this regex:</p> <pre><code>/(#[^_]+_[^_]+)/ </...
38,052
<p>In standard php or source code based projects we easily keep all of the code in SVN and each developer can checkout their own copy and collaborate on the same code. </p> <p>When developing a Drupal site however, much of the work is in "setup". Besides the theme and modules you don't really have any "source code"....
<p>I think a good strategy here is to use the install profile API. With install profile API you can do most things that using the Drupal admin tools do. Most core forms simply set variables in the variables table. To be able to sensibly version your non content database contents i.e. configuration it is wise to use upd...
<p>Drupal has now support for <em>exportables configuration</em> that allow you to move most of a site configuration to code. Exportables are supported for configuration variables, views, content type, fields, input formats, etc. with the help of the <a href="http://drupal.org/project/features" rel="nofollow">features...
35,834
<p>Can we access div tags of user control in Master page? I am trying to change the background color for each one of the div tags on some event.</p>
<p>Something like this should work (in C#):</p> <pre><code>Control myControl = this.Page.Master.FindControl("[Your name here]"); </code></pre> <p>Then you can do whatever you would like to the control. If it's a Panel control (for the div) you can cast it that way, or if you are using an HTML server side control, you...
<p>The best way is to make a public property in the user control that you can then set directly from the masterpage.</p>
44,884
<p>I’ve got a problem with Visual Basic (6) in combination with LDAP. When I try to connect to an LDAP store, I always get errors like ‘Bad Pathname’ or ‘Table does not exist’ (depending on what the code looks like).</p> <p>This is the part of the code I wrote to connect:</p> <pre><code>path = "LDAP://xx.xxx.xxx.xxx:...
<p>I'm not sure how much help this will be, but I use this code to access Active Directory objects.</p> <pre><code> Set oinfo = New ADSystemInfo sDomain = Split(oinfo.DomainDNSName, ".") '-- Get Datasets from the Active Directory '-- Connect to Active Directory in logged in domain con.Open "Provider...
<p>2 things: </p> <ul> <li>The <code>Open()</code> method call takes additional parameters, server/username/password</li> <li><p>The LDAP query you passed to <code>Execute()</code> should be: </p> <pre><code>"&lt;" &amp; path &amp; "ou=Some/ou=Kindof/o=Searchbase&gt;;(objectclass=*);name;subtree" </code></pre></l...
14,001
<p>given the following code: </p> <pre><code>import ctypes ip="192.168.1.1" thisdll = ctypes.cdll['aDLL'] thisdll.functionThatExpectsAnIP(ip) </code></pre> <p>how can I correctly pack this for a DLL that expects it as a c_ulong datatype?</p> <p>I've tried using: </p> <pre><code>ip_netFrmt = socket.inet_aton(ip)...
<p>The inet_aton returns a string of bytes. This used to be the <em>lingua franca</em> for C-language interfaces.</p> <p>Here's how to unpack those bytes into a more useful value.</p> <pre><code>&gt;&gt;&gt; import socket &gt;&gt;&gt; packed_n= socket.inet_aton("128.0.0.1") &gt;&gt;&gt; import struct &gt;&gt;&gt; st...
<p>First a disclaimer: This is just an educated guess.</p> <p>an ip-address is traditionally represented as four bytes - i.e. xxx.xxx.xxx.xxx, but is really a unsigned long. So you should convert the representation 192.168.1.1 to an unsiged int. you could convert it like this.</p> <pre><code>ip="192.168.1.1" ip_long ...
41,014
<p>Is there a fixed point in the MD5 transformation, i.e. does there exist x such that <code>md5(x) == x</code>?</p>
<p>Since an MD5 sum is 128 bits long, any fixed point would necessarily also have to be 128 bits long. Assuming that the MD5 sum of any string is uniformly distributed over all possible sums, then the probability that any given 128-bit string is a fixed point is <sup>1</sup><em>/</em><sub>2<sup>128</sup></sub>.</p> <...
<p>Probably, but finding it would take longer than we have or would involve compromising MD5.</p>
29,182
<p>I'm using JScrollPane to allow scrolling in a JFrame that has a text component that's serving as a text editor. What I want to do, after setting the text in this editor, is have it scroll back up to the top, so you can see what's at the beginning of the file.</p> <p>Does anyone know how to do this?</p>
<p>Calling <a href="http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#setCaretPosition(int)" rel="noreferrer">setCaretPosition(0)</a> on your text component will cause it to scroll to the top.</p>
<p>Here's how:</p> <pre><code>textArea.setSelectionStart(0); textArea.setSelectionEnd(0); </code></pre>
37,125
<p>I have two tables in my database, called <em>ratings</em> and <em>movies</em>.</p> <p><strong>Ratings:</strong></p> <blockquote> <p><code>| id | movie_id | rating |</code></p> </blockquote> <p><strong>Movies:</strong></p> <blockquote> <p><code>| id | title |</code></p> </blockquote> <p>A typical movie record might b...
<p>Use the HAVING clause. Something along these lines:</p> <pre><code>SELECT movies.id, movies.title, COUNT(ratings.id) AS num_ratings FROM movies LEFT JOIN ratings ON ratings.movie_id=movies.id GROUP BY movies.id HAVING num_ratings &gt; 5; </code></pre>
<p>The above solutions are okay for the scenario you mentioned. My suggestion may be overkill for what you have in mind, but may be handy for other situations:</p> <ol> <li><p>Subquery only those from the ratings table having more than the number you need (again using tha group by having clause):</p> <p>select movie_...
21,174
<p>I'm testing how the classes FileStream and StreamReader work togheter. Via a Console application. I'm trying to go in a file and read the lines and print them on the console.</p> <p>I've been able to do it with a while-loop, but I want to try it with a foreach loop.</p> <pre><code>using System; using System.Collec...
<p>To read all lines in New Text Document.txt:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace testing { public class Program { public static void Main(string[] args) { string file = @"C:\Temp\New Folde...
<p>You are enumerating a string, and when you do that, you take one char at the time.</p> <p>Are you sure this is what you want?</p> <pre><code>foreach(string line in file) </code></pre>
36,413
<p>What is the easiest way to create and verify PGP/GPG signatures from within a Python application? </p> <p>I can call pgp or gpg using subprocess and parse the output, but I was looking for a way that didn't require an external program to be installed (my application is cross-platform mac/windows/unix).</p>
<p>I think <a href="http://www.gnupg.org/related_software/gpgme/" rel="nofollow noreferrer">GPGME</a> and the <a href="http://pyme.sourceforge.net/" rel="nofollow noreferrer">PyMe Python wrapper</a> should do what you need.</p>
<p>In addition to PyMe, consider <a href="http://code.google.com/p/python-gnupg/" rel="nofollow">python-gnupg</a> and the <a href="http://py-gnupg.sourceforge.net/" rel="nofollow">gnupginterface</a>.</p>
6,113
<p>How do I limit <code>os.walk</code> to only return files in the directory I provide it?</p> <pre><code>def _dir_list(self, dir_name, whitelist): outputList = [] for root, dirs, files in os.walk(dir_name): for f in files: if os.path.splitext(f)[1] in whitelist: outputList....
<p>Don't use os.walk.</p> <p>Example:</p> <pre><code>import os root = "C:\\" for item in os.listdir(root): if os.path.isfile(os.path.join(root, item)): print item </code></pre>
<p>This is how I solved it</p> <pre><code>if recursive: items = os.walk(target_directory) else: items = [next(os.walk(target_directory))] ... </code></pre>
28,369
<p>Is there a way with WPF to get an array of elements under the mouse on a MouseMove event?</p>
<p>You can also try using the Mouse.DirectlyOver property to get the top-most element that is under the mouse.</p>
<p>Can you use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper.hittest.aspx" rel="nofollow noreferrer">VisualTreeHelper.HitTest</a> ?</p> <p><a href="http://lukieb.blogspot.com/2008/07/visualtreehelperhittest.html" rel="nofollow noreferrer">http://lukieb.blogspot.com/2008/07/...
6,782
<p>I have a Visual Studio 2008 solution with several projects in it - some of which are web applications / sites. </p> <p>Whenever I go "Debug > Start new instance" for a specific web application and VS launches the ASP.net Development Server (WebDev.WebServer.EXE) for that application, VS also launches 3 additional s...
<p>I think it runs one for each Port -- you can try turning setting them to have the same port - click on the project and look at the properties pane (you have to turn off the the automatic port generation and then set the port#)</p>
<p>Suggestion - don't use the internal WebDev, use IIS instead. Also reduces the clutter in the systray. ;)</p>
42,605
<p>I would like to be able to write a Java class in one package which can access non-public methods of a class in another package without having to make it a subclass of the other class. Is this possible?</p>
<p><strong>Here is a small trick that I use in JAVA to replicate C++ friend mechanism.</strong></p> <p>Lets say I have a class <code>Romeo</code> and another class <code>Juliet</code>. They are in different packages (family) for hatred reasons.</p> <p><code>Romeo</code> wants to <code>cuddle</code> <code>Juliet</code...
<p>I once saw a reflection based solution that did "friend checking" at runtime using reflection and checking the call stack to see if the class calling the method was permitted to do so. Being a runtime check, it has the obvious drawback.</p>
22,027
<p>I'm using a build script that calls Wise to create some install files. The problem is that the Wise license only allows it to be run under one particular user account, which is not the same account that my build script will run under. I know Windows has the <strong>runas</strong> command but this won't work for an a...
<p>This might help: <a href="http://blogs.msdn.com/oldnewthing/archive/2004/11/29/271551.aspx" rel="nofollow noreferrer">Why doesn't the RunAs program accept a password on the command line?</a></p>
<p>This might help, it's a class I've used in another project to let people make their own accounts; everyone had to have access to the program, but the same account couldn't be allowed to have access to the LDAP stuff, so the program uses this class to run it as a different user.</p> <p><a href="http://www.codeprojec...
12,363
<p>Everytime I upload a file to my ASP.NET site, all users are logged out (aka, I guess their session become invalidated). </p> <p>Is there any way to "hotswap" the code in ASP.NET so that this doesn't happen? Compile before deploying etc. </p> <p>My deployment method is pretty simple through a SVN update. </p> <p>T...
<p>You could store your session in a <a href="http://msdn.microsoft.com/en-us/library/ms229862(VS.80).aspx" rel="nofollow noreferrer">SQL database</a>, thus the application restart would not lose your sessions.</p> <p>Having precompiled non updatable code to deploy would make your xcopy faster alright but app pool wou...
<p>If you're deploying files to the bin folder or the web.config, this will automatically reset the site for very good reasons.</p>
41,910
<p>I'd like to call svn up from an asp.net page so people can hit the page to update a repository. (BTW: I'm using Beanstalk.com svn hosting which doesn't allow post-commit hooks, which is why I am doing it this way). </p> <p>See what I've got below. The process starts (it shows up in Processes in Task Manager) and ex...
<p>You can also use the Subversion library that comes with Ankh SVN. I used it in a project to manage files in a Subversion repository and it worked well.</p> <p>If you insist on using the command line client make sure you check the StandardError output for any error messages. Also make sure the user you run the proce...
<p>Using <a href="http://sharpsvn.net/" rel="nofollow noreferrer">SharpSvn</a>:</p> <pre><code>using(SvnClient client = new SvnClient()) { client.Update(Request["path"]); } </code></pre> <p>But I would recommend not to use a user passed variable directly for security reasons.</p>
36,269
<p>What's the best .NET communication component or protocol for very low bandwidth and intermittently connected communication (i.e.: &lt; 10 kilobits/sec)?</p>
<p>Probably <code>System.Net.Sockets.</code><strong><code>Socket</code></strong>. There is also a <code>TcpClient</code> and <code>UdpClient</code> in that namespace.</p>
<p>yeap!, sockets is what you're looking for</p>
20,487
<p>Let's say I wanted to have an application that could easily switch the DB at the back-end.<br> I'm mostly thinking of SQL Server as the primary back-end, but with the flexibility to go another DB engine. Firebird and PostGreSQL seem to have (from my brief wikipedia excursion) the most in common w/ SQL Server (plus ...
<p>I worked on one project where it was an absolute requirement to support many databases, including at least Access, SQL Server and Oracle.</p> <p>So I know that it can be done. Mostly DML (SELECT,UPDATE,INSERT...) is the same and certainly we didn't have huge problems making it work across all of the databases - jus...
<p>Well, CRUD stuff should be the same everywhere, but if you build anything complex, you'll probably want to use triggers and stored procedures and that's where compatibility becomes low. Writing a DBMS-agnostic application usually means moving most of the business logic outside of database, so having a 3-tier applica...
24,389
<p>I'm developing non-interactive cpu-bound application which does only computations, almost no IO. Currently it works too long and while I'm working on improving the algorithm, I also think if it can give any benefit to change language or platform. Currently it is C++ (no OOP so it is almost C) on windows compiled wit...
<p>Just to be thorough: the first thing to do is to gather profile data and the second thing to do is consider your algorithms. I'm sure you know that, but they've got to be #included into any performance-programming discussion.</p> <p>To be direct about your question "Can switching to ASM help?" the answer is "If you...
<p>It is hard to produce ASM code that is faster than naive C or C++ code. In most cases if you do this job really well, you probably gain not much than few percents and getting like 10% speedup is considered great success but in most cases it is just impossible. </p> <p>Compilers are capable of understanding how to c...
23,659
<p>I've got a page with a normal form with a submit button and some jQuery which binds to the form submit event and overrides it with <code>e.preventDefault()</code> and runs an AJAX command. This works fine when the submit button is clicked but when a link with <code>onclick='document.formName.submit();'</code> is cli...
<p>A couple of suggestions:</p> <ul> <li>Overwrite the submit function to do your evil bidding</li> </ul> <pre><code> var oldSubmit = form.submit; form.submit = function() { $(form).trigger("submit"); oldSubmit.call(form, arguments); } </code></pre> <ul> <li>Why not bind to all the &lt;a&...
<p>Thanks Eran</p> <p>I am using this event binding code</p> <pre><code>this._form.bind('submit', Delegate.create(this, function(e) { e.preventDefault(); this._searchFadeOut(); this.__onFormSubmit.invoke(this, new ZD.Core.GenericEventArgs(this._dateField.attr('value'))); }); </code></pre> <p>but there is...
17,166
<p>I've got a bunch of stateless ejb 3.0 beans calling each other in chain. Consider, BeanA.do(message) -> BeanB.do() -> BeanC.do() -> BeanD.do(). Now i'd like to access message data from BeanD.do(). Obvious solution is to pass message as a parameter to all that do() calls (actually that's how it works now), but i wa...
<p>i don't believe there is anything in the EJB spec that provides that functionality. If you are on a specific app server, you may be able to use app server specific stuff (i think JBoss allows you to add stuff to a call context). you also may be able to fake something up using JNDI.</p> <p>personally, this seems (...
<p>You could have a class with static get/set methods that access a static ThreadLocal field. However I would take james' advice and consider very carefully if you want to couple your EJBs to that other class. Definitely double-check your app server docs as I'm not sure if using ThreadLocals in an EJB environment is ...
48,086
<p>I have a cron "time definition"</p> <pre><code>1 * * * * (every hour at xx:01) 2 5 * * * (every day at 05:02) 0 4 3 * * (every third day of the month at 04:00) * 2 * * 5 (every minute between 02:00 and 02:59 on fridays) </code></pre> <p>And I have an unix timestamp.</p> <p>Is there an obvious way to find (calcula...
<p>This is basically doing the reverse of checking if the current time fits the conditions. so something like:</p> <pre><code>//Totaly made up language next = getTimeNow(); next.addMinutes(1) //so that next is never now done = false; while (!done) { if (cron.minute != '*' &amp;&amp; next.minute != cron.minute) { ...
<p>Check <a href="http://www.phpclasses.org/browse/package/2568.html" rel="noreferrer">this out</a>:</p> <blockquote>It can calculate the next time a scheduled job is supposed to be run based on the given cron definitions.</blockquote>
41,615
<p>If my domain objects implement IDataErrorInfo, and I am using M-V-VM, how do I propagate errors through the ViewModel into the View? If i was binding directly to the model, I would set the "ValidateOnExceptons" and "ValidateOnErrors" properties to true on my binding. But my ViewModel doesn't implement IDataErrorInfo...
<p>You can implement IDataErrorInfo additionally in your VM and route the calls to the VM to your corresponding domain objects. I think this is the only way without exposing domain objects directly to the view.</p>
<p>The <strong>BookLibrary</strong> sample application of the <strong><a href="http://waf.codeplex.com" rel="nofollow noreferrer">WPF Application Framework (WAF)</a></strong> might be interesting for you. It implements the IDataErrorInfo interface as well on the domain objects and it uses the M-V-VM pattern.</p>
44,425
<p>Given the following XML:</p> <pre><code>&lt;current&gt; &lt;login_name&gt;jd&lt;/login_name&gt; &lt;/current&gt; &lt;people&gt; &lt;person&gt; &lt;first&gt;John&lt;/first&gt; &lt;last&gt;Doe&lt;/last&gt; &lt;login_name&gt;jd&lt;/login_name&gt; &lt;/preson&gt; &lt;person&gt; &lt;first&gt;Pier...
<p>I'd define a key to index the people:</p> <pre><code>&lt;xsl:key name="people" match="person" use="login_name" /&gt; </code></pre> <p>Using a key here simply keeps the code clean, but you might also find it helpful for efficiency if you're often having to retrieve the <code>&lt;person&gt;</code> elements based on ...
<p>I think what he actually wanted was the replacement in the match for the "current" node, not a match in the person node:</p> <pre><code>&lt;xsl:variable name="login" select="//current/login_name/text()"/&gt; &lt;xsl:template match="current/login_name"&gt; &lt;xsl:value-of select='concat(../../people/person[login_n...
8,733
<p>How do I cause the page to make the user jump to a new web page after X seconds. If possible I'd like to use HTML but a niggly feeling tells me it'll have to be Javascript.</p> <p>So far I have the following but it has no time delay</p> <pre><code>&lt;body onload="document.location='newPage.html'"&gt; </code></pre...
<p>A meta refresh is ugly but will work. The following will go to the new url after 5 seconds: </p> <pre><code>&lt;meta http-equiv="refresh" content="5;url=http://example.com/"/&gt; </code></pre> <p><a href="http://en.wikipedia.org/wiki/Meta_refresh" rel="noreferrer">http://en.wikipedia.org/wiki/Meta_refresh</a></p>...
<p>The JavaScript method, without invoking <code>eval</code> in the the <code>setTimeout</code>:</p> <pre><code>&lt;body onload="setTimeout(function(){window.location.href='newpage.html'}, 5000)"&gt; </code></pre>
16,888
<p>In my JSP I need to test two objects using the <code>equals()</code> method. Is there a way to do this using EL, JSTL, or another tag library? I am not allowed to use scriptlets due to team rules.</p> <p>I tried to use the JSTL <code>&lt;c:if&gt;</code> tag, but it only seems to use the <code>==</code> operator.</...
<p>The JSP Expression Language operator <code>==</code> (or its alias, <code>eq</code>) performs comparison with the <code>equals</code> method, although some coercions are performed if one of the objects is a special type (BigDecimal, BigInteger, Double, Float, Long, Integer, Short, Byte, Character, Boolean, or String...
<p>The <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html" rel="nofollow noreferrer">J2EE 1.4 guide</a> has an example of just that. You'll have to setup your once function lib, but it doesn't look hard.</p>
43,944
<p>Currently, we are using WebSphere Portal v5.1, and the URLs are about a un-friendly as a URL could get. For example: </p> <p><a href="http://www.foo.com/wsps/portal/!ml/QjzQ0IhyR0UAkc39Aw!!/delta/base64xml/L3dJ82XzBfQ1A" rel="nofollow noreferrer">http://www.foo.com/wsps/portal/!ml/QjzQ0IhyR0UAkc39Aw!!/delta/base64x...
<p>WebSphere Portal is holding the navigational state in its URLs. Cutting this urls will destroy that information. Since Portal 6.1 there is a way to define a "friendly name"=url for pages which allows to send them around without the risk to get them destroyed by copy&amp;paste actions. WebSphere portal is of course s...
<p>What are your portal requirements?</p> <p>I'm guessing it needs to be Java orientated and I'm guessing when you say portal you mean JSR-168? Or JSR-286? (WPS 5.1 is 168 + IBM mess, 286 is newer, I think Java5+).</p> <p>It's also worth mentioning that if you've built an entire set of portlets in WAS 5.1 you may nee...
43,447
<p>I have a pretty unusual problem (for me). I am writing an application that will allow a user to change their system time forward or back either by explicit date (change my date to 6/3/1955) or by increment using buttons (go forward 1 month).</p> <p>I'm writing this to help some of my users test some software that...
<p>As mentioned by gabr and mliesen, have a look at the <a href="http://docwiki.embarcadero.com/VCL/en/DateUtils" rel="noreferrer">DateUtils</a> and <a href="http://docwiki.embarcadero.com/VCL/en/SysUtils" rel="noreferrer">SysUtils</a> units, useful functions include.</p> <ul> <li><a href="http://docwiki.embarcadero.c...
<p>There is plenty of helpers in the SysUtils unit (and as gabr pointed out, also in DateUtils).</p>
20,303
<p>Large datasets, millions of records, need special programming to maintain speed in DBGrids. </p> <p>I want to know if there are any ready-made components for Delphi (DBGrids) that do this automatically?</p> <p>EDIT For Example: Some databases have features such as fetch 1st X records (eg 100 records). When I reach...
<p>I would have a look at <a href="http://www.devexpress.com/Products/VCL/ExQuantumGrid/key_datacontroller.xml" rel="nofollow noreferrer">Developer Express QuantumGrid Suite</a>. (@birger: you just were a tick faster ;-) ) So I'm not just duplicating the answer, some elaboration:</p> <p>The DevExpress Grid uses a data...
<p>sorry, I just saw your comment to Neftalí</p> <p>if you would to bring 100 record per time, and then fetch the next 100, this work related to database access components, look at <strong>devart</strong> components, they are offer direct access components to most used database, and they have the feature you are askin...
24,506
<p>I have a subclass "s" of UIView. I want to put some buttons and labels on s. How do I associate my UIView subclass with a nib file?</p>
<ol> <li>In Interface Builder, create a new xib with the View template. <ul> <li>Click on the view in the list of objects in the xib (you should also see "File's Owner and "First Responder").</li> <li>Push Cmd-4 to open the Identity pane of the inspector.</li> <li>Type your class's name into the "Class Name" field an...
<p>In my case, I didn't want my view controller to have any knowledge of the IBOutlets from my view's .xib. I wanted my view subclass to own the IBOutlets. Unfortunately UIView doesn't have an <code>initWithNibName:</code> method, so I just created my own category.</p> <p>Here's what I did:</p> <ul> <li>In IB, click ...
29,514
<p>Over the years I've worked on a number of microcontroller-based projects; mostly with Microchip's PICs. I've used various microcontroller simulators, and while they can be very helpful at times, I often find myself frustrated. In real life microcontrollers never exist alone and the firmware's behavior is dependent o...
<p>For the "simulate the whole board" approach, The Free Model Foundry has a large number of models, some in VHDL others in Verilog, that are available now.. but you'll need to pay to have new models created. These are very helpful in being sure the board is built correctly. </p> <p>But I think the more common approa...
<p>My workmates from the hardware department use FPGA simulation software quite often to find timing-bugs and trace down strange behaviours.</p> <p>Simulating one or two milliseconds can take several hours, so using the simulator for anything but very small things is not feasable.</p> <p>You may want to have a look a...
49,171
<p>My application is generating different floating point values when I compile it in release mode and in debug mode. The only reason that I found out is I save a binary trace log and the one from the release build is ever so slightly off from the debug build, it looks like the bottom two bits of the 32 bit float values...
<p>Release mode may have a different FP strategy set. There are different floating point arithmetic modes depending on the level of optimization you'd like. MSVC, for example, has strict, fast, and precise modes.</p>
<p>This discrepancy may very well be caused by the compiler optimization, which is typically done in the release mode, but not in debug mode. For example, the compiler may reorder some of the operations to speed up execution, which can conceivably cause a slight difference in the floating point result.</p> <p>So, I w...
17,134
<p>Hey everyone, I am trying to run the following program, but am getting a NullPointerException. I am new to the Java swing library so I could be doing something very dumb. Either way here are my two classes I am just playing around for now and all i want to do is draw a damn circle (ill want to draw a gallow, with a ...
<p>You're getting NPE because <code>g</code> is not set, therefore, it's <code>null</code>. Furthermore, you shouldn't be doing the drawing in the constructor. Overload <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComponent.html#paintComponent(java.awt.Graphics)" rel="nofollow noreferrer"><code>paintCo...
<p>A couple of things: Don't forget to add the panel to the <code>JFrame</code>. And override the <code>paint()</code> method of <code>JPanel</code> for your custom painting. You do not need to declare a Graphics object since the <code>JPanel</code>'s paint method will have a reference to one in any case.</p> <pre><co...
35,368
<p>Can it be assumed a evaluation order of the function parameters when calling it in C ? According to the following program, it seems that there is not a particular order when I executed it. </p> <pre><code>#include &lt;stdio.h&gt; int main() { int a[] = {1, 2, 3}; int * pa; pa = &amp;a[0]; printf("a[0...
<p>No, function parameters are not evaluated in a defined order in C.</p> <p>See Martin York's answers to <a href="https://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-c-programmer-should-know-about">What are all the common undefined behaviour that c++ programmer should know abou...
<p>Grant's answer is correct, it's undefined.</p> <p>BUT,,,</p> <p>By your example, your compiler seems to be evaluating in right-to-left order (unsurprisingly, the order that arguments are pushed onto the stack). If you can do other tests to show that the order is maintained consistently even with optimizations enab...
49,254
<p>I want to develop a website in ASP classic that uses HTTP Authentication against a database or password list that is under the control of the script. Ideally, the solution should involve no components or IIS settings as the script should be runnable in a hosted environment.</p> <p>Any clues/code deeply appreciated....
<p>It is possible to do HTTP Basic Authentication in pure classic ASP VBScript. </p> <p>You will need something to decode base 64. <a href="http://www.motobit.com/tips/detpg_base64/" rel="noreferrer">Here is a pure VBScript implementation</a>. You will also need to make sure that in your IIS config you turn off "Basic...
<p>Hi are you trying to get a list of users from a database or use network based permissions on the HTTP server?</p> <p>If you are using a database use ODBC and DSN</p> <pre><code>Dim DatabaseObject1 Set DatabaseObject1 = Server.CreateObject("ADODB.Connection") DatabaseObject1.Open("DSN=DSNname;") </code></pre> <p>I...
25,518
<p>What is the behind-the-scenes difference between 'int?' and 'int'? Is 'int?' a somehow a reference type?</p>
<p>? wraps the value type (T) in a Nullable&lt;T&gt; struct:</p> <p><a href="http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx</a></p>
<p>I learned that you must explicitly cast a nullable value type to a none-nullable value type, as the following example shows:</p> <pre><code>int? n = null; //int m1 = n; // Doesn't compile int n2 = (int)n; // Compiles, but throws an exception if n is null </code></pre> <p><a href="https://learn.microsoft.com/en...
13,543
<p>I'm trying to import an XML file via a web page in a Ruby on Rails application, the code ruby view code is as follows (I've removed HTML layout tags to make reading the code easier)</p> <pre><code>&lt;% form_for( :fmfile, :url =&gt; '/fmfiles', :html =&gt; { :method =&gt; :post, :name =&gt; 'Form_Import_DDR', :enct...
<p>Rather than a rails/mongrel problem, it sounds more likely that there's an issue either with your XML file or with the way REXML handles it. You can check this by writing a short script to read your XML file directly (rather than within a request) and seeing if it still fails.</p> <p>Assuming it does, there are a ...
<p>Since getting this to work requires me to only change the encoding attribute of the first XML element to have the value UTF-8 instead of UTF-16, the XML file is actually UTF-8 and labelled wrongly by the application that generates it.</p> <p>The XML file is a FileMaker DDR export produced by FileMaker Pro Advanced ...
8,904
<p>This is the page that I'm having. But the resize part in the section does not seem to be working. I copied most of the code from the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/UpdatePanelAnimation/UpdatePanelAnimation.aspx" rel="nofollow noreferrer">Ajax site</a>. I placed a alert() in the tag (li...
<p>Use the following function:</p> <pre><code>DATEADD(type, value, date) </code></pre> <ul> <li><p><strong>date</strong> is the date you want to manipulate</p> </li> <li><p><strong>value</strong> is the integere value you want to add (or subtract if you provide a negative number)</p> </li> <li><p><strong>type</strong> ...
<pre><code>DECLARE @date DateTime SET @date = GetDate() SET @date = DateAdd(day, 1, @date) SELECT @date </code></pre>
20,231
<p>Can anyone point to some code that deals with the security of files access via a path specified (in part) by an environment variable, specifically for Unix and its variants, but Windows solutions are also of interest?</p> <p><em>This is a big long question - I'm not sure how well it fits the SO paradigm.</em></p> ...
<p>Option 2 works, if you write a new value for <code>$PQRHOME</code> after resolving its real path and check its security. That way very little of your code needs changing thereafter.</p> <p>As far as keeping the setuid privileges, it would help if you can do some sort of privilege separation, so that any operations ...
<p>Well, it <strong>sounds</strong> paranoid, but if it is or not depends on which system(s) your application is running on and which damage can an attacker do.</p> <p>So, if your userbase is possibly hostile and if the damage is possibly very high, I'd go for the option 4, but modified as follows to remove its drawba...
23,845
<p>On a Windows 2003 server I have a pure .NET 3.5 <code>C#</code> app (no unmanaged code). It connects to various other remote systems via sockets and acts like a data hub. It runs for 10-15 hours fine with no problem but from time to time it just disappears. If I watch the app using task manager the memory usage rema...
<p>Try using the debugging tools from microsoft. You can download them from <a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" rel="noreferrer">here</a>.</p> <p>Use adplus to capture the crash and then windbg to analyze it.</p> <p>adplus -crash -pn your.exe -quiet</p> <p>Lots of great info about...
<p>If it's a Windows Forms application, you could try <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx" rel="nofollow noreferrer"><code>Application.ThreadException</code></a>.</p>
33,701
<p>Rehsarper 4.0 - Renaming a class does not rename the file…<br> I probably set something on accident in the options, but I can't find it. Any ideas?</p>
<p>When I do a rename in Resharper there's a checkbox below the textbox where you type the new name that says "Synchronise file name with class name". Check that and the file is renamed too.</p> <p>Be sure you're using Resharper's rename (right-click/Refactor/Rename) rather than Visual Studio's (right-click/Rename), a...
<ol> <li>Go to the class name and click Ctrl+R+R</li> <li>Set the new name</li> <li>select the check box &quot;Also rename files to reflect this change.&quot;</li> </ol>
7,873
<p>I am trying out the debugger built into <code>Zend studio</code>. It seems great! One thing though, when I start a page using the debugger does anyone know how I can set a request get argument within the page?</p> <p>For example, I don't want to debug runtests.php</p> <p>I want to debug <code>runtests.php?test=1...
<p>Just start the debugger on another page, and then change the browser url to what you wanted. It's not ideal but it should work.</p> <p>I have high hopes for their next release.</p>
<p>I recommend getting the <a href="http://www.zend.com/en/products/studio/downloads" rel="nofollow noreferrer">Zend Studio Toolbar</a>. The extension allows you to control which pages are debugged from within the browser instead of from Zend Studio. The options for debugging let you debug the next page, the next form...
9,473
<p>Problem: I have an address field from an Access database which has been converted to SQL Server 2005. This field has everything all in one field. I need to parse out the address's individual sections into their appropriate fields in a normalized table. I need to do this for approximately 4,000 records, and it needs ...
<p>I've done a lot of work on this kind of parsing. Because there are errors you won't get 100% accuracy, but there are a few things you can do to get most of the way there, and then do a visual BS test. Here's the general way to go about it. It's not code, because it's pretty academic to write it, there's no weirdness...
<p>There are data services that given a zip code will give you list of street names in that zip code.</p> <p>Use a regex to extract Zip or City State - find the correct one or if a error get both. pull the list of streets from a <a href="http://www.melissadata.com/lookups/zipstreet.asp" rel="nofollow noreferrer">data ...
3,712
<p>I need to create a news ticker that is updated via an RSS feed. Any ideas on how to implement this?</p> <p>I would prefer Javascript but any language is acceptable.</p>
<p>There are are several good examples of this on <a href="http://www.dynamicdrive.com/dynamicindex17/rsstickerajax/index.htm" rel="nofollow noreferrer">this DynamicDrive page</a>, although one of the requirements is that you can run PHP on your site. PHP here is used to fetch the actual feeds and allow your ticker to ...
<p>If you really have a nice niche market where your news ticker could be very popular, you might want to 'be on their desktop' and develop a widget with <a href="http://www.adobe.com/products/air/" rel="nofollow noreferrer">Adobe Air</a>.</p> <p>You can create a nice scrolling ticker then with any javascript you like...
20,804
<p>What is the proper way to give printer settings to CuraEngine? Is it possible to put all these settings into a file (like Json formatted)?</p> <pre><code>CuraEngine.exe -v -o "c:\3d\test.gcode" "c:\3d\test.stl" </code></pre>
<p>I'm not sure if it's possible, but on github is code for setting CuraEngine up. Maybe you'll find this link, <a href="https://github.com/Ultimaker/CuraEngine/blob/master/src/settings/settings.cpp" rel="nofollow noreferrer"> CuraEngine/src/settings/settings.cpp</a> helpful. </p> <p>The latest release has more speed ...
<p>I'm not sure if it's possible, but on github is code for setting CuraEngine up. Maybe you'll find this link, <a href="https://github.com/Ultimaker/CuraEngine/blob/master/src/settings/settings.cpp" rel="nofollow noreferrer"> CuraEngine/src/settings/settings.cpp</a> helpful. </p> <p>The latest release has more speed ...
213
<p>I’m attempting to check the rights on a particular file for a specific trustee and am using the win32 API GetEffectiveRightsFromAcl(). When the file is accessible by a domain group, the function returns 5 (Access Denied) when a local account (admin or other) is used to execute the function.</p> <p>These three stat...
<ul> <li>if domain group have right to the file, this function has to access the active directory to enumerate the group membership of the trustee ( at least if it is a domain user ). If your program is running under local account, then this account don't have right to access the active directory, hence the error retur...
<ul> <li>if domain group have right to the file, this function has to access the active directory to enumerate the group membership of the trustee ( at least if it is a domain user ). If your program is running under local account, then this account don't have right to access the active directory, hence the error retur...
47,532
<p>When i compile the application in my laptop it runs fine but when i run the same application in the server something is wrong with the date format. But when i checked the system date time format wit my laptop and server it the same format. Can anyone tell me what is wrong.</p>
<p>You also have to check the default culture set in the laptop and the server. Are they running in the same culture? Different culture settings will have different default time formats.</p>
<p>Is the system clock running UTC, and the OS changing it to local time on the server. This is a pretty common configuration, but will break programs that bypass the OS's functions to retrieve the date/time.</p>
12,413
<p>Is that possible to switch an Open Source Project license from <a href="http://opensource.org/licenses/gpl-2.0.php" rel="nofollow noreferrer">GPL</a> to <a href="http://opensource.org/licenses/lgpl-3.0.html" rel="nofollow noreferrer">LGPL v3</a> ?</p> <p>I am the project originator and the only contributor.</p>
<p>yes, of course. You can change the licence to whatever you want.</p> <p>Go to your admin page, then edit registration from the menu, view Public Info, then edit the Trove categorisation. You need to remove then add a new category. Easy (if a little link-happy).</p> <p>This applies if you're an admin of the project...
<p>AFAIK, you can do that if you're the only contributor to the source code, irrespective of whether you're the original author or lead developer.</p> <p>If you can get approval from all the contributors, then you can change the license.</p> <p>Warning: IANAL.</p>
11,821
<p>I'm looking at the output from spring being loaded up by tomcat and there's something very strange...Everything is duplicated. What would cause this? Whatever it is, it's causing my application to run in odd ways.</p> <p><strong>Additional Info:</strong></p> <p>The application is a web app. All the spring inform...
<p>Are you sure that something in the logging configuration isn't adding each category/logger to the appender more than once?</p> <p>That's something that's possible with log4j, not sure about JCL or whatever the latest version of Tomcat uses under the cover.</p>
<p>In Tomcat, if your application is configured to be the default application it must be deployed under the /root directory. If not, then Tomcat will launch 2 copies of your application, one where you put it, and one where it expects the default to be. </p> <p>That could explain what is happening here, assuming that I...
30,334
<p>I have a JSP page that will display the exact content of another web page on a different server. My understanding was that c:import from the JSTL should be able to include content from files that are not part of the current web application.</p> <p>I added c:import url="page on my server in a different application"...
<p>I had a similar error once. It turned out to be that the machine that I was running the app on had some problems connecting to the internet through the firewall. Once I deployed the app to a machine that was always connected it worked fine.</p>
<p>If it works from the same server, different app, makes it possible that there's a variable that's not being initialized somewhere, or some state which makes it throw an exception. Check the error logs for any stack traces that could point to the specific line of code that's causing the problem.</p>
28,215
<p>I have been sold on the fun of using linq in areas other than pure database interaction. (See <a href="https://stackoverflow.com/questions/365352/calling-fellow-code-nerds-alternatives-to-nested-loops">Calling fellow code nerds - Alternatives to Nested Loops?</a>).</p> <p>We are stuck on 2.0. I have told the powers...
<p>Can YOU make a case for it? Sounds like you want it because LINQ is fun. Other people are mentioning features that are <em>fun</em>. I've always had a problem selling <em>fun</em> features to management because they aren't very compelling reasons to potentially disrupt an environment.</p> <p>Honestly, it really dep...
<p>In my experience, the addition of LINQ and Extension methods alone have made many previously arduous and/or time consuming tasks much easier and faster. The increased developer productivity from that alone is worth the upgrade effort IMHO.</p>
48,196
<p>My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at working with .NET. I have been able to transfer much of my Java experience into working with .NET (specifically C#), but the only thing that has re...
<p>I can't claim that it's a best practice, but I often see files organized in a directory hierarchy that mirrors the namespace. If it fits your mental model of the code better, then do so - I can't think of any harm. Just because the .NET model doesn't enforce relationships between namespaces, projects, and directory ...
<p>I've always considered source file organization and assigning identifiers to classes and objects to be two separate problems. I tend to keep related classes in groups, but not every group should be a namespace. Namespaces exist (more or less) to solve the problem of name conflicts—in flat-namespace languages like C,...
7,950
<p>I have a textbox with the <strong>Text</strong> property bound to a dataset column with the DataType set to System.DateTime.<br> The FormatString on the Binding is set to <strong>dd-MM-yyyy</strong>.</p> <p>When the user enters a date it attempts to convert it to a date but can come up with some strange values for ...
<p>A .NET DateTime is in the range 01/01/0001 to 31/12/9999 23:59:59.9999999, so 01/01/200 is considered to be valid.</p> <p>You can validate the input and restrict the range: the Validating event would be the place to do your validation. You'll need to parse the string into a DateTime and validate its range.</p> <p...
<p>Any reason not to use a date picker control instead of a textbox? Would solve validation problem and probably make it a better experience for the user.</p>
31,012
<p>What is the difference between <strong><code>const</code></strong> and <strong><code>readonly</code></strong> in C#? </p> <p>When would you use one over the other?</p>
<p>Apart from the apparent difference of</p> <ul> <li>having to declare the value at the time of a definition for a <code>const</code> VS <code>readonly</code> values can be computed dynamically but need to be assigned before the constructor exits. After that it is frozen.</li> <li><code>const</code>'s are implicitly <...
<p>One thing to add to what people have said above. If you have an assembly containing a readonly value (e.g. readonly MaxFooCount = 4; ), you can change the value that calling assemblies see by shipping a new version of that assembly with a different value (e.g. readonly MaxFooCount = 5;)</p> <p>But with a const, it...
7,986
<p>Our team is migrating from VSS 6.0 to TFS 2008 to be used for source control purposes. I am wondering if anyone has any experience with this migration. In particular, we are interested in preserving the history of files in source control, as well as any other potential gotchas.</p>
<p>This is fairly easy once setup. You will first need to create a usermap.xml. This will map your VSS users to your TFS2008 users. Then you create a project configuration file. I would post examples of mine but I can't get the XML to post.</p> <p>The project configuration file will point to the usermap XML file. Then...
<p>Unfortunately, when I tried this...</p> <p>TF60032: The VSS Converter requires Visual SourceSafe 2005 or later to run. Please install Visual SourceSafe 2005 or later and try again.</p>
45,959
<p>I've run into strange problem in my Flex/Flashcom application. If client application unexpectedly disconnects from server latter does not call application.onDisconnect handler function. In witch direction should I look? Thank you.</p> <p><strong>Update</strong> I'm not using server components, but I do host this th...
<p>If so, it's documented and <a href="https://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&amp;catid=578&amp;threadid=1401786&amp;enterthread=y" rel="noreferrer">here</a> an interesting forum to follow..basically on Linux it may work a bit crazy like :)</p>
<p>It's possible that a client is disconnected before the (Flash Media-) server 'knows' about this. So no 'onDisconnect' function gets invoked (it <em>never</em> gets called by the client) until very, very late.</p> <p>If you want to detect (and act upon) "lingering" disconnects early, use the client.getStats() method...
46,928
<p>I am running into a very strange issue with PHP 5.2.6 w/ IIS on Windows XP (have tried both CGI and ISAPI). I am running a fresh installation with the default php.ini settings. </p> <p>First, assume the following (ugly, but effective) HTML code:</p> <pre><code>&lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?...
<p>Well, if it's any consolation your code works as intended in PHP5 with Apache.</p> <p>A quick Google revealed a couple other people with the same problem but no definitive solution - closest thing was <a href="http://bytes.com/archives/php/389664-_post-problem-php5-iis" rel="nofollow noreferrer">this</a>...</p> <b...
<p>Well, I just had the same issue. </p> <p>The PHP.ini file is picky...make sure you don't have "GB" where it should be "G". I had my "post_max_size" at 1GB instead of 1G, PHP ran fine, except for POST requests.</p>
40,375
<p>I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a "No module named resource" error. </p> <p>And I found the py2exe said:</p> <blockquote> <p>The following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils', 'pkg_resou...
<p>I've seen this before... py2exe, for some reason, is not detecting that these modules are needed inside the ZIP archive and is leaving them out.</p> <p>You can explicitly specify modules to include on the py2exe command line:</p> <pre><code>python setup.py py2exe -p win32com -i twisted.web.resource </code></pre> ...
<p>Had same issue with email module. I got it working by explicitly including modules in setup.py:</p> <p>OLD setup.py:</p> <pre><code>setup(console = ['main.py']) </code></pre> <p>New setup.py:</p> <pre><code>setup(console = ['main.py'], options={"py2exe":{"includes":["email.mime.multipart","email.mime.text...
20,505
<p>I'm trying to write a html helper extension that outputs an image tag. I need to access (within C# code) something like Razor's @Url.Content() helper to get the proper URL for the current context. How does one do this?</p>
<p>Use the following to mimic Url.Content in code.</p> <pre><code>VirtualPathUtility.ToAbsolute("~/url/"); </code></pre>
<p>You can get to the Request object and thus the URL like this:</p> <pre><code>string fullUrl = HttpContext.Current.Request.Url.AbsoluteUri; </code></pre>
45,828
<p>I am seeking insight on how to have each row in a Gridview expand to show a DIV or PANEL that has a form of elements, i.e. a simple form of textboxes, etc. I don't need a nested Gridview showing results or using DynamicPopulate.</p> <p>I have tried some techniques from a DataGrid Expandable Row, but ran into some pr...
<p>I was able to do this successfully by injecting a div within a div underneath each gridview row created. Once there, I was able to give them unique ids based on the data I was using, call an expand function in javascript, and expand/collapse the divs as I wished.</p> <p>This is fairly doable with a gridview, but a ...
<p>If you can afford it, there are many gridview controls that are ajaxified and have the ability to expand each row as needed. I use one set of controls from a company who shall remain nameless (for now) and have been extremely happy with them.</p> <p>Do a google search on gridview controls.</p>
38,780
<p>Within my Subversion project I have a few directories that contain other open source projects that my code needs. For example ffmpeg, freetype, matrixssl and a few others. </p> <p>What is the best way to update SVN to hold the the latest version of one of these projects?</p> <p>Essentially I will be doing the foll...
<p>You can take a look to svnbook talking about <a href="http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.advanced.vendorbr" rel="noreferrer">vendor branches</a>. This is exactly what you try to accomplish</p> <p>You can use <strong>svn_load_dirs.pl</strong> to replace your manual steps 1-5. svn_load_dirs.pl will ...
<p>I think you've got two options.</p> <p><strong>A)</strong></p> <ol> <li>SVN Delete all the files.</li> <li>Get current &amp; make it work.</li> <li>SVN Add all the files.</li> </ol> <p>Pro: Will make sure no extra files are kept if they are not present in the latest version.</p> <p>Con: May be time consuming.</p...
23,443
<p>How can I measure runtime memory requirements of an application on windows platform?</p>
<p>Perfmon.exe will monitor the usage of a process.</p> <p>Run perfmon.exe, right-click Add counters, pick Process for the Performance Object, then choose things like Virtual Bytes, Working Set, and Page File.</p>
<p>"Memory requirements" are not very well defined, in the first place. WHen you start, your executabel will be linked to many DLLs. Together with the first stack, this forms your initial process. Then, your proces might start extra threads, allocate more memory, and/or memory map some files. </p> <p>Now Wwindows won'...
47,629
<p>How to unit test WCF services? Any 3rd Party tools available?</p>
<p>As aku says, if you're testing service methods (ie code behaviour) then you can unit test that directly and bypass the WCF infrastructure. Of course, if your code depends on WCF context classes (like OperationContext) then I suggest introducing wrappers much like ASP.NET MVC does for HttpContext.</p> <p>For testing...
<p>I have seen <a href="http://www.parasoft.com/jsp/solutions/soa_solution.jsp?itemId=319" rel="nofollow noreferrer">SOA Test</a> used to evaluate performance and scalability tests on WCF services, if this is what you seek. I have no information on cost or liscencing.</p> <p>In our case, we captured the messages from...
18,381
<p>I have the following problem. If I query values with a keyfigure which is a function I can't specify multiple values of the same dimension restriction, but if it is not a function it works.</p> <p>So this works:</p> <pre><code>SELECT {[Measures].[Netto]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month]....
<p>Ok, this works:</p> <pre><code>WITH MEMBER [Time].[Month].a AGGREGATE ({[Time].[Month].[Month].&amp;[2008-03-01T00:00:00], [Time].[Month].[Month].&amp;[2008-04-01T00:00:00]}) SELECT {[Measures].[CalculatedFunction]} on columns FROM TDC where a </code></pre>
<p>The problem is in your calculated measure. You are using .CurrentMember and ClosingPeriod without a specific member reference which implies a call to .CurrentMember. When you have set in the WHERE clause there is no "Current" member - there are multiple current members. Re-writting your MDX to something like the fol...
48,216
<p>I have a clock feature in a VB.NET program that displays the time including the seconds. I currently have a timer constantly polling using NOW. I have to poll the system clock quite often because I need to have the second update in sync with the system clock.</p> <p>Is there a more direct to access the time only wh...
<p>Why not use the timer component? This assumes that you are using a GUI and not building a service.</p> <p>You could call a synchronization routine that performed the polling to get the timer very close to the seconds changing, then delegate to the timer. You could call the sync routine once a minute or so to make...
<p>Use a Timer object, set it's "interval" to 0, set it's "enabled" to true. That will fire roughly every 15 milliseconds (based on your hardware configuration). In that method, set MyLabel.Text = DateTime.Now.ToString() (or whatever you're doing).</p> <p>That is perfectly performant.</p>
33,884
<p>Im using APACHE as my web server and using port 8080. Ive create a site called (e.g. <a href="http://test.domain.com:8080" rel="nofollow noreferrer">http://test.domain.com:8080</a>). I have a Firewall (ISA Server 2006).</p> <p>How am I suppose to establish "<a href="http://test.domain.com:8080" rel="nofollow noref...
<p>Create a rule and related listner rule to listen on port 80 for the domain test.domain.com Then on the bridging tab of the rule, redirect to port 8080.<br> (That's if you want users to use port 80 rather then 8080).</p> <p>It's public name would be test.domain.com </p>
<p>Thanks a lot Bravax!</p> <p>Here's the step Ive done so far... first Ive created a web publishing rule, its public name was (e.g. test.domain.com) then after establishing new web rule I went to its properties and go to the bridging tab... I change the "Redirect request to http port" from 80 to 8080.</p> <p>Then I ...
20,911
<p>I am trying to access a Windows Media Player library from ASP.NET.</p> <p>The following code:</p> <p>WMPLib.WindowsMediaPlayer mplayer = new WMPLib.WindowsMediaPlayer();</p> <p>WMPLib.IWMPStringCollection list = mplayer.mediaCollection.getAttributeStringCollection("artist", "audio");</p> <p>Returns an non-empty ...
<p>Have you tried configuration via web.config in ASP.NET? When you're running in the VS2005 debugger, you're (probably) running code as yourself, but when under IIS you'll be running it as IUSR_<em>machinename</em> or another low-permission system account.</p> <p>Try adding something like this to your web.config file...
<p>I've run into a similar problem: the code works fine on my local machine, but once deployed on my home server, it can not pull anything out of the media library (I can open media player to verify there are songs in the library)</p> <p>At first I thought it was a process issue as well, so I tried both setting the ap...
16,731
<p>I'm coding the shutdown of a multithreaded server.If everything goes as it should all the threads exit by their own, but there's a small chance that a thread gets stuck.In this case it would be convenient to have a non-blocking join so I could do.</p> <p><strong>Is there a way of doing a non-blocking pthread_join? ...
<p>If you are running your application on Linux, you may be interested to know that:</p> <pre><code>int pthread_tryjoin_np(pthread_t thread, void **retval); int pthread_timedjoin_np(pthread_t thread, void **retval, const struct timespec *abstime); </code></pre> <p>Be careful, as the s...
<p>You could push a byte into a pipe opened as non-blocking to signal to the other thread when its done, then use a non-blocking read to check the status of the pipe.</p>
9,912