input
stringlengths
51
42.3k
output
stringlengths
18
55k
Programatically converting from MS word to Excel <p>Is there anyway to problematically take a MS Word file and convert to excel. (Obviously, word would to guess where to put stuff). Any language would be fine</p>
<p>That's a pretty wide-open question. The content of the Word document will affect how easy/hard this is.</p> <p>One method you could look at is using Word automation to open the Word document and then write out a new file using comma-separated format and just name the file with a .xls extension. Upon opening this ...
Search for nearest value in an array of doubles in C++? <p>I have a sorted array of double values in C++. Is there an STL function that will return the <strong>index</strong> of the <strong>nearest</strong> value in the array to a given double value?</p> <p>For example, given the following array</p> <pre><code>doubl...
<p>maybe <code>std::lower_bound</code> <code>std::upper_bound</code> will help you.</p>
Fast pixel plotting using SWT? <p>I'm looking for a fast and easy way to plot arbitrarily colored pixels in an SWT Canvas. So far I'm using something like that:</p> <pre><code>// initialization: GC gc = new GC(canvas); // inside the drawing loop: Color cc = new Color(display, r, g, b); gc.setForeground(cc); gc.drawPo...
<p>I bet that what is killing performance is allocating and releasing 90,000 <code>Color</code> objects. Remember, in SWT, each <code>Color</code> object allocates native resources, which is why you have to <code>dispose()</code> it. This means each time you allocate and dispose a <code>Color</code> object, you have ...
Escaping HTML in Rails <p>What is the recommended way to escape HTML to prevent XSS vulnerabilities in Rails apps?</p> <p>Should you allow the user to put any text into the database but escape it when displaying it? Should you add before_save filters to escape the input?</p>
<p>There are three basic approaches to this problem.</p> <ol> <li>use <code>h()</code> in your views. The downside here is that if you forget, you get pwnd.</li> <li>Use a plugin that escapes content when it is saved. My plugin <a href="http://github.com/look/xss%5Fterminate/tree/master">xss_terminate</a> does this. T...
Where are all the places that VBA macros for Excel 2007 can be turned off? <p>Macros refuse to run for me in Excel 2007 on Windows Server 2003. The macro and visual basic icons on the ribbon are grayed out. If I open a workbook with a macro, I get the warning: " This workbook has lost its VBA project, ActiveX controls ...
<p>Are you sure there isn't a system policy in place that inhibits VBA?</p> <p>Edit: Some reading, if you've not already seen these:</p> <p><a href="http://support.microsoft.com/kb/282847/en-us" rel="nofollow">http://support.microsoft.com/kb/282847/en-us</a></p> <p><a href="http://support.microsoft.com/kb/287567" re...
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error <p>I have created a text area that allows users to enter html code. When I attempt to post this code back to the server, I get a popup window that says "Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occured while processing th...
<p>It's a very generic error seemingly caused by any number of things unfortunately, from app recycling, corrupted cookies, RoleManager, anything..</p> <p>For reference:</p> <ul> <li><a href="http://forums.asp.net/p/1046935/1576341.aspx#1576341" rel="nofollow">http://forums.asp.net/p/1046935/1576341.aspx#1576341</a><...
Change selected and unfocused Listbox style to not be grayed out <p>I have a really simple WPF ListBox with SelectionMode set to Multiple.</p> <pre><code>&lt;ListBox SelectionMode="Multiple" /&gt; </code></pre> <p>When the ListBox loses focus it's really hard to tell what's been selected because the selection colour ...
<p>I have done something like this using the following in a merged ResourceDictionary, it may help you:</p> <pre><code>&lt;Style TargetType="ListBoxItem"&gt; &lt;Style.Resources&gt; &lt;!--SelectedItem with focus--&gt; &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Lig...
What is the best way to programatically convert a word document with a table structure to XML <p>So, I have this word document that has a whole bunch of tables some of which are pretty long. It spans many many pages in some cases. I need to programmatically convert this thing to XML. </p> <p>I was initially told we...
<p>You should realize that there is no such thing as a MS Word document. There are numerous formats and some early format are not deserving of the name, but are better described as memory dumps of hacky compressed text. You're not really in need of XML, that is a later concern. You have to take control of the data in ...
applet fails to load class from jar <p>Some users are complaining that the applet no longer works, When they view the java console they are greeted with a java.lang.noClassDefFoundError and checking my access log's I see they have downloaded the jar file that contains the class, and then issue a get request for the par...
<p>The jar is getting corrupted in transit, We are looking at getting patches from oracle/bea for the server.</p> <p>It appears that if a connection is too slow (Modem speeds) that weblogic will signal the end of a transfer by sending a packet with len=0.</p> <p>The network will signal java saying the download comple...
Catching when user selects an item from a CComboBox <p>This is as basic as it gets.</p> <p>I want to catch when the user selects an item from a CComboBox (actually, a subclass of CComboBox).</p> <p>Tried lots of combinations of OnCblSelChange, OnCommand. Guess I haven't hit the right combo yet (no pun intended). </p>...
<p>Unfortunately, it seems that all messages (even <code>SELEND_OK</code>) for combo box changing are sent <em>before</em> the text has actually changed, so DoDataExchange will give you the previous text in the CComboBox. I have used the following method, <a href="http://msdn.microsoft.com/en-us/library/12h9x0ch%28VS.8...
What is the simplest way to lock an object in Django <p>I want to raise error when a user tries to delete an object when some other users are active in update_object view. I feel some sort of mutex-like locking mechanism is needed for that. Do you have any suggestions?</p>
<p>So, there are a handful of ways to do what you're asking. But a good number of them are not going to be implementation independent: you could use locks or rlocks, but they will really only work on 100% threaded servers and probably not at all in a fork/pre-fork implementation.</p> <p>That more or less means the lo...
Gracefully handle validation errors in a XML file in C# <p>The description is bit on the longer side please bear with me. I would like to process and validate a huge XML file and log the node which triggered the validation error and continue with processing the next node. A simplified version of the XML file is shown ...
<p>See this question:<br /> <a href="http://stackoverflow.com/questions/32505/xml-parser-validation-report">http://stackoverflow.com/questions/32505/xml-parser-validation-report</a></p> <p>You need to distinguish between <em>well-formed</em> xml (it follows the rules required to be real xml) and <em>valid</em> xml (fo...
Inundated with marketing tracking pixels (Campaigns with multiple vendors)! <p>We have some third parties that are sending us traffic and have asked us to put a tracking pixel on the confirmation page so they can track through the sales.</p> <p>We are currently using Google analytics for our own usage.</p> <p>Google ...
<p>Here's how I solved the problem at our company: we gave our partners a URL that has a parameter in the query string. This parameter triggers a cookie. On the "goal"/confirmation page (where the tracking pixel is usually inserted), we insert some logic to see if the cookie value is correlated with a one of our recogn...
What would be a good way to add a help system to Silverlight applications? <p>What would be a good way to integrate a help system into Silverlight applications? The original manual is written in MS Word, so I will need some means to transfer it to whatever format you suggest. Also if your answer is HTML can you explain...
<p>I've written some code to convert Word documents to XAML to aid in the process: <a href="http://www.codeplex.com/Word2007ToXaml" rel="nofollow">Word 2007 XAML Generator</a></p> <p>Michael</p>
Problems with DataGridTemplateColumn with ComboBox <p>I have a DataGrid template column with ComboBox. When I select a value and press enter the bound data is not updated (I see empty cell).</p> <p>XAML:</p> <pre><code>&lt;Window x:Class="WpfGrid2.Window2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/present...
<p>I don't know if this is a feasible solution to your problem, but if you change the ItemsSource binding of the Combo-Box to a StaticResource, the binding works. </p> <pre><code>... &lt;ComboBox ItemsSource="{StaticResource knownLastNames}" ... /&gt; ... </code></pre> <p>I am pretty sure that what is happening is...
Universal Comment Identifier for .NET <p>What is the most prohibitive aspect of having a universal comment identifier for all .net languages?</p> <p>For example, in each language the symbol "??" would identify a comment. (I'm not saying that it <em>should</em> be "??"... just an example.)</p>
<p>In C#, the '??' operator denotes null coalescence. Repurposing this for comments would render a large amount of code non-operational.</p> <p>I know you said it's just an example, but this is the problem you're facing - finding a single token that isn't used in any .NET language. I don't think it's a practical goal....
Why should I implement ICloneable in c#? <p>Can you explain to me why I should inherit from <code>ICloneable</code> and implement the <code>Clone()</code> method?</p> <p>If I want to do a deep copy, can't I just implement my method? Let's say <code>MyClone()</code>?</p> <p>Why should I inherit from <code>ICloneable</...
<p>You shouldn't. Microsoft recommends against implementing <code>ICloneable</code> because there's no clear indication from the interface whether your <code>Clone</code> method performs a "deep" or "shallow" clone.</p> <p>See <a href="http://blogs.msdn.com/brada/archive/2003/04/09/49935.aspx">this blog post from Brad...
std::map design: why map accept comparator as template parameter <p>Map type from STL have next type: </p> <pre><code>std::map&lt; Key, Data, Compare, Alloc &gt; </code></pre> <p>As one of template parameters we could pass <code>Compare</code> predicate, why map accept this predicate as template parameter and not as...
<p>The template argument is the <em>type</em> of the predicate, not the value. The value <em>can</em> be provided as an argument to the constructor. You can specify any value that matches the type. As given, the default type is <code>std::less&lt;Key&gt;</code>, which pretty much only has one value, but you should be a...
If you break long code lines, how do you indent the stuff on the next line? <p>Sometimes you have to write in your source long lines, that are better to break. How do you indent the stuff ceated by this.</p> <p>You can indent it the same:</p> <pre><code>very long statement; other statement; </code></pre> <p>That mak...
<p>I like braces on their own line because I fine it easier to see the condition and inner block all as one item (if you know what I mean):</p> <pre><code>if ((long test 1) &amp;&amp; (long test 2) &amp;&amp; (long test 3)) { code executed if true; } </code></pre> <p>and I like starting additional condit...
What's the best way to tell if a Python program has anything to read from stdin? <p>I want a program to do one thing if executed like this:</p> <pre><code>cat something | my_program.py </code></pre> <p>and do another thing if run like this</p> <pre><code>my_program.py </code></pre> <p>But if I read from stdin, then...
<p>If you want to detect if someone is piping data into your program, or running it interactively you can use isatty to see if stdin is a terminal:</p> <pre><code>$ python -c 'import sys; print sys.stdin.isatty()' True $ echo | python -c 'import sys; print sys.stdin.isatty()' False </code></pre>
What do + and * mean in regex? <p>I got an answer to my question here: <a href="http://stackoverflow.com/questions/699253/how-to-find-out-if-file-is-tab-or-space-delimited-in-perl/699256#699256">http://stackoverflow.com/questions/699253/how-to-find-out-if-file-is-tab-or-space-delimited-in-perl/699256#699256</a></p> <p...
<pre><code>Regex: /^(\d+\s+)+?$/ Parts: 1 2 3 456 </code></pre> <ol> <li>Match from the start of a line</li> <li>Find one or more numbers</li> <li>Followed by one or more spaces (or tabs)</li> <li>Find one or more of <strong>2</strong> and <strong>3</strong></li> <li>But don't be greedy in that match (that is, sto...
Make UserControl remove itself <p>Does anyone see anything wrong with this:</p> <pre><code>this.Controls.Remove(this); </code></pre> <p><code>this</code> is a class which extends user control. When I step through this section of code it looks like everything is fine, however nothing happens to the form. I would exp...
<p>As mentioned, you're removing the control from itself...that's not likely what you want. I assume you want to remove the control from it's <em>parent</em> - so you probably want <code>this.Parent.Controls.Remove(this);</code>.</p> <p>Luckily, since you didn't mention platform, the code is the same for <a href="http...
Lucene analyzer and dots <p>Am newbie to Lucene.</p> <p>Is there any way I can make Lucene analyzer not ignore dots in the string?? for example,if my search criteria is: "A.B.C.D",Lucene should give me only those documents in the search results which have "A.B.C.D" and not "ABCD"....</p>
<p>It's all about the analyzer you use. The <a href="http://lucene.apache.org/core/old_versioned_docs/versions/3_0_2/api/core/org/apache/lucene/analysis/standard/StandardAnalyzer.html" rel="nofollow"><code>StandardAnalyzer</code></a> does <a href="http://stackoverflow.com/questions/660298/multifieldqueryparser-is-remov...
Is it possible to create a class that represents another type in Python, when directly referenced? <p>So if I have a class like:</p> <pre><code>CustomVal </code></pre> <p>I want to be able to represent a literal value, so like setting it in the constructor:</p> <pre><code>val = CustomVal ( 5 ) val.SomeDefaultIntMet...
<p>The usual way to wrap an object in Python is to override <code>__getattr__</code> in your class:</p> <pre><code>class CustomVal(object): def __init__(self, value): self.value = value def __getattr__(self, attr): return getattr(self.value, attr) </code></pre> <p>So then you can do</p> <pre...
navigating through different drive letters in python os.system <p>I am having a problem with a bit of code on one windows machine but not all windows machines. i have the following code:</p> <pre><code>path = "F:/dir/" os.system(path[0:2] + " &amp;&amp; cd " + path + " &amp;&amp; git init") </code></pre> <p>On all bu...
<p><a href="http://docs.python.org/library/os.path.html" rel="nofollow">os.path</a> contains many usefull path manipulation functions. Probably just handling the path cleanly will resolve your problem.</p> <pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; &gt;&gt;&gt; &gt;&gt;&gt; path = "F:/dir/" &gt;&gt;&gt; &gt;&gt;&...
Inserting with asp:ListView inside asp:FormView <p>I have a asp:listview which uses the SelectedValue of the FormView.</p> <p>I have editing working with the listview fine, and insert will insert a record but it doesnt insert the SelectedValue of the parent FormView...</p> <p>What am I missing?</p>
<p>I added this</p> <pre><code> protected void ProposalAddressListView_ItemInserting(object sender, ListViewInsertEventArgs e) { e.Values[" My FormView Selected Value "] = MyFormView.DataKey.Value; } </code></pre> <p><strong>Update:</strong> Just found similar question, <a href="http://stackoverflow...
Python: Testing for unicode, and converting to time() <p>Sometimes self.start is unicode:</p> <p>eg.</p> <pre><code>&gt;&gt;&gt;self.start u'07:30:00' </code></pre> <p>Which makes datetime.combine complain</p> <pre><code>start = datetime.combine(self.job_record.date, self.start) </code></pre> <p>How does one:</p> ...
<p>Checking for unicode:</p> <pre><code>&gt;&gt;&gt; import types &gt;&gt;&gt; type(u'07:30:00') is types.UnicodeType True &gt;&gt;&gt; type('regular string') is types.UnicodeType False </code></pre> <p>Converting strings to time:</p> <pre><code>&gt;&gt;&gt; import time &gt;&gt;&gt; time.strptime(u'07:30:00', '%H:%M...
C# AssemblyFileVersion usage within a program <p>I'm working on a program, and I'm trying to display the assembly <em>FILE</em> version </p> <pre><code> public static string Version { get { Assembly asm = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionI...
<p>Use ProductMajorPart/ProductMinorPart instead of FileMajorPart/FileMinorPart :</p> <pre><code> public static string Version { get { Assembly asm = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location); return St...
Adding to built-in ExcludeFromBuild ItemGroup with Web Deployment project <p>I've added a Web Deployment Project to my solution to create a clean deployment of my web application. This works mostly as expected... i.e. builds the source &amp; then copies the files to be deployed to a /Release folder (and excludes things...
<p>Well for anyone who comes looking, I thought I should answer my own question... I didn't find the exact solution I was looking for, so I just added everything I needed excluded manually to the ExcludeFromBuild ItemGroup (to mimic what the default options seemed to do &amp; then also exclude my specific file). My Exc...
Bind GridView via jQuery ajax <p>I am new to jQuery, trying to populate a GridView or Telerik RadGrid using jQuery. Not sure how to go about it and unable to find any examples. Any help is appreciated. Thanks.</p> <p>Essentially I am trying to display a modal window with a textbox and button. The user enters a search ...
<p>A couple of thoughts here. You cannot populate a GridView or Telerik Grid using jQuery. jQuery is a client side technology and those two grids are server side. </p> <p>You can use jQuery to hit a web service and build out and HTML table with the results (which is basically what a GridView does). </p> <p>I'm g...
How do I time a Cocoa app? <p>What is an easy way to time a Cocoa application? (Alternatively, any good way to measure performance would suffice).</p> <p>(I have two different frameworks and would like to compare their performances over some fixed input data)</p>
<p>Instruments will keep a clock for you, although you may find that the frameworks' difference is within the margin of how quickly you can start the app working on the data.</p> <p>You can use Shark and the CHUD framework to do a better job of this. The framework lets you programmatically start and stop profiling; yo...
Best way to store configuration settings for T4 <p>I need to create some files using Visual Studio T4 (templating). What is the best way to import some configuration settings into multiple .tt files and have it accessible in the templating code portion.</p>
<p>The simplest way to store configuration is by placing it as code in a shared .tt file, which you can include from multiple templates (i.e. if you need a connection string, make it a constant in a class feature block). However, if that is not an option and you need to access settings in .config file, I agree with Joh...
DIV with Image and Text <p>I want to create a DIV with a header of 6px height and inside the div body, I want to align an Image and Text next to each other. The height of the DIV body should be fixed.</p>
<p>Here's a very simple example of how to do what you want (using inline styles):</p> <pre><code>&lt;div&gt; &lt;div style="height:6px;width:500px;background-color:#3399CC;"&gt;&lt;/div&gt; &lt;div style="clear:both"/&gt; &lt;div style="float:left"&gt;&lt;img src="http://www.google.com/intl/en_ALL/images/logo.gi...
Java Socket Programming <h2>Java Socket Program did not work for WAN</h2> <p>I have written a TCP IP socket program which works fine in my LAN. One of my friend is at bangalore He ran the server and I ran the client with the host name of my friend's IP. In this case my socket program did not work.</p>
<p>You said that your program is attempting to connect to host 192.168.1.107 port 46216.</p> <p>192 prefix specifies it is a class C address and is private. Making your program connect to that will force it to remain on the local network searching for that node. You will need to find the IP address of your router (you...
Zend Framework - Static form elements <p>I have got a form which a user can use to create a new store and to edit an existing one. When this form is being used to edit a store there are certain fields that I want the user to see but not edit eg. store_id. I have explored the different Zend_Form_Elements hoping to find ...
<p><code>readonly</code> alone is not enough, because users will still be able to edit it if they really want. You should use <code>$element-&gt;setIgnore(true)</code> that will ensure that <code>Zend_Form_Element</code> won't try to populate the element from POST/GET, and I'd double check that also. You have to make s...
How to disable tabbing in a tab panel in gwt <p>I have a tab panel in the gwt. I want allow the user to select the tab only by mouse. For this one I have disable the tabindex for all the tab in my tabpanle. I tried with this code:</p> <pre><code>DOM.setElementAttribute(cdrMeseTabPanel.getElement(), "tabIndex", "-1" );...
<p>Try setting the tabIndex to an empty property:</p> <pre><code>DOM.setElementAttribute(cdrMeseTabPanel.getElement(), "tabIndex", "" ); </code></pre>
How do I add an object with the entity framework when it has a foreign key object that already exists <p>I have 2 tables:</p> <pre><code>tblAuthors - id - username tblPosts - id - authorid </code></pre> <p>So if I create a new Post</p> <pre><code>var post = new Post { Id=Guid.NewId(), Author=new Author { UserNa...
<p>Shouldn't you first retrieve the Author record from the database to be able to set it in the Post object?</p> <p>So you would you get:</p> <pre><code>var author = Author.Select(a =&gt; a.Id).FirstOrDefault(); var post = new Post { Id=Guid.NewId(), Author=author }; entities.AddToPosts(obj); </code></pre> <p>Maybe ...
Is there a Python library to interact with Genesys? <p>I work within a contact center and we use Genesys with an Alcatel PBX. We currently use .NET libraries to wrap the DLL's provided to us, but I'm wondering if there are any Python libraries out there before I attempt to write my own?</p> <p>Thanks</p> <p>Edit:</p>...
<p>If they are providing a C library, you can use ctypes to interact with it.</p>
java tcp ip socket programming regardless of proxy type <p>How to write TCP IP socket programming in java. If the client is behind any type of proxy (may be http or socks or no proxy).</p> <p>Thanks Bapi</p>
<p>When I faced such kind of problem I had to code myself http layer (over HTTP CONNECT) and used existing (in standard library) socks layer. However the main problem is to get the proxy settings. As far as I was doing it for a Web Start application, I could use default browser settings.</p>
Subtraction without minus sign <p>How can i do subtraction of integers in C without using either the unary or binary '-' operator?</p> <p>Or can we do the same for other data types like float/double?</p>
<p>have a look at the <a href="http://en.wikipedia.org/wiki/Two%27s%5Fcomplement">two's complement</a></p>
Database deploy (vsdbcmd.exe): DatabaseName and DefaultDataPath are ignored? <p>Visual Studio database edition comes with a tool, vsdbcmd.exe, that should allow someone to deploy a .dbschema file (which is generated by the database project on build) to a database. It does this by first building the script, then executi...
<p>This can be (is) caused when doing a <em>Database Schema Synchronization -> Database Project</em>. (My environment is VS2010 Enterprise RTM).</p> <p>The generated ALTER DATABASE statements are generated to mirror the <em>source</em> database without taking any substitution values into account (it will also include ...
Control access to WebDav/Apache using Python <p>I want to give users access to WebDav using Apache, but I want to autenticate them first and give each user access to a specific folder. All authentication must be done against a Django-based database. I can get the Django-authentication working myself, but I need help wi...
<p>First, for you other readers, my authentication was done against Django using a <a href="http://www.davidfischer.name/2009/10/django-authentication-and-mod_wsgi/" rel="nofollow">WSGI authentication script</a>.</p> <p>Then, there's the meat of the question, giving each Django user, in this case, their own WebDav dir...
Is it possible to move components around the screen using the standard android apis? <p>I would like to produce an <code>android</code> user interface which allows the user to move added <code>components</code>/<code>widgets</code> around the screen by selecting them and then dragging them around.</p> <p>Is this possi...
<p>Yes. It depends what you are trying to achieve.</p> <p>It can be done <em>using</em> the standard APIs, but this functionality is not <em>part of</em> the standard APIs. That is, there is no <code>widget.DragOverHere()</code> method unless you write one.</p> <p>That said, it would not be terribly complicated to do...
How can I write a program which can test throughput of disk? <p>How can I write a program which can test throughput of disk in Windows systems using c++?</p> <p>What's the mainly steps and APIs that I can use to programming?</p>
<p>In outline:</p> <ul> <li>write a known (large) amount of data to disk ( see write() )</li> <li>start clock (see time() or clock() )</li> <li>read data from disk (see read() )</li> <li>stop clock (see above)</li> <li>report results (see cout)</li> </ul>
Image field on ReportViewer <p>Anybody tried to display image field (image/byte array) data type on reportviewer.</p> <p>Regards, Peter</p>
<p>Yes. ReportViewer requires a Base64 Image encoding in order to display the image properly.</p> <p>If your image is in a Byte array, it will need to be converted to Base64:</p> <pre><code> Public Function ConvertImageToBase64String(ByVal img As Image) As String Dim output As String = "" Dim outputArray() ...
VS: Automatic "ArgumentNull' check? <p>It's often the case when I need to check a method's arguments for not being null, something like:</p> <pre><code>public static bool operator &lt;= (ApplicationVersion i_app1, ApplicationVersion i_app2) { if (i_app1 == null) throw new ArgumentNullException("i_app1"); ...
<p>Resharper has this feature. If you have cursor over parameter name - say i_app1 and hit Alt-Enter - it offers the option to check for null.</p>
Creating navigation links in Struts 2 <p>Is there some way to replicate rails' "link-to-unless-current"?</p> <p>Ie. if i have a list of links in my navigation, and I want to mark the current page with a different css style (or even have it be plain text, not a link)?</p> <p>Now I just made a method in my action-class...
<p>To get the current url you you can use the Url tag without any params, actions, etc:</p> <pre><code>&lt;s:url var="currenturl" includeParams="get" escapeAmp="false"/&gt; </code></pre> <p>Then assuming you construct your navigation Url something like:</p> <pre><code>&lt;s:url var="url" action="someAction" escapeAm...
Database Replication MSSQL 2000 to 2005 <p>I am trying to replicate a database from SQL server 2000 to 2005 they are located on two different servers both running Windows Server 2003 R2. Im am using SERVER1(SQL2000) as the Transactional publisher and distributor and SERVER2(SQL2005) is the subscriber. I can set up the ...
<p>0x5 means "access denied" and that you're not allowed to query active directory user information. Likely, the sql server service account does not have proper domain privileges to perform look ups in AD. This could be caused by an account password simply being expired and therefore not enabling SQL to validate agains...
How can I import only a couple of functions from a Ruby module? <p>Suppose I have a module with the methods : function1,function2,function3. I want to import function1 and function2 but not function3. Is there a way to do this in ruby?</p>
<p>Not sure if there is a clean way to just add the methods you want, but you can remove the methods that you don't want by using <code>undef_method</code>.</p> <pre><code>module Foo def function1 end def function2 end def function3 end end module MiniFoo include Foo not_wanted_methods = Foo.instanc...
ASP.net weekly schedule control <p>Can anyone recommend a free asp.net control that I can use for the following:</p> <ul> <li>Weekdays Monday-Saturday along the top row</li> <li>Time of day along left hand side</li> <li>Template fields for the actual data</li> <li>Databindable</li> <li>Cells span the rows based on the...
<p><a href="http://www.daypilot.org/">DayPilot</a> is a pretty good general purpose calendaring/schedule control.</p> <p>The full version is not free, but there is a "lite" version available which is not only free but open source!</p>
NHibernate Error reporting advice <p>This is not so much a problem as advice on best practice really. I am writing an ASP.Net MVC application, and in my DAL i am using NHibernate, but what do you do if an exception is thrown in your DAL?</p> <p>Do you catch the exception in the DAL, log the error and then re-throw the...
<p>This is exactly one of those 'it depends' questions. This is what I do:</p> <ul> <li>Handle all exceptions in Application_Error (or similar sink-like location)</li> <li>If the exception is base for business logic - say cannot have duplicates, just catch it and act upon it.</li> <li>If it is an infrastructure except...
using mouseover/mouseout in gridview with alternating rows <p>I currently have a gridview with alternating colors, Silver and White, with a blue header (not selectable, obviously). Initially, I had this onmouseover/onmouseout thing working but for some reason, yesterday morning it failed to work, and all day yesterday...
<p>First of all you can solve this problem with some CSS (not supported in IE6):</p> <pre><code> tbody tr:hover td { background-color: orange; } </code></pre> <p>If I were to use JavaScript I would use an <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript" rel="nofollow">unobtrusive technique</a>. Then yo...
eclipse indexer problem with cmake project <p>I've created the eclipse project with cmake. I use vtk with qt. Dir structure is as follows:</p> <pre><code>parent_dir: source - source.h, source.cpp build - this is where the .project resides </code></pre> <p>I've fired up the eclipse with workspace dir <em>/path...
<p>According to the Wiki, you should have your build tree outside the source tree.</p> <blockquote> <p>This linked resource isn't created if the build directory is a subdirectory of the source directory because Eclipse doesn't allow to load projects which have linked resources pointing to a parent director...
Using google analytics to track multiple companies in a single website <p>I've been tasked with implementing Google Analytics inside our (ASP.NET) application. Here is the scenario:</p> <ol> <li>A single web-site on one domain</li> <li>Multiple companies all use this single website</li> <li>Statistics need to be colle...
<p>Virtual addresses work fine with Google Analytics. You will see the content page there giving you a list like</p> <p>/companyA/welcome.aspx<br /> /companyA/aboutus.aspx<br /> /companyC/orderstatus.aspx<br /> /companyB/welcome.aspx<br /> /companyA/confirmorder.aspx<br /> /companyC/welcome.aspx </p> <p>You can then...
Union two or more tables, when you don't know the number of tables you are merging <p>I am working with MS SQL 2005. I have defined a tree structure as:</p> <pre><code>1 |\ 2 3 /|\ 4 5 6 </code></pre> <p>I have made a SQL-function Subs(id), that gets the id, and returns the subtree table. So, Subs(3) will ret...
<p>I do not think you need UNION here, with SQL Server 2005 you can achieve the desired result using CROSS APPLY:</p> <pre><code>select f.* from resultsTable rt cross apply dbo.subs(rt.ID) f </code></pre> <p>That is assuming that the resultTable is the one that stores the results of your first query, a...
variable database name <p>Is there any way in MySQL to put the name of the database into a variable? For example, when I have a database called 'db1', can I do something like this:</p> <pre><code>set @db= 'db1'; select * from @db.mytable; </code></pre> <p>EDIT: There is another example of what I want to do:</p> <pre...
<p>With considerable effort, yes.</p> <pre><code>SET @db = 'db1'; SET @q = CONCAT('SELECT * FROM ', @db, '.mycol'); PREPARE stmt FROM @q; EXECUTE stmt; DEALLOCATE PREPARE stmt; </code></pre>
What's the significance of Oct 12 1999? <p>In the SignOut method of <a href="http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.aspx">System.Web.Security.FormsAuthentication</a>, the ASP.NET team chose to expire the FormsAuth cookie by setting the expiration date to "Oct 12 1999".</p> <pre...
<p>Elementary my dear Watson:</p> <ul> <li>Oct 12 1999 is exactly 80 days before 1-1 2000. </li> <li>For some people the year 2000 was the end of the world</li> <li>As we know, <a href="http://en.wikipedia.org/wiki/Around%5Fthe%5FWorld%5Fin%5FEighty%5FDays">it takes 80 days to go around the world</a>.</li> <li>So oct ...
Is it OK to return a const reference to a private member? <p>I need to implement read-only access to a private member container. If I return a constant reference is it possible to const_cast it and obtain a full access to the member? What's the technique to be used?</p> <p>Thanks.</p>
<h2>Is it safe to return a const reference to a private member</h2> <p>Yes as long as the lifetime of the reference does not exceed the lifetime of the object which returned it. If you must expose the private member you do not want modified, this is a good way to do so. It's not foolproof but it's one of the better ...
Which is the best managed .NET e-mail component with support for S/MIME? <p>I need a replacement for <code>System.Net.Mail.MailMessage</code> that is able to send signed and/or encrypted e-mails. </p> <p>Is there an open source library covering that? </p> <p>Or do you have some experiences with some of those:</p> <u...
<p>It seems like you <em>can</em> in fact send S/MIME encrypted emails using the BCL of .NET. It requires a bit of a hack (not too bad however), but you could wrap the solution easy enough... See <a href="http://social.microsoft.com/Forums/en-US/netfxnetcom/thread/74e4711e-1f66-43a7-9e3b-bc9cfbcd1b73/" rel="nofollow">t...
Roles for white-label service access <p>Okay,</p> <p>I know I'm doing something wrong - but can't figure out a better way. I am developing a website which is going to allow users to setup their own mini-websites.</p> <p>Something like Ning. Also, I have only 1 basic login and access to each mini website is provided (...
<p>I afraid standard roles-related stuff of ASP.NET is not what you need. You can try to change authentication module so it will:</p> <ol> <li>Log you in with cookie.</li> <li>Determine what roles does your visitor have. Perhaps you will use some special table that corresponds user and site.</li> <li>Make custom princ...
Is there an un-buffered I/O in Windows system? <p>I want to find low-level C/C++ APIs, equivalent with "write" in linux systems, that don't have a buffer. Is there one? </p> <p>The buffered I/O such as fread, fwrite are not what I wanted.</p>
<p>Look at <a href="http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx">CreateFile</a> with the FILE_FLAG_NO_BUFFERING option</p>
Are there any strategies to avoid satisficing? <blockquote> <p><strong>Satisficing</strong> (a portmanteau of "satisfy" and "suffice") is a decision-making strategy which attempts to meet criteria for adequacy, rather than to identify an optimal solution. A satisficing strategy may often be (near) optimal if the cost...
<p>I would normally have two problems with putting a problem aside for a week: a) my boss probably wouldn't go for it because the business will usually need a solution sooner as opposed to later, and b) I have the attention span of a gold fish, so if I drop a problem for that long, I will have to take time to walk thro...
ExternalInterface.call() not getting return value <p>I have a Javascript function that returns the innerHTML of a div. I am attempting to call this function from Actionscript and store the return value. I know that the Javascript function is being called because there is an alert that displays the return data, The d...
<p><a href="http://osmanu.com/flex/EITest/EITest.html" rel="nofollow">This is a working sample</a> based on the code you provided. You can right click it to view the source. I suspect the problem lies in the HTML for 'myDiv' or when you are making the actionscript call.</p>
Get unique identifier of a Thread in Java 1.4 <p>In Java 1.4, is there any better way of getting a Thread's ID than using <code>Thread.getName()</code>?</p> <p>I mean, <code>getName()</code> in unit tests returns something like <code>"Thread-1"</code>, but in WebLogic 10 I get <code>"[ACTIVE] ExecuteThread: '1' for qu...
<p><a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#getId%28%29">Thread.getId</a> (it can theoretically <a href="http://stackoverflow.com/questions/591627/thread-getid-global-uniqueness-question">overflow</a>, but it is defined not to and in practice will not).</p> <p>1.5 is going through its End o...
How do I rename a filename after uploading with php? <p>How do I rename the file either before or after it gets uploaded? I just want to rename the filename, not the extension.</p> <pre><code>$changeTXT = $_SESSION['username']; $uploaderName = strtolower($changeTXT); $changeTXT = strtolower($changeTXT); $changeTXT = u...
<p>When using <code>move_uploaded_file</code> you get to pick the filename, so you can pick anything you want.</p> <p>When you upload the file, its put into a temporary directory with a temporary name, <code>move_uploaded_file()</code> allows you to move that file and in that you need to set the name of the file as we...
How to implement REST in a web application? <p>I want to know how I could implement REST in my web application. I want to create a web application based on this service, but I don't know how to do it. Now, i'm using J2EE and Tomcat. What things should be considered for these technologies?</p> <p><strong>EDIT:</strong>...
<p>REST is not specific interface or technology, but a style. The best example is the web itself - your browser sends an HTTP request to a web server, which responds with a web page.</p> <p>Representational State Transfer in this context: The representation is the web page, the state is the information contained in it...
SQL Server Agent Job for the first 4 days of Month <p>I was wondering if anyone knew how to create a job that will run the first 4 days of the month in SQL Server 2000? I found how to run a job once on the first or second day, but the only way I figured I could run each of the four days would be to create a job for eac...
<p>Instead of creating 4 jobs, you can create one job with 4 schedules.</p> <p>Fire up enterprise manager, create your job as you normally would and on the schedules tab of the Job properties add 4 schedules, one for each day of the month you'd like the job to run.</p>
Launching Ruby without the prefix "Ruby" <p>I'm on OS X (with bash) and a newbie at unix. I want to know if it's possible to amend some file such that to run a ruby program, I don't need "ruby file.rb", but instead can just run "ruby.rb".</p> <p>Is there a reason NOT to do this?</p> <p>Thanks!</p>
<p>Yes you can do this.</p> <p>Assuming <code>ruby.rb</code> has something like this in it:</p> <pre><code>#!/usr/bin/env ruby puts 'Hello world' </code></pre> <p>At the command line: <code>chmod +x ruby.rb</code></p> <p>This makes it executable.</p> <p>Then you can execute it like this:</p> <pre><code>./ruby.rb ...
Assertion in VS2008 but not in VS2005 <p>After switching from VS2005 to VS2008 SP1, I found an issue that I can't explain.<br /> A program works fine under VS2005 in both release and debug mode. Under VS2008, when entering the debugger an assert is raised.<br /> If I let the program run (in debug or release mode), no a...
<pre><code>// Note: if either of the above asserts fire and you are // writing a multithreaded application, it is likely that // you have passed a C++ object from one thread to another // and have used that object in a way that was not intended. // (only simple inline wrapper functions should be used) // // In general,...
Header <h2> floating to be below the next UL list <p>I have a multiple unordered lists, with a h2 titling each list by subject.</p> <p>Here is the html</p> <pre><code>&lt;h2&gt;Early Childhood Education&lt;/h2&gt; &lt;ul class="course-list"&gt; &lt;li&gt;&lt;a href="/academics/courses/child_growth_and_develop...
<p>You might wrap each h2/ul pair in a div. This is even good for semantics, since the two are related and therefore could be said to be part of a logical division. Then you can float the whole div and keep the elements grouped.</p>
What would this sql query (w count and group by) look like when translated to linq? <p>How would the following sql query look when translated to linq?</p> <pre><code>SELECT myId, Count(myId) FROM MyTable GROUP BY myId </code></pre> <p>I've tried the following:</p> <pre><code>var q = from a in db.MyTable group ...
<p>Try this:</p> <pre><code>var q = from a in db.MyTable group a by a.Id into g select new { Id=g.Key, Count=g.Count() }; </code></pre> <p>That's nearly the same as yours, but your <code>Count</code> is obtained in a different way which looks wrong to me.</p> <p>If LLBLGen doesn't understand <code>IG...
Jquery Hidden Field in Table <p>I was wondering if anyone knew of a way to access a hidden field (by client id) within a table row using jquery.</p> <pre><code>$("#tblOne").find("tr").click(function() { var worker = $(this).find(":input").val(); }); </code></pre> <p>I find that the above works for...
<p>I normally use a positive lookup to match the id, this method avoids requiring the client id</p> <p>(id contains foo) $(this).find("input[id*='foo']").val(); </p>
Concatenate collection of XML tags to string with LINQ <p>I'm stuck with using a web service I have no control over and am trying to parse the XML returned by that service into a standard object.</p> <p>A portion of the XML structure looks like this</p> <pre><code>&lt;NO&gt; &lt;L&gt;Some text here &lt;/L&gt; &...
<p>LINQ to XML is indeed the way here:</p> <pre><code>var textArray = topElement.Elements("L") .Select(x =&gt; x.Value) .ToArray(); var text = string.Join(" ", textArray); </code></pre> <p>EDIT: Based on the comment, it looks like you just need a single-expression ...
SQL Server 2005: How to automatically include database name and brackets in queries <p>Good day,</p> <p>In SQL Server 2005, when I write a new query, I like to drap and drop table and column names from the object explorer. However, when I drag and drop a table, is there a way to automatically include the database name...
<p>Sorry, not from drag and drop from object explorer.</p> <p>One of the tools suggested in this question may help:</p> <p><a href="http://stackoverflow.com/questions/686394/686416">Need a tool to automatically indent and format SQL Server stored procedures</a></p>
NHibernate unexpected ORDER BY Statement <p>I am using NHibernate 2.0, and when I submit a request asking for the top 2 records to be returned, I get a number of ORDER BY clauses in my SQL. When I take out the Max results, the query looks fine (no ORDER BY statements). Why is NHibernate automatically adding this whe...
<p>It's the way that paging is implemented. So there's no special case for just taking the top n elements, because for example Oracle does not support this construct.</p> <p>So anything that has either of the paging limits set is done this way.</p> <p>Are you getting the correct results?</p>
How can I allow my user to insert HTML code, without risks? (not only technical risks) <p>I developed a web application, that permits my users to manage some aspects of a web site dynamically (yes, some kind of cms) in LAMP environment (debian, apache, php, mysql)</p> <p>Well, for example, they create a news in their ...
<p>If you are using php, an excellent solution is to use <a href="http://htmlpurifier.org/">HTMLPurifier</a>. It has many options to filter out bad stuff, and as a side effect, guarantees well formed html output. I use it to view spam which can be a hostile environment. </p>
How do I save a web page to image <p>I have a WebBrowser control and I want to save the whole page viewed to image (any web page). I tried using IHTMLElementRender interface but it didn't work for all web pages. Maybe I'm doing something wrong because sometimes the snapshot included the scrollers and sometimes it was j...
<p>There is a <a href="http://www.codeproject.com/KB/graphics/IECapture.aspx" rel="nofollow">great CodeProject article</a> that shows hows to accomplish this task using the IE engine. If you prefer to use another browser's rendering engine, this is a good place to start learning. There is also <a href="https://addons.m...
copy the symbolic link in Solaris <p>I am trying to copy a link on Solaris OS but find that it does not simply copy the link instead copies the whole contents of the directory/file the link is poinitng to? Which is not in other OSes like AIX,HP-UX,Linux.</p> <p>Is this a normal behaviour of Solaris OS?</p>
<p>Charlie was close, you want the <code>-L</code>, <code>-H</code> or <code>-P</code> flags with the <code>-R</code> flag (probably just <code>-R -P</code>). Similar flags exist for <code>chmod(1)</code> and <code>chgrp(1)</code>. I've pasted an excerpt from the man-page below.</p> <p>Example:</p> <pre><code>$ touch...
Role based or shopping cart style Java bean binding? <p>I have a POJO that I would like to expose as XML from a web service, preferably with JAX-B.</p> <p>The fields that need to be exposed in XML depend on what type of user is making the request. For instance, we have a role for HumanResources and Finance users. A Us...
<p>Why don't you just check the user's role in your server-side web service implementation?</p> <p>What is your web service interface?</p> <pre><code>public interface DarcysWebService { public HumanResourceResponse getHumanResourceData(Authentication a, HumanResourceRequest req); public FinanceResponse getFin...
iPhone: Where is the Starting Point in an View-Based Application? <p>I can't find it. Actually I look for the part where I could try this:</p> <pre><code>[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]; self.navigationController.view.bounds = CGRectMake(0,0,320,480); self.navigationController.na...
<p>The starting point would be your App delegate, the applicationDidFinishLaunching method. When you create a new application, x-code should create one of those for you.</p> <pre><code>- (void)applicationDidFinishLaunching:(UIApplication *)application { // Do your thing here. } </code></pre>
(Ruby) If the array intersection operator ( & ) is inefficient, why is it available? <p>I asked a <a href="http://stackoverflow.com/questions/699448/ruby-how-do-you-check-whether-a-range-contains-a-subset-of-another-range">question</a> yesterday about comparing ranges for overlap and its been stuck in my throat ever si...
<p><code>&amp;</code> is not a particularly inefficient method. I think you misunderstood the criticism of the accepted answer.</p> <p>Your preferred solution is inefficient because it converts the ranges to arrays. </p> <p>A range such as <code>1..10000</code> has a relatively small memory footprint - it only stores...
.Net: Nested References <p>How smart is Garbage Collection when it comes to nested references? </p> <p>Take this code for example:</p> <pre><code>Public Class SomeClass Private m_SomeOtherClass(Me) End Class </code></pre> <p>I know that GC works by looking at how many references remain, and any object without an...
<p>It's absolutely fine. The GC works from a set of roots (local and static variables, etc) and finds all the references it can. If nothing else references this mutually-referencing object, it will be eligible for collection.</p>
Sample text that will invalidate ASP.NET text input? <p>I need to do some checking on a validation control but I am not sure what type of text ASP.NET will think is a security issue. Can someone give me some things to try? I tried various HTML tags and it seemed to accept them fine. This is a multiline rich textbox use...
<p>It sounds like you are confusing Validator controls with ValidateRequest, an internal mechanism of ASP.Net for sanitizing requests.</p> <p>Validator validation is entirely dependant on your validators. Are you using a RequiredFieldValidator? Then the invalid inputs are simply blank textboxes. Is it a RegularExpre...
Django Model.object.get pre_save Function Weirdness <p>I have made a function that connects to a models 'pre_save' signal. Inside the function I am trying to check if the model instance's pk already exists in the table with:</p> <pre><code>sender.objects.get(pk=instance._get_pk_val()) </code></pre> <p>The first insta...
<p>S.Lott is correct... use <code>save()</code>, as you've already acknowledged that you have started doing.</p> <p>As for the signal question, I can honestly see nothing wrong with your code. I've even run it locally myself with success. Are you sure that you're representing it properly in the question? Or that insta...
Context help for Java API & language in NetBeans <p>Is it possible to set up context help for Java API &amp; language in NetBeans. </p> <p>For example something like pressing F1 on <code>ServletContextListener</code> (for API) or on word <code>while</code> (for language) in source code and obtain help on these words. ...
<p>Pressing Alt-F1 will bring up the javadoc in your default browser but you have to have the javadocs installed for the APIs that you're using.</p> <p>To install the Java SE javadoc for example, go to <a href="http://java.sun.com/javase/downloads/index.jsp" rel="nofollow">java.sun.com</a> and download the documentati...
Did test server port change in Rails 2.3? <p>I upgraded rails to 2.3.2 from 2.1.1 yesterday and a bunch of my tests started failing.</p> <p>When I was running under 2.1.1, the test server was running on port 3000 so I had a HOST_DOMAIN variable that included the port - HOST_DOMAIN = "localhost.tst:3000". This is so m...
<p>Test request use "test.host", which would be port 80. You can write</p> <pre><code>@request.host = 'www.example.com' @request.port = 3000 </code></pre> <p><a href="http://lists.rubyonrails.org/pipermail/rails/2006-April/030204.html" rel="nofollow">http://lists.rubyonrails.org/pipermail/rails/2006-April/030204.html...
How can I show the numeric virtual keyboard on the Blackberry Storm? <p>I'm having some difficulty showing the virtual keyboard I want for the Blackberry Storm. I have an option to toggle the keyboard's visibility on a certain screen. Whenever the user types a number, it's handled by the screen, rather than any parti...
<p>I don't think BlackBerry has exposed any APIs to allow for programmatic control over the type of virtual keyboard that is shown. I seem to remember reading about it in the BB forums (although unfortunately I can't find it now).</p> <p>One thing you could try doing is using a BasicEditField with a numeric field, bu...
Store a collection of values in a config file <p>In a .Net 3.5 (Windows) service, I would like to store a small collection of values in the config file. Basically, I need to allow admins to add and remove values from this small collection. What do I need to add to the config file to store a collection of small values...
<p>There's a good article on creating a custom configuration section handler that loads the values as a list <a href="http://www.dotneat.net/2007/10/16/StoringACollectionOnYourAppconfigUsingSectionHandlers.aspx" rel="nofollow">here</a>.</p> <p>Basically your <code>IConfigurationSectionHandler</code>'s Create method sh...
Rewriting C++ methods in C <p>How can I make equivalents to these methods in C? I read somewhere that they could be "replaced with functions that take a structure pointer as the first parameter," but I'm not sure how to do this, if that is the right thing to do.</p> <pre><code>struct SCustomKeys { struct SCustomK...
<p>Basically, instead of having a member function like:</p> <pre><code>struct SCustomKey &amp;key(int i) { return ((SCustomKey*)this)[i]; } </code></pre> <p>You will need to rewrite this as a function that takes a pointer to a SCustomKeys as it's first argument.</p> <p>The function will look like:</p> <pre><code>SC...
AS2 FLA Component with embeded classes <p>I'm trying to create an AS2 component which is easily skinnable.</p> <p>I create an FLA component by creating a mc with some assets > component definition > link it to MyClass, and drop the fla into the Components dir. If I then drag the component into a new fla and try to re...
<p>It seems to me you're trying to create a compiled clip (SWC). You can find some Adobe documentation <a href="http://livedocs.adobe.com/flash/mx2004/main%5F7%5F2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash%5FMX%5F2004&amp;file=00003108.html#1140637" rel="nofollow">here</a>, but I'd rather go for <a href="http...
SQL Query to Collapse Duplicate Values By Date Range <p>I have a table with the following structure: ID, Month, Year, Value with values for one entry per id per month, most months have the same value.</p> <p>I would like to create a view for that table that collapses the same values like this: ID, Start Month, End Mon...
<p>I'm going to develop my solution incrementally, decomposing each transformation into a view. This both helps explain what's being done, and helps in debugging and testing. It's essentially applying the principle of functional decomposition to database queries.</p> <p>I'm also going to do it without using Oracle ext...
jQuery dialog theme and style <p>How do I change the background color of the title bar of a jQuery dialog?</p> <p>I have looked at the themeroller but it does not seem to work for me.</p> <p>Thanks</p>
<p>You can change it by modifying the ui-dialog-titlebar CSS class, but I highly recommend you to use the <a href="http://jqueryui.com/themeroller/">ThemeRoller tool</a>.</p> <p>See also:</p> <ul> <li><a href="http://docs.jquery.com/UI/Dialog/Theming">UI/Dialog/Theming</a></li> <li><a href="http://docs.jquery.com/UI/...
Form Styling with SPAN text instead of input or select controls <p>I've got CSS that formats labels above form input elements and I'd like to replace the input elements with text from the database if I'm just displaying read-only data.</p> <p>No matter what I do, changing the input fields to a span or asp:label will n...
<p>I'm guessing you need to add <code>display: block</code> to the input field replacement spans.</p>
Why doesn't my site work in IE6 or IE7? <p>For some reason my site <a href="http://tom.hsc.be" rel="nofollow">http://tom.hsc.be</a> displays a "Cannot display this message" error in those browsers while working correctly in Firefox, Opera, Safari and IE8.</p> <p>It looks like this: <a href="http://www.reviewsaurus.com...
<p>It doesn't have anything to do with HTML errors. The worst that can do is show a garbled or blank page.</p> <p>There is some sort of server misconfiguration going on of WordPress and the <code>gzip</code> Content-Encoding.</p> <p><a href="http://tom.hsc.be/" rel="nofollow">http://tom.hsc.be/</a> doesn't work in IE...
sorting and paging with gridview asp.net <p>I'm trying to get a gridview to sort and page manually with no success.</p> <p>The problem is that when a user clicks the column they want to sort, it sorts that page, but doesn't sort the datasource (dataview) behind the gridview. So when they progress to a different page,...
<p>Save your sorting order in a ViewState.</p> <pre><code>private const string ASCENDING = " ASC"; private const string DESCENDING = " DESC"; public SortDirection GridViewSortDirection { get { if (ViewState["sortDirection"] == null) ViewState["sortDirection"] = SortDirection.Ascending; ...
Making a template parameter a friend? <p>Example:</p> <pre><code>template&lt;class T&gt; class Base { public: Base(); friend class T; }; </code></pre> <p>Now this doesn't work... Is there a way of doing this?</p> <p>I'm actually trying to make a general class sealer like this:</p> <pre><code>class ClassSeal...
<p>It is explicitly disallowed in the standard, even if some versions of VisualStudio do allow it.</p> <p>C++ Standard 7.1.5.3 Elaborated type specifiers, paragraph 2</p> <blockquote> <p>3.4.4 describes how name lookup proceeds for the identifier in an elaborated-type-specifier. If the identifier resolves to ...
Dividing lines between Session Object, User Object, and Login Controller <p>I'm developing my own PHP framework, and I'm trying to do things more "by the book".</p> <p>I want to build login system. I have done this plenty of times, but now I just want to confirm/get some feedback on a system.</p> <p>I know we need......
<p>In my opinion, the user object shouldn't know about persistence (session) or the application (controllers). All it should care for is representing a user and handling user-related functions like authenticate.</p> <p>The controller is all about application logic, and the session is part of the application. I feel li...
How do I generate multi-word terms recursively? <p>Say I have a string of words: <code>'a b c d e f'</code>. I want to generate a list of multi-word terms from this string.</p> <p>Word order matters. The term <code>'f e d'</code> shouldn't be generated from the above example.</p> <p><strong>Edit:</strong> Also, word...
<p>This isn't recursive, but I think it does what you want. </p> <pre><code>doc = 'a b c d e f' words = doc.split(None) max = 3 for index in xrange(len(words)): for n in xrange(max): if index + n &lt; len(words): print ' '.join(words[index:index+n+1]) </code></pre> <...
Is there a better trivial Python WebDAV server code snippet than this? <p>Does anyone have a better code snippet for a trivial Python <a href="http://en.wikipedia.org/wiki/WebDAV" rel="nofollow">WebDAV</a> server? The code below (which is cobbled together from some Google search results) appears to work under Python 2...
<p>Or try PyFileServer, which I picked up for further develpment by the name WsgiDAV (<a href="http://code.google.com/p/wsgidav/" rel="nofollow">http://code.google.com/p/wsgidav/</a>)<br> <strong>Edit:</strong> the project has moved to GitHub (<a href="https://github.com/mar10/wsgidav" rel="nofollow">https://github.com...
Building a highly modular business application with WPF? <p>I'm fleshing out a WPF business application in my head and one thing that sparked my interest was how I should handle making it incredibly modular. For example, my main application would simply contain the basics to start the interface, load the modules, conne...
<p>Check out <a href="http://msdn.microsoft.com/en-us/library/cc707819.aspx" rel="nofollow">Composite Client Application Guidance</a></p> <p>The Composite Application Library is designed to help architects and developers achieve the following objectives:</p> <p>Create a complex application from modules that can be bu...