input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Access sharepoint list data in SQL <p>I am new to SharePoint development. I have a list, this list has a column that is called <code>Todaysdate</code>. This column needs to be updated daily to today's actual date and since it contains ~20,000 rows I am NOT going to update it manually everyday. Because it's used in a ... | <p>You really should not query let alone update the SharePoint content database directly using SQL. It is totally unsupported, so if you break something you are left alone, and the database schema may change with future service packs / releases.<br/>
Also as noesgard mentioned it in his comment you do not need it to us... |
Cleaning up a database in django before every test method <p>By default when Django runs against sqlite backend it creates a new in memory database for a test. That means for every class that derives from unittest.TestCase, I get a new database. Can this be changed so that it is cleared before every test method is run?... | <p>As always, solution is trivial: use <code>django.test.TestCase</code> not <code>unittest.TestCase</code>. And it works in all major versions of Django!</p>
|
Is there a way to collapse functions and sub-routines for Classic ASP in Visual Studio 2008? <p>Is there a way to enabling collapsing of functions and sub-routines for Classic ASP in Visual Studio 2008? I'm able to manually go through and specify blocks of code as collapsable, but it would save me a lot of time if the... | <p>Notepad++ has a "Function List" plugin:</p>
<p><a href="http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=223668" rel="nofollow">http://sourceforge.net/project/showfiles.php?group_id=189927&package_id=223668</a></p>
<p>While this doesn't allow you to collapse your Classic ASP function... |
How do I make a field in MySql auto-incrementing in PHPMyAdmin? <p>I created a field in my table and set it as the index but I can't get it to increase on it s own when a new item is added. How do I do make it do this through PHPMyAdmin?</p>
| <p>Select the A_I check box when creating/editing a column.</p>
|
How do I check if my workstation is locked? <p>Can anyone help with code snippet for checking if the workstation is locked? I tried with getting the document.title, so that when the workstation is locked it returns blank for document.title. This is not working. </p>
<p>I am encoding wscript in vbscript which is residi... | <p>Normally you should be using a wmi query to look at the event log's security log.
Howver, XP doesn't have a lock event ids (vista/win7/2008 does have both lock and unlock event ids). </p>
<p>XP DOES have an unlock event, event though. Most people don't realize the unlock event invovles BOTH a logon/logoff events (... |
How to pass a flexible number of ids into a controller in Rails? <p>I'd like to display a comparison page so user can compare the properties of several objects in my database. Any number of objects can be compared. I'd also like it to be bookmarkable (so a 'get').</p>
<p>How should I structure my URL / route for the c... | <p>I'd prefer </p>
<pre><code>/compare?a=1&b=5&c=22
</code></pre>
<p>The 1_5_22 is just fugly, and I think that</p>
<pre><code>/compare/1/5/22
</code></pre>
<p>is a very non-RESTful route.</p>
|
Is a string property itself threadsafe? <p>String's in C# are immutable and threadsafe. But what when you have a public getter property? Like this:</p>
<pre><code>public String SampleProperty{
get;
private set;
}
</code></pre>
<p>If we have two threads and the first is calling 'get' and the second is calling ... | <p>Most of the answers are using the word "atomic" as if atomic changes are all that are needed. They're not, usually.</p>
<p>This has been mentioned in the comments, but not usually in the answers - that's the only reason for me providing this answer. (The point about locking at a coarser granularity, to allow things... |
Printing from web applications <p>How do you generate paper-prints from a web application?</p>
<p>Specifically I am thinking about more complex paper documents like diplomas, invoices and contracts. Variable number of pages with frames, tables, logos and headers/footers.</p>
<p>Today I use custom forms and CSS for ce... | <p>IMHO for fixed format printing PDF if the answer</p>
|
Transaction rollback and web services <p>Given an example of calling two web services methods from a session bean, what if an exception is thrown between the calls to two methods? In the case of not calling the web services the transaction will rollback and no harm done. However, the web service will not rollback. Of c... | <p>A number of techniques are evolving, but the problem is still sufficiently cutting edge that the standardization process has not yet provided us with a totally portable solution.</p>
<p>Option one, you can make the web services transaction aware. This of course assumes you have control over them, although writing a... |
How to determine installed IIS version <p>What would the preferred way of programmatically determining which the currently installed version of Microsoft Internet Information Services (IIS) is?</p>
<p>I know that it can be found by looking at the MajorVersion key in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services... | <pre><code>public int GetIISVersion()
{
RegistryKey parameters = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\W3SVC\\Parameters");
int MajorVersion = (int)parameters.GetValue("MajorVersion");
return MajorVersion;
}
</code></pre>
|
Setting start node in a umbraco website <p>I have this content structure for a multi language site.</p>
<ul>
<li>Content
<ul>
<li>Danish
<ul>
<li>Forside</li>
<li>Om os</li>
</ul></li>
<li>English
<ul>
<li>Frontpage</li>
<li>About Us</li>
</ul></li>
</ul></li>
</ul>
<p>When I start the website it automatically starts... | <p>You can use the built-in feature:</p>
<ol>
<li>Add a property called 'umbracoRedirect' to the document type associated with the 'Danish' node.</li>
<li>Set the property to be of type 'Content picker' and save it</li>
<li>At 'Danish' node set the property to point to node 'ForSide'.</li>
</ol>
<p>That should work.<... |
What would you consider good Eclipse support? <p>As part of my job, I'm employed to install and support development tools for the developers in the company. </p>
<p>Eclipse is an IDE that a great deal of developers here use, but I don't actively support. With the huge range of plugins and quick release of new versions... | <ol>
<li>Private, in-house plugin central. You are responsible for updating this repo and testing plugin updates first for currently developed projects - so devs do not need to worry about compatibility; they'll just update from in-house plugin repo.</li>
<li>Common settings, eg. coding style formatting defined and mai... |
PHP Arrays, appending depth of array item recursively to an array with the key of 'depth' <p>Per the example array at the very bottom, i want to be able to append the depth of each embedded array inside of the array. for example:</p>
<pre>
array (
53 =>
array (
'title' => 'Home',
'path... | <p>I assume there is another array( at the top not included in your example code.
Something like this?</p>
<pre><code>function array_set_depth($array, $depth = -1)
{
$subdepth = $depth + 1;
if ($depth < 0) {
foreach ($array as $key => $subarray) {
$temp[$key] = array_set_depth(($subarray), $subdept... |
Where should I put Velocity template files for a command line utility built with Maven? <p>I have a small command line utility project that I'm using Maven to manage. The utility is a very simple app to populate a Velocity template and dump the results to a new file. My problem is where to put my Velocity templates. Wh... | <p>You can programmatically configure TEMPLATE_ROOT as follows:</p>
<pre><code>Properties props = new Properties();
props.put("file.resource.loader.path", templateRootDir);
VelocityEngine engine = new VelocityEngine();
engine.init(props);
engine.evaluate(...);
</code></pre>
|
Read Excel files from C# in 64 bit version server <p>reading excel files from C# working well in 32 bit version server. It is <strong>not</strong> working in <strong>64 bit version</strong> (Windows 2003 server), because excel data connection dll not supported in <strong>64 bit version</strong>.
Is any other option ava... | <p>In your project properties set the target platform from 'Any' to 'x86'.</p>
<p><strong>Details:</strong></p>
<p>In Windows x64 a process may be started as 32bit or 64bit process. A 64bit process can only load 64bit dlls and a 32bit process only 32bit dlls.</p>
<p>If your platform target (e.g. specified in the pro... |
How to create a connection string outside web.config <p>Just thinking about this, is it possible to create a connection string outside the ASP.NET's web.config?</p>
| <p>Possibly you're looking for <a href="http://stevenharman.net/blog/archive/2007/06/07/tip-put-connection-strings-in-their-own-configuration-file.aspx" rel="nofollow">configSource</a>?</p>
|
How would you model a "default child" flag with an ORM? <p><br />
I'm using an ORM (SQLAlchemy, but my question is quite implementation-agnostic) to model a many-to-many relationship between a parent class and its children.. I was wondering, what would be a simple way to express the concept "one of the children is the ... | <p>The simplest way would be to have a join table, PersonAddressRelation, and also a DefaultAddress column on the Person table that keys to the Address table.</p>
|
SQL Sub-Query vs Join Confusion <p>I have a database which is in Access (you can get it <a href="http://cid-84dd6ce2da273835.skydrive.live.com/self.aspx/.Public/Unisa.accdb" rel="nofollow">link text</a>). If I run</p>
<pre><code>SELECT DISTINCT Spl.Spl_No, Spl.Spl_Name
FROM Spl INNER JOIN Del
ON Spl.Spl_No = Del.S... | <p>I think I would go for:</p>
<pre><code>SELECT SELECT Spl_No, Spl_Name
FROM Spl
WHERE Spl_No NOT IN
(SELECT Spl_No FROM Del
WHERE Item_Name = 'Compass')
</code></pre>
|
How are CSS frameworks used? <p>For some reason, it never dawned on me that there could be frameworks for CSS. I have been working on my own personal site, and I just really hate 'designing' with CSS (I think more then a few programmers might agree with me). Anyways, I understand the benefits of a framework for a lan... | <p>I used <a href="http://www.yaml.de/en/" rel="nofollow">YAML (Yet Another Multicolumn Layout)</a> in a few projects, because I didn't like to "fight" with the Internet Explorer 6 HACKS.
There is a good explanation of how to use it and you can customize it to your needs (as long as you're going to use a multicolumn (2... |
ActiveMQ: Issue with queue lookup <p>I've set up a queue by configuring it in activemq.xml (ActiveMQ version 5.2.0) as described in the <a href="http://activemq.apache.org/configure-startup-destinations.html">documentation</a>.</p>
<pre><code><destinations>
<queue physicalName="FOO.BAR" />
<queu... | <p>Firstly you don't have to <a href="http://activemq.apache.org/how-do-i-create-new-destinations.html">explicitly create any queues in the broker</a> though it does no harm.</p>
<p>Also the destinations available in the broker are not auto-magically mapped into a JNDI context for you using some kind of JNDI name.</p>... |
Which event in the app's startup sequence is appropriate to trigger loading a config file in AIR/Flex? <p>I am working on a small AIR desktop application and I have some configuration infos that I want to store in a little file that's loaded at some point when the application starts and will be used to set public prope... | <p>If your handler needs to access UI components directly, you should wait for <code>creationComplete</code>; otherwise you'll get NULL references.</p>
<p>If you simply want to set properties on the root <code>Application</code> object, <code>initialize</code> seems the best place to do this. If you wait until <code>... |
Are there good Java libraries that facilitate building command-line applications? <p>I need to write a simple command-line application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters...</p>
<p><strong>UPDATE</strong><... | <p>I've used the <a href="http://commons.apache.org/cli/">Apache Commons CLI library</a> for command-line argument parsing. It's fairly easy to use and has <a href="http://commons.apache.org/cli/introduction.html">reasonably good documentation</a>.</p>
<p>Which library you choose probably comes down to which style of... |
SSIS, dtsx and deployment packages <p>I'm just trying to understand SSIS packages a bit better and how they are deployed. Correct me I'm wrong but for any deployment, I believe there needs to be at least two files a .SSISDeploymentManifest and a .dtsx. The .SSISDeploymentManifest acts as the equivalent windows install... | <blockquote>
<p>Correct me I'm wrong but for any deployment, I believe there needs to
be at least two files a .SSISDeploymentManifest and a .dtsx. The
.SSISDeploymentManifest acts as the equivalent windows installer
package which points to the .dtsx. The dtsx is the actual package of
"stuff" that is reference... |
Show joined value on bound field without custom type? <p>I have a GridView bound to an <code>ICollection<UserAnswer></code> that needs to show two columns:</p>
<pre><code><asp:GridView ID="UserAnswersGridView" runat="server">
<Columns>
<asp:BoundField DataField="Question.Name" HeaderT... | <p>I believe that <code>GridView</code> only supports properties of the immediate type. Is repeater or anything similar an option? That gives you more flexibility.</p>
<p>Alternatively, you can add shim properties to the type via a partial class:</p>
<pre><code>namespace YourLinqNamespace {
partial class UserAnsw... |
Find Java classes implementing an interface <p>Some time ago, I came across a piece of code, that used some piece of standard Java functionality to locate the classes that implemented a given interface. I know the functions were hidden in some non-logical place, but they could be used for other classes as the package n... | <p>Awhile ago, I put together a package for doing what you want, and more. (I needed it for a utility I was writing). It uses the <a href="http://asm.objectweb.org/">ASM</a> library. You can use reflection, but ASM turned out to perform better.</p>
<p>I put my package in an open source library I have on my web site. T... |
How to find WITH RECOMPILE metadata in SQL Server (2005)? <p>How do you find which SPs are declared WITH RECOMPILE, either in INFORMATION_SCHEMA, sys.objects or some other metadata?</p>
<p>(I'm adding some code to my system health monitoring and want to warn on ones which are declared that way where it is not justifia... | <p>For a quick and dirty way I would use:</p>
<pre><code>SELECT
o.name
FROM
syscomments c
INNER JOIN sys.objects o ON
o.object_id = c.id
WHERE
c.text LIKE '%WITH RECOMPILE%'
</code></pre>
<p>That's probably not a good idea for use in an actual application though. If I have a few minutes I'll try t... |
Can't add domain users to Reporting Services 2008 <p>I have <code>SSRS 2008</code> setup on the database server.<br>
The server is part of the domain.<br>
Reporting Services is running under <code>NetworkService</code>.<br>
When I try to add a domain user using the web interface (<code>Site Settings</code> --> <code>Se... | <p>got to home then on properties
and then add the user with roles whatever you want to gives.</p>
|
Does Java have native support for events, similar to that of C#? <p>I'm a bit confused from what I've heard Java doesn't do events.</p>
<p>But I know that it does GUI events.</p>
<p>Am I missing something? Does java have an event handling mechanism?</p>
<p>I'm aware that I can implement a publisher subscriber patter... | <p>As you already stated, you can do the exact same thing with the publisher-subscriber/Observer pattern. It just requires a bit more legwork.</p>
<p>And no, Java does not have native support for events, like C# does with delegates.</p>
|
javascript - accessing private member variables from prototype-defined functions <p>Is there any way to make "private" variables (those defined in the constructor), available to prototype-defined methods?</p>
<pre><code>TestClass = function(){
var privateField = "hello";
this.nonProtoHello = function(){alert(p... | <p>No, there's no way to do it. That would essentially be scoping in reverse. </p>
<p>Methods defined inside the constructor have access to private variables because all functions have access to the scope in which they were defined. </p>
<p>Methods defined on a prototype are not defined within the scope of the con... |
Python: Is there a way to determine the encoding of text file? <p>I know there is something buried in <a href="http://stackoverflow.com/questions/90838/how-can-i-detect-the-encoding-codepage-of-a-text-file">here</a>. But I was just wondering if there is an actual way built into Python to determine text file encoding?<... | <p>Correctly detecting the encoding all times is <strong>impossible</strong>.</p>
<p>(From chardet FAQ:)</p>
<blockquote>
<p>However, some encodings are optimized
for specific languages, and languages
are not random. Some character
sequences pop up all the time, while
other sequences make no sense. A
pers... |
Link to download Cassini source code? <p>Does any one know from where can I download source code for Cassini. I tried the link <a href="http://www.asp.net/Projects/Cassini/Download" rel="nofollow">http://www.asp.net/Projects/Cassini/Download</a> but this page does not exist now.</p>
| <p>You can download it <a href="http://blogs.msdn.com/dmitryr/archive/2008/10/03/cassini-for-framework-3-5.aspx">here</a> there are also older versions on the website for the 2.0 framework for instance.</p>
|
Are constant C expressions evaluated at compile time or at runtime? <p>If I write a <em>#define</em> that performs an operation using other preprocessor constants, is the final value computed each time the macro appears at runtime? Does this depend on optimizations in the compiler, or is it covered under a standard?</p... | <p>Macros are simply textual substitution, so in your example writing <code>TIMER_100_MS</code> in a program is a fancy way of writing <code>32768 / 10</code>.</p>
<p>Therefore, the question is when the compiler would evaluate <code>32768 / 10</code>, which is a constant integral expression. I don't think the standar... |
How to add external data to an XML? <p>I've got an XML Schema and an XML instance that is valid to that schema.</p>
<p>This XML instance contains some data.</p>
<p>I'd like to extend the XML instance with further data(my own meta-data per XML element in the XML instance) while keeping it valid to the provided schema.... | <p>It's not clear from your question if the additional meta-data is generated once, or need to be stored and used in subseqeunt loads.</p>
<p>You may consider using XSLT to generte the new XML with the meta-data. If the new data is failry straight forward and deduced from the original XML, you can use XSLT to easily g... |
Linux C++ Debugger <p>I'm looking for the perfect Linux C++ debugger. I don't expect success, but the search should be informative.</p>
<p>I am a quite capable gdb user but STL and Boost easily crush my debugging skills. It not that I can't get into the internals of a data structure, it's that it takes so long I usu... | <p>A development branch of gdb (part of gdb's <a href="http://sourceware.org/gdb/wiki/ProjectArcher" rel="nofollow">Project Archer</a>) adds Python support to gdb (to replace gdb's macros). There's a series of blog postings <a href="http://tromey.com/blog/?p=494" rel="nofollow">starting here</a> that extensively cover... |
How to SendKeys F12 from current .NET form/application <p>I am pretty sure the following button-activated form code should raise a Control-F12 in my C# application:</p>
<p>SendKeys("^{F12}");</p>
<p>But it does not appear to go on up to the windows shell and activate another program that is listening for it. My keyb... | <p>SendKeys is not capable of sending keys outside of the active application.</p>
<p>To really and truly simulate a keystroke systemwide, you need to P/Invoke either <code>keybd_event</code> or <code>SendInput</code> out of <code>user32.dll</code>. (According to MSDN <code>SendInput</code> is the "correct" way but <co... |
Uri.AbsolutePath messes up path with spaces <p>In a WinApp I am simply trying to get the absolute path from a Uri object:</p>
<pre><code>Uri myUri = new Uri(myPath); //myPath is a string
//somewhere else in the code
string path = myUri.AbsolutePath;
</code></pre>
<p>This works fine if no spaces in my original path. I... | <p>This is the way it's supposed to be. That's called URL encoding. It applies because spaces are not allowed in URLs.</p>
<p>If you want the path back with spaces included, you must call something like:</p>
<pre><code>string path = Server.URLDecode(myUri.AbsolutePath);
</code></pre>
<p>You shouldn't be required to ... |
What's the best way to get the DropDown event of a ComboBox in a DataGridView <p>Say I have a DataGridView in which I dynamically build up a ComboBox column and add values to it. What's the best approach to trapping when the user clicks on the drop down button to show the drop down list. If I simply use CellClick on th... | <p>try EditingControlShowing</p>
|
Request.Form sometimes returns the value of a checkbox, other times doesn't <p>Anyone know what's wrong with this? I have some Classic ASP code that checks for the value of a checkbox, like so:</p>
<pre><code><!-- HTML page: page1.asp --->
<input id="useBilling" name="useBilling" value="Y" type="checkbox" /&... | <blockquote>
<p>Been wracking my brain trying to
figure out why the hell this isn't
working, because everything seems to
be right, just Request.Form sometimes
picks up the value and sometimes
doesn't, even when it's checked.</p>
</blockquote>
<p>Not a direct answer, but just to be totally clear: Request.Fo... |
JSF Multiple Partial Validations Scenario <p>In JSF, is it possible to solve the following validation / updating scenario using the validation framework of JSF (aka validators, immediate, required, etc.)?</p>
<pre><code>+-- Form ----------------------------------------------------+
| ... | <p>Technically, yes, it is possible to do this with validators/immediate. However, it wouldn't be particularly simple.</p>
<p>If you add validators, the logic in <em>[Update C using A and B]</em> will only run if all validators pass or if its immediate attribute has been set to true. If its immediate attribute has bee... |
Local html file AJAX Call and jQuery Woes <p>I'm working on a offline version of a website using jQuery and some xml files. I'm running in to a problem in jQuery when I do a $.ajax call on a xml file jQuery throws a error.</p>
<p>When I look at the error I can tell its loading the XML file because its in the error's r... | <p>From the <a href="http://docs.jquery.com/Specifying_the_Data_Type_for_AJAX_Requests" rel="nofollow">link</a> that the OP posted with the answer:</p>
<blockquote>
<p>When loading XML files locally, e.g. a
CD-ROM etc., the data received by
Internet Explorer is plain-text, not
text/xml. In this case, use the
... |
Is switching app.config at runtime possible? <p>Is there a way at runtime to switch out an applications app.config (current.config to new.config, file for file). I have a backup/restore process which needs to replace its own application.exe.config file. I have seen this <a href="http://stackoverflow.com/questions/242... | <p>Turns out I can swap the .config file for the new one and do a ConfigurationManager.RefreshSection(...) for each section. It will update from the new .config file.</p>
|
Element.appendChild() chokes in IE <p>I have the following javascript:</p>
<pre><code> css = document.createElement('style');
css.setAttribute('type', 'text/css');
css_data = document.createTextNode('');
css.appendChild(css_data);
document.getElementsByTagName("head")[0].appendChild(css);
</code></pre>
<p>fo... | <p>Try instead:</p>
<pre><code>var css = document.createElement('style');
css.setAttribute('type', 'text/css');
var cssText = '';
if(css.styleSheet) { // IE does it this way
css.styleSheet.cssText = cssText
} else { // everyone else does it this way
css.appendChild(document.createTextNode(cssText));
}
document.get... |
SMO scripting objects and security <p>I have a customer that has a SQL database on a hosted server; call the db "myDatabase".<br>
<br />The hosting co. has locked down object explorer - I can't see myDatabase in the database listed (I see tempdb and master). However, if I "use myDatabase" and then "select * from myTab... | <p>I haven't looked at the SMO code, but have you tried using the constructor on the database object? Maybe you can access it directly.</p>
<pre><code>Database myDB = new Database(myServer, "myDatabase");
</code></pre>
|
matching a line that doesn't contain specific text with regular expressions <p>I want to do the following with regular expressions but not sure how to do it. I want it to match <code>one two</code> when <code>one two</code> is the beginning of the line unless the string contains <code>three</code> anywhere after <code>... | <p>You need a <a href="http://www.perl.com/doc/manual/html/pod/perlre.html#item__pattern_">negative lookahead assertion</a> - something like this:</p>
<pre><code>/^one two(?!.*three)/m
</code></pre>
<p>Here's <a href="http://www.regular-expressions.info/lookaround.html">a tutorial on lookahead/lookbehind assertions</... |
What do you think about Microsoft Oslo MGraph? <p>MGraph is a great textual data format brought by Microsoft "Oslo".</p>
<p>Do you think it has a chance to get as broad as XML is today?</p>
<p>Example (Google Geocode):</p>
<pre><code>{
name = "waltrop, lehmstr 1d",
Status {
code = 200,
request: "... | <p><strong>Here are part of <a href="http://blog.jclark.com/2008/11/some-thoughts-on-oslo-modeling-language.html" rel="nofollow">James Clark's thoughts on M</a></strong>:</p>
<p>" I see several major things missing in M, whose absence might be acceptable for a database application of M, but which would be a significan... |
Maven install folder structure problem j2ee (spring, struts ..) <p>i'm using maven 2.1-SNAPSHOT as eclipse plugin.
My project structure is like this:</p>
<p>src/main/java<br>
-model<br>
-service<br>
-action<br>
src/test/java<br>
empty atm<br>
src/main/resources<br... | <p>I believe files that you want deployed to the classpath go in the <code>resources/</code> folder.</p>
<p>Take a look at the <a href="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html" rel="nofollow">Maven in 5 Minutes guide</a>, along with the <a href="http://maven.apache.org/guides/getting-... |
Has anyone successfully connected to MySQL from Ruby? <p>I'm starting to get a bit desperate in my attempts to get a ruby script to connect to MySQL.</p>
<p>I've given up on DBI, as I just don't seem to be able to get it to work no matter what I do. I figured I might have more luck with just using mysql.rb from ruby-m... | <p>There is a good summary of how to do this here: <a href="http://rubylearning.com/satishtalim/ruby_activerecord_and_mysql.html" rel="nofollow">http://rubylearning.com/satishtalim/ruby_activerecord_and_mysql.html</a></p>
|
Can one access TestContext in an AssemblyCleanup method? <p>In Microsoft's UnitTesting namespace (<code>Microsoft.VisualStudio.TestTools.UnitTesting</code>) there are <code>AssemblyInitialize</code> and <code>AssemblyCleanup</code> attributes you can apply to static methods and they will be called before and after all ... | <p>I'm accessing a static property on the same class and it seems to be working fine. I'll update this answer if I encounter any problems. I am <em>not</em>, however, accessing the <code>TestContext</code> so I'm curious if that would work too.</p>
|
What's your ideal C# project built upon? <p>I'm starting a new personal project on the side, so this is the first time I'll be able to start from the ground up on a larger project since ASP.NET 2.0 was first released. I'd like this to also be a good learning experience for me, so right now I'm planning on building this... | <p><a href="http://www.asp.net/mvc/" rel="nofollow"><strong>Web Framework: MVC</strong></p>
<p>Just a better way to make web applications</p>
<p><a href="http://www.hibernate.org/343.html" rel="nofollow"><strong>OR/M: NHibernate</strong></a></p>
<p>Nothing really beats it in performance or features</p>
<p><a href="... |
How do I send users to a different "site" in Apache while also using mod_proxy? <p>I have a web site that I administer that uses Apache 2.0 on the front with Tomcat 6 on the back-end (with mod_proxy proxying the connection between the two).</p>
<p>I want to be able to use the same VirtualHost to also access the phpMyA... | <p>How about using <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" rel="nofollow"><code>mod_rewrite</code></a> instead of mod_proxy?</p>
<p>You can use the <code>P</code> modifier to send certain request (i.e. all those that aren't to /phpmyadmin*) through a proxy. This actually uses mod_proxy interna... |
Can someone explain this template code that gives me the size of an array? <pre><code>template<typename T, size_t n>
size_t array_size(const T (&)[n])
{
return n;
}
</code></pre>
<p>The part that I don't get is the parameters for this template function. What happens with the array when I pass it through ... | <p>Well, first you have to understand that trying to get a value out of an array can give you a pointer to its first element:</p>
<pre><code>int a[] = {1, 2, 3};
int *ap = a; // a pointer, size is lost
int (&ar)[3] = a; // a reference to the array, size is not lost
</code></pre>
<p>References refer to objects usi... |
IronPython Webframework <p>There seem to be many excellent web frameworks for Python. Has anyone used any of these (Pylons, Web2Py, Django) with IronPython?</p>
| <p>Django <a href="http://unbracketed.org/2008/mar/16/pycon-2008-django-now-plays-dark-side/">has been run on IronPython</a> before, but as a proof-of-concept. I know the IronPython team are interested in Django support as a metric for Python-compatibility.</p>
<p>Somewhat related is the possibility to use <a href="ht... |
DomainKeys Sendmail DNS <p>What steps do I have to take to configure my sendmail server to implement domainkeys properly?</p>
<p>Also what do I have to do on the DNS end?</p>
| <p>There are detailed descriptions on the web. For example:</p>
<ul>
<li><a href="http://www.elandsys.com/resources/sendmail/domainkeys.html" rel="nofollow">http://www.elandsys.com/resources/sendmail/domainkeys.html</a></li>
<li><a href="http://www.erikberg.com/notes/milters.html" rel="nofollow">http://www.erikberg.co... |
Read single value from query result <p>I am trying to return the result that I found in my query to the ASP.net table. How do I do that? I already have the query, I am just having trouble getting the count result back. </p>
<pre><code>string configMan.ConnString["connect"].ToString();
iDB2Conn temp = new iDB2Conn
s... | <p>This is where the SqlCommand object comes in handy.</p>
<pre><code>int result = 0;
using(SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
SqlCommand sql = new SqlCommand("SELECT COUNT(*) FROM test", conn);
result = (int)sql.ExecuteScalar();
}
</code></pre>
|
How to cope with slow feedback when pair programming? <p>I work in an Extreme Programming team, pair programming every day. Recently more and more often I get to do stuff that gives slow feedback, on order of 3 minutes. For example: change some thing, recompile, run and see wheather the performance is improved. I see i... | <p>If you could do something else alone, why not when pairing? Maybe simpler action items could be taken off an issue list while waiting? A 3 minute wait would be too long for me to keep the brain in the "flow-mode". So being disrupted anyway (and your partner as well), can't you just do something else with your partne... |
Friend scope in C++ <p>If I have three classes, A, B, C. A and B are friends (bidirectionally). Also, B and C are friends (bidirectionally). A has a pointer to B and B has a pointer to C. Why can't A access C's private data through the pointer?</p>
<p>Just to clarify: This is a pure theoretical C++ language question, ... | <h3>Friendship in C++ is not transitive:</h3>
<p>John is a friend of mine and he can use my wireless connection any time (I trust him).<br>
John's friend Tim though is a waster and though John is my friend I do not include Tim as a friend, and thus I don't let him use my wireless connection.</p>
<h3>Friendship is NOT... |
Exclude a column from being sorted using jQuery tablesorter <p>I am looking for a way to exclude a single column from being sorted using jQuery's tablesorter plugin. Specifically, I have a fairly large table and would like to keep a "row number" column fixed so that it is easy to see what position in the table a partic... | <p>For those who find this while looking for a way to exclude a column from being sortable (i.e. clickable header on the column), the below example excludes column 4 (zero-indexed) from being sorted):</p>
<pre><code>$("table").tablesorter({
headers: {4: {sorter: false}}
});
</code></pre>
|
How can I make cygwin autocomplete windows paths? <p>I don't want to type /cygdrive/c/path/to/stuff, especially when using tools that don't know anything about cygwin. Is there a way to configure cygwin to autocomplete "c:\path\to\stuff" or even "c:/path/to/stuff"?</p>
| <p>For tools that can't understand cygwin paths, you'll need to convert them to windows paths. The <code>cygpath</code> utility can do this for you:</p>
<pre><code>notepad $(cygpath -w /cygdrive/c/path/to/stuff)
</code></pre>
<p>You can probably create aliases or wrapper scripts for commonly-used windows executables.... |
Type to use to represent a byte in ANSI (C89/90) C? <p>Is there a standards-complaint method to represent a byte in ANSI (C89/90) C? I know that, most often, a char happens to be a byte, but my understanding is that this is not guaranteed to be the case. Also, there is stdint.h in the C99 standard, but what was used b... | <p><code>char</code> is always a <strong>byte</strong> , but it's not always an <strong>octet</strong>. A byte is the smallest addressable unit of memory (in most definitions), an octet is 8-bit unit of memory.</p>
<p>That is, <code>sizeof(char)</code> is always <strong>1</strong> for all implementations, but <code>CH... |
Java synchronized static methods: lock on object or class <p>The Java Tutorials say: "it is not possible for two invocations of synchronized methods on the same object to interleave." </p>
<p>What does this mean for a <code>static method</code>? Since a static method has no associated object, will the synchronized k... | <p>Just to add a little detail to Oscar's (pleasingly succinct!) answer, the relevant section on the Java Language Specification is <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.3.6">8.4.3.6, 'synchronized Methods'</a>:</p>
<blockquote>
<p>A synchronized method acquires a monitor (§17... |
Oracle: How to create an element in a specific namespace with XMLElement() <p>In Oracle, you can use the <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions230.htm#i1129193" rel="nofollow">XMLElement()</a> function to create an element, as in:</p>
<pre><code>XMLElement('name', 'John')
</c... | <p>You can also use XMLAttribute:</p>
<pre><code>select xmlelement("my:name",
xmlattributes('http://www.example.com/my' as "xmlns:my"),
'John'
)
from dual
</code></pre>
<p>Will return:</p>
<pre><code><my:name xmlns:my="http://www.example.com/my">John</my:name>
</code></pre>
<p>You can a... |
Visual Studio designer moving controls and adding grid columns when form is opened <p>The first time I try to open a particular form many of the controls (those with anchors on the right side and/or the bottom) are shifted and my grids automatically regain all the columns from their datasource which (the columns) I had... | <p>I found deleting the controls and adding them back in works. Not just cut and paste, but adding the controls back from scratch. This seems to be related to where to designer code is written in the InitialiseComponent method.</p>
<p>This link describes some issues with anchoring and derived forms:
<a href="http://... |
Where does Rails store data created by saving activerecord objects during tests? <p>Where does Rails store data created by saving activerecord objects during tests?</p>
<p>I thought I knew the answer to that question: obviously in the <strong>_test database</strong>. But it looks like this is <strong>not true</strong>... | <p>Items in the test database are erased by default after each test is run, by design. This is done to make sure that each of your tests has its own sandbox to play in that doesn't cause any interactions with the tests before it.</p>
<p>Again, this is by design. You don't want tests that are manipulating the same set ... |
the level of a treeview in WPF? <p>In a WinForms application, the level of a treeview is given by node.level<br />
What is the corresponding one in WPF?</p>
<p>Thanks! </p>
| <p>The direct answer to your question is that there is no level property in WPF.</p>
<p>There is no one to one relationship between the winforms controls and wpf control. Because the underlying architecture and usage is totally different in both. In WPF you will bind a heirarchical data(LinkedList kind of Datastructu... |
WCF and embedded systems <p>I am working on a project that involves an embedded system which runs a non-microsoft OS with a C program for the application and am developing .NET software for its end user applications. For remote configuring with the .NET software (which can go across firewalls), I am considering using ... | <p>WCF is interoperable because it's accessed over HTTP. Visual Studio can help you build client libraries very quickly for WCF, but client access to WCF doesn't require anything other than HTTP calls with the proper payload. If you're looking at a remote server call and your built-in support in your embedded environm... |
i want to find all if statements in C# code which are not followed by brackets. Through regex <p>I want to find all <code>if</code> statements and <code>for</code> statements which are not followed by curly brackets '<code>{</code>'. When you write a single line in an <code>if</code> statement you do not mostly enclose... | <p>Since the underlying mathematics disallow a perfect match, you could go for a good heuristic like "find all '<code>if</code>' followed by a semicolon without an intervening open brace:</p>
<pre><code>/\<if\>[^{]*;/
</code></pre>
<p>where <code>\<</code> and <code>\></code> are begin-of-word and end-of-... |
Monitor a process's network usage? <p>Is there a way in C# or C/C++ & Win32 to monitor a certain process's network usage (Without that application being built by you obviously)? I would like to monitor just 1 process for like an hour or so, then return the bytes used by only that process, such as limewire for examp... | <p>It's possible, but if I'm not mistaken you'll have to create a network driver to filter all network traffic and than figure out which process created the traffic.</p>
<p>Microsoft has an free application for it called <a href="http://blogs.technet.com/netmon/archive/2008/09/17/network-monitor-3-2-has-arrived.aspx" ... |
Delphi fast file copy <p>I'm writing an app that supposed to copy a bunch of files from one place to another.
When I'm using TFileStream for the copy it is 3-4 times slower than copying the files with the OS.</p>
<p>I also tried to copy with a buffer, but that was too slow aswell.</p>
<p>I'm working under Win32, anyo... | <p>There are a few options.</p>
<ol>
<li>You could call CopyFile which uses
the <a href="http://msdn.microsoft.com/en-us/library/aa363851(VS.85).aspx">CopyFileA</a> windows API</li>
<li>You could call the api which explorer uses (the windows api
<a href="http://msdn.microsoft.com/en-us/library/bb762164(VS.85).aspx">SH... |
How to create a compeletely transparent window with MFC? <p>I want to create a completely transparent window with MFC, but I don't know how to do this. Can you tell me the way? </p>
<p>Thank you very much!</p>
| <p>You can use layered windows for transparency effects. See <a href="http://msdn.microsoft.com/en-us/library/ms997507.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms997507.aspx</a>. Be sure to set the WS_EX_LAYERED bit and to use UpdateLayeredWindow. This allows you to trap messages even though the ... |
asp.net: moving from session variables to cookies <p>My forms are losing session variables on shared hosting very quickly (webhost4life), and I think I want to replace them with cookies. Does the following look reasonable for tracking an ID from form to form:</p>
<pre><code>if(Request.Cookies["currentForm"] == null)
... | <p>Before changing any code, I would investigate why session variables are disappearing.</p>
<p>Perhaps it is as simple as changing the timeout setting in the web.config?</p>
<p>Here's a list of the session state settings in the config file: <a href="http://msdn.microsoft.com/en-us/library/h6bb9cz9.aspx" rel="nofollo... |
What can cause a .NET process/thread to terminate unexpectedly? <p>I'm trying to gather a complete listing of the reasons a .NET process or thread to terminate, even though the main() method is guarded by a try...catch clause.</p>
<p>One such reason is Thread.Abort() (unless you call Thread.ResetAbort). Do you know of... | <p>StackOverflowException cannot be handled by your code. </p>
<p>A StackOverflowException typically occurs when you have an endless loop which lets your call-stack grow until the usual stack size (1MB) is exceeded.</p>
<p>There are more exceptions where you cannot recover from. <a href="http://weblogs.asp.net/tgraha... |
Tablet PC Autocomplete <p>I have been trying to implement the autocomplete functionality mentioned
<a href="http://msdn.microsoft.com/en-us/library/ms695043%28VS.85%29.aspx" rel="nofollow">here</a>.</p>
<p>The problem is I am developing on a windows xp machine and I cant seem to find the right dlls used to develop th... | <p>There is no need to call the DLLs directly. As long as your solution is based on .NET Framework 3.0 or above you just need to enable AutoComplete mode on the specific textbox. Deploying your solution to Vista should enable the functionality.</p>
<p>However, one caveat is that the autocomplete integration is for Vis... |
Undo in a transactional database <p>I do not know how to implement undo property of user-friendly interfaces using a transactional database.</p>
<p>On one hand it is advisable that the user has multilevel (infinite) undoing possibility as it is stated <a href="http://stackoverflow.com/questions/125269/how-would-you-ha... | <p>The idea of undo in a database and in a GUI are fundamentally different things; the GUI is going to be a single user application, with low levels of interaction with other components; a database is a multi-user application where changes can have cascading effects as the result of any change.</p>
<p>The thing to do ... |
How do I upgrade PHP 5.1 to 5.2 on SUSE 10.1 using the yast command line only? <p>How do I upgrade PHP 5.1 to 5.2 from the SUSE 10.1 command line? Is there a package manager command to do it automatically?</p>
<p>Actually I need JSON support to use the JavaScript-RTE and believe it's in PHP 5.2 only.</p>
| <p>How about using <a href="http://en.opensuse.org/Zypper" rel="nofollow">zypper</a>?</p>
<p>I got this, already having latest available.</p>
<pre><code>aansari:~ # zypper in php
Downloading repository 'openSUSE-11.0-Updates' metadata [done]
Building repository 'openSUSE-11.0-Updates' cache [done]
Reading installed p... |
Improving our dev environment at work <p>In the near future i will get some 2 weeks for moving and improving our development environment at work.</p>
<p>We mainly develop one large PHP/MySQL project with 2-10 developers.</p>
<p>At the moment we have one dev server, running apache with mod_userdir, each dev has a /pub... | <p>I would make sure that you write your automated deployment scripts in such a way that they can be used by your continuous integration tool. <a href="http://hudson-ci.org/">Hudson</a> (and CruiseControl I suspect) basically wrap these scripts and provide a nifty front-end. </p>
<p>Hundson is easy to install and come... |
(ProjectEuler) Sum Combinations <p>From <a href="http://projecteuler.net/">ProjectEuler.net</a>:</p>
<p><strong>Prob 76: How many different ways can one hundred be written as a sum of at least two positive integers?</strong></p>
<p>I have no idea how to start this...any points in the right direction or help? I'm not ... | <p><a href="http://mathworld.wolfram.com/PartitionFunctionP.html">Partition Numbers</a> (or Partition Functions) are the key to this one.</p>
<p>Problems like these are usually easier if you start at the bottom and work your way up to see if you can detect any patterns.</p>
<ul>
<li>P(1) = 1 = {[1]}</li>
<li>P(2) = 2... |
Deploy PowerBuilder application <p>I'm trying to deploy the examples project that comes with PowerBuilder 9 IDE to an .exe file. </p>
<ol>
<li>Full build - passed successfully.</li>
<li><p>Deploy - fails with the following error:</p>
<p>"The current library list is different than the library list contained within thi... | <p>By the time you've seen this message, PowerBuilder has updated your library list in the project (assuming you've got the project open in the project painter). Just hit Deploy again to start the build. Remember to hit Save before you close the painter, or else you'll go through the same dance next time.</p>
<p>Good ... |
How do I write a query that outputs the row number as a column? <p>How do I write a query that outputs the row number as a column? This is DB2 SQL on an iSeries.</p>
<p>eg if I have</p>
<p>table Beatles:</p>
<pre><code>John
Paul
George
Ringo
</code></pre>
<p>and I want to write a statement, without writing a proced... | <pre><code>SELECT ROW_NUMBER() OVER (ORDER BY beatle_name ASC) AS ROWID, * FROM beatles
</code></pre>
|
Open File Dialogue box in JavaScript <p>how can I get an "open file dialogue" box in JavaScript? ::)</p>
<p><strong>Edit:</strong> </p>
<p>Duplicate of <a href="http://stackoverflow.com/questions/408735/javascript-file-uploads">JavaScript file uploads</a> by the same person.</p>
| <p>Javascript cannot open files. (Leastways not in any cross browser secure way).</p>
<p>Possibly you'd be interested in <code><input type="file" /></code> (an intro <a href="http://www.cs.tut.fi/~jkorpela/forms/file.html" rel="nofollow">here</a>).</p>
|
How to unregister an event handler in Internet Explorer 6? <p>I am registering a function with the onload method of a html form, I need to unregister this event hander function on unload of the form. How do I do it in Internet Explorer 6?</p>
| <p>if you have added the onload in your HTML or via JavaScript</p>
<pre><code><form onload="blah()">
</code></pre>
<p>or</p>
<pre><code>myForm.onload = blah;
</code></pre>
<p>then</p>
<pre><code>myForm.onload = null;
</code></pre>
<p>should do it<br />
if you've used attachEvent</p>
<pre><code>myForm.attac... |
Is this a bug in string.TrimEnd? <pre><code>"\u4000\f".TrimEnd(new char[0])
</code></pre>
<p>is equal to <code>"\u4000"</code>. </p>
<p>I am passing an empty array, so according to the MSDN documentation nothing should be removed and <code>"\u4000\f"</code> should be returned. Is there a reason for this behaviour?</p... | <p>the documentation says "If trimChars is null (Nothing in Visual Basic) or an <em>empty array</em>, white-space characters are removed instead. "<br />
So no, not a bug.</p>
|
ASP.NET MVC application controller constructor problem <p>I've created an application controller abstract class that my controllers derive from (As described in the following <a href="http://www.asp.net/Learn/mvc/tutorial-13-cs.aspx" rel="nofollow">article</a>)</p>
<p>The following is an example of what my code looks ... | <p>Try this instead of using the constructor:-</p>
<pre><code>public abstract class ApplicationController : Controller
{
private ProjectDataContext datacontext = new ProjectDataContext();
protected ProjectDataContext DataContext
{
get { return datacontext; }
}
protected override void Init... |
Localization of a WinForms app and later UI changes <p>I am using VS2008 to develop a WinForms 2.0 application. I have read about how to localize my app in the Visual Studio by setting the Localizable property to true in the designer etc.</p>
<p>I would like to ask about your experience, how does it work when I trans... | <p>I've never heard of editing localized forms causing problems, after answering questions for 3 years in the MSDN Windows Forms forum. Microsoft isn't Borland.</p>
|
How to get jquery ui tabs working? <p>At <a href="http://docs.jquery.com/UI/Tabs#Example" rel="nofollow">http://docs.jquery.com/UI/Tabs#Example</a> there is a short HTML example of how to use JQuery UI Tabs.</p>
<ul>
<li>I put the HTML in a local index.htm file.</li>
<li>I downloaded all the CSS and Javascript files, ... | <p>If your problem is that everything seems to run but the DIVs do not disappear as they should then you have probably run into the same problem I did.</p>
<p>You need to define the class .ui-tabs-hide so that it hides the element. Basically jQuery uses this to hide the elements, rather than doing it manually with dis... |
"SelectAll" checkbox not working when back button on the browser is clicked <p>I have the following html page:</p>
<pre><code><html>
<body>
<script>
var check = 0;
function doNow()
{
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
{
if(... | <p>It's because when the page is reloaded, the Javascript is parsed and your declaration </p>
<pre><code>var check = 0;
</code></pre>
<p>unsurprisingly causes the check variable to be reset to zero at this point. Thus after the page is reinitialised, the first click of the button will enable all checkboxes. It seem... |
Is it alright to add custom Html attributes? <p>I have a site I'm working on where I want to mark if a row of data has been changed.
If something has been changed in that row I would mark it with a custom attribute
like so.</p>
<pre><code><tr>
<td isDirty="true">
....row data
<td>
</tr>... | <p>Why don't you use the jQuery data capability?</p>
<p>Your example will be (I don't know the condition to select proper td):</p>
<pre><code>$("tr td").data("isDirty", true);
</code></pre>
<p>take a look at <a href="http://docs.jquery.com/Core/data#name">documentation</a></p>
|
How to configure Tomcat to use Windows NTLM authentication? <p>I would like to use NTLM authentication with Tomcat so that Iexplorer send automatically both the user id+pwd to webapp. Is this possible? </p>
<p>With "BASIC" authentication IE pops up the usual pwd dialog but I want to skip this dialog. ( Note, I us... | <p>Yes, it's now possible with Waffle Tomcat Authenticator that supports Negotiate (NTLM v1, v2, etc., and Kerberos).</p>
<ul>
<li>Tutorial:
<a href="http://code.dblock.org/ShowPost.aspx?id=103" rel="nofollow">http://code.dblock.org/ShowPost.aspx?id=103</a></li>
<li>Waffle:
<a href="http://dblock.github.io/waffle/" re... |
Has anyone used smartwin (a Windows C++ GUI OS library)? <p>I am considering using <a href="http://smartwin.sourceforge.net/" rel="nofollow">smartwin</a> for a Windows platform only C++ project but notice that there has not been a release for 18months since 2.0rc5 was released i.e. it appears that it is no longer maint... | <p>Have you looked at <a href="http://en.wikipedia.org/wiki/Qt_%28toolkit%29" rel="nofollow">Qt</a> instead? I think it has a lot of the features you're looking for, and would be <em>much</em> better supported, both in developer tools and framework maturity.</p>
|
Shell script user prompt/input <p>This is a crude korn shell script that someone else wrote. I don't know much about using shell syntax and I'm not even sure if this is possible.</p>
<p>Is there any way for me to run this file and be prompted for the date so that I don't have to manually go into the script and change... | <p>If you want to be prompted (as opposed to passing the date in as a parameter), use the following logic (or something similar):</p>
<pre><code>date=
while [ -z $date ]
do
echo -n 'Date? '
read date
done
</code></pre>
<p>That loop will continue to prompt for the date until the user enters something (anything... |
Does anyone have any useful resources to share or tips to offer for developing a MUD? <p>As a hobby project I am trying to create a ROM (Diku-Merc based) derivative. (Now defunct) I would appreciate it if anybody has done something similar and has some useful resources to share or tips to offer. I'm finding that a lot ... | <p>After extensive research I've decided to go with a <a href="http://www.tbamud.com/">tba</a> code base. I may elaborate later but very broadly</p>
<ul>
<li>Coding experience is more important than experience as a player and this has convinced me to abandon my roots. I wanted a well documented, reasonably modern, ma... |
How to see SOAP data my client application sends? <p>I have a project where I have created web service proxy classes with wsdl.exe and then simply create an instance of that class (inherits System.Web.Services.Protocols.SoapHttpClientProtocol) and call the method that should send a SOAP message. I'm using Visual Studio... | <p>Use <a href="http://www.fiddler2.com/fiddler2/" rel="nofollow">fiddler</a>.</p>
|
What are some best practices / conventions / guidelines for ASP.NET or C#? <p>Long ago I read a great book on C# and Visual Basic best practices:</p>
<p><em>Practical Guidelines and Best Practices for Microsoft Visual Basic and Visual C# Developers</em>
by Francesco Balena, Giuseppe Dimauro</p>
<p><img src="http://ww... | <p>For C# and .Net in general I'd highly recommend picking up Krzysztof Cwalina and Brad Adams' book "<a href="http://rads.stackoverflow.com/amzn/click/0321545613" rel="nofollow">Framework Design Guidelines</a>". That book along with running my code against FxCop and the ReSharper Code Analysis has really helped me kee... |
Can a VBA function in Excel return a range? <p>I seem to be getting a type mismatch error when trying to do something like this:</p>
<p>In new workbook:</p>
<pre><code>A1 B1
5 4
Function Test1() As Integer
Dim rg As Range
Set rg = Test2()
Test1 = rg.Cells(1, 1).Value
End Function
Function Test2() As Ran... | <p>A range is an object. Assigning objects requires the use of the SET keyword, and looks like you forgot one in your Test2 function:</p>
<pre><code>Function Test1() As Integer
Dim rg As Range
Set rg = Test2()
Test1 = rg.Cells(1, 1).Value
End Function
Function Test2() As Range
Dim rg As Range
Set ... |
Function pointer to class member function problems <p>First of all I have to admit that my programming skills are pretty limited and I took over a (really small) existing C++ OOP project where I try to push my own stuff in. Unfortunately I'm experiencing a problem which goes beyond my knowledge and I hope to find some ... | <p>Your private member method has an implicit <code>this</code> pointer as first argument. If you write that out, it's obvious that the function signatures do not match.</p>
<p>You need to write a static member function, which can be passed as the callback-function to the library. The last argument to the <code>Hook... |
best way to programmatically modify excel spreadsheets <p>I'm looking for a library that will allow me to programatically modify Excel files to add data to certain cells. My current idea is to use named ranges to determine where to insert the new data (essentially a range of 1x1), then update the named ranges to point... | <p>The safest suggestion is to just use OLE. It uses the COM, which does not require .NET at all.</p>
<p><a href="http://en.wikipedia.org/wiki/OLE_Automation" rel="nofollow">http://en.wikipedia.org/wiki/OLE_Automation</a> <--about halfway down is a C++ example.</p>
<p>You may have to wrap a few functionalities in... |
How do you create a JavaScript Date object with a set timezone without using a string representation <p>I have a web page with three dropdowns for day, month and year. If I use the JavaScript Date constructor that takes numbers then I get a Date object for my current timezone:</p>
<pre><code>new Date(xiYear, xiMonth, ... | <p>using <code>.setUTCHours()</code> it would be possible to actually set dates in UTC-time, which would allow you to use UTC-times throughout the system.</p>
<p><strike>You cannot set it using UTC in the constructor though, unless you specify a date-string.</strike></p>
<p>Using <code>new Date(Date.UTC(year, month, ... |
How can I mix COUNT() and non-COUNT() columns without losing information in the query? <p>I started with a query:</p>
<pre><code>SELECT strip.name as strip, character.name as character
from strips, characters, appearances
where strips.id = appearances.strip_id
and characters.id = appearances.character.id
and ... | <p>Does mySQL support analytic functions? Like:</p>
<pre><code>SELECT foo.bar, baz.yoo, count(baz.yoo) over (partition by foo.bar) as yoo_count
from foo, bar
where foo.baz_id = baz.id and baz.id in (...)
</code></pre>
<p>Alternatively:</p>
<pre><code>SELECT foo.bar, baz.yoo, v.yoo_count
from foo, bar,
( select f... |
Fixing the timezone on Solaris 10 <p>I have no ideas how to fix this. In my /etc/TIMEZONE file the TZ variable has the correct value (Canada/Eastern) and still it's showing a -1 hour lag. Where else should I be looking?</p>
| <p>You should check what your hardware clock is.
I would suggest doing this:</p>
<ul>
<li>Set the UTC time correctly. i.e. (5 AM in the example):</li>
</ul>
<p>$ date -u -s "05:00"</p>
<p>Thursday, April 29, 2010 05:00:00 AM UTC</p>
<ul>
<li>Set the hardware clock accordingly (tod for SPARC and rtc for x86):</li>
<... |
Visual Source Safe Version 8 <p>My issue is that when I check a project out of SS I sometimes do not get the latest version of the project, and when I check a project into SS the .frx files are corrupt.</p>
| <p>Are you tied to SS? Can you not use a more modern repository? Subversion would be a good start. Getting that started is very easy to do, a lot easier than I think people think.</p>
<p>If not, then you have to run a tool to find out what the corruption is and then try to clean it or reset it. You may also check... |
T-SQL: Selecting rows to delete via joins <p>Scenario:</p>
<p>Let's say I have two tables, TableA and TableB. TableB's primary key is a single column (BId), and is a foreign key column in TableA.</p>
<p>In my situation, I want to remove all rows in TableA that are linked with specific rows in TableB: Can I do that t... | <pre><code>DELETE TableA
FROM TableA a
INNER JOIN TableB b
ON b.Bid = a.Bid
AND [my filter condition]
</code></pre>
<p>should work</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.