input
stringlengths
51
42.3k
output
stringlengths
18
55k
MS Source Server: significance of srcsrv.ini variable <p>The MS source server technology uses an initialization file named srcsrv.ini. One of the values identifies the source server location(s), e.g.,</p> <pre><code>MYSERVER=\\machine\foobar </code></pre> <p>The docs leave much unanswered about this value. To start w...
<p>For anyone looking into this in the future, I received the following information from MS:</p> <blockquote> <p>The name on the left side is the logical name of a version control server. The name is also used in the source-indexed symbol files (pdb). For example, a symbol file may contain this string value:<b...
Microsoft MIDL does not report an error if a typedef uses an unknown type, is it a bug? <p>I would like to know whether I am missing something:</p> <pre><code>//this is test.idl typedef foo foo_t; // end of test.idl </code></pre> <p>When I compile test.idl with the following command:</p> <pre><code>midl /W4 test.idl...
<p>I submitted the following bug to Microsoft:</p> <p><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=382571" rel="nofollow">MIDL does not report an error if a typedef uses an unknown type</a></p>
SQL - How to make a conditional INSERT <p>Using <strong>only MySQL</strong>, I'm seeing if it's possible run an insert statement ONLY if the table is new. I successfully created a user variable to see if the table exists. The problem is that you can't use "WHERE" along with an insert statement. Any ideas on how to get ...
<pre><code>IF @TableExists &gt; 0 THEN BEGIN INSERT INTO country (name) VALUES ('Afghanistan'),('Aland Islands'); END </code></pre>
Can I make a website full screen without flash or silverlight? <p>I'm working on something that needs a webpage to go full screen. The screen must become completely white. </p> <p>Is there anyway that I can do this without flash or silverlight? Thanks in advance</p> <p>edit: Im not trying to force anybody into fulls...
<p>You cant do full screen, because of security reasons the title bar is still there and so on in different browsers.</p> <p>But a way could be to make the window larger than the screen, lets say 100 pixels wider and 100 pixels higher and position the window at -50, -50. I havent tried that but if there is no restrai...
C++ reading from a file blocks any further writing. Why? <p>I am implementing a very simple file database. I have 2 basic operations: </p> <pre><code>void Insert(const std::string &amp; i_record) { //create or append to the file m_fileStream.open(m_fileName.c_str(), std::ios::out | std::ios::app); if (m_fi...
<p>Change </p> <pre><code> while (!m_fileStream.eof()) { getline (m_fileStream, line); results.push_back(line); } </code></pre> <p>to </p> <pre><code> while (getline (m_fileStream, line)) { results.push_back(line); } </code></pre> <p>Otherwise you will get one addition...
Silverlight DataBinding Error - Works in WPF Though! <p>Start a new Silverlight application... and in the code behind (in the "Loaded" event), put this code:</p> <pre><code>// This will *NOT* cause an error. this.LayoutRoot.DataContext = new string[5]; </code></pre> <p>But...</p> <pre><code>// This *WILL* cause an e...
<p>You can't currently use visual elements as a data source for data binding in Silverlight 2. I think this is slated to be added for Silverlight v.Next.</p>
How to correctly unregister an event handler <p>In a code review, I stumbled over this (simplified) code fragment to unregister an event handler:</p> <pre><code> Fire -= new MyDelegate(OnFire); </code></pre> <p>I thought that this does not unregister the event handler because it creates a new delegate which had never...
<p>The C# compiler's default implementation of adding an event handler calls <code>Delegate.Combine</code>, while removing an event handler calls <code>Delegate.Remove</code>:</p> <pre><code>Fire = (MyDelegate) Delegate.Remove(Fire, new MyDelegate(Program.OnFire)); </code></pre> <p>The Framework's implementation of <...
How best can I isolate my application from an unreliable database? <p>I have a Java SOAP data service which sits on top of a Sybase database which, for reasons out of my control, has unreliable performance. The database is part of a vendor package which has been modified by an internal team and most of the issues are c...
<p>I have seen this issue a few times, normally with a vendor database. </p> <p>If this is on Windows, you could create a Windows service as an intermediary between the SOAP service and the database. Then put a message queue (either MSMQ or a JMS implementation such as MQ Series) between the SOAP service and Windows s...
Spring Integration as embedded alternative to standalone ESB <p>Does anybody has an experience with <a href="http://springframework.org/spring-integration" rel="nofollow">Spring Integration</a> project as embedded ESB?</p> <p>I'm highly interesting in such use cases as:</p> <ul> <li>Reading files from directory on sc...
<p>Remember, "ESB" is just a marketing term designed to sell more expensive software, it's not a magic bullet. You need to consider the specific jobs you need your software to do, and pick accordingly. If Spring Integration seems to fit the bill, I wouldn't be too concerned if it doesn't look much like an uber-expensiv...
Print Report without ReportViewer in ASP.NET <p>I am using Business Intelligent reporting servicess to reporting some data from My MS SQL Database. In ASP.NET I create new Reporting Viewer that take data from BI and display the report then I can Print it.</p> <p>My Question is How can I print the report without report...
<p>I tend to deliver reports optimized for printing as .pdf responses. This assumes the client has a .pdf reader installed. Since you scenario sounds like a business focused one, this might be reasonable.</p> <p>If the report server is directly accessible, you can access the report via the report's url (something like...
What constitutes a good memory profile? <p>In designing any desktop applications, are there any general rules on how much memory should the application uses?</p> <p>For heavy-weight applications, those can be easily understood or at least profiled such as Firefox or Google Chrome. But for smaller utilities or line-of-...
<p>There is no absolute answer for this. It depends on too many variables.</p> <p>Here are some trade-offs for consideration:</p> <ul> <li>What device/platform are you developing for?</li> <li>Do you expect your user to use this software as the main purpose for their computer (example maybe you are developing some k...
Algorithm to determine how positive or negative a statement/text is <p>I need an algorithm to determine if a sentence, paragraph or article is negative or positive in tone... or better yet, how negative or positive.</p> <p>For instance:</p> <blockquote> <blockquote> <p>Jason is the worst SO user I have ever wit...
<p>There is a sub-field of natural language processing called <a href="http://en.wikipedia.org/wiki/Sentiment_analysis">sentiment analysis</a> that deals specifically with this problem domain. There is a fair amount of commercial work done in the area because consumer products are so heavily reviewed in online user for...
Function persistence in Common Lisp <p>Is there any persistence solution for Common Lisp, such as Elephant, that allows function persistence? Currently my app stores an identifier on the db and later searches in a function table which it is, but this method does not allow dynamically created functions to be stored.</p>...
<p>It's not a database persistence mechanism, but most Common Lisps have a way of <a href="http://www.franz.com/support/documentation/8.1/doc/operators/excl/fasl-write.htm" rel="nofollow">writing FASLs</a> for all kinds of objects, including functions. For example:</p> <pre><code>cl-user(1): (compile (defun hello () (...
Positive lookahead for exclamation mark <p>I'm trying to build a Java regular expression to match "<code>.jar!</code>"</p> <p>The catch is that I don't want the matcher to consume the exclamation mark. I tried using <code>Pattern.compile("\\.jar(?=!)")</code> but that failed. As did escaping the exclamation mark.</p> ...
<p>Using your regex works for me (using Sun JDK 1.6.0_02 for Linux):</p> <pre><code>import java.util.regex.*; public class Regex { private static final String text = ".jar!"; private static final String regex = "\\.jar(?=!)"; public static void main(String[] args) { Pattern p...
How semantic is your XHTML/CSS markup? <p>I think I'm pretty good at using semantic markup on my pages but I still have a handful of classes like this:</p> <pre><code>/**** Aligns ****/ .right_align { text-align: right; } .left_align { text-align: left; } .center_align { text-align: center; } </code></pre> <p>Whic...
<p>Why do you want to align the text?</p> <p>The answer to the question is the name of the id or class you need to have for your selector. Do you want to align it right because it's a price?</p> <pre><code>table .price { text-align: right } </code></pre> <p>Just ask yourself <em>why</em> do you want to apply a par...
Vb6: Need some help with a loop <p>So I have a loop that's supposed to do three things, go through a text file line by line, the text file contains pathnames and filenames(C:\Folder\file1.txt) If the line contains a certain string, it then copies a file to that location, renames it to what it is named in the text file,...
<p>I don't believe</p> <pre><code>#3 = Replace$(#3, "abc", "xyz") </code></pre> <p>is valid. You will need to read the contents of that file in, preferable line by line (or some sensible chunk at a time), do your replacement, then write it back out to a new file. As you are copying the file anyway I would suggest re...
Using application settings across assemblies <p>I'm writing an application that includes a plugin system in a different assembly.</p> <p>The problem is that the plugin system needs to get application settings from the main app (like the directory to look for plugins).</p> <p>How is this done, or am I going about this...
<p>Let the main application get the plugin directory from the application settings and push it into the plugin system.</p>
"Unknown column 'user_id' error in django view <p>I'm having an error where I am not sure what caused it.</p> <p>Here is the error:</p> <pre><code>Exception Type: OperationalError Exception Value: (1054, "Unknown column 'user_id' in 'field list'") </code></pre> <p>Does anyone know why I am getting this error...
<ol> <li><p>The <code>user_id</code> field is the FK reference from <code>Idea</code> to <code>User</code>. It looks like you've changed your model, and not updated your database, then you'll have this kind of problem.</p> <p>Drop the old table, rerun syncdb.</p></li> <li><p>Your model tables get an <code>id</code> f...
Why Isn't My C Code Being Compiled To An EXE <p>I'm just starting out writing trying to write a simple program in C and I am using Visual Studios to do so. I heard that it does compile C as well as C++. And I know that it does because it says it compiles. The only problem is that when I go to the output directory, ther...
<p>By default when you're creating a new C++ project within a new solution, you're getting folder structure like this:</p> <p>C:\Projects\YourSolution C:\Projects\YourSolution\YourCppProject</p> <p>YourSolution contains YourSolution.sln and YourCppProject contains YourCppProject.vcproj.</p> <p>When you build the sol...
How to deploy an RubyGem-based Server <p>We have built a custom socket server in ruby and packaged it as a gem. Since this is an internal project we can not simply publish it to RubyForge or GitHub. I tried to setup our own gem server but gem would not authenticate over https. Our other deployment is all for standard...
<p>You can install gems from the local filesystem.</p> <pre><code>gem install /path/to/some.gem </code></pre> <p>Shouldn't be too hard for you to script scp with that, or use an NFS mount, etc.</p>
Can I use CSS in directory listing of Firefox? <p>For example if I put "C:\docs" in address bar of Firefox, it shows all files in the directory. Is it possible to customize this page with CSS?</p> <p>Apache 2.2 allows us to do it using IndexStyleSheet directive, so I wondered if Firefox can do it.</p>
<p>Firefox has a file userContent.css for each profile (found in the profile's settings folder). That file defines the standard CSS, why may then be overwritten by a website. So they also apply to directory listings.</p> <p>You should have a look at the actual HTML code Firefox is creating for the directory listing to...
Dynamically include .js files from Zend_Controller_Action? <p>I came across the case where depending on the execution path I may need to invoke an inclusion of .js file from controller. Is there a nice way of doing it? (besides setting some view variable with actual .js include code)?</p>
<p>See the view helper headScript(). I'm just writing this off the top of my head but I think it works like this:</p> <p>From within a view file: <code>$this-&gt;headScript()-&gt;appendFile('filename.js');</code></p> <p>From within a controller: <code>$this-&gt;view-&gt;headScript()-&gt;appendFile('filename.js');</co...
If I'm posting a question about Oracle SQL query performance, what should I include in my question? <p>If I am posting a question about a query against an Oracle database, what should I include in my question so that people have a chance to answer me? How should I get this information?</p> <p>Simply providing the poo...
<ul> <li>The schema definition of the tables involved.</li> <li>The indexes defined on those tables.</li> <li>The query you are executing.</li> <li>The resulting query execution plan</li> </ul>
jQuery two sliders controlling each other <p>This is in reference to the <a href="http://stackoverflow.com/questions/282944/jquery-one-slider-controls-another">question</a> previously asked The problem here is, each slider controls the other. It results in feedback. How do I possibly stop it?</p> <pre><code>$(function...
<p>This is sort of a hack, but works:</p> <pre><code>$(function () { var slider = $("#slider"); var slider1 = $("#slider1"); var sliderHandle = $("#slider").find('.ui-slider-handle'); var slider1Handle = $("#slider1").find('.ui-slider-handle'); slider.slider({ slide: moveSlider1 }); slider1.sl...
In C#, how do I save a webpage to file without destroying whatever the encoding is? <p>Here's what I got so far (that doesn't work). At this point I thought my target was Ansi encoded, but I really don't want to have to know at this point. My browser seems to be able to determine what encoding to use, How can I?</p> <...
<p>There are three ways how web-browsers try to detect character encoding.</p> <p>Look for (if it's HTML):</p> <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"&gt; </code></pre> <p>or (for XHTML)</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; </code></pre> <p>or...
Free space in a CMD shell <p>Is there a way to get the amount of free diskspace of a disk or a folder in a CMD without having to install some thirdparty applications?</p> <p>I have a CMD that copies a big file to a given directory and could of course use the errorlevel return from the copy command, but then I have to ...
<p>If you run "<code>dir c:\</code>", the last line will give you the free disk space.</p> <p><strong>Edit:</strong> Better solution: "<code>fsutil volume diskfree c:</code>"</p>
How to use Castle Windsor with ASP.Net web forms? <p>I am trying to wire up dependency injection with Windsor to standard asp.net web forms. I think I have achieved this using a HttpModule and a CustomAttribute (code shown below), although the solution seems a little clunky and was wondering if there is a better suppor...
<p>I think you're basically on the right track - If you have not already I would suggest taking a look at Rhino Igloo, an WebForms MVC framework, <a href="http://ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Forms.aspx">Here's a good blog post on this</a> and the source is <a href="https://...
What is the difference between CIL and MSIL (IL)? <p>Are these two terms interchangeable?</p>
<p>CIL is the term used in the <a href="http://www.ecma-international.org/publications/standards/Ecma-335.htm">CLI Standard</a>. MSIL is (I suppose) CIL created by MS tools. Effectively they are synonymous.</p> <p><a href="http://blogs.msdn.com/brada/archive/2005/09/20/CILorMSIL.aspx">Brad Abrams says this.</a></p>
Is there a fast way to transfer all the variables of one identical object into another in C#? <p>This is probably a simple question. Suppose I have a object called Users and it contains a lot of protected variables. </p> <p>Inside that Users class I have a method that creates a temporary Users object, does something ...
<p>A better approach is to implement the IClonable interface. But you'll find it doesn't save you a lot of work.</p>
How can I automate (script) creating a war file in eclipse? <p>It's 5 button clicks to get eclipse to create a deployable war file for my eclipse project, I figure there's probably some eclipse command line option to do the same thing, so I can just write it into a script, but I'm not seeing it.</p>
<p>Use the <a href="http://ant.apache.org/manual/Tasks/war.html" rel="nofollow">Ant <code>war</code> task</a>, set up a relevant build file and you can just hit the "external tools" button to execute it. </p>
How to expand 'select' option width after the user wants to select an option <p>Maybe this is an easy question, maybe not. I have a select box where I hardcode with width. Say 120px.</p> <pre><code>&lt;select style="width: 120px"&gt; &lt;option&gt;ABC&lt;/option&gt; &lt;option&gt;REALLY LONG TEXT, REALLY LONG TEX...
<p>I fixed my problem with the following code:</p> <pre><code>&lt;div style="width: 180px; overflow: hidden;"&gt; &lt;select style="width: auto;" name="abc" id="10"&gt; &lt;option value="-1"&gt;Any&lt;/option&gt; &lt;option value="123"&gt;123&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>Hope it helps!...
dllimport failed to locate dll even though it is in the PATH <p>I use [Dllimport("DllName.dll")] where I'm sure a path to my dll exists in the process PATH environment variable, and still I get "DllName.dll could not be found"</p>
<p>"DllName.dll could not be found" could also mean that DllImport has not found one of DllName.dll dependencies.</p> <p>Grab <a href="http://www.dependencywalker.com/">Dependecy Walker</a> to check which dependecy you are missing.</p>
Best way to move a data row to another shard? <p>The question says it all. </p> <p>Example: I'm planning to shard a database table. The table contains customer orders which are flagged as "active", "done" and "deleted". I also have three shards, one for each flag.</p> <p>As far as I understand a row has to be moved t...
<p>Sharding usually refer to separating them in different databases on different servers. Oracle can do what you want using a feature called partitioned tables.</p> <p>If you're using triggers (after/before_update/insert), it would be an immediate move, other methods would result in having different types of data in t...
Dragging an image in WPF <p>I'm trying to create a WPF application where I can drag an image around.</p> <p>Currently I have an image placed in the center of the window, and I'm thinking of using the three mouseevents MouseDown, MouseMove and MouseUp to calculate the new position when dragging the image.</p> <p>Are t...
<p>ok, here's an attached property "behaviour" that you can use to make any element draggable provided it's on a canvas:</p> <pre><code>public class DraggableExtender : DependencyObject { // This is the dependency property we're exposing - we'll // access this as DraggableExtender.CanDrag="true"/"false" p...
How do I retrieve an HTML element's actual width and height? <p>Suppose that I have a <code>&lt;div&gt;</code> that I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the <code>&lt;div&gt;</code> element. </p> <p>What should I use? Please include information on ...
<p>You should use the <code>.offsetWidth</code> and <code>.offsetHeight</code> properties. Note they belong to the element, not <code>.style</code>.</p> <p><code>var width = document.getElementById('foo').offsetWidth;</code></p>
How do you call a constructor for global objects, for arrays of objects, and for objects inside classes/structs? <p>How would you call the constructor of the following class in these three situations: Global objects, arrays of objects, and objects contained in another class/struct?</p> <p>The class with the constructo...
<h3>Global objects</h3> <p>Yours is the only way. On the other hand, try to avoid this. It’s better to use functions (or even other objects) as factories instead. That way, you can control the time of creation.</p> <h3>Arrays of objects</h3> <p>There’s no way to do this directly. Non-POD objects will always be d...
How do I get the mouse button pressed from a command event in XUL? <p>It seems that the XUL <em>command</em> and <em>click</em> events are somewhat different.</p> <p>Although my function does get called when using the <em>command</em> event, the event object does not contain the <em>button</em> property.</p> <p>My qu...
<p>The main thing to keep in mind is that <code>oncommand</code> is fired for any action that results in an activation of the button which can include pressing the space bar when the button has the focus, using a keyboard shortcut attached to the button, or clicking the button with the mouse. The event handler is not r...
NHibernate, Codesmith and project physical architecture <p>Recently I tried CodeSmith templates for NHibernate. As many of you might watched, there is a video explaining how to create a Petshop.Data using these templates. My question is what is the correct architecture in this approach? Should we have a BLL (or Service...
<p>Please feel free to address these issues in our <a href="http://community.codesmithtools.com/Template_Frameworks/f/67.aspx" rel="nofollow">community site</a> and on our <a href="http://code.google.com/p/codesmith/issues/list?can=2&amp;q=Framework-NHibernate" rel="nofollow">template bug tracker</a>. We take all feedb...
How do I find userid by login (Python under *NIX) <p>I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find <code>uid</code> if I have <code>login</code>?</p> <p>I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?</p...
<p>You might want to have a look at the <a href="http://docs.python.org/library/pwd.html">pwd</a> module in the python stdlib, for example:</p> <pre><code>import pwd pw = pwd.getpwnam("nobody") uid = pw.pw_uid </code></pre> <p>it uses /etc/passwd (well, technically it uses the posix C API, so I suppose it might work ...
What are some techniques for code generation? <p>I'm generating C++ code, and it seems like it's going to get very messy, even my simple generating classes already have tons of special cases. Here is the code as it stands now: <a href="http://github.com/alex/alex-s-language/tree/local%2Fcpp-generation/alexs_lang/cpp" ...
<p>I wrote <a href="http://nedbatchelder.com/code/cog/index.html">Cog</a> partly to generate C++ code from an XML data schema. It lets you use Python code embedded in C++ source files to generate C++ source.</p>
Algorithm to match preferred partners into groups of three <p>What's a good algorithm to solve this problem?</p> <p>I have three groups of people - group A, group B, and group C. There are the same number of people in each group. They each have a list of people in the other groups that they're willing to work with. I ...
<p>This is like the stable marriage problem, but with 3 parties instead of two.</p> <p>Have a look at efficient solutions for former problem (bi-partite graph matching) and adapt them to your needs.</p> <p><a href="http://en.wikipedia.org/wiki/Stable_marriage_problem">http://en.wikipedia.org/wiki/Stable_marriage_prob...
How to improve performance of an Abstract Factory when all the time appears to be spent in memory allocation <p>The application de-serializes a stream into dynamically allocated objects and then keeps base type pointers in a linked list (i.e. abstract factory). It's too slow. Profiling says all the time is spent in <...
<p>The only way is to reduce the number of memory allocations. Have you used a profiler that will tell you exactly what is doing the allocation? Are you possibly doing some string manipulation?<br /> If all the time is spent allocating the objects the factory is creating, you may need to go to a pool. </p>
How does ASP.NET MVC communicate w/ an AJAX enabled webpage? <p>How does the data go from the MVC to the browser and back again? Does it use Microsoft's own technology like ASMX or WCF or something completely different? </p> <p>This sounds like MVC is using a ASMX Web Service they are using but I can't seem to find...
<p>The data from the MVC app &lt;-> browser is just plain ole HTTP request/response data. To see what this raw data is, install <a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow" title="FireBug:Firefox addon">Firebug</a> or <a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nof...
How do you show animated gifs with .NET Compact Framework <p>I would like to display an animated gif on a .NET Compact <code>Form</code>. Currently I use a <code>PictureBox</code> control and toggle between <code>.Visible = true</code> and <code>.Visible = false</code>.</p> <p>After <code>.Visible = true</code> the g...
<p>By default the .Net Compact framework does not support displaying GIF based animations on a Windows Form. It is possbile to code up a custom animator that will essentially do the same. Here's a link to a sample class for displaying a GIF on the compact framework.</p> <p><a href="http://msdn.microsoft.com/en-us/li...
ASP.NET MVC - User Input and Service/Repository - Where to do Validation? <p>This might be too opinionated a question, but looking for help!</p> <p>I have been trying to refine my ASP.NET MVC program structure. I just started using it at preview 5 and it is my first foray into business application development -- so e...
<p>I typically do basic validation (required fields, email format, etc.) in the controller action when the form is submitted. I then let the business layer handle validation that requires business knowledge. I usually double check the basic stuff in the business layer as well, so if I expose that logic through web serv...
Pycurl WRITEDATA WRITEFUNCTION collision/crash <p>How do I turnoff WRITEFUNCTION and WRITEDATA?</p> <p>Using pycurl I have a class call curlUtil. In it I have pageAsString (self, URL) which returns a string. </p> <p>To do this I setopt WRITEFUNCTION. Now in downloadFile (self, URL, fn, overwrite=0) I do an open and s...
<p>using the writefunction, instead of turning it off would save you a lot off trouble. you might want to rewrite your pageAsString by utilizing WRITEFUNCTION..</p> <p>as an example: </p> <pre><code>from cStringIO import StringIO c = pycurl.Curl() buffer = StringIO() c.setopt(pycurl.WRITEFUNCTION, buffer.write) c.set...
Using Stomp and Apache ActiveMQ as reliable syslog <p>One of my programs requires a reliable way to log across unreliable network (ie internet). The sender or receiver may go offline any time and can come back later. But any message sent by client should not be missed. Obviously syslog does not fit the bill. I am explo...
<p>That all sounds fine to me</p>
Embedding XULRunner application on Java <p><strong>My goal is to get Limewire(JAVA) and Songbird(XULRunner) to run together.</strong></p> <p>I was thinking the best way is to run the XUL application(songbird) inside a JAVA swing panel. Is there another way?</p> <p>Would it be better or possible to have the GUI entire...
<p>Take a look at <a href="http://jrex.mozdev.org/" rel="nofollow">JRex</a>, as it might let you peek into a couple of ideas.</p> <p>Other than that, I'd also research about <a href="http://zelea.com/project/textbender/o/rhinohide/description.xht" rel="nofollow">Rhinohide</a> as well.</p>
Requesting memory for your application <p>I am having a similar issue to <a href="http://stackoverflow.com/questions/28387/sql-server-2k5-memory-consumption">this person</a>. The primary difference being the application is NOT meant for a developer environment, and therefore I need to know how to optimize the space us...
<p>Some applications allocate a lot of memory at startup, and then run their own memory management system on it. This can be good for applications that have particular allocation patterns, and that feel they can do a better job than the more generic memory manager provided by the runtime system.</p> <p>Many games do t...
c# Pre-processor directive scope <p>I'm looking to use: </p> <pre><code>#define </code></pre> <p>and</p> <pre><code>#if </code></pre> <p>to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the <code>#define</code> statements? </p> <p>i.e. what is its default scope? c...
<p>As Chris said, the scope of #define is just the file. (It's worth noting that this isn't the same as "the class" - if you have a partial type, it may consist of two files, one of which has symbol defined and one of which doesn't!</p> <p>You can also define a symbol project-wide, but that's done with <a href="http:/...
C++ mark as deprecated <p>I have a method in an interface that I want to deprecate with portable C++. When I Googled for this all I got was a Microsoft specific solution; <a href="http://msdn.microsoft.com/en-us/library/c8xdzzhh(VS.80).aspx">#pragma deprecated</a> and <a href="http://msdn.microsoft.com/en-us/library/04...
<p>This should do the trick:</p> <pre><code>#ifdef __GNUC__ #define DEPRECATED(func) func __attribute__ ((deprecated)) #elif defined(_MSC_VER) #define DEPRECATED(func) __declspec(deprecated) func #else #pragma message("WARNING: You need to implement DEPRECATED for this compiler") #define DEPRECATED(func) func #endif ...
How to pass an unpersisted modified object from view back to controller without a form? <p><em>Short:</em> how does modelbinding pass objects from view to controller?</p> <p><em>Long:</em><br /> First, based on the parameters given by the user through a search form, some objects are retrieved from the database. These ...
<p>The default model binding takes form parameters by name and matches them up with the properties of the type specified in the argument list. For example, your model has properties "Price" and "Name", then the form would need to contain inputs with ids/names "Price" and "Name" (I suspect it does a case insensitive ma...
How can I achieve uploading same files as a batch using jQuery? <p>When uploading some image/audio/video files in the same batch I want the file selected in the one field should not get accepted in the other buttons. How can I achieve this?</p>
<p>I think you are asking how to make it so no two files in a list of file upload boxes are the same, so you don't accidentally upload the same file twice.</p> <p>This could be easily done using the input.onchange event. When you add a new file input box, assign its onchange event to a function like this one:</p> <p...
Get SQL Server database folder of selected instance by using vbscript <p>Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database folder is c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. </p> <p>How can VBScript be used to retrieve that folder? </p> <p>Maybe by usin...
<p>The <a href="http://technet.microsoft.com/en-us/library/ms144134.aspx" rel="nofollow">PrimaryFilePath Property</a> of <a href="http://technet.microsoft.com/en-us/library/ms133993.aspx" rel="nofollow">SQL-DMO</a> looks interesting. </p> <p>The MSDN states that SQL-DMO is deprecated as of SQL Server 2008, but for now...
How to call a Delphi DLL from VB6 <p>Given the following Delphil DLL declaration</p> <pre><code>function csd_HandleData(aBuf: PChar; aLen: integer): integer; stdcall; </code></pre> <p>what would be the VB6 declaration to use it?</p> <p>I've tried a variety of declarations, e.g.</p> <pre><code>Declare Function csd_H...
<p>try</p> <pre><code>Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, ByVal aLen As Integer) As Integer </code></pre> <p>Seems you forgot the return value.</p>
css layers ordering and arranging <p>I am trying to have one one layer, and center images within. I.E., if I have 3 images and want 3 links beneath them, is there a way to do this without using a separate div tag for each link and image? To automatically make the links be centered under the images, and the images to be...
<p>Yes, you'll have to put a container element, such as a div, around each image and its caption to keep them together.</p> <pre><code>&lt;div class="pictureBox"&gt; &lt;div&gt; &lt;img /&gt; caption caption &lt;/div&gt; &lt;div&gt; &lt;img /&gt; more caption &lt;/div&gt...
What is a partial class? <p>What is and how can it be used in C#.<br/> Can you use the same concept in Python/Perl?</p>
<p>A <a href="http://msdn.microsoft.com/en-us/library/wa80x488.aspx">partial type</a> (it doesn't have to be a class; structs and interfaces can be partial too) is basically a single type which has its code spread across multiple files.</p> <p>The main use for this is to allow a code generator (e.g. a Visual Studio de...
what does this preg_replace_callback do in PHP? and how do I stop it leaking memory? <p>I've got a section of code on a b2evo PHP site that does the following: </p> <pre><code>$content = preg_replace_callback( '/[\x80-\xff]/', create_function( '$j', 'return "&amp;#".ord($j[0]).";";' ), $content); </code></...
<p>It's <code>create_function</code> that's leaking your memory - just use a normal function instead and you'll be fine.</p> <p>The function itself is replacing the characters with numeric HTML entities (<code>&amp;#xxx;</code>)</p>
Logging every data change with Entity Framework <p>There is a need from a customer to log every data change to a logging table with the actual user who made the modification. The application is using one SQL user to access the database, but we need to log the "real" user id.</p> <p>We can do this in t-sql by writing t...
<p>How about handling Context.<a href="http://msdn.microsoft.com/en-us/library/cc716714.aspx">SavingChanges</a>?</p>
Help with XML-RPC server <p>I'm now trying to create a xml-rpc server with the CodeIgniter Framework. </p> <pre><code>&lt;?php $this-&gt;load-&gt;library('xmlrpc'); $this-&gt;load-&gt;library('xmlrpcs'); $config['functions']['weblogUpdates.ping'] = array('function' =&gt; 'weblogUpdates.ping'); $config['functions']['p...
<p>Have you looked at <a href="http://codeigniter.com/user_guide/libraries/xmlrpc.html" rel="nofollow">the codeigniter user guide</a>?</p>
.net remoting stops every 100 seconds <p>We have very strange problem, one of our applications is continually querying server by using .net remoting, and every 100 seconds the application stops querying for a short duration and then resumes the operation. The problem is on a client and not on the server because applica...
<p>100 Seconds is a give away number as it's the default timeout for a webrequest in .Net.</p> <p>I've seen in the past that the PSI (Project Server Interface within Microsoft Project) didn't override the timeout and so the default of 100 seconds was applied and would terminate anything talking to it for longer than t...
Why do people use tarballs? <p>As a primarily Windows developer, perhaps I'm missing something cultural in the Linux community, but it has always confused me when downloading something that the files are first put into a .tar archive, then zipped. Why the two step process? Doesn't zipping achieve the file grouping? I...
<p>bzip and gzip work on single files, not groups of files. Plain old zip (and pkzip) operate on groups of files and have the concept of the archive built-in.</p> <p>The *nix philosophy is one of small tools that do specific jobs very well and can be chained together. That's why there's two tools here that have specif...
System.Random keeps on returning the same value <p>I am using a System.Random object which is instantiated with a fixed seed all thoughout the application. I am calling the NextDouble method and after some time passed I am getting 0.0 as result.</p> <p>Is there any remedy to this, has anyone else encountered this ?</p...
<p>The random number generator in .NET is not thread safe. Other developers have noticed the same behaviour, and one solution is as follows (from <a href="http://blogs.msdn.com/brada/archive/2003/08/14/50226.aspx">http://blogs.msdn.com/brada/archive/2003/08/14/50226.aspx</a>):</p> <pre><code>class ThreadSafeRandom { ...
What harm can DBO do to a server? <p>Aside from executing XP_CmdShell, which I have disabled in my SQL 2005 installation, what could a malicious user who gains DBO rights to my database do:</p> <ul> <li>To my database,</li> <li>To my server?</li> </ul> <p>I'm assessing the worst-case security risk of someone obtainin...
<p>he can run any XP_ sproc so it can mess up the registry and mess up your whole server for one thing. drop/change tables, etc... </p>
How can I abort a running JDBC transaction? <p>Is there a way to prematurely abort a transaction? Say, I have sent a command to the database which runs five minutes and after four, I want to abort it.</p> <p>Does JDBC define a way to send a "stop whatever you are doing on this connection" signal to the DB?</p>
<p>As mentioned by james, <a href="https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#cancel()">Statement.cancel()</a> will cancel the execution of a running Statement (select, update, etc). The JDBC docs specifically say that Statement.cancel() is safe to run from another thread and even suggests the u...
Does Visual Studio 2008 have integration with SourceSafe? <p>I'm using Visual Studio 2008 Professional Edition. In previous versions, there has been integration with VSS, through which one could "open from SourceSafe" and then, in the solution view, have the ability to interact with the source control by clicking on in...
<p>You have to install the VSS client software, and if you want the auto check out, etc. the project has to be bound to the source control repository. </p> <p>Also try looking in the Tools -> Options -> Source control menu item.</p>
Stateful PHP Web Service Using SOAP <p>I'm trying to implement a stateful web service in PHP using the SOAP extension. (Yes I know that web services are supposed to be stateless; all I really care to persist is some form of a session ID so I don't need to authenticate with every call to the service). PHP.net's API doc...
<p>I actually solved my own problem.</p> <p>I was working under the assumptions that: 1) .NET handles cookies automatically; and 2) my problem was with the PHP. Neither was the case. My PHP code was fine but I needed to add one more element to my .NET code to handle the session cookie.</p> <p>After instantiating th...
How can I lock the first row and first column of a table when scrolling, possibly using JavaScript and CSS? <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...
<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="http://stackoverflow.com/questions/10838700/large-dynamically-sized-html-table-with-a-fixed-scroll-row-and...
C# Create a hidden transaction <p>I am using C# and DSL Tools for VS2005. </p> <p>I need to create Transactions to change some data but i want them to be hidden from the user, that means, to not show in the UNDO list in VS2005.</p> <p>I tried by disabling the UndoManager</p> <pre><code>store.UndoManager.UndoState = ...
<p><code>store.UndoManager.UndoState = UndoState.Disabled</code>; </p> <p>is almost right for what u want,</p> <p><code>store.UndoManager.UndoState = UndoState.DisabledNoFlush;</code> </p> <p>this will not clear the rest of the undo list :) cyas at lunch Luis.</p>
What are the best practices to log an error? <p>Many times I saw logging of errors like these:</p> <pre><code>System.out.println("Method aMethod with parameters a:"+a+" b: "+b); print("Error in line 88"); </code></pre> <p>so.. What are the best practices to log an error?</p> <p><strong>EDIT:</strong></p> <p>This is...
<p>Logging directly to the console is horrendous and frankly, the mark of an inexperienced developer. The only reason to do this sort of thing is 1) he or she is unaware of other approaches, and/or 2) the developer has not thought one bit about what will happen when his/her code is deployed to a production site, and ho...
Regex match question <p>In javascript, I've got a block of HTML like this:</p> <pre><code>&lt;h2&gt;{title}&lt;/h2&gt; &lt;p&gt;&lt;a href="{url}"&gt;{content}&lt;/a&gt;&lt;/p&gt; </code></pre> <p>And I'm trying use regex "match" to spit out an array of all the {item}'s. So my output should look like:</p> <pre><code...
<p>You need to create a pattern with the global flag:</p> <pre><code>var pattern = new RegExp("\{[a-zA-Z]+\}", "g"); </code></pre> <p>or:</p> <pre><code>var pattern = /\{[a-zA-Z]+\}/g; </code></pre> <p>Then you can call the match() method on your string to get a list of matches:</p> <pre><code>var matches = "{Samp...
Which is more efficient in Python: standard imports or contextual imports? <p>I apologize in advance if this question seems remedial.</p> <p>Which would be considered more efficient in Python:</p> <p><strong>Standard import</strong></p> <pre><code>import logging try: ...some code... exception Exception, e: logg...
<p>Contextual imports are technically more efficient, but I think they can create other problems.</p> <p>Later, if you want to add a similar except clause, you now have two places to maintain the same block of code. You also now have the problem of testing the exception, to make sure that the first import doesn't caus...
How to Check if File is ASCII or Binary in C++ <p>So using the system command file we can use file to determine if a file is ASCII Text or "data". I wanted to know if there is a way to check in code which one it was? I want to basically throw a corrupt error if the file is 'data'. I am using ifstream for reading the ...
<p>You can iterate over the bytes of the file and use <code>std::isprint</code> from <code>&lt;cchar&gt;</code> to test whether the character is printable. If there are nonprintable characters in the file, chances are it's a binary file. Notice that this only works for legacy encodings (e.g. ASCII mentioned by you), no...
How do I remove a specific number of files using python (version 2.5)? <p>I would like to remove two files from a folder at the conclusion of my script. Do I need to create a function responsible for removing these two specific files? I would like to know in some detail how to use os.remove (if that is what I should us...
<p>It sounds like what you really want is a temp file: <a href="http://docs.python.org/library/tempfile.html" rel="nofollow">http://docs.python.org/library/tempfile.html</a></p>
Win32 console processes in VISTA - 10% CPU, but VERY SLOW <p>I have a Win32 console application which is doing some computations, compiled in Compaq Visual Fortran (which probably doesn't matter). </p> <p>I need to run a lot of them simultaneously.</p> <p>In XP, they take around 90-100% CPU together, work very fast. ...
<p>Have you tried redirecting the console output to a file? If your applications are being held up writing to the console (this happens sometimes unfortunately) then redirecting the output should help, as it's much quicker to write to a simple file than write to the console.</p> <p>You do this like so</p> <pre><code>...
using date range in Lucene.net <p>I understand how Lucene.net can work for text indexing. Will I be able to efficiently search for documents based on a given date range? Or will Lucene.net just use text matching to match the dates?</p>
<p>Lucene.Net will just use text matching, so you'd need to format the dates correctly before adding to the index:</p> <pre><code> public static string Serialize(DateTime dateTime) { return dateTime.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture); } public static DateTime Deserialize(s...
Mount/Unmount USB drives with VBSCript <p>I am looking for a way to mount\unmount a USB flash drive using VBScript. This is the closest I was able to get.</p> <pre><code>Sub EjectDrive(strDrive) On Error Resume Next CONST SSF_DRIVES = 17 Set objShell = CreateObject("Shell.Application") Set objDrive = objShell.Namespa...
<p>This will work on Windows Server 2003, but not NT/2000/XP/Vista unfortunately.</p> <pre><code>strComputer = "." Set objWMIService = GetObject("winmgmts:" _ &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_Volum...
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other? <p>We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this:</p> <p>Has anyone done server performance tests for simple echo services as we...
<p>Latest comparison available here at the <a href="https://github.com/eishay/jvm-serializers/wiki/">thrift-protobuf-compare</a> project wiki. It includes many other serialization libraries.</p>
Disappearing Foreign Keys in phpMyAdmin <p>I am creating a new table inside mysql and I am trying to add a foreign key constraint to one of the fields.</p> <pre> CREATE TABLE `onlineorder` ( `receiptid` varchar(10) NOT NULL default '', `delivereddate` date default NULL, `cid` int(10) NOT NULL, `card#` int(10) ...
<p>You need to use the InnoDB engine to have foreign keys.</p> <p>Ref: <a href="http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html">http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html</a></p>
Adding handlers to Dynamically Created Context Menu <p>I need to populate a context menu from a database at run time. I do not know the number of items that will be in the list, so I would like to handle the click event in a single place. How do I declare the handler so I can tell which menu item actually triggered t...
<pre><code>Dim mnuitm As New ToolStripMenuItem mnuitm.Name = name_cbk.Items(i) mnuitm.Text = name_cbk.Items(i) AddHandler (mnuitm.Click), AddressOf item_Click menulist.Items.Add(mnuitm) </code></pre>
Changing a Property into a Method - any side effects? <p>I have a class that has some properties. And I want something that calculates a Score out of these properties. Since this is a trivial task (some additions and divisions, but nothing spectacular).</p> <p>So naturally, the question is: "When to use a Property wit...
<p>Pull up reflector, you'll see that your properties already are methods :)</p>
Huge Transaction Log - Is This Normal? <p>I have a 5GB database and a 20GB transaction log (SQL Server 2005). Not sure why it is so large or what happened to make it that large, it used to be around 1/2 the size of the DB. DB grows about 1GB/month. </p> <p>Are there any guidelines to how how big your transaction log s...
<p>Er... excuse the bleeding obvious, but do you have scheduled backups with "BACKUP LOG"</p> <p>If the recovery model is FULL then this needs to happen.</p> <p>There are other, rare options that I'll include (not exhaustive):</p> <ul> <li>Large table index rebuild/maintenance. However, backup log will clear this.</...
What's the Windows equivalent of a UNIX shell script? <p>I want to have an executable file that will call some other programs. The way I would do this in Linux is with a simple bash script that looks like this:</p> <pre><code>#!/bin/bash echo "running some-program" /home/murat/some-program arg1 arg2 </code></pre> <p>...
<p>Take a look at <a href="http://www.microsoft.com/downloads/details.aspx?familyid=C6EF4735-C7DE-46A2-997A-EA58FDFCBA63&amp;displaylang=en">PowerShell</a>, which is the closest you will get to a true scripting language like you have in Unix. Other than that, for simple things such as simply runnning an application, ta...
How do you get the current time of day? <p>How do you get the current time (not date AND time)?</p> <p>Example: 5:42:12 PM</p>
<p><code>DateTime.Now.TimeOfDay</code> gives it to you as a <code>TimeSpan</code> (from midnight).</p> <p><code>DateTime.Now.ToString("h:mm:ss tt")</code> gives it to you as a <em>string</em>.</p> <p>DateTime reference: <a href="https://msdn.microsoft.com/en-us/library/system.datetime">https://msdn.microsoft.com/en-u...
Partial Keyword Searching (MS SQL 2005) <p>Current, I've got a stored procedure that has a main goal of doing a full text search through a database table of films and tv shows. In order to get it to do partial-keyword searching, I added some code in SQL to split up the search query by spaces, and output a statement li...
<p>After some more researching, I'm going to try and use Lucene.Net for my movie-title search engine, and not rely on Full-Text Searching in SQL Server 2005. Early testing shows that the results have been better and more relevant with Lucene. A search for "batman" returns the following partial result-set:</p> <ul> <l...
How to generate sound effects in Java? <p>I'm looking for Java code that can be used to generate sound at runtime - NOT playback of existing sound files.</p> <p>For example, what's the best code for generating a sawtooth waveform at 440 Hz for a duration of 2 milliseconds? <b>Source code appreciated!</b></p> <p>I rem...
<p>The <a href="http://java.sun.com/javase/technologies/desktop/media/jmf/index.jsp" rel="nofollow">Java media framework</a> does both. You can play back recorded sounds or use the MIDI interface to synthesize your own sounds and music. It also provides a mixer API.</p> <p>Of course, if you know the details of the wav...
AS/400 ODBC Drivers <p>We have been using the Client Access ODBC drivers when accessing AS/400 data from our .net applications and SQL DTS/SSIS packages. Are there third party drivers that provide better performance or functionality?</p>
<p>Our company is using the same Client Access drivers. As far as we know there are no other ones available. One issue we ran into last year was that there were no 64-bit drivers available so our servers that have applications connecting to the AS/400 must be 32-bit.</p>
How to place text in the clipboard so that it pastes as a table in Word? <p>Using VBA in MS Office, how do I add text to the Windows clipboard so that it will paste into Word as a table?</p>
<p>The Windows clipboard supports multiple formats. When you want to place things in the clipboard, you make one or more calls to RegisterClipboardFormat() telling it the formats of the objects you will be placing on the clipboard, followed by calls to SetClipboardData() which actually places the data into the clipboa...
Best way to use a DB table as a message/job queue <p>I have a databases table with ~50K rows in it, each row represents a job that need to be done. I have a program that extracts a job from the DB, does the job and puts the result back in the db. (this system is running right now)</p> <p>Now I want to allow more than ...
<p>Here's what I've used successfully in the past:</p> <p>MsgQueue table schema</p> <pre><code>MsgId identity -- NOT NULL MsgTypeCode varchar(20) -- NOT NULL SourceCode varchar(20) -- process inserting the message -- NULLable State char(1) -- 'N'ew if queued, 'A'(ctive) if processing, 'C'ompleted, default 'N' --...
CodeDOM & .Net Modules <p>How do I programmatically embed a .Net module to the assembly generated by CodeDOM?</p>
<p>on VB</p> <pre><code>dim param as CompilerParameteres param.EmbeddedResources.Add("dynamiclinklibrary") </code></pre>
How to Consume JSON Web Services from a Windows Client <p>Is it possible to consume a JSON enabled WCF Web Service from a standard Proxy Client (i.e. not JavaScript)? </p> <p>Basically I want to minimize the payload size between 2 web services. </p>
<p>Yes, it is, if the service interface definition on the client side is setup correctly (i.e. the RequestFormat/ResponseFormat properties of the WebGet/WebInvoke attribute on the operation contracts are set to Json. Also remember you'll need to use the WebHttp or WebScriptEnabled behaviors on your client.</p> <p>Noti...
Installing a ASP.NET application <p>Ok, this has got to be a super simple problem. I just can't seem to find the answer anywhere. First - I'm not a web developer of any kind, I'm an old school c programmer - so don't flame me for what's probably something quite trivial :)</p> <p>I need to write a small proof-of-conc...
<p>Your best bet is to use 'Publish website' from the Visual Studio Solution Explorer.</p> <p><a href="http://stackoverflow.com/users/2424/chris-lively">Chris Lively</a> adds: </p> <blockquote> <p>Just a minor add: Publish Website can be found by Right Clicking on the project name. The command will be named "...
Getting .png pixel data in Silverlight <p>We have a Silverlight application that needs to load a number of .png files. We can load the images OK, but Silverlight doesn't support reading the pixel data from the Image class.</p> <p>Can anyone suggest a simple solution for getting at this data? Our current best bet wou...
<p>There is no built in classes for doing pixel based imagine manipulation/generation i n Silverlight. You need to implement your own PNG Encoder/Decoder that works on an byte array containing the image information. Joe Stegman has implemented one such encoder you should check out. He got lots of great information abou...
list of email addresses that can be used to test a javascript validation script <p>Does anyone have a list of email addresses that I can use to test my JS address validation script? I'm looking for as complete of a list as is reasonable to test the most common edge cases, if not all cases.</p>
<p>Examples valid according to RFC2822</p> <ul> <li>me@example.com</li> <li>a.nonymous@example.com</li> <li>name+tag@example.com</li> <li>name\@tag@example.com – this is a valid email address containing two @ symbols.</li> <li>spaces\ are\ allowed@example.com</li> <li>"spaces may be quoted"@example.com</li> <li>!#$%...
Tabs, Text-Mate, Editing HTML (Rails) <p>Is there any way to force Text-Mate to use a two-space tab instead of a full tab when editing HTML (Rails) documents?</p>
<p>Yes. There's a pop-up menu near the bottom middle of the window that probably reads <code>Tabs: 4</code> or something like that. Click on it and hange it to <code>2</code> and <code>Soft Tabs</code>.</p> <p>You should have an <code>rhtml</code> or <code>erb</code> document (or whatever file type you want to change)...
Use GET or POST for a search form <p>I have a couple search forms, 1 with ~50 fields and the other with ~100. Typically, as the HTML spec says, I do searches using the GET method as no data is changed. I haven't run into this problem yet, but I'm wondering if I will run out of URL space soon?</p> <p>The limit of <a hr...
<p>Are your users actually going to be using all 50-100 fields to do their searches? If they're only using a few, why not POST the search to an "in between" page which header()-redirects them to the results page with only the user-changed fields in the URL? The results page would then use the default values for the fie...
asp.net gridview sort without data rebind <p>I am trying to make a gridview sortable which uses a stored procedure as a datasource, I would not want it to rerun the query each time to achieve this. How would I get it to work my current code is:</p> <pre><code>protected override void OnPreRender(EventArgs e) { if (...
<p>If you are not paging the results, and just doing a read, then something like the jquery tablesorter plugin would be a quick and easy fix. I have used this on tables of up to 1400 rows and works great, although ~> few hundred probably better on slow putas.</p> <p>If the gridview is editable, then aspnet event/input...
How should I interact with the geometry of a UIView, disregarding any transforms applied? <p>I have a view that I would like the user to rotate around its center, by tapping and holding somewhere and just move their finger round and round.</p> <p>I have all the geometry worked out; What I do is store the initial touch...
<p>I would use the coordinate system of the superview, since it is unaffected by the rotation:</p> <pre><code>- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint location = [[touches anyObject] locationInView:self.superview]; CGPoint relativeTouch = [MathHelper translatePoint:location re...
Creating a selector from a method name with parameters <p>I have a code sample that gets a <code>SEL</code> from the current object, </p> <pre><code>SEL callback = @selector(mymethod:parameter2); </code></pre> <p>And I have a method like </p> <pre><code> -(void)mymethod:(id)v1 parameter2;(NSString*)v2 { } </code></p...
<p>SEL is a type that represents a selector in Objective-C. The @selector() keyword returns a SEL that you describe. It's not a function pointer and you can't pass it any objects or references of any kind. For each variable in the selector (method), you have to represent that in the call to @selector. For example:</p> ...
How can I clean up dead connections using Oracle? <p>Right now I have a few new applications being developed against an Oracle Database, and sometimes they crash or fail to end correctly, etc... anyways the problem is they sometimes seem to leave their connections open, and I need to cleanup after them. My question is ...
<p>Here's a page referring to connection timeout parameters you can set in <a href="http://download.oracle.com/docs/cd/B28359_01/java.111/e10788/optimize.htm#sthref181" rel="nofollow">Oracle 11g</a>. I think the 'Abandon Connection Timeout' is what you're looking for. </p>