input
stringlengths
51
42.3k
output
stringlengths
18
55k
Creating Local variables in .Net <p>I just want to know that creating local variables to accept the return value of function is going to hit memory usage or performance in .Net applications , especially in ASP.Net.</p> <p>say</p> <pre><code> MyObject myObject = Foo(); MyOtherObject myOtherObject = Boo(); SomeFunti...
<p>Don't optimise prematurely; in a release build it is quite likely that the compiler will optimise these away anyway! Either way, you are just talking a tiny amount of stack space for (presumably) a few references. Either approach is fine; go with whichever is more readable.</p>
Evaluation order of new expression? <p>In the following code sample, do the C++ standard guarantee that '++i' is evaluated after the memory allocation (call to operator new) but before the call to X’s constructor?</p> <pre><code>new X( ++i ) </code></pre>
<p>From my copy of n2798:</p> <blockquote> <p><strong>5.3.4 New</strong></p> <p>21 Whether the allocation function is called before evaluating the constructor arguments or after evaluating the constructor arguments but before entering the constructor is unspecified. It is also unspecified whether the arguments ...
How can I list all processes running in Windows? <p>I would like to find a way to loop through all the active processes and do diagnostics checks on them (mem usage, cpu time etc) kinda similar to the task manager. </p> <p>The problem is broken down into two parts:</p> <ol> <li>Finding all the processes</li> <li>Find...
<p><strong>Finding all of the processes</strong></p> <p>You can do this through the Process class</p> <pre><code>using System.Diagnostics; ... var allProcceses = Process.GetProcesses(); </code></pre> <p><strong>Running Diagnostics</strong></p> <p>Can you give us some more information here? It's not clear what you ...
Refreshing a SQL database connection <p>How do you refresh a database connection within a VB application to SQL Server 2005 so that whenever data is changed in SQL, such changes are picked up by the application? For now the application only picks up the changes after it has been restarted, and that is not what I want....
<p>You don't need to "refresh" a database connection. If your application is only picking up changes after it restarts, then there is something wrong with your transaction handling.</p>
Add a field to a Grails Domain Class? <p>I would like to add a field to an existing domain class. I do not want to lose my view files however as I know will happen if i run generate-all. Is there another way I can update the mapping etc?</p>
<p>I think this is a common concern. </p> <p>This is not a direct solution to your problem, but this is what I do and works very well for me. </p> <ol> <li><p>I never make direct modifications to the grails scaffolded artifacts (views and controllers) </p></li> <li><p>I keep my production views/controllers separate f...
Determining when IE activex control has been repainted <p>I was using spy++ and noticed that the IE control I have embedded in a windows form was periodically calling or sending WM_PAINT when it repaints itself. I'm trying to figure out how in C# code I can perform a C# method every time this control sends WM_PAINT. ...
<p>You don't really need PInvoke to do this. The proper way is to use subclassing to handle specific Windows messages. Here's a link to do this:</p> <p><a href="http://www2.sys-con.com/ITSG/virtualcd/Dotnet/archives/0112/hankins/index.html" rel="nofollow">Handle Windows Messages with .Net</a></p>
Is there a way to delay an event handler (say for 1 sec) in Windows Forms <p>I need to be able to delay the event handlers for some controls (like a button) to be fired for example after 1 sec of the actual event (click event for example) .. is this possible by the .net framework ?</p> <p>I use a timer and call my cod...
<p>Perhaps you could make a method that creates the timer?</p> <pre><code>void onButtonClick(object sender, EventArgs e) { Delay(1000, (o,a) =&gt; MessageBox.Show("Test")); } static void Delay(int ms, EventHandler action) { var tmp = new Timer {Interval = ms}; tmp.Tick += new EventHandler((o, e) =&gt; tmp...
Is this all for Garbage Collection in Objective-C? <p>Hi I just picked up Obj-C and quite dislike its manual memory management.</p> <p>I decide to go with its Garbage Collection, by adding </p> <pre><code>objc_startCollectorThread();//garbage collection </code></pre> <p>in my Main() and change the garbage collection...
<p>Yes you are right, but in case any iPhone programmer comes by and thinks "oh sweet!", please note that the iPhone doesn't support Garbage Collection yet (ever?). So this is the MacOS only solution.</p>
How to enable Web Services Extension folder on IIS 6 <p>I'm trying to get .asp pages working on Windows Internet Information Server 6.0 on <strong>Win XP Pro</strong> <em>(I originally mistakenly posted this as Home)</em>.</p> <p>I found instructions in several places that say I should enable it in the Web Services Ex...
<p>IIRC XP has IIS 5.1, not 6.0, so the instructions for "Web Services Extension" do not apply</p> <p>I recall IIS 5.1 only allowing ASP support on a virtual folder, not on the root level for some reason?</p> <p>Have you run the IIS lockdown tool and locked out ASP? Need to undo that :-)</p> <p>Check <a href="http:/...
Standard Output from MSTest, NUnit, MbUnit, xUnit.NET test runners <p>How do you in any of the common .NET testing frameworks MSTest, NUnit, MbUnit, or xUnit.NET get the command line test runner to output a simple yes/no or true/false or 1/0 on whether all the tests passed or failed? </p> <p>I'm open to workarounds l...
<p>they all output XML if you want (esp MSTEST). You can use XSLT like <a href="http://preetsangha.blogspot.com/2008/05/decoding-ms-test-trx-file.html" rel="nofollow">my version</a> for MSTEST</p>
C++ templates, undefined reference <p>I have a function declared like so:</p> <pre><code>template &lt;typename T&gt; T read(); </code></pre> <p>and defined like so:</p> <pre><code>template &lt;typename T&gt; T packetreader::read() { offset += sizeof(T); return *(T*)(buf+offset-sizeof(T)); } </code></pre> ...
<p>You need to use the <code>export</code> keyword. However, I don't think G++ has proper support, so you need to include the template function's definition in the header so the translation unit can use it. This is because the <code>&lt;int&gt;</code> 'version' of the template hasn't been created, only the <code>&lt;t...
Server Error <p>In my Project (ASP.NET,VB.NET ),some times Server Error is showing. When this error is shown ,Users cannot submit their Applications,so that they have to re-type full details and submit again.How can I escape from these Server Errors. I think the reason may be Memmory issues.Because if the user try to s...
<p>I think that you'll need to provide a bit more info to get meaningful solutions. </p> <ul> <li>Do you have server logs?</li> <li>Can you debug through the app as the error occurs?</li> <li>Does the error occur at a certain time of day, or after a certain regular action?</li> <li>Does your app attempt to write to a ...
std::vector on VisualStudio2008 appears to be suboptimally implemented - too many copy constructor calls <p>I've been comparing a STL implementation of a popular XmlRpc library with an implementation that mostly avoids STL. The STL implementation is much slower - I got 47s down to 4.5s. I've diagnosed some of the rea...
<p>Don't forget to count the copy constructor calls needed to <code>push_back</code> a temporary <code>C</code> object into the vector. Each iteration will call <code>C</code>'s copy constructor at least once.</p> <p>If you add more printing code, it's a bit clearer what is going on:</p> <pre><code>std::vector&lt;C&g...
Why Emacs/Vim/Textmate? Isn't Xcode good enough? <p>Hi I mostly do C++, Objective-C programming. And I found Xcode plus an auto completion/macro plugin (Completion Dictionary) quite adequate.</p> <p>However, all people seem to praise over their pure text editors. I tried Textmate for a bit; liked its simplicity but di...
<p>Pull up a chair son, let me speak on this.</p> <p>Well before the days of Xcode, there was VIM and Emacs. I know it's hard to imagine, but it's true.</p> <p>Many people got accustomed to VIM/Emacs, and thus continue to use it.</p> <p>Emacs is extremely customizable, and offers pretty much everything you can imagi...
Can Design-by-Contract be applied to dynamic languages as easily/well as to statically-typed ones? <p>The title pretty much sums up the gist.</p> <p>I'm interested in whether it is possible to enable/disable contract enforcement(s) when using a dynamic language without running a serious risk of poorly/un-diagnosed fai...
<p>Not only is it possible, there are real-world implementations of this and they've been around for years. Here's a <a href="http://portal.acm.org/citation.cfm?id=785590" rel="nofollow">DbC implementation</a> for Python that's <em>twelve years old</em>, for example.</p>
BASH ^word^replacement^ on all matches? <p>To clarify, I am looking for a way to perform a <em>global</em> search and replace on the previous command used. <code>^word^replacement^</code> only seems to replace the first match.</p> <p>Is there some <code>set</code> option that is eluding me? </p>
<p>Try this:</p> <pre><code>$ echo oneone oneone $ !!:gs/one/two/ # Repeats last command; substitutes 'one' --&gt; 'two'. twotwo </code></pre>
How are floating point literals in C interpreted? <p>In a C program, when you write a floating point literal like 3.14159 is there standard interpretation or is it compiler or architecture dependent? Java is <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Double.html#valueOf%28java.lang.String%29" rel="nofo...
<p>It is architecture dependent. That generally means IEEE 754, but not necessarily. The C standard (ISO 9899:1999) discusses this mainly in section 5.2.4.2.2 'Characteristics of floating types'.</p>
Calling into a shared object on a key-sequence from vi/Vim <p>I have a shared library (in binary form; I have the source) that I use to invert/cycle between symbols in source files in Visual Studio.</p> <p>I would like to be able to use the same functionality in vi and/or Vim.</p> <p>Specifically, what I'd like to do...
<p>Try</p> <pre><code>inoremap &lt;C-i&gt; &lt;esc&gt;"hciw&lt;C-R&gt;=libcall('path/to/your.dll', 'func', @h)&lt;CR&gt; </code></pre> <p>What it does:</p> <ul> <li>create map for insert mode &lt;Ctrl+i&gt;</li> <li>&lt;esc&gt; switch to normal mode "hciw move word under cursor into the register h</li> <li>&lt;C-r&g...
Do you compile and run code very often or write large code pieces at once? <p>When you code, do you write a few lines at a time, compile and run, write a little more, compile and run etc.? Or do you usually write large chunks at once without compiling? Has this work style changed over time for you?</p>
<p><strong>Always</strong> keep your code in a working state. Write some code, compile it and test that it runs correctly. This is the habit that had kept me off the debugger for years, at least for new code I've written myself. It's one of the most important habits a programmer can acquire. When I see a new coder writ...
using "?" in SVG href <p>I'm having some major problems trying to get a "?" inside of hrefs that are part of my SVG scripts. I want to link to other parts of my website from inside of my SVGs, and most of my pages are dynamic that require $_GET variables to create them on the fly. SVG seems to throw a spaz every time I...
<p>Have you try to replace it with the ascii code instead? &amp;#63; In the same way that you have to replace the &amp; by &amp;amp;</p>
Minimum permissions for a SQL server "heartbeat" check? <p>We are developing an application to do a "hearbeat" test of all our SQL servers (2000, 2005 and 2008), and we're trying to figure out the minimum permissions necessary on the SQL server to do that. (Platform involved is TBD, but should use a standard connection...
<p>Just create the login used by the monitor code. On SQL Server 2005 and 2008, you'll also need <code>GRANT CONNECT SQL TO (login)</code>, otherwise it's the same.</p> <p>No other rights are needed for <code>SELECT @@VERSION</code>. The <code>db_datareader</code> you mention is within a database, not the server level...
Socket ReadFile Issue <p>We have a application which uses ReadFile to read a socket . In one of the scenarios the ReadFile gets a call saying that there are 2 bytes to read , but when the ReadFile tries to read this it return with bytesread as 0 . Does this mean that the socket on the other end has closed down ? . I me...
<p>When ReadFile() finds that there're two bytes to read, it at the same time does read these two bytes and they are removed from the socket. If the sender doesn't send more data, the next call will show that there's nothing to read. To determine if an error occured you have to check the retun value of ReadFile().</p>
Getting real row indices of selected rows in JTable when columns are alphabetized <p>If the columns of my JTable are unalphabetized, I can use getSelectedRows() and get values of their rows without any trouble. But, if the user clicks on the column name and the rows are alphabetized in that column, getSelectedRows() re...
<p>Use this code you will get the correct rows you visually selected.</p> <pre><code>int[] row_indexes=jTable1.getSelectedRows(); for(int i=0;i&lt;row_indexes.length;i++){ domain=jTable1.getValueAt(row_indexes[i], 1).toString(); System.out.println(this, domain); } </code></pre>
What does 'end of stream' mean when working with sockets <p>When working with Sockets in Java, how can you tell whether the client has finished sending all (binary) data, before you could start processing them. Consider for example:</p> <pre><code>istream = new BufferedInputStream (socket.getInputStream()); ostream = ...
<p>Yes, you're right - using <code>available()</code> like this is unreliable. Personally I very rarely use <code>available()</code>. If you want to read until you reach the end of the <em>stream</em> (as per the question title), keep calling <code>read()</code> until it returns -1. That's the easy bit. The hard bit is...
ASP.NET MVC compression options in IIS6 <p>For now I'm stuck with IIS6 for ASP.NET-MVC (as in I cant upgrade to Server 2008 yet). It doesnt seem to know that my RESTful URLS are dynamic files and isn't compressing them.</p> <p>All my old .aspx files are compressed (as seen in Fiddler), but not the <code>'/products/100...
<p>As HTTP compression for ASP.NET usually has been implemented using HttpModules since version 1.0, and HttpModules still belong to the ASP.NET request pipeline used by the MVC framework, you can still use a HttpModule to inject a GZIP or deflate response filter.</p> <p>Here you can find a very nice, open-source, rea...
CURL import character encoding problem <p>I'm using CURL to import some code. However, in french, all the characters come out funny. For example: Bonjour ...</p> <p>I don't have access to change anything on the imported code. Is there anything I can do my side to fix this?</p> <p>Thanks</p>
<p>Like Jon Skeet pointed it's difficult to understand your situation, however if you have access only to final text, you can try to use <strong>iconv</strong> for changing text encoding. </p> <p>I.e.</p> <pre><code>$text = iconv("Windows-1252","UTF-8",$text); </code></pre> <p>I've had similar issue time ago (with I...
Writing a Windows Printer Driver <p>I want to write a application in C++ or C# that will behave as a printer driver when installed. It will be available in the drop down list in Print dialog but instead of printing it will call into my code.</p> <p>I think there may be some interfaces that Windows provide to write pri...
<p>Windows provides loads of interfaces. Do you know what sort of a printer driver you want to write? At present, Windows supports three flavors of printer drivers -- PostScript, Unidrv and XPSDrv (the latter on XP/2003 Server with EP 1.0 and upwards only). Most of the time, it suffices to write a driver plug-in instea...
Can I register a .it domain name for a company outside of Italy? <p>I've got a domain name that would work nicely with a .it domain name (e.g. redd.it). This is for a web application I'm building, which if it ever generates revenue will be for a company in the US. Is this allowed?</p>
<p>According to their <a href="http://www.nic.it/en/faq/faq-nomi.html#nomi6">FAQ</a>, you need to have an office within EU.</p>
How to use assembly of one application in to another application? <p>I want to use assembly of one application into another. There is one assembly in one application "EventCalendar" which is registered as </p> <pre><code>&lt;%@ Register TagPrefix="ec" Namespace="ControlCalender" Assembly="EventCalendar" %&gt; </code><...
<p>Since you've tagged it as ASP.NET I assuming you want to refer to an assembly in your web application. All you need to do is put the dll in the bin folder of your web app.</p> <p>Beyond that I think you need to be more specific =)</p>
Opening a VB6 form from WPF application <p>We are currently working on porting an old VB6 application to WPF. The plan, in phase one, is to port several key forms and not all the application. Its been brought up that we might try and open some of the old VB6 form from within the WPF application (as modal forms), thus p...
<p>Yes this is possible; depending on how hard you're willing to work. The key scenarios that are supported are as follows (note: there are other supported scenarios but these are the <strong>key</strong> ones):</p> <ol> <li>WPF -> WinForms</li> <li>WinForms -> WPF</li> </ol> <p>Given that with VB6 your objects are a...
C# adding referenes at run time <p>Sorry if it is a duplicate post. <a href="http://stackoverflow.com/questions/629414/adding-references">link text</a></p> <p>but i didnt get any clear solution.. </p> <p>my application loads various dll, and processes them. so i need to add the dlls in my references list at run-time....
<p>i got the solution. if i use, the below code its working fine. </p> <p>Type type = asm.GetType("for_hutt_proj.class1", false, true);</p> <p>credits to Marc Gravell.</p>
Print php array in xslt <p>Is there any way to print a php array in xslt? I'm working with php sessions and trying to print the hole array in the xslt stylesheet.</p>
<p>To use your array in a XSLT stylesheet you first have to convert your array into a XML representation. This representation strongly depends on your array-structure. A simple way would be:</p> <pre><code>$array = ( 'key1' =&gt; 'value1', 'key2' =&gt; 'value2', 'key3' =&gt; 'value3' ); // ext/DOM can als...
How to do an efficient priority update in STL priority_queue? <p>I have a priority_queue of some object:</p> <pre><code>typedef priority_queue&lt;Object&gt; Queue; Queue queue; </code></pre> <p>From time to time, the priority of one of the objects may change - I need to be able to update the priority of that object i...
<p>I can suggest 2 choices to solve the problem, although neither performs a real update.</p> <ol> <li><p>Use the <code>priority_queue</code> and push element each time you would like to update it. Accept the fact that you will have useless entries in the queue. When popping the top value, check if it contains the up-...
ListView_SetBkImage does not work on XP <p>I want to set the background image of a ListView control in my Shell Extension. The ListView inherits IShellView and I am using the following code:-</p> <pre><code>HBITMAP m_hBmp = (HBITMAP)::LoadImage( hinst, MAKEINTRESOURCE( IDB_BITMAP1 ), IMAGE_BITMAP, 0, 0, LR_C...
<p>To make it work in both versions(XP and Vista), we used both the approaches. For XP, we are loading the image from file and for Vista we are loading it from resource. For some reason, loading from file does not work in Vista and loading from resource handle does not work in XP.</p> <p>So the approach is to load it...
Comparison of bmp files? <p>I want to compare two bmp files. I thought of two approaches: </p> <ol> <li>to compare the header as well as the information header of the two files</li> <li>convert the bmp file to binary and then do the above comparison</li> </ol> <p>But, I don't know how to start and which will be a bet...
<p>I don't know on which platform you want to implement this, but here are some code snippets which could be useful:</p> <p><a href="http://www.dreamincode.net/code/snippet2859.htm" rel="nofollow">Compare two images with C#</a></p> <blockquote> <p>This is a snippet to compare 2 images to see if they are the same....
Detecting the launch of a application <p>How do I detect with C# on Windows the moment when an external application is being launched?</p> <p>I tried the FilesystemWatcher which doesn't work because the file is not really changing. Also having a timer constantly check all the open processes might be a bit over kill. I...
<p>You can use <a href="http://msdn.microsoft.com/en-us/library/system.management.aspx">System.Management</a> and <a href="http://fr.wikipedia.org/wiki/Windows%5FManagement%5FInstrumentation">WMI (Windows Management Instrumentation)</a></p> <pre><code>class WMIEvent { public static void Main() { WMIEvent w...
dynamic model creation in django <p>How do you create a dynamic model in Django?</p> <p>Are there any recommended Django apps or tutorials for doing so?</p> <p>Here is an example use case for a dynamic model:</p> <blockquote> <p>A University has an information system for all of the students enrolled. The admin...
<p><a href="http://code.djangoproject.com/wiki/DynamicModels">http://code.djangoproject.com/wiki/DynamicModels</a></p>
How do I find out the code coverage of the JDK caused by my tests? <p>I am currently using Emma as the code coverage tool for my project. I know how to get the code coverage analysis of running a sample Java test case. This will give me the code coverage details of the Java test case code, but, what I want to know is h...
<p>Have you considere explicitely instrumenting the jars from the jdk and including com.sun; java. and javax packages?</p>
MVVM Routed and Relay Command <p>What is the Difference between the <a href="http://msdn.microsoft.com/en-us/library/system.windows.input.routedcommand.aspx">RoutedCommand</a> and <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090051">RelayCommand</a> ? When to use RoutedCommand and when to use Rel...
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.input.routedcommand.aspx">RoutedCommand</a> is part of WPF, while <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090051">RelayCommand</a> was created by a WPF Disciple, Josh Smith ;).</p> <p>Seriously, though, RS Conley described so...
Issues with Asp.net Gridview Paging <p>I have used the Gridview_PageIndexChanging event in asp.net.i have used the code like this:</p> <pre><code>gridFileDetails.PageIndex = e.NewPageIndex </code></pre> <p>During the run time when i clicked the next page,it generates an error:</p> <blockquote> <p>An exception of t...
<p>Instead of this:</p> <pre><code>Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow) </code></pre> <p>Use the index from the <code>EventArgs</code> to grab the row programmatically like this:</p> <pre><code>Dim index As Integer = Convert.ToInt32(e.CommandArgument) Dim row A...
Updateable view in mssql with multiple tables and computed values <p>Huge database in mssql2005 with big codebase depending on the structure of this database.</p> <p>I have about 10 similar tables they all contain either the file name or the full path to the file. The full path is always dependent on the item id so it...
<p>Scroll down on the page you linked and you'll see a paragraph about updatable views. You can not update a view based on unions, amongst other limitations. The logic behind this is probably simple, how should Sql Server decide on what source table/view should receive the update/insert?</p>
Developing kernels and testing them in virtual machines <p>I like programming challenges, and writing a kernel seems a programming challenge.</p> <p>Unfortunately, kernels are particularly hard to test because they are basically the core of operating systems and so they can't be easily ran on top of an operating syste...
<p>While BOCHS seems to be better at letting you know when something goes horribly wrong with your pet OS... it is very slooooow! I use VirtualPC for general purpose testing and BOCHS when things get murky.</p> <p>Also, you will more than likely be booting the OS every 2 minutes, so it helps to have some sort of autom...
Securing a mvc view so only the server can access it <p>I'm building a .Net MVC app, where I'm using one particular view to generate an internal report. I don't want the users of the site to gain access to this page at all.</p> <p>I've a console app that fires every so often which will scrape some of the details from ...
<p>The best practice would be to expose a wcf service for this, and set up a security model that is different than website.</p> <p>If you must use MVC the best approach use forms authentication with mvc and set </p> <pre><code>[Authorize(Roles = "SecureUser")] </code></pre> <p>On the View.</p>
C# Settings xml file location <p>I have a project that reads in a file based on a value in a C# Setting class. This value however changes from machine to machine and Id rather not ask the user the first time the program is run as its a corporate environment, instead Id like it to be set in the installer, but where is t...
<p>From your post it appears you have a windows application? , you can store an initial value in the application config, you can make an installer in Visual Studio and write custom actions that can write values to the file on first install in you install project.</p>
Project source code that follows Microsoft Best Practices <p>I would like to know if you know some sites with great source code that follows Microsoft best practices?</p> <p>By best practice I mean that projects that most likely conforms to say, this documents: <a href="http://www.codeplex.com/AppArchGuide" rel="nofol...
<p>I believe Microsoft's own code follows their best practices, so have a look at <a href="http://www.microsoft.com/resources/sharedsource/default.mspx" rel="nofollow">Shared Source Initiative</a>.</p>
Scope of JButton outside of its native class <p>If i have a method in my gui that returns a list of JButtons then in my makeFrame() method i populate my GridView with these buttons, how can i get hold of these buttons in my logic class,</p> <p>the logic i am using is to check the labels of the buttons, if three in a r...
<p>Instead of checking the actual GUI buttons your logic class should hold a model of the button state, for example, in a 2D array. You then have the state within the logic class to check for a win etc.</p> <p>The buttons on the GUI should only be a representation of the state held in the logic class.</p>
long integer as array index in C gives segmentation fault <p>The following C Code gives a segmentation fault:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdint.h&gt; int main(){ uint32_t *a; uint32_t idx=1233245613; a[idx]=1233; return 0; } </code></pre> <p>How can I use uin...
<ul> <li>The variable "a" is just a pointer varaible. </li> <li>A pointer variable holds the address of a memory location.</li> <li>You need to point a to a memory location that has the space you need already allocated.</li> </ul> <p>Also you are trying to index pretty far in the array. You may not have enough memor...
Do Python lists have an equivalent to dict.get? <p>I have a list of integers. I want to know whether the number 13 appears in it and, if so, where. Do I have to search the list twice, as in the code below?</p> <pre><code>if 13 in intList: i = intList.index(13) </code></pre> <p>In the case of dictionaries, there'...
<p>You answered it yourself, with the <code>index()</code> method. That will throw an exception if the index is not found, so just catch that:</p> <pre><code>def getIndexOrMinusOne(a, x): try: return a.index(x) except ValueError: return -1 </code></pre>
Cache AJAX requests <p>I am sending AJAX GET-requests to a PHP application and would like to cache the request returns for later use.</p> <p>Since I am using GET this should be possible because different requests request different URLs (e.g. getHTML.php?page=2 and getHTML.php?page=5).</p> <p>What headers do I need to...
<p>Add the following headers on the server:</p> <pre><code> header("Cache-Control: private, max-age=$seconds"); header("Expires: ".gmdate('r', time()+$seconds)); </code></pre> <p>Where <strong>$seconds</strong> has an obvious meaning.</p> <p>Also, check if your server do not issue some other anti-caching head...
Get month from DATETIME in sqlite <p>I am trying to get extract the month from a <code>DATETIME</code> field in SQLite. <code>month(dateField)</code> does not work as well as <code>strftime('%m', dateStart)</code>. </p> <p>Any ideas?</p>
<p>I don't understand, the response is in your question : </p> <pre><code>select strftime('%m', dateField) as Month ... </code></pre>
Is the join expression not supported by MS Access? <p>Can anyone explain to me what is wrong with my query?</p> <pre><code>SELECT T2.TIPOPRODUTO , T2.PRODUTO , T1.ESPESSURA , '' AS LARGURA , '' AS COMPRIMENTO , '' AS [ACABAM REVEST] , '' AS [ESPECIF QUALIDADE] , T1.CÓDIGORASTREABILIDADE ...
<p>You are mixing a join statement with "classical joins" (a comma separated list of tables with conditions in the where statement), which I believe is not allowed.</p> <p>Change the query to use only join statements. In Access you have to pair the joins using parentheses, in this manner:</p> <pre><code>from (((t1 jo...
how to do a "fill with color"(from mspaint) with a picturebox? <p>I did a little research and I didn't find a way, anyone know?</p> <p>c# or vb.net</p>
<p>Are you looking for a flood fill algorithm? Check this for example: <a href="http://www.codeproject.com/KB/GDI-plus/floodfillincsharp.aspx" rel="nofollow">Flood Fill Algorithms in C# and GDI+</a></p>
Why is javascript unable to get asp:Label innerText? <p>I have two labels: username and email. I use them to retrieve their content and pass them as method parameters.</p> <pre><code>var lblEmail = $get('&lt;%= lblEmail.ClientID %&gt;'); var email = lblEmail.innerText; var lblUsername = '&lt;%= lblUsername.ClientID %...
<p>In the second part of your code </p> <pre><code>var lblEmail = $get('&lt;%= lblEmail.ClientID %&gt;'); var email = lblEmail.innerText; var lblUsername = '&lt;%= lblUsername.ClientID %&gt;'; var username = lblUsername.innerText; </code></pre> <p><strong>$get</strong> call is absent. Should be </p> <pre><code>var ...
Hibernate tutorials <p>Let's say that I'm new to Hibernate, is there a way to get my skills up to speed? Are there any good tutorials?</p>
<p>Hibernate.org is pointing this to begin with : <a href="http://www.hibernate.org/152.html" rel="nofollow">Getting Started with Hibernate</a></p> <p>I would then recommend reading this very good book : <a href="http://www.manning.com/bauer2/" rel="nofollow">Java Persistence with Hibernate (Christian Bauer and Gavi...
RESTful iPhone client and Model hierarchy <p>I'm curious what strategy most of you are employing in order to build solid RESTful iPhone clients in respect to model hierarchies. What I mean by model hierarchies is that I have a REST server in which several resources have a correlation to each other. For instance, let's ...
<p>How you choose to store manage your model data on the iPhone probably depends on how much the XML data you are dealing with is likely to vary, and how bloated it might get. </p> <p>If this is a simple XML model that is unlikely to change, and doesn't carry terribly much redundant information with it, you might do w...
COTS vs. Custom / Build vs. Buy: Decision Tree and Best Practices <h3>Background:</h3> <p>I work at a company with a large SAP investment, and we also have dozens of large .NET systems (mostly internally for engineering systems), and Java platforms (mostly for external web applications). As such, we have large develop...
<p>I'm not entirely sure what you are asking for but I'd thought I'd comment on a few things that I've seen arise in COTS versus custom development choices over the years:</p> <ol> <li><p>It is going to take time to properly analyse any COTS systems for suitability. Both from a requirements perspective and a technical...
What part of the ASP.Net framework do you use to execute arbitrary code on every inbound request to IIS? <p>I'd like to run a discrete chunk of .Net code for each and every request that comes through a certain Web site in IIS. This is completely isolated code -- it doesn't affect anything before or after it -- it logs...
<p>You can use an <a href="http://msdn.microsoft.com/en-us/library/ms227673.aspx" rel="nofollow">HTTP Module</a>, however, to use it you will need to map all requests to IIS which can be done using a <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/5c5ae5e0-f4f9-44b0-a743-f4c3a5ff68ec...
C++: Is it possible to share a pointer through forked processes? <p>I have a count variable that should get counted up by a few processes I forked and used/read by the mother process. </p> <p>I tried to create a pointer in my main() function of the mother process and count that pointer up in the forked children. That ...
<p>Each child gets its own copy of the parent processes memory (at least as soon as it trys to modify anything). If you need to share betweeen processes you need to look at shared memory or some similar IPC mechanism.</p> <p>BTW, why are you making this a community wiki - you may be limiting responses by doing so.</p>...
Put current route values/url in form post <p>In my master page, I have a language dropdown menu. When the user selects a language from the dropdown, a submit sends the currently selected language to the "Translate" method in my controller. After which it should redirect to the url it was before the translation submit s...
<p>I have a similar situation, and I solved it slightly differently.</p> <p>Because my master page had <em>functionality</em> in it, I created a new base controller class (that inherits from Controller) and all my real controllers inherit from my custom class.</p> <p>Then, I implement OnActionExecuting in the base cl...
jQuery: Adding context to a selector is much faster than refining your selector? <p>I just noticed that adding context to the selector is much faster than refining your selector.</p> <p><code>$('li',$('#bar')).append('bla');</code></p> <p>Is twice as faster than:</p> <p><code>$('#bar li').append('bla');</code></p> ...
<blockquote> <p>adding context to the selector is much faster than refining your selector</p> </blockquote> <p>This is true in the general case. With respect to your specific examples however it is not necessarily true for jQuery &lt;= 1.2.6.</p> <p>Up to and including jQuery 1.2.6 the selector engine worked in a...
Java XML Node Edit without Node.getTextContents() <p>I'm using an old version of the JRE (1.4) where Node.getTextContents() and Node.setTextContents() are not available. Is there a long way to do these actions still?</p> <p>Example XML:</p> <pre><code>&lt;MyEle&gt;4119&lt;MyEle/&gt; </code></pre> <p>Java:</p> <pre...
<p>The text is a child node of the MyEle element, so you would use something like:</p> <pre><code>MyEle.getFirstChild().getNodeValue() </code></pre>
POSTing to https form not always working <p>On my site I have a simple login form. The page is served via HTTP, but the form's POST URL is HTTPS.</p> <p>The normal method is that the user fills in their username/password, the form is submitted (to the fully qualified HTTPS URL, on the same site), and then the POST pro...
<p>How do you "log out" Have you tried clearing your cache to see if any leftover session variables are throwing it off?</p> <p>In Firefox: Tools -> Clear Private Data -> Check Cache, Cookies, and Authenticated Sessions</p>
Returning an object as a property in ATL <p>I am creating a COM object using Visual Studio 2008 and ATL. Adding simple properties and methods is easy enough but now I want to do something more complicated. I want to give access to a C++ object via a property of my COM object, so I can do something like:</p> <pre><co...
<p>If you're going to call it from an automation language, you'll need the interface returned to be derived from IDispatch, and you'll likely need to return it at least as an IDispatch**. For retval I think that's good enough; for simple [out] parameters you need to pass it as a VARIANT* (with the variant type set to V...
Upgrade database from SQL Server 2005 to 2008 — and rebuild full-text indexes? <p>I upgraded from Sql Server 2005 to Sql Server 2008. I backed up the data in SQL Server 2005, and then I restored in SQL Server 2008. Next, I found the catalog under "Storage->Full Text Catalogs", and I right-clicked on it, and am trying...
<p>Take a look at the following article.</p> <p>It provides details and references for best practices for using Full Text Search in SQL Server 2008.</p> <p><a href="http://sqlcat.com/msdnmirror/archive/2008/11/05/best-practices-for-integrated-full-text-search-ifts-in-sql-2008.aspx" rel="nofollow">http://sqlcat.com/ms...
Scrum - where do you do all the 'other' stuff? <p>With Scrum, there is the principal of user stories and these stemming tasks etc etc iterating around to a finished product - which is fine.</p> <p>But, let's say I have 100 features that need implementing, in the real world I can't put any developer on these until a lo...
<p>My understanding is that in scrum you only build what is required to implement each user story. Therefore, you build the underlying stuff that is not a feature only when it is required to implement a feature for the user story you are working on.</p>
Database design, how to setup tables <p>I have a simple ecommerce type site that will have users with accounts, orders, and contact/billing information for those users. I just wanted to know the best way to setup these tables from an efficiency and logical point of view. So far I have basically two different entities, ...
<p>You might have to think about this a little more:</p> <p>Users have a contact and billing address, what about shipping and other addresses? Is it possible to have two users from one company, each with different contact addresses but the same billing address? Is it possible for one user to have multiple billing ad...
Prism 2 SL : Remove View from Region when button clicked <p>I am new to Prism and I am trying to determine a best practice for deactivating a view in a Prism 2 application -- when a user clicks a button on the view I want to deactivate the view. The view is executing a command when the button is clicked.</p> <p>The v...
<p>I'm gonna go on a limb here and assume that you are using an itemscontrol or such for your region, because that's the most obvious use of a "button that removes a view".</p> <p>In that case, you should have a Controller (or whatever you want to call it, but the Prism team seems to use that kind of name for that kin...
How to convert a Swing Application to an Applet? <p>I created a desktop application with Swing Application Framework, now how can I convert it to an applet? The main class extends SingleFrameApplication.</p> <p>EDITED: This is the starting class, used NetBeans GUI builder:</p> <pre><code>public class PhotoApp extends...
<p>The quick and dirty way:</p> <p>Drop extends SingleFrameApplication. Add extends JApplet.</p> <p>replace the constructor with public void init() leaving the body as is.</p> <p>Create an HTML page to hold it. and give it a whirl.</p> <p>There will likely be some scoping issues, but you should be able to fix those...
I don't understand this Code <p>I do not understand this code snippet :</p> <pre><code>function ms(){ var plc=unescape('". unescape( '\x43\x43\x43\x43\n.............\xEF'. $URL).CollectGarbage(); if (mf)return(0); mf=1; var hsta=0x0c0c0c0c,hbs=0x100000,pl=plc.length*2,sss=hbs-(pl+0x38); var ...
<p>It's a javascript snippet trying to exploit a security vulnerability related to Facebook, more specifically to its image uploader client side ActiveX control.</p> <p>The <code>cobj</code> part tries to create an object of ClassID <code>{5C6698D9-7BE4-4122-8EC5-291D84DBD4A0}</code> which happens to be an ActiveX pho...
IPhone Accelerometer Determine Motion <p>Using the accelerometer output, how do I determine if the user (iphone mounted on waist) is walking?</p> <p>Looking for a good algorithm to determine if the user is walking to determine activity transitions- standing-to-walking or walking-to-standing.</p> <p>please help.</p> ...
<p>For a previous project, I tried calculating the magnitude of the acceleration vector, and just setting a threshold of about 2g, and that worked pretty well in testing. A typical (hardware) pedometer will ignore single jolts that happen more than about a second apart, which seems like a good way to filter out occasio...
How to have jQuery restrict file types on upload? <p>I would like to have jQuery limit a file upload field to only jpg/jpeg, png, and gif. I am doing backend checking with <code>PHP</code> already. I am running my submit button through a <code>JavaScript</code> function already so I really just need to know how to chec...
<p>You can get the value of a file field just the same as any other field. You can't alter it, however.</p> <p>So to <strong>superficially</strong> check if a file has the right extension, you could do something like this:</p> <pre><code>var ext = $('#my_file_field').val().split('.').pop().toLowerCase(); if($.inArray...
Web Routing for IIS6 and II7 Classic Mode? *NOT* MVC <p>According to the msdn.microsoft.com site, .NET 3.5 Routing should work under IIS6 and II7 in classic mode. I've made the mods to the web.config file and tested under IIS7 integrated mode and it's working great.</p> <p>I'd love to keep IIS7 Integrated, but my web...
<p>The joy of the internet... keep searching and rephrasing and you find it yourself. :)</p> <p>For posterity, the answer is to enable a wildcard mapping that routes all requests through ASP.NET ISAPI.</p>
Issue trying to bind rss feed to repeater <p>I am trying to bind a datatable to a repeater. To do this, according to a code sample, I need to call dataview() when choosing the datasource property of the repeater and then write databind().</p> <p>When I do this, I still get the exception that the source to databind to ...
<p>With a repeater you should be able to just do the following:</p> <pre><code>rpYourRepeater.DataSource = dtYourDataTable; rpYourRepeater.DataBind(); </code></pre> <p>That's it. </p> <p>Just verify that your DataSourceID is tied to a real field in your datatable or just leave the DataSourceID out completely as you ...
How do I make Weblogic 8.1 serve static content? <p>I come from the Open source world where I'm used to having Apache serve up my images, css, javascript, etc., while Tomcat or an app server of its ilk handles all the Java EE lifting.</p> <p>But now I'm doing a project with Weblogic 8.1, and I can't seem to figure out...
<p>You might want to take a look <a href="http://e-docs.bea.com/wls/docs81/adminguide/web%5Fserver.html#105827" rel="nofollow">here</a> and <a href="http://e-docs.bea.com/wls/docs81/webapp/index.html" rel="nofollow">here</a>:</p> <p>Here's the short version of what BEA says:</p> <blockquote> <p>Web Applications</p>...
Wpf Toolkit. Bind DataGrid Column Header to DynamicResource <p>I'm trying to bind DataColumn Header to DynamicResource using following code.</p> <pre><code>&lt;Window.Resources&gt; &lt;sys:String x:Key="HeaderText"&gt;Header Text&lt;/sys:String&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;tk:DataGrid&gt; ...
<p>Try this:</p> <pre><code>&lt;Window.Resources&gt; &lt;sys:String x:Key="HeaderText"&gt;Header Text&lt;/sys:String&gt; &lt;Style x:Key="HeaderTextStyle" TargetType="{x:Type Primitives:DataGridColumnHeader}"&gt; &lt;Setter Property="Content" Value="{DynamicResource HeaderText}" /&gt; &lt;/Style&gt;...
Using MD5 hash on a string in cocoa? <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1524604/md5-algorithm-in-objective-c">MD5 algorithm in Objective C</a> </p> </blockquote> <p>I need to hash a string using the MD5 technique in cocoa. Any frameworks that ar...
<p>Noticed this in the Facebook Connect source code. Looks pretty solid, give it a shot.</p> <pre><code>#import &lt;CommonCrypto/CommonDigest.h&gt; ... + (NSString*)md5HexDigest:(NSString*)input { const char* str = [input UTF8String]; unsigned char result[CC_MD5_DIGEST_LENGTH]; CC_MD5(str, strlen(str), r...
Escaping verbatim string literals <p>I have the following string which won't compile:</p> <pre><code>String formLookupPull = @"SELECT value1, '"+tableName+"', '"+columnName+"' FROM lkpLookups WHERE ""table"" = '" + tableName + "' and ""field"" = '" + columnName + "';"; </code></pre> <p>The offending sections are :</p...
<p>To address your title question...</p> <p>To escape the quote in a verbatim string literal, use the quote-escape-sequence <code>""</code> (that's two quote characters)</p> <pre><code>string a = @"He said ""Hi!""..."; // He said "Hi!"... </code></pre> <p>See <a href="http://msdn.microsoft.com/en-us/library/aa691090...
PHP library or command line? <p>I have run into two situations lately where I have chosen to use the command line for doing something rather than the PHP library. For example, in PHP doing this: </p> <pre> `curl http://someplace.com` </pre> <p>instead of this:</p> <pre> $ch = curl_init(); curl_setopt($ch, CURLOPT_UR...
<p>I'd always use the libraries:</p> <ol> <li><p>No need to fork twice (once for the sub-shell, and another for the program you're running) - hence faster</p></li> <li><p>No need to worry about escaping command line arguments, which helps security</p></li> </ol> <p>If the number of lines of code is a worry, write tho...
What is the AppDelegate for and how do I know when to use it? <p>I'm just beginning to work on iPhone apps. How do I know when I should be putting stuff in AppDelegate versus a custom class? Is there a rule or any type of analogy with another programming language like Python or PHP that uses an AppDelegate like patte...
<p>I normally avoid the design approach implied by Andrew's use of the term "heart of your application". What I mean by this is that I think you should avoid lumping too many things in a central location -- good program design normally involves separating functionality by "area of concern".</p> <p>A delegate object is...
Change webserver used by Flex in FlexBuilder to .NET Framework 3.5 <p>I just had to reformat and reinstall Flex and reconstruct a project.</p> <p>The problem is i am using ASP.NET as my server side technology and using LINQ in my files. The version of <code>WebDev.Webserver.exe</code> that FlexBuilder starts up is the...
<p>It turned out I only had a very minimal <code>web.config</code> file set up.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration&gt; &lt;system.webServer&gt; &lt;directoryBrowse enabled="true" /&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>Once I o...
Neural networks - input values <p>I have a question that may be trivial but it's not described anywhere i've looked. I'm studying neural networks and everywhere i look there's some theory and some trivial example with some 0s and 1s as an input. I'm wondering: do i have to put only one value as an input value for one n...
<p>The above answers are technically correct, but don't explain the simple truth: there is <em>never</em> a situation where you'd need to give a vector of numbers to a single neuron.</p> <p>From a practical standpoint this is because (as one of the earlier solutions has shown) you can just have a neuron for each numbe...
How do I detect a Lock This Computer command from a WPF application? <p>Would prefer an answer in C#, .Net 3.5 using WPF (Windows Forms also okay)</p> <p>I have an application that is essentially a toolbar window or tray icon. It needs to detect if a user locks his/her workstation and walks away in order to update th...
<p>When you handle the <a href="http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.sessionswitch%28VS.85%29.aspx"><code>Microsoft.Win32.SystemEvents.SessionSwitch</code></a> event (which it sounds like you're already doing to detect logout), check to see if the <code>Reason</code> is <a href="http://m...
How to let my visitors to listen to different online radios using flash player? <p>After I've found out that WMP is not best idea for Firefox users as they need to install additional plugin, I wanted to try out JW player and I googled all I could about audio streaming and flash players.</p> <p>I got something like www...
<p>For security reasons, you can't do it with flash unless you either set up a proxy on your web server, or you get the owners of the radio station to add your website to the crossdomain.xml file on their server.</p> <p><a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213" rel="nofollow">http://...
Know of any small projects implementing an HTTP service using libevent? <p>My C is a bit rusty. I have some ideas I'd like to try and realize with libevent. Do you know any codebase I can use as a reference?</p>
<p>Two good projects that have fairly straight forward code are <a href="http://code.google.com/p/simplehttp/source/browse/#svn/trunk/server" rel="nofollow">simplehttp</a> and <a href="http://code.google.com/p/libevent-longpolling/" rel="nofollow">libevent-longpolling</a></p> <p>Two spots i can point you to in order t...
Summarise unlimited sequence using constant storage <p>Assume we're frequently sampling a particular value and want to keep statistics on the samples. The simplest approach is to store every sample so we can calculate whatever stats we want, but this requires unbounded storage. Using a constant amount of storage, we ca...
<p>Minimum, maximum, average, total count, variance are all easy and useful. That's 5 values. Usually you'll store sum and not average, and when you need the average you can just divide the sum by the count. </p> <p>So, in your loop</p> <pre><code>maxVal=max(x, maxVal); minVal=min(x, minVal); count+=1; sum+=x; second...
How to unlock an sqlite3 db? <p>OMG!</p> <p>What an apparent problem... my django based scripts have locked my sqlite db...</p> <p>Does anyone know how to fix?</p>
<p>Your database is locked because you have a transaction running somewhere. </p> <p>Stop all your Django apps. If necessary, reboot.</p> <p>It's also remotely possible that you crashed a SQLite client in the middle of a transaction and the file lock was left in place.</p>
Delete with Join in MySQL <pre><code>CREATE TABLE `clients` ( `client_id` int(11), PRIMARY KEY (`client_id`) ); CREATE TABLE `projects` ( `project_id` int(11) unsigned, `client_id` int(11) unsigned, PRIMARY KEY (`project_id`) ); CREATE TABLE `posts` ( `post_id` int(11) unsigned, `project_id` int(11...
<p>You just need to specify that you want to delete the entries from the <code>posts</code> table:</p> <pre><code>DELETE posts FROM posts INNER JOIN projects ON projects.project_id = posts.project_id WHERE projects.client_id = :client_id </code></pre> <p>EDIT: For more information you can see <a href="http://stackov...
What's the best client architecture for Flash Remoting communicating with ASP.Net? <p>We have found the combination of ASP.Net as a server backend and Adobe Flash for the User Interface to be an excellent marriage.</p> <p>Up until now we have used Javascript as the communication conduit between the two technologies. T...
<p>Have you tried building a Web Service serving up JSON? I would try that and see how it suits your needs before going the Flash Remoting route.</p>
How can I asynchronously add items to a Native Context Menu in Adobe AIR? <p>Once a Native Context Menu is invoked, I need it to be populated from a set of remote service calls. Current implementation, however, requires items to be set before opening the menu.</p> <p>Any ideas?</p> <p>Thanks ;) A</p>
<p>EDIT: I've once again re-read your question and realized that you want to update a menu while you are opening it, not before it is opened. There is another event you can listen for called <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/NativeMenu.html#event:displaying" rel="nofollow"...
Having problems inserting and updating tables in a database with prepared statements <p>Very new to PHP5 and have some problems still. I figured out how to Select with prepared statements now trying to insert/update my code is as follows </p> <pre><code>function input_lab_results($name, $image, $descrip) { $query...
<p>I changed it to </p> <pre><code>function input_lab_results($name, $image, $descrip) { $query = "INSERT INTO pat_table (pat_name, pat_image, pat_descrip, pat_doctor, pat_resident, pat_create, pat_modify) VALUES (?, ?, ?, 0, 0, ?, ?)"; if($stmt = $this-&gt;conn-&gt;prepare($query)){ $stmt-&gt;bind_pa...
'System.Web.Security.SqlMembershipProvider' requires a database schema compatible with schema version '1' <p>I want to use profiles and was able to use aspent_regsql -A p to install the tables. I can see them throughout SQL management studio. </p> <p>I'm actually using SQLExpress 2005, and my dbo.aspnet_SchemaVersions...
<p>Well, fool of me. I was quite sure it was a problem with SQLExpress database but it was actually my <code>web.config</code> file that was totally weird. I got it to work by adding the correct properties to the providers:</p> <pre><code> &lt;connectionStrings&gt; &lt;add name="RGConnectionString" conne...
Idea: Embed data/DSLs in Java as comments and generate Java code with APT <p>I had an idea and I wanted to run it by you to get some feedback. Please look the following over and let me know what you think, whether it's positive or negative.</p> <p>I've always wished that there was a way to embed certain pieces of data...
<p>I would use the the google collections api now part of the guava libraries <a href="http://code.google.com/p/guava-libraries/" rel="nofollow">http://code.google.com/p/guava-libraries/</a> it has awesome list and map support. It support the kind of constructs your trying to achieve </p> <pre><code>public static fin...
Best way to create a sitesearch in ASP.NET <p>Which is the best way to create a site search engine for a dynamic asp.net site with hundreds of dynamic pages. I have seen many products and articles </p> <p><a href="http://www.karamasoft.com/UltimateSearch/overview.aspx" rel="nofollow">http://www.karamasoft.com/Ultimate...
<p>Priyan,</p> <p>Another high-quality open-source option would be the .NET port of Lucene </p> <ul> <li><p><a href="http://www.codeproject.com/KB/library/IntroducingLucene.aspx" rel="nofollow">CodeProject - Introducing Lucene</a></p></li> <li><p><a href="http://www.dotlucene.net" rel="nofollow">dotlucene</a></p></li...
How do you POST to a page using the PHP header() function? <p>I found the following code on <a href="http://php.net/manual/en/function.header.php#89447">here</a> that I think does what I want, but it doesn't work:</p> <pre><code>$host = "www.example.com"; $path = "/path/to/script.php"; $data = "data1=value1&amp;data2=...
<p>The header function is used to send HTTP response headers back to the user (i.e. you cannot use it to create request headers.</p> <p>May I ask why are you doing this? Why simulate a POST request when you can just right there and then act on the data someway? I'm assuming of course script.php resides on your server....
Equivalence of <limits> and <climits> <ol> <li><p>Is this guaranteed to be always true:</p> <pre><code>std::numeric_limits&lt;int&gt;::max() == INT_MAX </code></pre> <p>What does C++ standard say about it? I could not find any reference in the standard that would explicitly state this, but I keep reading that those s...
<p>My copy of the C++ 2003 standard says that the <code>numeric_limits&lt;&gt;::max()</code> and <code>min()</code> templates will return values:</p> <blockquote> <p>Equivalent to <code>CHAR_MIN, SHRT_MIN, FLT_MIN, DBL_MIN,</code> etc.</p> <p>Equivalent to <code>CHAR_MAX, SHRT_MAX, FLT_MAX, DBL_MAX,</code> etc<...
advantages of .net over java in Intranet <p>Our company has an intranet with 30,000+ web pages and 160+ web applications. This is being used by 5000+ employees.</p> <p>We also have internet with 150+ Web applications and 100+ websites. Both the internet and Intranet is 7+ years and they run on classic ASP.</p> <p>Re...
<p>This is very situation dependent. In your situation, if it is as you described, the decision to go to Java was not very well thought through. You obviously have a large investment in the Microsoft stack. I don't think there is a compelling reason to drop all of your legacy code and go through all this pain just to g...
Automating Internet Explorer <p>Can anyone offer any suggestions for "something" that an end-user could use to put together macros that automate some CRM forms in Internet Explorer?</p> <ul> <li>I was originally going to suggest iMacro, but then found out<br /> (i) they only have Internet Explorer and<br /> (ii) to ma...
<p>How about <a href="http://seleniumhq.org/" rel="nofollow">Selenium</a>?</p>
Delphi ClientDataset Read-only <p>I am currently testing with:</p> <ol> <li>A SQLConnection which is pointed towards an IB database. </li> <li>A SQLDataset that has a SQLConnection field set to the one above. </li> <li>A DatasetProvider that has the SQLDataset in (2) as its Dataset field value. </li> <li>A ClientDatas...
<p>It appears that your ClientDataSet.Data property is being populated from the Data property of the DataSetProvider. With the setup you described, you should be able to simply call ClientDataSet.Open, which will get the data from the DataSetProvider.</p> <p>BTW, the default behavior of the DataSetProvider when you ca...
Equivalent to exclamation mark for method names from ruby in other languages <p>In Ruby, methods with side effects or methods that change the object passed as parameters have "!" as a postfix.</p> <p>For example:</p> <p><code>"SomeString".gsub!(/S/, "s")</code><br/> would be changing the String object, while<br/> <c...
<p>Bang methods are not intended to mean "changing the receiver".</p> <p><a href="http://www.wobblini.net/bang.txt">http://www.wobblini.net/bang.txt</a></p> <p>As you can see, Matz intended them to mean "more dangerous than the version without an exclamation mark". Just a general FYI, seeing most of the answers so fa...
Perforce as integration and build server on w2k3x64? <p>We are in the process of migrating from TFS 2005 to Perforce and moving to more Simple TDD type process for our software. Do you have any resources for setting Perforce up as an intergation and build server? </p> <p>Looked at this question <a href="http://stack...
<p>Perforce isnt a integration or build server, it simple plays the role of a source repository for the CI process. So for your CI tool (if its MSBuild, Hudson, CruiseControl etc) its important to have an adapter (a perforce adapter) to get the most recent changes from the repository. The adapter should be configurable...