instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I wrote a component that displays a filename, a thumbnail and has a button to load/play the file. The component is databound to a repeater. How can I make it so that the button event fires to the main application and tells it which file to play?</p>
<p>Maybe you should try including a fourth column, stating the table it came from, and then order and group by it:</p> <pre><code>SELECT A,B,C, "query 1" as origin FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C, "query 2" as origin FROM table WHERE field LIKE '%query' UNION SELECT A,B,C, "query 3" as origin F...
<p>If there isn't a sort that makes sense to order them you desire, don't union the results together - just return 3 separate recordsets, and deal with them accordingly in your data tier.</p>
2,589
<p>What do you guys think about this for a generic singleton?</p> <pre><code>using System; using System.Reflection; // Use like this /* public class Highlander : Singleton&lt;Highlander&gt; { private Highlander() { Console.WriteLine("There can be only one..."); } } */ public class Singleton&lt;T&...
<p>Creating a singleton class is just a few lines of code, and with the difficulty of making a generic singleton i always write those lines of code.</p> <pre><code>public class Singleton { private Singleton() {} static Singleton() {} private static Singleton _instance = new Singleton(); public static S...
<p>Using generics is not useful for singletons. Because you can always create multiple instances of the type parameter T and then it is <strong>not</strong> by definition a singleton. </p> <p>Look at this:</p> <pre><code>public sealed class Singleton&lt;T&gt; where T : class, new() { private static readonly Lazy&...
49,896
<p>I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search all over the internet on this for last h...
<p>Forget all that, python just allocates more memory as needed, there is not a myriad of comandline arguments for the VM as in java, just let it run. For all comandline switches you can just run python -h or read man python.</p>
<p>Are you sure that the machine does not have a 128M process limit? If you are running the python script as a CGI inside a web server, it is quite likely that there is a process limit set - you will need to look at the web server configuration.</p>
23,283
<p>What do you think.. are clean URLs a backend or frontend 'discipline'</p>
<p>If we're talking url's being 'clean' from an end user experience then I'm going to break the mould a bit and say that url's in general are not intuitive and they never will be, they are intended to be machine readable. </p> <p>There is no standard to the format of a url such that when navigating from site to site ...
<p>I think the main reasons for using friendly URLs are:</p> <ul> <li>Ease of linking / sharing</li> <li>Presentation</li> <li>Seo </li> </ul> <p>So I think it's purely a client-side pleasure. While they're nice on the server as well, they're not mission critical.</p>
24,869
<p>Here's my issue: I need to close a process, already running, from a C# program. The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never have a main window. </p> <p>The other requirement that...
<p>This should work:</p> <pre><code>[DllImport("user32.dll", CharSet=CharSet.Auto)] private static extern IntPtr FindWindow(string className, string windowName); [DllImport("user32.dll", CharSet=CharSet.Auto)] private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); private const ...
<p>Question to clarify why you're attempting this: If the only user interface on the process is the system tray icon, why would you want to kill that and but leave the process running? How would the user access the process? And if the machine is "unattended", why concern yourself with the tray icon?</p>
13,558
<p>Where I can download sample database which can be used for data warehouse creation? It should't be sample from Microsoft (Northwind etc.).</p> <p>EDIT: Sorry for not clarifying my question. At my university we have class where we must create some data warehouse and since Northwind is so popular over net then profes...
<p>This is a free online database data generator: <a href="http://www.generatedata.com/" rel="noreferrer">www.generatedata.com</a></p> <p>You can design a table structure and let the script generate rows to populate it. It's not exactly what you need, but I think it can help.</p>
<p>Hey Just use Adventure works SR4</p>
29,268
<p>When userA uploads a file, his files will be uploaded to folderA, when userB, to folderB, and so on. Roles/Profiles in ASP.NET. Folders will be pre-existing. Anyone?</p>
<p>You'll probably want to hand-code that. There's nothing intrinsic to ASP.NET for managing user files. However, the code to do so should be relatively easy. Assuming the username is unique and never changes, you can combine the username with a path (use Path.Combine) and upload to that location. I would also lock dow...
<p>You can just check for the existance of the folder and create it for the user if it doesn't exists, but there are security implications for this. You might also want to try and store data in a database and tie it to a user.. this depends on what you are letting users upload I guess.</p>
15,254
<p>Imagine I have a property defined in global.asax. </p> <pre><code>public List&lt;string&gt; Roles { get { ... } set { ... } } </code></pre> <p>I want to use the value in another page. how to I refer to it?</p>
<p>You can access the class like this:</p> <pre><code>((Global)this.Context.ApplicationInstance).Roles </code></pre>
<p>If the values are dependent on the Session then this is actually simple using the HttpContext.Items Dictionary:</p> <p>Place this code in the Global.asax to store the value:</p> <pre><code>Dim someValue As Integer = 5 Context.Items.Add("dataKey", someValue) </code></pre> <p>Let retreive it in a Page with this cod...
31,397
<p>I have build plenty of SOAP webservices, but am building a REST webservice for a specific project, and I was wondering what people used for a 'WSDL' for REST services or if it is even needed.</p>
<p>You can try <a href="http://swagger.io/" rel="nofollow noreferrer">Swagger</a>(now OpenAPI) which allows to describe REST services using a JSON open standard.</p>
<p>You can supply an XSD if you are using XML in your REST service.</p> <p>Or just examples of the XML, should be enough to work things out for simple data structures anyway.</p>
36,129
<p>I am attempting to copy a custom struct from kernel space to user space. inside user space errno returns 'bad address'. What is the usual cause of a bad address error?</p> <pre><code>if(copy_to_user(info, &amp;kernel_info, sizeof(struct prinfo))) </code></pre>
<p>Bad Address error means that the address location that you have given is invalid. With the case you have above I would guess it is because you are passing a copy of <code>info</code> instead of a pointer to <code>info</code>'s memory location.</p> <p>Looking at the docs, <code>copy_to_user</code> is defined as</p> ...
<p>I had a same problem while writing a small char driver. All I was doing wrong was the function copy_to_user returns non-zero on failure, so you have to do this..</p> <pre><code>if(copy_to_user(void *userbuf, void *kernelbuf, long len)) return -EFAULT; // Continue with code.. </code></pre>
8,721
<p>DocumentsController#common_query can handle multiple different request styles.</p> <p>i.e. all docs in batch 4 or all docs tagged "happy"</p> <p>I want a single route to make em pretty, so:</p> <p>/documents/common_query?batch=4</p> <p>/documents/common_query?tag=happy</p> <p>become:</p> <p>/documents/batch/4<...
<p>As a single route:</p> <pre><code>ActionController::Routing::Routes.draw do |map| map.connect "documents/:type/:id", :controller =&gt; "documents_controller", :action =&gt; "common_query" end </code></pre> <p>Then <code>params[:type]</code> will either be <code>"batch"</code> or <code>"tag"</code>...
<p>As a single route:</p> <pre><code>ActionController::Routing::Routes.draw do |map| map.connect "documents/:type/:id", :controller =&gt; "documents_controller", :action =&gt; "common_query" end </code></pre> <p>Then <code>params[:type]</code> will either be <code>"batch"</code> or <code>"tag"</code>...
44,118
<p>Is there a built in way to convert an integer in Ruby into its hexadecimal equivalent?</p> <p>Something like the opposite of <a href="http://ruby-doc.org/core-2.0.0/String.html#method-i-to_i" rel="noreferrer"><code>String#to_i</code></a>:</p> <pre><code>"0A".to_i(16) #=&gt;10 </code></pre> <p>Like perhaps:</p> <...
<p>You can give <a href="http://www.ruby-doc.org/core/classes/Integer.html#method-i-to_s" rel="noreferrer"><code>to_s</code></a> a base other than 10:</p> <pre><code>10.to_s(16) #=&gt; "a" </code></pre> <p>Note that in ruby 2.4 <code>FixNum</code> and <code>BigNum</code> were unified in the <code>Integer</code> clas...
<p>Just in case you have a preference for how negative numbers are formatted:</p> <pre><code>p "%x" % -1 #=&gt; "..f" p -1.to_s(16) #=&gt; "-1" </code></pre>
11,000
<p>I have a ComboBox bound to an ObservableCollection of decimals. What is the correct way to apply our currency converter to the items?</p> <p>Edit:</p> <p>a) I have an existing currency converter that I must use b) .NET 3.0</p> <p>Do I need to template the items?</p>
<p>You can use the ItemStringFormat property on ComboBox to tell it how to format each of its items:</p> <pre><code>&lt;ComboBox ItemStringFormat="c"&gt; </code></pre> <p>However, be aware that when using "c" as a currency formatter, it will use the currency defined by the local machine. If your values are defined in...
<p>Use <strong>StringFormat</strong> in the Binding expression like </p> <pre><code>&lt;TextBox Text="{Binding Path=Value, StringFormat=Amount: {0:C}}"/&gt; </code></pre> <p>See this <a href="http://blogs.msdn.com/llobo/archive/2008/05/19/wpf-3-5-sp1-feature-stringformat.aspx" rel="nofollow noreferrer">blog for more ...
37,638
<p>After creating a instance of a class, can we invoke the constructor explicitly? For example</p> <pre><code>class A{ A(int a) { } } A instance; instance.A(2); </code></pre> <p>Can we do this?</p>
<p>You can use <a href="http://en.wikipedia.org/wiki/Placement_new" rel="nofollow noreferrer">placement new</a>, which permits</p> <pre><code>new (&amp;instance) A(2); </code></pre> <p>However, from your example you'd be calling a constructor on an object twice which is very bad practice. Instead I'd recommend you ju...
<p>Just to summarize, the three ways to specify the explicit constructor are via</p> <ol> <li><p>A instance(2); // does A instance = 2; ever work?</p></li> <li><p>A *instance = new A(2); //never sure about &amp; versus * here, myself</p></li> <li><p>new (&amp;instance) A(2);</p></li> </ol> <p>and flavors of those. ...
40,479
<p>Is there similar component for Delphi like dictionary of Python?</p> <p>I'm now using TStringList to map string/object pairs, but I'd like more general approach and maybe more powerful (TStringList has binary search when it is sorted).</p> <p>Solutions for pre-D2009 are also welcome.</p>
<p>There is in Delphi 2009. A whole new containers unit has been added, and a Dictionary class is one of the classes available.</p> <p>Couple this with Generics, and you have a very powerful set of classes.</p>
<p>I have allways used <a href="http://sourceforge.net/projects/decal/" rel="nofollow noreferrer">DeCAL</a>. It includes both sequences, maps and hashtables.</p>
49,522
<p>I'm pretty sure most of us are familiar with the concept of a project's requirements changing after it starts, this becomes more and more of an issue the less the client knows about how things work and the closer you work with them.</p> <p>How then can I design a system (specifically a website but general advice wi...
<p>All the normal oo principles apply here, reduce coupling, increase cohesion, don't repeat yourself etc. This will make sure you have a flexible and extendible code base.</p> <p>Apart from that don't try to preempt change. Apply YAGNI (You aint gonna need it) everywhere. Only build stuff you know your users need. Do...
<p>This is where frameworks come into play.</p> <p>If all the baseline, background, business-as-usual is in the framework, then your application is the extensions, special-cases and add-ons.</p> <p>The framework is already designed and built for change. Your stuff is the change that the frame was designed to accept....
16,067
<p>Your backend could be PHP or Python but you want to use the controls from the ASP.NET toolkit is there a successful way to do this?</p>
<p>I don't think that it is possible.</p> <p>The ASP.NET AJAX Toolkit is based on ASP.NET technique (what a surprise) and needs ASP.NET.</p> <p>It contains server-side controls, which are translated to HTML and Javascript by the ASP.NET engine. It is not working without the engine.</p> <p>However you can check the c...
<p>I have found that much of the functionality in AJAX Control Toolkit can be accomplished via the javascript frameworks such as jQuery.</p>
7,717
<p>In JavaScript this was a cross-browser compatibility issue, so both were used, but there are numerous instances in different languages where I see both printed out together as \r\n. Is this still the generally excepted norm that you should just always use both, or is there ever a time where languages understand both...
<p>The CRLF pair is the expected end-of-line (EOL) marker on most internet protocols.</p> <p>Here, Postel's "Robustness Principle" should apply. Be liberal in what you accept, but strict in what you send. So, be prepared to receive just a LF, but if you're sending data use whatever the relevant standards require.</p...
<p>This is not a language compatibility issue, but either a file issue or a protocol issue. File-wise: Unix uses \n as a carriage return, Windows uses \r\n and I think MacOS used (not sure about now) \r. Many 'cross platform' languages abstract this in a platform dependant variable. Protocol-wise: what the protocol spe...
32,115
<p>We are using the Board SKR 1.3 with the following pins:</p> <pre><code>/** * Trinamic Stallguard pins */ #define X_DIAG_PIN P1_29 // X- #define Y_DIAG_PIN P1_27 // Y- #define Z_DIAG_PIN P1_25 // Z- #define E0_DIAG_PIN P1_28 // X+ #define E1_DIAG_PIN P1_26 ...
<p>I second the previous answer if running second Z motor in parallel, just split wires or buy adapter consisting of two females to one male, Z motor on most printers don't draw huge current (or at least in smaller less frequent intervals to give things time to cool). </p> <p>Erm I extruder with two temperature zones,...
<p>Unfortunately, I faced the same problem. The heated chamber will not be accurate enough due to lack of PID tuning. As a result, the temp will differ up to 10 degrees celsius when the heater is on. Is a big difference that will either not dry your filament enough or in the worst scenario will melt it. You will need t...
1,608
<p>I am looking for a Dataflow / Concurrent Programming API for Java.<br> I know there's <a href="http://www.pervasivedatarush.com/" rel="noreferrer">DataRush</a>, but it's not free. What I'm interested in specifically is multicore data processing, and not distributed, which rules out <a href="http://en.wikipedia.org/w...
<p>You might try <a href="http://www.gpars.org/" rel="nofollow noreferrer">gpars</a>; it apparently has implementations of data flow variables and streams in Java even though it is geared towards providing concurrent programming goodies for Groovy.</p>
<p>Does the built in Java <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html" rel="nofollow noreferrer">concurrent</a> package meet your needs? It's a very nice package, built in ThreadPools, CopyOnWriteCollections, Executors, Future. We use it to process large volumns of data ...
19,621
<p>Reading through <a href="https://stackoverflow.com/questions/39879/why-doesnt-javascript-support-multithreading">this question</a> on multi-threaded javascript, I was wondering if there would be any security implications in allowing javascript to spawn mutliple threads. For example, would there be a risk of a malic...
<p>No, multiple threads would not add extra security problems in a perfect implementation. Threaded javascript would add complexity to the javascript interpreter which makes it more likely to have an exploitable bug. But threads alone are not going to add any security issues. </p> <p>Threads are not present in javasc...
<p>Well I think that the only major example of multi-threaded javascript is Google's chrome (WOULD THEY RELEASE IT ALREADY JEEZ) and if I understand it the javascript will only one process per tab, so unless it started spawning tabs (popups) I would assume this would be a null issue, but I think that Google has that un...
6,117
<p>I'm looking to establish some kind of socket/COMET type functionality from my server(s) to my iPhone application. Essentially, anytime a user manages to set an arbitrary object 'dirty' on the server, by say, updating their Address.. the feedback should be pushed from the server to any clients keeping a live poll to ...
<p>There are a couple of solutions available to use a <a href="http://stomp.codehaus.org/Protocol" rel="noreferrer">STOMP</a> client.</p> <p>STOMP is incredibly simple and lightweight, perfect for the iPhone.</p> <p>I used <a href="http://code.google.com/p/stompframework/" rel="noreferrer">this one</a> as my starting...
<p>COMET, LightStreamer, AJAX all that junk is broken. It is basics of TCP that no 'keep-alives' are ever guaranteed without pinging traffic.. So you can forget that long-polling if any decent reliability or timely delivery is to be guaranteed..</p> <p>It's just hype everyone saw through back in 2003 when the lame-man...
43,861
<p><em>TLDR - I’ve just driven myself insane trying to fix what I thought was a physical problem with my Z-axis, but it seems to have been solved by switching from the TH3D firmware to the Creality firmware. I’m hoping someone can help me see where I went wrong here, so I can learn from it. Have I missed something obvi...
<p>It's well known in mathematical circles that the &quot;salesman problem&quot; is what mathematicians call &quot;hard&quot; -- in their usage, that means a lot of extremely smart people have worked on the problem for many years (more than a century?) and still not found a robust, works-every-time solution.</p> <p>Wha...
<p><strong>Long story short:</strong> I only know the setting &quot;Combing Mode OFF&quot; that improves the travel paths. In my case it did not help. In your case I suggest you should give PrusaSlicer a try. I assume that the overall print duration will be improved because of a better calculation of the travel paths. ...
1,992
<p>My company is currently migrating some of their really old db's to sql server 2005. Some legacy apps have problems connecting to the new server. The connection string works in Asp.NET 2.0, probably because it assumes tcp:1433 automatically.</p> <p>I have to construct the connection string like this in ASP.NET 1.1 f...
<p>IIRC SQL Server 2005 defaults to find any-old-port that is available. On my laptop this means port 1212.</p> <p>To force it to a specific port you must go to Start->Programs->SQL Server 2005->Configuration Tools->SQL Server Configuration Manager</p> <p>From here you must go to SQL Server 2005 Network Configuration...
<p>Perhaps your SQL Server is configured for multi-protocol, and it's trying to use the other protocol first and failing, perhaps for some security reason (the account that the app is running as in IIS). Just a guess.</p>
36,858
<p>This declaration causes an overflow in VBA:</p> <pre><code>Const OVERFLOWS As Long = 10 * 60 * 60 </code></pre> <p>whereas setting the value directly is fine:</p> <pre><code>Const COMPILES_OK As Long = 36000 </code></pre> <p>How do you persuade VBA to treat literal integers as longs?</p> <p>Thanks</p>
<p>Add the <code>long</code> suffix <code>&amp;</code> to at least one number:</p> <pre><code>Const OVERFLOWS As Long = 10&amp; * 60 * 60 </code></pre> <p>Note that using the <code>CLNG</code> function to convert the values to <code>long</code> will not work, because VBA does not allow assigning the return value of a...
<p>The type character can also be appended to literals : Const OVERFLOWS As Long = (10&amp; * 60 * 60) (one is suffucient actually because of the way the VBA engine evaluates the expression).</p>
32,718
<p>What are the ways by which we can reduce the size of the HTML Response sent by an asp.net application?</p> <p>I am using Controls which are not owned by me and it produces output with white spaces. I am interested in Minifying the entire HTML output of the page just like how google does (View source www.google.com)...
<p>There is no need to do it at run time. Because it can be done at compile time.</p> <p>Details: <a href="http://omari-o.blogspot.com/2009/09/aspnet-white-space-cleaning-with-no.html" rel="noreferrer">http://omari-o.blogspot.com/2009/09/aspnet-white-space-cleaning-with-no.html</a></p>
<p>The accepted answer does not work with MVC 4, so here is a similar lib that minifies at build-time <a href="https://github.com/jitbit/HtmlOptimizerMvc4" rel="nofollow">https://github.com/jitbit/HtmlOptimizerMvc4</a></p>
31,818
<p>I erroneously delete all the rows from a MS SQL 2000 table that is used in merge replication (the table is on the publisher). I then compounded the issue by using a DTS operation to retrieve the rows from a backup database and repopulate the table.</p> <p>This has created the following issue: The delete operation m...
<p>Have you tried truncating the table?</p>
<p>Would creating a second table be an option? You could create a second table, populate it with the needed data, add the constraints/indexes, then drop the first table and rename your second table. This should give you the data with the right keys...and it should all consist of SQL statements that are allowed to trick...
10,912
<p>I'm planning to write a aspx pages on Windows XP machine. I have IIS 7.0 enabled and virtual directory setup. Are aspx page developments allowed on Win XP?</p>
<p>Yes, you can develop ASP.NET pages (.aspx) on Windows XP. XP only runs IIS 5.1, however you don't even need IIS installed as Visual Web Developer Express has a built-in web server you can use during development.. To get started, I would go to <a href="http://www.microsoft.com/express/" rel="nofollow noreferrer">http...
<p>The new Web Platform Installer now supports XP:</p> <p><a href="http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx" rel="nofollow noreferrer">http://www.microsoft.com/web/channel/products/WebPlatformInstaller.aspx</a></p>
42,405
<p>Has anyone else experienced (and possibly solved) unintentional pitch changes using MS SAPI TTS voices? </p> <p>I'm using the SpVoice automation interface with SAPI 5.1.</p> <p>Right now, my application (VB6 app) can get into a state where the TTS (Microsoft Anna) starts to sound like a chipmunk (proper rate, but ...
<p>Can you answer your own question? Can you ask another question in the answer? Too late... :)</p> <p>My solution was to initialize the Voice.AudioOutputStream.format.Type to something sensible, like 16kHz16BitMono. I had a bug where if there is only one voice available, this initialization step could be skipped. Tur...
<p>I haven't seen that happen, although my experience is mostly with SAPI 5.3 with SSML, which gets translated (under the covers) to SAPI TTS.</p> <p>Have you tried surrounding your text with the <code>&lt;pitch absmiddle="0"&gt;</code> Your Text Here instead of just at the front of the text?</p>
11,820
<p>I've searched a lot for an answer for this question in the web: they say it's true, SBCL doesn't work under Vista. But I really need to work with lisp on my home Vista laptop and VM doesn't help really... And CL is not so interesting because of speed...</p> <p>If you have any recommendation, please share!</p>
<p>Have you seen these articles?</p> <p><a href="http://robert.zubek.net/blog/2008/04/09/sbcl-emacs-windows-vista/" rel="noreferrer">http://robert.zubek.net/blog/2008/04/09/sbcl-emacs-windows-vista/</a></p> <p><a href="http://brainrack.wordpress.com/2008/05/29/running-sbcl-on-windows/" rel="noreferrer">http://brainra...
<p>Make sure you have DEP off for SBCL.</p>
17,814
<p>I have some thread-related questions, assuming the following code. Please ignore the possible inefficiency of the code, I'm only interested in the thread part.</p> <pre><code>//code without thread use public static int getNextPrime(int from) { int nextPrime = from+1; boolean superPrime = false; while(!...
<p>By putting the join() in the loop, you're starting a thread, then waiting for that thread to stop before running the next one. I think you probably want something more like this:</p> <pre><code>public static void main(String[] args) { int primeStart = 5; // Make thread-safe list for adding results to Lis...
<p>Running a test, the second one doesn't seem to take 9 seconds--in fact, it takes at least as long as the first (which is to be expected, threding can't help the way it's implemented in your example.</p> <p>Thread.join will only return when the thread.joined terminates, then the current thread will continue, the one...
30,867
<p>I was thinking of centralizing this functionality by having a single method that gets passed an AppState argument and it deals with changing the properties of all GUI elements based on this argument. Every time the app changes its state (ready, busy, downloading so partially busy, etc), this function is called with ...
<p>Emrah,</p> <p>Your idea is good. You need to limit the state structure and this is the only way to ensure reliable UI. On the other hand do not follow the "one function" idea to strictly. Rather continuously follow its direction, by creating a function and then do progressively refactoring all attributes to a singl...
<p>Yes, this is the most time consuming part of the GUI work, to make a user friendly application. Disable this, enable that, hide this, show that. To make sure all controls has right states when inserting/updateing/deleteing/selecting/deselecting things.</p> <p>I think thats where you tell a good programmer from a ba...
43,825
<p>I'm new to ReSharper and am surprised that there isn't a template defined for</p> <pre><code>public void MethodName(&lt;params&gt;) { } </code></pre> <p>I realize I could create one, but I would have thought this would have been part of the standard product. Perhaps I'm missing some other shortcut?</p>
<p>I'm not aware of any such default template, but as you pointed out it's terribly easy to write:</p> <pre><code>public void $METHODNAME$($PARAMS$) { $END$ } </code></pre> <p>However, I'm more that a tiny bit perplexed that you're interested in making all your methods both public and void <strong>by default.</st...
<p>My version:</p> <pre><code>//----------------------------------------------------------------- private $RETURN_TYPE$ $METHODNAME$($PARAMS$) { $CLIPBOARD$ $END$ } </code></pre> <p>Notice: In Template Editor you can insert macro for each <code>$FIELD$</code>. For example: "Clipboard content" macro for <code>...
41,701
<p>In my app have a window splitted by a QSplitter, and I need to remove an widget. </p> <p>How can I do that? I can't find useful methods </p>
<p>Many things in Qt cannot be "traditionally" removed. Instead call hide() on it and destruct it. From <a href="http://doc.qt.io/qt-5/qsplitter.html#details" rel="noreferrer">QSplitter</a> documentation:</p> <blockquote> <p>When you hide() a child its space will be distributed among the other children. It will ...
<p>Another easy way to prevent the child widget from getting deleted is to use QSplitter.takeWidget(child). This is also the recommended way of removing the widget from a splitter. (Qt Documentation)</p>
48,565
<p>What is the best practice for naming UI controls (textboxes, drop-downs, etc.) on forms and reports for reference in the code-behind pages?</p> <p>I develop a lot of reports and forms in my office. I have several web applications providing about 80+ "live" reports being generated from various and multiple data sou...
<p>The main product I work on at work uses the txt_ pnl_ etc prefixes. This does work, though it is a bit of a pain at times when switching something that just hides/shows controls from say, a tr to a panel because you have to rename it. </p> <p>What I've started doing in new projects, is naming my UI controls with a ...
<p>I've always felt that the only real reason for the prefixes was so you could have things like txtFirstName and lblFirstName on the same form/page. Since, the vast majority of the time, I'm really only working with the actual field control itself, I skip the prefix for that, and only use the prefixes for associated c...
13,701
<p>I'm a pretty experienced Grails developer, but most of my experience has been with using grails for serving up JSON/XML to a flex app and some relatively simple HTML websites.</p> <p>I've been diving deeper into using the sitemesh integration in grails and I'm struggling a little to find best practices for some mor...
<p>Well, I can answer a bit:</p> <p>Your first and third questions are related, as you can't chain layouts using the meta tag.</p> <p>Your final page should have a meta tag as you suggest, but if you want to layer a layout on top of another layout, you put a g:applyLayout tag at the top of the child layout, pointing ...
<p>See our <a href="https://github.com/Rabbytes/rabbtor-examples" rel="nofollow">Rabbtor Showcase App</a> for a few very good examples on </p> <ul> <li>creating nested layouts</li> <li>rendering templates </li> <li>applying layouts to specific parts of a page</li> </ul> <p>. This app is actually a showcase for our to...
44,077
<p>I'm not new to web publishing, BUT I am new to publishing against a web site that is frequently used. Previously, the apps on this server were not hit very often, but we're rolling out a high demand application. So, what is the best practice for publishing to a live web server?</p> <ol> <li>Is it best to wait unt...
<blockquote> <p><strong>@Nick DeVore wrote:</strong></p> <p>If 2 is true, then that seems bad if someone is using that specific page or DLL and it gets overwritten.</p> </blockquote> <p>It's not really an issue if you're using ASP.NET stack (Webforms, MVC or rolling your own) because all your aspx files get compiled an...
<p>We do most of our updates in the wee small hours.</p> <p>Handy hint, if this is an ASP.NET site, whatever time of the day you roll out, drop in an App_Offline.htm file with a message explaining to users that the site is down for maintenance. </p> <p>Scott Guthrie has more info here:</p> <p><a href="http://weblogs...
3,286
<p>Wondering if my approach is ok or could be improved:</p> <pre><code>Public Class Company private _id as Integer private _name as String private _location as String Public Function LoadMultipleByLocation(Byval searchStr as String) as List(Of Company) 'sql etc here to build the list End Function End...
<p>In this case, you would create an instance of Company, and then use it to return a List of Companies?</p> <p>Some people do this, but I prefer to seperate my data object into a dumb data container:</p> <pre><code>public class Company : EntityBase { private int _id; private string _name; private stri...
<p>@Dan</p> <p>EntityBase would be a base class that each entity object would inherit, something like:</p> <pre><code>public class EntityBase { public virtual string SaveSproc { get; } public virtual void LoadFromReader(SqlReader reader) { } public virtual void Save() { List&l...
32,484
<p>In Eclipse, under <kbd>Windows</kbd> -> <kbd>Preference</kbd> -> <kbd>Java</kbd> -> <kbd>Code Style</kbd>, you can define code templates for comments and code, and you can setup a code formatter. </p> <p>I'm wondering if it is possible in Eclipse to have these setting take affect every time I save a source file. B...
<p>Under <kbd>Preferences</kbd>, choose <kbd>Java</kbd> --> <kbd>Editor</kbd> --> <kbd>Save Actions</kbd>. Check the <kbd>Perform the selected actions on save</kbd>, and check the <kbd>Format source code</kbd> box.</p> <p>This may or may not be available in previous versions of Eclipse. I know it works in:</p> <pre...
<p>If you find that you do not have a <kbd>Save Actions</kbd> preference under <kbd>Java</kbd>--> <kbd>Editor</kbd>, it may be because you are using an older version of Eclipse. In that case you can install the Format on save plugin from <a href="http://sourceforge.net/projects/ejp/files/eclipse%20formatonsave%20plugin...
29,039
<p>Consider this sample code:</p> <pre><code>&lt;div class="containter" id="ControlGroupDiv"&gt; &lt;input onbeforeupdate="alert('bingo 0'); return false;" onclick="alert('click 0');return false;" id="Radio1" type="radio" value="0" name="test" checked="checked" /&gt; &lt;input onbeforeupdate="alert('bingo 1'); r...
<p>Yup, that's a strange bug. I did manage to cook up a workaround. I use a bit of Prototype to handle class names here. It works in IE and FF. You can probably shorten it up with a selector instead of a crude loop.</p> <pre><code>&lt;form name="f1"&gt; &lt;input type=radio onmouseover="recordMe()" onclick="clickCheck...
<p>What is your goal? If you just want to capture when a change is made, run your logic on the onclick event. (this will get around IE's bug with onchange)</p> <p>If you are trying to change the expected behavior of radio buttons - I would highly recommend against it.</p>
49,207
<p>I'm trying to create a new Excel file using jxl, but am having a hard time finding examples in their API documentation and online.</p>
<p>After messing around awhile longer I finally found something that worked and saw there still wasn't a solution posted here yet, so here's what I found:</p> <pre><code>try { String fileName = "file.xls"; WritableWorkbook workbook = Workbook.createWorkbook(new File(fileName)); workbook.createSheet("Sheet1...
<pre><code>public void exportToExcel() { final String fileName = "TodoList2.xls"; //Saving file in external storage File sdCard = Environment.getExternalStorageDirectory(); File directory = new File(sdCard.getAbsolutePath() + "/javatechig.todo"); //create directory if not exist if(!directory.i...
18,161
<p>I've noticed there are a few solutions to allow the use of memcached on C# / ASP.NET:</p> <ul> <li><p>memcacheddotnet</p></li> <li><p>enyim.com Memcached Client</p></li> <li><p>BeIT</p></li> </ul> <p>Which one should I use? It seems like the enyim port has more active development, but I wanted to see what you guy...
<p>I use <a href="http://code.google.com/p/beitmemcached/" rel="nofollow noreferrer">BeIT</a> and i am happy with it.</p>
<p>Take a look at <a href="http://msdn.microsoft.com/en-us/data/cc655792.aspx" rel="nofollow noreferrer">Velocity</a>. Its Microsofts new alternative, its not stable yet but looks promising.</p>
34,378
<p>Assuming you can't use LINQ for whatever reason, is it a better practice to place your queries in stored procedures, or is it just as good a practice to execute <em>ad hoc</em> queries against the database (say, SQL Server for argument's sake)?</p>
<p>In my experience writing mostly WinForms Client/Server apps these are the simple conclusions I've come to:</p> <p><strong>Use Stored Procedures:</strong></p> <ol> <li>For any complex data work. If you're going to be doing something truly requiring a cursor or temp tables it's usually fastest to do it within SQL S...
<blockquote> <p>is it good system architecture if you let connect 1000 desktops directly to database?</p> </blockquote> <p>No it's obviously not, it's maybe a poor example but I think the point I was trying to make is clear, your DBA looks after your database infrastructure this is were their expertise is, stuff...
4,293
<p>I have a Linq Query where I do the following:</p> <pre><code>query = context.Select(a =&gt; new { Course = (CourseType)a.CourseCode, CourseDetail = sting.Format("Course: {0}\r\nCourse Detail: {1}", ((CourseType)a.CourseCode).ToString(), a.CourseDetail) }); enum CourseType{ Unknown = 0, FullTime = 1, Part...
<p>Are you sure that's the exact code you're using? </p> <p>There's a typo: sting.Format instead of st<strong>r</strong>ing.Format, so I guess you've retyped the code for this question. Check to make sure all your brackets are in the correct place etc.</p> <p>I've tried the following code, prints out "Fulltime", so t...
<p>Not directly an answer, but just a question, why are you typing:</p> <pre><code>((CourseType)i).ToString() ((CourseType)a.CourseCode).ToString() </code></pre> <p>The string.Format takes objects as ParamArray and calls .ToString() on each of them. The additional .ToString() you use performs just the creation of a n...
49,359
<p>We are developing a port of the GNU Assembler for a client architecture. Now the problem being faced is that:</p> <p>If an immediate operand to an instruction is an expression involving more than one relocatable symbols, how is it handled in output file in elf format. What will be the relocation information produce...
<p>ELF doesn't know about instructions, per se. It knows about particular encodings of symbol offsets within instructions. In the assembler, you would need to output two relocation records, each with the corresponding [address,type,symbol] triplet to properly patch that portion of the instruction. The linker wouldn'...
<p>I know jack about ELF and only a little more about linking but...</p> <p>I would expect that each operand is handled the same way that it would be if there was only one.</p> <p>OTOH might the issue be that the format for <code>j</code> alters depending on where the labels are? If so, I <em>think</em> you're sunk a...
45,094
<p>Does anyone know of papers/books/etc. that document patterns for databases? For example, one common rule of thumb is that every table should have a primary key and that the key should be <a href="http://en.wikipedia.org/wiki/Surrogate_key" rel="noreferrer">devoid of information content</a>. So I was wondering if a...
<p>Specifically, regarding keys: I strongly disagree with the strange idea that keys must be without meaning. In general, I consider a database a collection of facts; as soon as you start adding arbitrary numbers (like generated keys) and other irrelevant information into it, it should be a warning sign. I recommend <a...
<p>To answer exactly: <a href="http://www.amazon.com/s/ref=nb_ss_b/102-6537774-4068964?url=search-alias%3Dstripbooks&amp;field-keywords=database+design+patterns&amp;x=0&amp;y=0" rel="nofollow noreferrer">yes</a>. There are s*-tons of info written on 'good' database design. Although youe example rule of thumb is certa...
6,601
<p>We are now using NHibernate to connect to different database base on where our software is installed. So I am porting many SQL Procedures to Oracle.</p> <p>SQL Server has a nice function called DateDiff which takes a date part, startdate and enddate.</p> <p>Date parts examples are day, week, month, year, etc. . ....
<p>I stole most of this from an old tom article a few years ago, fixed some bugs from the article and cleaned it up. The demarcation lines for datediff are calculated differently between oracle and MSSQL so you have to be careful with some examples floating around out there that don't properly account for MSSQL/Sybase...
<p>YOU Could write a function in oracle for this</p> <pre><code>function datediff( p_what in varchar2, p_d1 in date, p_d2 in date) return number as l_result number; BEGIN select (p_d2-p_d1) * decode( upper(p_what), 'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL ) into l_result from...
6,544
<p>In my database I have tables that define types for example</p> <p>Table: Publication Types</p> <pre> ID | Type ---------- 1 | Article 2 | Abstract 3 | Book .... </pre> <p>Which is related through the ID key to a publication tables which has the field <em>TypeID</em>.</p> <p>I then create a PublicationTable ...
<p>if publication types are essentially static, enums are fine</p> <p>there is arguably little difference between embedding </p> <pre><code>inner join lookuptable lt on lt.id = (int)myenum.sometype </code></pre> <p>in a query and adding </p> <pre><code>inner join lookuptable lt on lt.name = "somehardcodeddescripti...
<p>For various reasons it would be nice to keep lists such as my publication type list and others in one place; the database. Then there is only one place for them to change. However, it seems to me that this adds some complexity to the code and I would still need to have some hard coded elements in the code if I wan...
31,420
<p>I have a MySQL table with coordinates, the column names are X and Y. Now I want to swap the column values in this table, so that X becomes Y and Y becomes X. The most apparent solution would be renaming the columns, but I don't want to make structure changes since I don't necessarily have permissions to do that.</p>...
<p>I just had to deal with the same and I'll summarize my findings.</p> <ol> <li><p>The <code>UPDATE table SET X=Y, Y=X</code> approach obviously doesn't work, as it'll just set both values to Y.</p></li> <li><p>Here's a method that uses a temporary variable. Thanks to Antony from the comments of <a href="http://beerp...
<p>Swapping of column values using single query</p> <p>UPDATE my_table SET a=@tmp:=a, a=b, b=@tmp;</p> <p>cheers...!</p>
5,842
<p>Is there a way to get Visual Studio 2008 to do matching brace highlighting for Javascript?</p> <p>If there is no way to do it in Studio, can it be done using ReSharper?</p> <p>Thanks!!</p>
<p>Note that Visual Studio will still find a matching brace in JavaScript via Ctrl + ].</p>
<p>For what it's worth, I use the most excellent ViEmu plugin for visual studio, and it supplies the Vi(m) paren/brace/bracket matching. </p> <p>ViEmu is <a href="http://www.viemu.com" rel="nofollow noreferrer">here</a></p> <p>Of course, if you're not a Vi lover, the price for matching parens may be too high. ;)</p>
31,577
<p>This has me stumped. I had been printing normally until this happened. Below is an expurgated version of my headache over two days. Some help would be appreciated.</p> <p>Printer is Hypercube Evolution (CoreXY) using Bowden tube and eSun PLA+ filament. Bowden tube goes from inside the feed cone in the extruder strai...
<p>The lump at the top of the heatbreak is because there is a gap between your bowden tube and the heatbreak. Liquid filament is leaking out of the heatbreak and solidifying there. When you reassemble, you need to close this gap.</p> <p>There should not be smoke coming out of your nozzle. Maybe when it is new, there...
<p>Worked out the reason for the thickening filament. A number of sites refer to heat creep and suggest that you check that the heatsink is clear and the heatsink fan is working properly. In my case, they were. However, the fan outlet (where it blows on the heat sink) was full of garbage. Cleaned that out things improv...
2,061
<p>The .NET <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx" rel="noreferrer">IDisposable Pattern</a> <em>implies</em> that if you write a finalizer, and implement IDisposable, that your finalizer needs to explicitly call Dispose. This is logical, and is what I've always done in the rare situat...
<p>The .Net Garbage Collector calls the Object.Finalize method of an object on garbage collection. By <strong>default</strong> this does <strong>nothing</strong> and must be overidden if you want to free additional resources.</p> <p>Dispose is NOT automatically called and must be <strong>explicity</strong> called if ...
<p>The documentation on <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx" rel="nofollow noreferrer">IDisposable</a> gives a pretty clear and detailed explaination of the behavior, as well as example code. The GC will NOT call the <code>Dispose()</code> method on the interface, but it will call t...
6,683
<p>Since you can use reflector to reverse-engineer a .Net app, is there any reason to NOT ship the pdb files with the app? If you do ship them with it, then your stack trace will include the line number with the problem, which is useful if it crashes.</p> <p>Please only enter 1 reason per comment for voting.</p>
<p>Shipping pdb does not give any additional convenience to an user. So there are no reasons to ship pdb files with the app. Besides pdb file usually has a large size.</p> <p>Instead of shipping pdb files you should use a local Microsoft Symbol Server for a fast access to pdb files corresponding to error reports. <a hr...
<p>Why would you ship anything more than you need to?</p>
11,460
<p>How can I create a table that has its first row and first column both locked, as in Excel, when you activate 'freeze panes'? I need the table to both scroll horizontally and vertically (a lot of solutions for this exist, but only allow vertical scrolling).</p> <p>So, when you scroll down in the table, the first ro...
<p>Oh well, I looked up for scrollable table with fixed column to understand the need of this specific requirement and your question was one of it with no close answers.. </p> <p>I answered this question <a href="https://stackoverflow.com/questions/10838700/large-dynamically-sized-html-table-with-a-fixed-scroll-row-an...
<p>I ran across a site a few weeks back. This is a working example of the first column locked but it is not browser compatible with Firefox. I didn't do a lot of checking around but it seems it only works in IE. There are some notes the author provided along with it that you can read.</p> <p>Lock the First column: <a ...
37,858
<p>I have a setup project created by Visual Studio 2005, and consists of both a C# .NET 2.0 project and C++ MFC project, and the C++ run time. It works properly when run from the main console, but when run over a Terminal Server session on a Windows XP target, the install fails in the following way - When the Setup....
<p>I had LOTS of issues with developing installers (and software in general) for terminal server. I hate that damn thing.</p> <p>Anyway, VS Setup Projects are just .msi files, and run using the Windows installer framework.</p> <p>This will drop a log file when it errors out, they're called MSIc183.LOG (swap the c183 ...
<p>Before installing, drop to a command prompt and type</p> <pre><code>CHANGE USER /INSTALL </code></pre> <p>Then install your software. Once the install has completed, drop back to the command prompt and type:</p> <pre><code>CHANGE USER /EXECUTE </code></pre> <p>Alternatively, don't start the installation by a dou...
3,589
<p>How do they compare to the DevXpress ones or the original MSOffice ones.<br> Are they worth investing time in them (for practical usage now, not academic curiosity which I'll do anyway)?</p>
<p>From my experience, the new ribbon control implements the entire specification as laid out by Microsoft. The only issue I noticed was a slight flicker when the form was resized which caused one of the sections to collapse or expand. </p> <p>Worth spending time in? Definitely, as they are lighter weight and its a...
<p>IMO, the DevExpress ribbon control is much more complex than it needs to be. i own the DevExpress ribbon control but converted to using the delphi TRibbon. the delphi TRibbon isn't perfect either but i've learned to avoid these problems.</p>
15,857
<p>With the jQuery datepicker, how does one change the year range that is displayed? On the jQuery UI site it says the default is "10 years before and after the current year are shown". I want to use this for a birthday selection and 10 years before today is no good. Can this be done with the jQuery datepicker or wi...
<p>If you look down the demo page a bit, you'll see a "Restricting Datepicker" section. Use the dropdown to specify the "<code>Year dropdown shows last 20 years</code>" demo , and hit view source:</p> <pre><code>$("#restricting").datepicker({ yearRange: "-20:+0", // this is the option you're looking for showO...
<p>i think this may work as well </p> <pre><code>$(function () { $(".DatepickerInputdob").datepicker({ dateFormat: "d M yy", changeMonth: true, changeYear: true, yearRange: '1900:+0', defaultDate: '01 JAN 1900' }); </code></pre>
33,859
<p>I can't seem to figure out what I am doing wrong here. I publish my website to my server and when I try to run it I get the following exception:</p> <blockquote> <p>Could not load the assembly 'App_Web_kh7-x3ka'. Make sure that it is compiled before accessing the page.</p> </blockquote> <p>Has anyone else ever e...
<p>This can also happen when you've taken a pre-compiled aspx page and edited it as if uncompiled, such as copying it from the Live server and overwriting your dev/working version.</p> <p>On the first line of your aspx page within the <code>&lt;%@Page /&gt;</code> tag you'll probably see an attribute like: </p> <p><c...
<p>We recently had this issue materialise overnight for one of our precompiled sites. Turns out our server's anti-virus software was silently quarantining one of the compiled DLL files. (apparently my code resembled an update hijacker... charming)</p> <p>Slightly off-the-wall cause for this problem, but hopefully it h...
37,836
<p>I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file: </p> <p><pre><code> NameVirtualHost 127.0.0.1</p> <p>&lt;VirtualHos...
<p>You did not need</p> <pre><code>Options Indexes FollowSymLinks MultiViews Includes ExecCGI AllowOverride All Order Allow,Deny Allow from all Require all granted </code></pre> <p>the only thing what you need is...</p> <pre><code>Require all granted </code></pre> <p>...inside the directory section.</p> <p>See Apa...
<p>I have fixed it with removing below code from </p> <p><strong>C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf</strong> file</p> <pre><code>&lt;VirtualHost *:80&gt; ServerAdmin webmaster@dummy-host.example.com DocumentRoot "c:/Apache24/docs/dummy-host.example.com" ServerName dummy-host.examp...
11,471
<p>I am a programmer at a financial institute. I have recently been told to enforce that all new user id's to have at least one alpha and one numeric. I immediately thought that this was a horrible idea and I would rather not implement it, as I believe this is an anti-feature and of poor user experience. The problem...
<p>One argument against this is that many usernames / ids in other areas do not require numeric components. It's more likely that users will be better able to remember user ids that they have used elsewhere -- and that is more likely if they do not need to include numerics. </p> <p>Furthermore, depending on the syste...
<p>it's good if it's in their password (as alas, financial companies like to deny you this security right [i'm talking to you american express]).</p> <p>username, i say no, unless they want to.</p>
12,326
<p>I have some Perl code that runs fine outside the debugger:</p> <pre><code>% perl somefile.pl </code></pre> <p>but when I run it inside the debugger:</p> <pre><code>% perl -d somefile.pl </code></pre> <p>it behaves differently.</p> <p>The files in question (there are several) are part of the test suite for a lar...
<p>This is a problem with perl5db.pl creating <code>__DIE__</code> handlers. If I localize <code>$SIG{__DIE__}</code> in your <code>eval</code>, things work as you expect.</p> <pre> eval { local $SIG{__DIE__}; die MyEx->new }; </pre> <p>If you don't do that, you're getting the handler from DB::dbdie, w...
<p>Is it possible you have an RC file or environment variable (<code>PERLDB_OPTS</code>) that is modifying the <code>dieLevel</code> option of the debugger? I personally haven't used <code>dieLevel</code> but apparently when it's set to a value greater than zero it can force stack unwinding and "tends to hopelessly de...
41,705
<p>This is a design question and good practice question. How do you structure your Java web development such that a lot of logic is not in the JSP file. Should you use any of the JSP tags for if structures or loops. I see a lot of code where the logic is hard to follow because of poorly designed JSP files. And then...
<p>The easiest way to avoid placing logic in JSPs is simply to perform all that logic <em>before</em> forwarding a request to a JSP. The only logic you should need to do in a JSP is some basic looping (e.g. for creating HTML table rows), evaluating conditional statements, and data formatting.</p> <p>All of this can be...
<p>Since you're already using Spring you may want to check out Spring Webflow. I assume you're using Spring form tags, but if not, you should check those out as well. With this combination there should be very little need [if any] to use JSP tags in your view logic.</p>
38,404
<p>I just recently found out that exchange server2007 will no longer be supporting WMI, namely the service which uses <code>\ROOT\MicrosoftExchangeV2</code>.</p> <p>The old script I wrote output the ServerName, StorageGroupName, Storename, MailboxDisplayName, Size, TotalItems, DeletedMessageSizeExtended fields to a CSV...
<p>And BTW... depending on how you want to format this information it might be better to write a function which gets the user info, then the Exchange info, and then combines that together into a custom object. PowerShell can then take care of outputting and formatting it for you in various ways. My PowerShell column at...
<p>The Quest PowerShell cmdlets (quest.com/powershell) are probably the best way. You can use Get-QADUser -IncludeAllProperties to get all of the AD attributes for a user, including Office, Description, etc. Keep in mind that it's AD that has this info, not Exchange.</p> <p>Exchange cmdlets (Get-Mailbox) will get a ce...
40,732
<p>I want to programatically create an NSTextView. How can I determine the correct frame height so that the view displays one line of text in the current default font?</p>
<p>The NSFont class has a method that can give you the size of a rectangle that would enclose a specific attributed string. Get the font used by your text view, create a string that serves as a reasonable example of what will be in the text view, and use that to inform your frame height. (The frame height will need t...
<p>It would be more normal to be using an NSTextField than an NSTextView for a single line of text.</p> <p>With NSTextField, just do the following:</p> <pre><code>[textField setFont:myFont]; [textField sizeToFit]; </code></pre> <p>Oh, and there is no built-in 'current default font'. If an application has such a con...
4,525
<p>I am looking for lightweight messaging framework in Java. My task is to process events in a SEDA’s manner: I know that some stages of the processing could be completed quickly, and others not, and would like to decouple these stages of processing.</p> <p>Let’s say I have components A and B and processing engine (be...
<p>Do you need any kind of persistence (e.g. if your JVM dies in between processing thousands of messages) and do you need messages to traverse to any other JVMs?</p> <p>If its all in a single JVM and you don't need to worry about transactions, recovery or message loss if a JVM dies - then as Chris says above, Executo...
<p>For help to somebody else read this thread:<br> One of the lightest messaging framework is <a href="https://github.com/bennidi/mbassador" rel="nofollow">Mbasseder</a>. MBassador is a very light-weight message (event) bus implementation following the publish subscribe pattern. It is designed for ease of use and aims ...
25,986
<p>I'm really beginning to understand what people mean when they say that C++'s error messages are pretty terrible in regards to templates. I've seen horrendously long errors for things as simple as a function not matching its prototype.</p> <p>Are there any tricks to deciphering these errors?</p> <p>EDIT: I'm usin...
<p>You can try the following tool to make things more sane:</p> <p><a href="http://www.bdsoft.com/tools/stlfilt.html" rel="noreferrer">http://www.bdsoft.com/tools/stlfilt.html</a></p>
<p>Some compilers give better messages than others. What compiler are you using? Having said that, they are all pretty bad. C++0X will fix most of this problem (see <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Concepts" rel="nofollow noreferrer">concepts</a>), but the standard won't be released until 2009, and broad...
7,033
<p>I have a problem with an object I have created that looks something like this:</p> <pre><code>var myObject = { AddChildRowEvents: function(row, p2) { if(document.attachEvent) { row.attachEvent('onclick', function(){this.DoSomething();}); } else { row.addEventListener('cl...
<p>WHen the function is called, "this" refers to row. If you want to have the object, you can do it something like this: ]</p> <pre><code>AddChildRowEvents: function(row, p2) { var theObj = this; if(document.attachEvent) { row.attachEvent('onclick', function(){theObj.DoSomething();}); } else { ...
<p>This is a common issue with closures. To resolve it try something like this:</p> <pre><code>var myObject = { AddChildRowEvents: function(row, p2) { var self = this; if(document.attachEvent) { row.attachEvent('onclick', function(){this.DoSomething(self);}); ...
45,024
<p>How would you configure/handle extraneous/optional URLs entities (aliases, maybe)?</p> <p>SO is a good example:</p> <ul> <li>stackoverflow.com/questions/99999999/</li> <li>stackoverflow.com/questions/99999999/<strong>question-goes-here</strong> (bad example, but I couldn't think of better)</li> </ul> <p>Amazon UR...
<p>This technique is commonly known as url rewriting. If you are looking out for a solution in IIS, you can use <strong><a href="http://www.isapirewrite.com/" rel="nofollow noreferrer">ISAPI rewrite</a></strong>, which is quite similar to <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" rel="nofollow nor...
<p>That's a task for your web app, not your web server.</p> <p>On URL=>file mappings, like PHP (or static webservers) it's tricky; but on MVC frameworks it's quite natural, even on PHP MVC frameworks.</p>
21,718
<p>Considering such code:</p> <pre><code>class ToBeTested { public: void doForEach() { for (vector&lt;Contained&gt;::iterator it = m_contained.begin(); it != m_contained.end(); it++) { doOnce(*it); doTwice(*it); doTwice(*it); } } void doOnce(Contained &amp; c) { // do something ...
<p>You should be able to use any good mocking framework to verify that calls to a collaborating object are done in a specific order.</p> <p>However, you don't generally test that one method makes some calls to other methods on the same class... why would you?</p> <p>Generally, when you're testing a class, you only ca...
<p>Some mocking frameworks allow you to set up ordered expectations, which lets you say exactly which function calls you expect in a certain order. For example, <a href="http://www.ayende.com/projects/rhino-mocks.aspx" rel="nofollow noreferrer">RhinoMocks</a> for C# allows this.</p> <p>I am not a C++ coder so I'm not ...
10,415
<p>How can I display a calendar control (date picker) in Oracle forms 9/10?</p>
<p>This does seem to be possible in the version of Qt Designer 4.5.2, but it <em>can't</em> be done from the Signal/Slot Editor dock-widget in the main window.</p> <p>This is what worked for me</p> <ol> <li>Switch to <a href="http://doc.qt.io/qt-4.8/designer-connection-mode.html" rel="noreferrer">Edit Signals/Slots</...
<p>click the widget by right button</p> <p>promote the widget into a class you defined</p> <p>click the widget by right button again</p> <p>you will see that signal and slot is editable</p>
20,005
<p>I switched to the dvorak keyboard layout about a year ago. I now use <a href="https://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard" rel="nofollow noreferrer">dvorak</a> full-time at work and at home.</p> <p>Recently, I went on vacation to Peru and found myself in quite a conundrum. Internet cafes were qwerty-onl...
<h2>Web</h2> <p>For your situation of being at a public computer that you cannot switch the keyboard layout on, you can go to this website: <a href="http://www.dvzine.org/type/DVconverter.html" rel="noreferrer">http://www.dvzine.org/type/DVconverter.html</a></p> <p>Use this to translate your typing and then use copy ...
<p>I've never used a public computer, but carry a keyboard and(/or, if you are good enough) just change the settings on the machine.</p>
3,261
<p>I'm about to be forced to write a script to download some number of files under Windows XP. The machines the script will be run at are all behind a proxy, and the proxy settings are entered into the IE configuration.</p> <p>What came to my mind was either to somehow call IE from the command line, and using its conf...
<p>Create radio</p> <pre><code>Radio radio = new Radio(); radio.setBoxLabel("Si"); radio.setValue(true); radio.setValueAttribute("true"); Radio radio2 = new Radio(); radio2.setBoxLabel("No"); radio2.setValueAttribute("false"); RadioGroup radioGroup = new RadioGroup(); radioGroup.setFieldLabel("Afecto"); ra...
<p>Using radioButton.setItemId() and getItemId() resolve it.</p>
46,453
<p>If there a way to protect against concurrent modifications of the same data base entry by two or more users?</p> <p>It would be acceptable to show an error message to the user performing the second commit/save operation, but data should not be silently overwritten.</p> <p>I think locking the entry is not an option...
<p>This is how I do optimistic locking in Django:</p> <pre><code>updated = Entry.objects.filter(Q(id=e.id) &amp;&amp; Q(version=e.version))\ .update(updated_field=new_value, version=e.version+1) if not updated: raise ConcurrentModificationException() </code></pre> <p>The code listed above can be impleme...
<p>To be safe the database needs to support <a href="http://en.wikipedia.org/wiki/Database_transaction" rel="nofollow noreferrer">transactions</a>. </p> <p>If the fields is "free-form" e.g. text etc. and you need to allow several users to be able to edit the same fields (you can't have single user ownership to the dat...
41,398
<p>I have only been working with sharepoint for three months but right from the start I was told that the SharePoint content db was off limits as MS could change the schema at any time. The recommended route is to use the object model, and in most case I kind of understands that.</p> <p>Now I need to join some lists i...
<p>Yes, you are. Microsoft is <em>very</em> clear that any modifications to the SharePoint tables renders you unsupportable. </p> <p><a href="http://msdn.microsoft.com/en-us/library/bb861829.aspx" rel="nofollow noreferrer">Direct modification of the SharePoint database or its data is not recommended because it puts th...
<p>Well, if the joins you need to do are pretty simple, defining a <a href="http://office.microsoft.com/en-us/sharepointdesigner/HA101154041033.aspx" rel="nofollow noreferrer">linked data source</a> in SharePoint Designer may work for you</p>
34,412
<p>I'm translating a library written in C++ to C#, and the keyword 'union' exists once. In a struct.</p> <p>What's the correct way of translating it into C#? And what does it do? It looks something like this;</p> <pre><code>struct Foo { float bar; union { int killroy; float fubar; } as; }...
<p>You can use explicit field layouts for that:</p> <pre><code>[StructLayout(LayoutKind.Explicit)] public struct SampleUnion { [FieldOffset(0)] public float bar; [FieldOffset(4)] public int killroy; [FieldOffset(4)] public float fubar; } </code></pre> <p>Untested. The idea is that two variables have the...
<pre><code>public class Foo { public float bar; public int killroy; public float fubar { get{ return (float)killroy;} set{ killroy = (int)value;} } } </code></pre>
15,422
<p>I need to write a 'simple' util to convert from ASCII to EBCDIC? </p> <p>The Ascii is coming from Java, Web and going to an AS400. I've had a google around, can't seem to find a easy solution (maybe coz there isn't one :( ). I was hoping for an opensource util or paid for util that has already been written. </p>...
<p><a href="http://jt400.sourceforge.net/" rel="noreferrer">JTOpen</a>, IBM's open source version of their Java toolbox has a collection of classes to access AS/400 objects, including a FileReader and FileWriter to access native AS400 text files. That may be easier to use then writing your own conversion classes.</p> ...
<p>It should be fairly simple to write a map for the EBCDIC character set, and one for the ASCII character set, and in each return the character representation of the other. Then just loop over the string to translate, and look up each character in the map and append it to an output string.</p> <p>I don't know if ther...
48,122
<p>I am trying to use JMockit's code coverage abilities. Using the JVM parameter</p> <pre><code>-javaagent:jmockit.jar=coverage=.*MyClass.java:html:: </code></pre> <p>I am able to run my tests (jmockit.jar and coverage.jar are on the classpath), unfortunately my log file says:</p> <pre><code>Loaded external tool: mo...
<p>I was running the test with JUnit 3, but the coverage needs JUnit 4. That fixed things, and I didn't have to add any bootstrap entries.</p>
<p>Random guess... Is coverage.jar on the classpath that jmockit uses - it might be a different one?</p>
25,557
<p>I'm working with an ASP.net 2.0 GridView control that is bound to the results of a sql query, so it looks something like this:</p> <pre><code>&lt;asp:GridView ID="MySitesGridView" runat="server" AutoGenerateColumns="False" DataSourceID="InventoryDB" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines=...
<p>TemplateFields are the way to go.</p> <p>I usually prefer to have a private string function in the Page which I pass several object variables, and calculate the resulting string.</p> <pre><code>&lt;a href="&lt;%# CalculateUrl(Eval("PublicIP"), Eval("Customer")) %&gt;"&gt;site&lt;/a&gt; </code></pre> <p>and in the...
<p>If you want an actual link, you can also use a HyperLinkField, which has a property DataNavigateUrlFields (plural) that you can use to specify multiple fields. You then set DataNavigateUrlFormatString to something containing {0}, {1} etc. This will become your link. For the link text, you use DataTextFormatString an...
35,747
<p>I thought I have already had and fixed every problem one could possibly have with a 3D printer. Guess I was wrong.</p> <p>I haven't used my Creality CR-10 for a few weeks, everything was working the last time I tried. Today I wanted to print something minor and the printer just randomly paused a few times in the mi...
<p><strong>Edit: The z-hop problem has been fixed in Cura 4.2.</strong></p> <hr> <p>This is a known issue with Cura 4.1 when z-hop is enabled.</p> <p>If you touch the z-axis motor frame while it is apparently stationary, you may feel it is actually moving.</p> <p>The solution is to set a value (I used something lik...
<p>I experienced the same with 4.1. Everything went back to normal after going back to 4.0 despite that all settings were identical as far as I could see. I compared the two g-code files using a simple file comparison tool. They were very different, hardly anything was the same. I still need to figure out what they mea...
1,351
<p>I have an application that sends the customer to another site to handle the payments. The other site, outside of the customer, calls a page on our server to let us know what the status is of the payment. The called page checks the parameters that are given by the payment application and checks to see whether the tra...
<p>A JSP is compiled to a servlet the first time it is run. That means that there's no real runtime difference between them. </p> <p>However, most have a tradition to use servlets for controllers and JSPs for views. Since controllers are just java classes you can get full tool support (code completion etc.) from all I...
<p>Yeah, this should be a servlet. A JSP may be easier to develop, but a servlet will be easier to maintain. Just imagine having to fix some random bug in 6 months and trying to remember how it worked.</p>
12,709
<p>I'm accessing an Ubuntu machine using PuTTY, and using gcc.</p> <p>The default <code>LANG</code> environment variable on this machine is set to <code>en_NZ.UTF-8</code>, which causes GCC to think PuTTY is capable of displaying UTF-8 text, which it doesn't seem to be. Maybe it's my font, I don't know - it does this...
<p><code>LANG=en_NZ</code> is correct. However, you must make locale files for <code>en_NZ</code>.</p> <p>For Ubuntu, edit <code>/var/lib/locales/supported.d/local</code> and add <code>en_NZ ISO-8859-1</code> to the file. If your system is another distribution (including Debian), the location will be different. Look a...
<p>For Debian 5.0 Lenny:</p> <pre><code>aptitude install locales </code></pre> <p>If that's already installed:</p> <pre><code>dpkg-reconfigure locales </code></pre>
4,669
<p>The following C# code takes 5 minutes to run:</p> <pre><code>int i = 1; string fraction = ""; while (fraction.Length &lt; 1000000) { fraction += i.ToString(); i++; } </code></pre> <p>"Optimising it" like this causes it to run in 1.5 seconds:</p> <pre><code>int i = 1; string fraction = ""; while (fraction....
<p>You will probably see that the first 1000 chars will take almost no time opposed to the last 1000 chars. </p> <p>I would assume that the time-consuming part is the actual copying of the large string into a new memory-area every time you add a char that is the tough work for your computer.</p> <p>Your optimization ...
<p>Answer to the modified queston ("why does this non-obvious optimization work so well" and "is it true you shouldn't use + operator on strings"):</p> <p>I'm not sure which non-obvious optimization you are talking about. But the answer to the second question, I think, covers all of the bases.</p> <p>The way strings...
35,772
<p>Given a pointer to some variable.. is there a way to check whether it was statically or dynamically allocated?? </p>
<p>Quoting from your comment:</p> <blockquote> <p>im making a method that will basically get rid of a struct. it has a data member which is a pointer to something that may or may not be malloced.. depending on which one, i would like to free it</p> </blockquote> <p>The correct way is to add <em>another</em> member ...
<p>1.) Obtain a map file for the code u have.</p> <p>2.) The underlying process/hardware target platform should have a memory map file which typically indicates - starting address of memory(stack, heap, global0, size of that block, read-write attributes of that memory block.</p> <p>3.) After getting the address of th...
34,883
<p>What does it mean by logical grouping of modules in assembly? Can anyone please explain how .NET's CLR works with assembly ?</p>
<p>You can organise modules using Namespaces. With Namespaces you can make one for each logical grouping of modules within your assembly.</p> <p>So if you have a <strong>Utlity</strong> assembly with some string helpers and some file helpers you could put the string helper modules in a Namespace called <strong>Utility...
<p>A dotNet Assembly is the container for all your executable code. The package that contains the executable code for your program in other words. Your question seems to be confusing a Microsoft term with another term perhaps. Can you clarify your question.</p>
49,640
<p>I'm building an ASP.Net MVC website. Rather than have everything in one project, I've decided to separate the Web, Model and Controller out into different projects in the same solution, that reference each-other.</p> <p>The referencing goes like this:</p> <blockquote> <p>Web ---[references]---> Controller ---[re...
<p>Check to make sure that the namespace of your extensions is accessible to our view. You need either this in your view:</p> <pre><code>&lt;%@ Import Namespace="MyRootNamespace.NamespaceForMyHtmlHelperExtensions"%&gt; </code></pre> <p>or this in your web config namespaces section:</p> <pre><code>&lt;add namespace=...
<p>Are you sure the compiler is set to .NET Framework 3.5? This happened to me when I inadvertently set the compiler to .NET Framework 2.0</p>
26,710
<p>I use Visual SourceSafe with Visual Studio. Every time I work on a project for a while, the directory structure on my harddisk gets messed up. The latest versions of the files are going to their own nested folder, so I end up with <code>C:\VS2005\Projects\MyProject\MyProject\MyProject\MyProject</code></p> <p>What i...
<p>I can't help with your particular problem, but I remember my own pains using SourceSafe just a few years ago.</p> <p>If you have a choice on the source control system you use, I'd recommend taking a look at other options. There are several good ones to choose from. </p> <p>I switched to <a href="http://subversio...
<p>What is causing this?</p> <p>Just the general contra-expectation insanity which is VSS and VS combined I'm afraid. You could spend the time to really get to know VSS and how it thinks of things and how to avoid the quirks and pitfalls, but the thing is such an outdated beast I'd second Robert's asssertion that it's...
46,498
<p>In static languages like Java you need interfaces because otherwise the type system just won't let you do certain things. But in dynamic languages like PHP and Python you just take advantage of <em>duck-typing</em>.</p> <p>PHP supports interfaces. Ruby and Python don't have them. So you can clearly live happily wit...
<p>I think of it more as a level of convenience. If you have a function which takes a "file-like" object and only calls a read() method on it, then it's inconvenient - even limiting - to force the user to implement some sort of File interface. It's just as easy to check if the object has a read method.</p> <p>But if y...
<p>Stop trying to write Java in a dynamic language.</p>
11,702
<p>Yes, it sounds crazy....It might be.</p> <p>The final updatepanel does not appear to trigger anything, it just refreshes the update panels and does not call back to the usercontrol hosting it.</p> <p>Any ideas?</p> <p>EDIT: I got it posting back, however the controls inside the final usercontrol have lost their d...
<p>I would suggest you start by removing the UpdatePanels at first, and make sure your control orgy is working correctly with postbacks. Once you have that working, try adding the UpdatePanels back in from the bottom up.</p>
<p>If you set the UpdateMode property to Conditional (default is Always) on both UpdatePanels it should stop the outer UpdatePanel triggering when only the usercontrols updatepanel should have refreshed.</p>
5,063
<p>I've had this long term issue in not quite understanding how to implement a decent Lucene sort or ranking. Say I have a list of cities and their populations. If someone searches "new" or "london" I want the list of prefix matches ordered by population, and I have that working with a prefix search and an sort by fie...
<p>dlamblin,let me see if I get this correctly: You want to make a prefix-based query, and then sort the results by population, and maybe combine the sort order with preference for exact matches. I suggest you separate the search from the sort and use a CustomSorter for the sorting: Here's <a href="http://blog.tremend....
<p>My current solution is to create an exact searcher and a prefix searcher, both sorted by reverse population, and then copy out all my hits starting from the exact hits, moving to the prefix hits. It makes paging my results slightly more annoying than I think it should be.</p> <p>Also I used a hash to eliminate dup...
2,996
<p>I need to install amp on a windows2003 production server. I'd like, if possible, an integrated install/management tool so I don't have to install/integrate the components of amp separately. Those that I've found are 'development' servers. Are there any packages out there that install amp in a production ready (locke...
<p>There doesn't appear to be any all-in one packages that are up to date and 'designed' for production. You just can't trust the default installs to be secure on whats out there.</p> <p>I ended up just doing this manually. It wasn't painful though. Each component's install procedure was documented reasonably well. To...
<p>Xampp is quite popular, i just don't know how "production level" it is:</p> <p><a href="http://www.apachefriends.org/en/xampp.html" rel="nofollow noreferrer">http://www.apachefriends.org/en/xampp.html</a></p> <p>Without wanting to sound elite: For "real" production Environments, it's possibly not a bad idea to set...
15,490
<p>Does anyone know how to change the Bordercolor for a Datagridviewcell in c#?</p> <p>Here's a picture of what I mean: </p> <p><a href="http://www.zivillian.de/datagridview.png" rel="nofollow noreferrer">Datagridviewstyle http://www.zivillian.de/datagridview.png</a> <a href="http://www.zivillian.de/datagridview.png"...
<p>You'd have to draw the cells yourself to achieve this, using OwnerDraw.</p>
<p>You can hook up on two events on your datagridview. 'ItemCreated' and 'ItemDatabound' Each will pass you an eventarg that can access your itemtemplate. Within that you can .FindControl("ControlId") or step through the .Controls collections to find the cell. Once you got that cell you can do whatever you want - both ...
13,391
<p>In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data:</p> <pre><code>1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern 2,hf35,08-Oct-08,34:12:13,dg,jh,fh,fgh,fgh,gh,gfh,re,fsaf,asdf,dd,yoko...
<p>You need to output the table rows <em>inside</em> the while loop, as that's where you are reading the lines.</p> <p>So change the code so that it</p> <ul> <li>outputs table headers</li> <li>reads the file line by line outputting table rows</li> <li>outputs table footer</li> </ul> <p>Here's how your loop might loo...
<p>Please close your &lt;font&gt; tags. Just because the browser will handle their lack doesn't mean they're not valuable to include.</p>
24,404
<p>I have an IList of type Breadcrumb which is just a lightweight class that has NavigationTitle, NavigationUrl and IsCurrent properties. It is cached on the webserver. I have a method that builds out the current breadcrumb trail up until the first Breadcrumb that has IsCurrent set to true... using the code below. Its ...
<p>I'm typing this as I think, so that it shows a train of thought as well as just an answer.</p> <ul> <li>Your source is just cachedCrumbs</li> <li>You want to add the first crumb which <em>does</em> have IsCurrent set, but nothing afterwards</li> <li>TakeWhile sounds like the way to go, but getting the "previous val...
<p>First of all, that code doesn't work. I'm gonna guess that some of those places where you used "crumbs" you meant "cachedCrumbs". If so, the code can be reduced to:</p> <pre><code>IList&lt;Breadcrumb&gt; crumbs = new List&lt;Breadcrumb&gt;(); for (int a = 0; a &lt; cachedCrumbs.Count; a++) { crumbs.Add(cached...
29,289
<p>I have a table of time-series data of which I need to find all columns that contain at least one non-null value within a given time period. So far I am using the following query:</p> <pre><code>select max(field1),max(field2),max(field3),... from series where t_stamp between x and y </code></pre> <p>Afterwards ...
<p>The EXISTS operation may be faster since it can stop searching as soon as it finds any row that matches the criteria (vs. the MAX which you are using). It depends on your data and how smart your SQL server is. If most of your columns have a high rate of non-null data then this method will find rows quickly and it s...
<p>Edit: I think I misread the question... this will give you all the <em>rows</em> with a non-null value. I'll leave it here in case it helps someone but it's not the answer to your question. Thanks @Pax</p> <p>I think you want to use <a href="http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#functio...
42,831
<p>I have inherited a Java applet (an actual &lt;APPLET&gt;) which throws an OutOfMemory exception after about 4 days of runtime. The nature of the applet is such that people really will leave it open for long periods of time.</p> <p>After almost two days running, jmap -histo shows the top heap consumers as:</p> <pre...
<p>Yup, looks like you are leaking class loaders. If you're not actually creating class loaders in you own code (typically through URLClassLoader.newInstance or XSLT) then it may be related to reloading the applet (although you would usually get back the same class loader). Possible causes of leaks are ThreadLocal, JDB...
<p>Yup, looks like you are leaking class loaders. If you're not actually creating class loaders in you own code (typically through URLClassLoader.newInstance or XSLT) then it may be related to reloading the applet (although you would usually get back the same class loader). Possible causes of leaks are ThreadLocal, JDB...
44,304
<p>Is there a way to view the register contents in each stack frame in a crash dump? The registers window seems to contain the registers when the exception occurred but it would be useful to be able to see their contents in each stack frame.</p>
<p>Depending on the calling convention, you can get some of the registers which are saved on the stack. For example, in the <a href="http://en.wikipedia.org/wiki/X86_calling_conventions#cdecl" rel="nofollow noreferrer">cdecl calling convention</a>, all of the registers except for EAX, ECX, and EDX are required to be s...
<p>I don't think you can get it either when debugging. The only value you can get from registers is their value at the current instruction.</p>
46,632
<p>I'm curious to know whether the PDFKit framework is available for use within the iPhone OS, in order to build a PDF reader a bit more sophisticated than the one available by simply opening PDF documents with UIWebView.</p> <p>Just wondering if this is an option or not.</p>
<p>The PDFKit is not available on iPhone at this time. Certainly the functionality is there, but Apple has not opened it up in an available framework. You should file a bug on this if you'd like to see it in the future.</p> <p>If you want more control over PDF, there are many ways to manipulate PDF content using Quart...
<p>Grab the official sample code called QuartzDemo which has an example on how to manipulate a PDF file using Quartz graphics. The output seems faster than the UIWebView.</p>
36,819
<p>Having a computer with multiple NICs, I need to specify somehow the one to use for the connection to SQL Server.</p>
<p>Following on from @pzycoman, SqlConnection (and SQL OLEDB/SQL Server ODBC) has no explicit connection string semantic to express the bound NIC other than to specify the destination server host address (which in turn triggers the route metrics discussion). Splitting out services or applications onto different subn...
<p>If the NIC's have diffrent subnets, windows should automatically route the request through the right NIC (running "route print" from the command line will show you what gets routed where)</p>
22,195
<p>When sockets are created or files are opened/created in C, is the file descriptor that's assigned to the socket/file guaranteed to be the lowest-valued descriptor available? What does the C spec say about file descriptor assignment in this regard, if anything?</p>
<p>It's not guaranteed to be the lowest, and is implementation dependent <em>(1)</em>. In general, however, the routine that assigns open file descriptors uses a method that gives you the first open on. It could be that immediately after several lower ones free, leaving you with a higher descriptor than you might exp...
<p>Steve M is right; C has no notion of sockets, and its file I/O functions use a [pointer to a] FILE object, not a descriptor.</p>
7,479
<p>Where can I find a free, lightweight YUI-like compressor for PHP?</p> <p>I am sure it will decrease the file size but will compressing PHP code boost its performance?</p> <p>Is this the same thing as an obfuscator?</p>
<p>There is a product called PHP Encoder by ionCube (<a href="http://www.ioncube.com/sa_encoder.php" rel="noreferrer">http://www.ioncube.com/sa_encoder.php</a>) which is enterprise grade compression and obfuscater.</p> <p>PHP Encoder is a PHP extension to create and run compiled bytecodes for accelerated runtime perfo...
<p>NuSphere has also released <a href="http://www.nusphere.com/products/nucoder.htm" rel="nofollow noreferrer">Nu-Coder</a> for both securing code and accelerating it.</p>
27,218