input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
CruiseControl.NET Set Variable to a dynamic value <p>is there any plug-in or other possibility to set an environment variable in CC.NET 1.4.2 to some generated value. I would like to pass to MSBuild some random value (can be a time stamp where to put some build reports). Afterwords all the generated report files from t... | <p>Can't you just produce the report files in the normal project working directory and merge them from there? Every other external reporting tool works this way.</p>
|
Syncfusion GridList Control Column Header Click <p>I would like to order contents in a column when user clicks column header on the Syncfusion GridList control. Does anyone have any idea on how I might achieve this using C#?</p>
| <p>I don't have them installed right now but it should be something like this:</p>
<pre><code>GridControl.TableDescriptor.AllowSort = true;
</code></pre>
<p>This should make the columns sortable, thus when clicking on the column header it will order them.</p>
|
Binding to interface and displaying properties in base interface <p><a href="http://stackoverflow.com/questions/539568/binding-ilistimyinterfacetype-doesnt-display-members-of-interfaces-that-imyint">This question</a> (along with its answer) explains why you can't easily bind a DataGridView to an interface type and get ... | <p><code>DataGridView</code> does not use <code>TypeConverter</code>; <strong><code>PropertyGrid</code></strong> uses <code>TypeConverter</code>.</p>
<p>If it relates to list-controls like <code>DataGridView</code>, then the other answer is wrong.</p>
<p>To provide custom properties on a list, you need one of:</p>
<... |
Semi-transparent panel background <p>I have a panel which sits on top of a control that renders video. I have controls (buttons, etc), on that panel which I want to be fully opaque. Now, creating a transparent panel background is doable, by overriding the CreateParams property. However, how to I make a panel with a s... | <p>In the end it turned out that this isn't possible really, setting transparency on a panel is pretty rubbish in WinForms.</p>
<p>The workaround I used was to render the controls manually onto the given surface, and alter the alpha values appropriately.</p>
|
Unbind not working in jQuery <p>I have a button and wrote two functions for the same button</p>
<p>Like initially</p>
<pre><code> $("#FieldSetting .button").eq(0).unbind('click');
$('.button').eq(0).click(function(){alert('initally');})
</code></pre>
<p>later in the jQuery when I click on a div I wrote another fu... | <p>If you run "unbind" at line 1, and then you attach a new event at line 10, the most recent activity will take authority. Meaning, whatever you did last, is King.</p>
<p>In this case, you added the .click() functionality long after you ran "unbind." <code>Unbind</code> isn't like <code>live,</code> it won't prevent ... |
Validating WinForms TextBox (in C#) <p>In TextBox_Leave event i need to check whether numbers entered in textbox is in serial number or not.If it is not in order then i need to display a message as "number" is missing </p>
<p>For example :</p>
<p>In textbox i have entered 3 and click tab :
I need to display message a... | <p>I don't know whether this also works in c#2.0, this is my experience in c#3.0:</p>
<p>Why do you use TextBox_Leave for that? The Validating-event should be used for validating whether input is correct.</p>
<p>Combine using the Validating-event with using an ErrorProvider (you can just drag it from the toolbox onto... |
What to know about IIS? <p>I would like to know what kind of things in IIS are really important to you on a day to day basis? And what should I look into initially to get started? Any articles/books/tutorials are welcome.</p>
| <p>Have you thought about getting into some Virtual Lab, such as:</p>
<p><a href="http://virtuallabs.iis.net/" rel="nofollow">http://virtuallabs.iis.net/</a></p>
<p>This link is full of resources also: <a href="http://learn.iis.net/" rel="nofollow">http://learn.iis.net/</a></p>
|
RegEx and QueryString <p>i have this regex that i use with my website</p>
<pre><code>^.*/([a-z0-9,-]+)/([a-z0-9,-]+)/$
</code></pre>
<p>My question is who i can use querystring with my regex,</p>
<p>/about-us/contact/?l=en -> page.aspx?id=12&l=en</p>
<p>where id=1 = /about-us/contact/</p>
<p>where l=en = /?l=e... | <p>If you want to include a <code>?</code> character in your search pattern, you just have to escape it with a backslash. So if you want to find 'l=en', you look for '\?l=en'</p>
<pre><code>^.*/([a-z0-9,-]+)/([a-z0-9,-]+)/(\?l=en)
</code></pre>
|
Flex / actionscript - Screen DPI <blockquote>
<p>Is there a way to get the screen dpi ?</p>
</blockquote>
<p><hr /></p>
<p><strong>I have tried <em>Capabilities.screenDPI</em> but it is broken, it always return 72.</strong></p>
<p><hr /></p>
<p>Any Ideas?</p>
<p>Many Thanks.</p>
| <p>I've never been able to completely wrap my head around why this is, but that is actually correct. If you want to get width by height information, you can use <code>Capabilities.screenX</code> and <code>Capabilities.screenY</code>.</p>
<p>I believe you must be using a Mac. 72 is often the dpi on Macs; on a Win mac... |
Any better alternative to fork() and then execvp(" gcc program.c ")? <p>The following code segment takes more time (5s) when it is run first time and takes less time(250ms) on consecutive runs. Is there any better way to execute gcc.</p>
<pre><code>int pid,status;
char * argv[] = {"gcc","program.c",NULL};
if(!(pid=for... | <p>Well, I don't think so. 5 seconds on the first go is probably time to read everything from disk to memory. The compiler itself, the sources to compile, the headers to include, libraries to link against etc. It's scattered all across the disk, so the disk heads have to seek a lot. That's slow.</p>
<p>After that you ... |
How do I check whether a given USB device is plugged in? <p>Our winforms application supports a custom controller using the manufacturer's SDK, but there's no support to detect whether a device is present or not. How do I check whether a given USB device is plugged in?</p>
| <p>The following class is used to monitor devices, you could use this to detect a USB device.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
namespace DeviceMonitor.Event
{
/// <summary>Media watcher delegate.</summary>
/// <param name... |
iPhone network performance <p>I have a question and I am very open to suggestions (even very odd ones!)</p>
<p>I am writing an iPhone app, which does a request (URL with parameters) to a server. As a response, the iPhone receives XML. All is well.</p>
<p>Right now, I am looking to improve my application's speed by me... | <p>Assuming you're using NSXMLParser's initWithContentsOfURL:, that's probably part of the problem. It seems like that downloads the entire contents of the URL, then hands it off to the parser to parse all at once.</p>
<p>Despite the fact that the NSXMLParser is an event-driven parser, it doesn't seem to support strea... |
wxPython SplitterWindow does not expand within a Panel <p>I'm trying a simple layout and the panel divided by a SplitterWindow doesn't expand to fill the whole area, what I want is this:</p>
<pre><code>[button] <= (fixed size)
---------
TEXT AREA }
~~~~~~~~~ ... | <p>The Panel is probably expanding but the ScrolledWindow within the Panel is not, because you aren't using a sizer for the panel, only the frame.</p>
<p>You could also try just having the SplitterWindow be a child of the frame, without the panel.</p>
|
Generic Model Representations In ASP.NET MVC <p>I'm trying to implement a highly reusable web system where the source of data for the model can be changed at will. What I need is a generic type instead of relying on the type generated by either LINQ or entities.</p>
<p><a href="http://www.asp.net/learn/mvc/tutorial-2... | <p>Wouldn't the class you create then be very close to a DataTable, DataRow or even a NameValueCollection? Your object would have to include it's schema as part of itself and the View would have to iterate over the Collection(s).</p>
|
Adding an identity to an existing column <p>I need to change the primary key of a table to an identity column, and there's already a number of rows in table. </p>
<p>I've got a script to clean up the IDs to ensure they're sequential starting at 1, works fine on my test database. </p>
<p>What's the SQL command to alte... | <p>You can't alter the existing columns for identity.</p>
<p>You have 2 options,</p>
<ol>
<li><p>Create a new table with identity & drop the existing table</p></li>
<li><p>Create a new column with identity & drop the existing column</p></li>
</ol>
<p>Approach 1. (<em>New table</em>) Here you can retain the e... |
Importing database data into Joomla <p>How to import data from a database to Joomla CMS?</p>
<p>I have a database with lots of data I want to use in my new website. An ideal solution for me would be a Python/Perl/PHP API that would know how to do Joomla' basic routines:</p>
<ol>
<li>adding/removing a section/category... | <p>You could try the following extensions:</p>
<ol>
<li><a href="http://extensions.joomla.org/extensions/migration-&-conversion/data-import-&-export/7243/details" rel="nofollow">Bulk Import</a></li>
<li><a href="http://extensions.joomla.org/extensions/migration-&-conversion/extensions-migration/4247/detail... |
Unable to make Less to indicate location in percentage <p>I now aim to show the percentage sign also when you run, for example, the command</p>
<pre><code>man emacs
</code></pre>
<p>If you run it, you get 'byte 3300' for instance.</p>
<p><a href="http://stackoverflow.com/questions/1049350/unable-to-make-less-to-indi... | <h1>Solution</h1>
<p>A less manual version of <a href="http://stackoverflow.com/a/18427567/470844">knitatoms' answer</a>
combined with <a href="http://stackoverflow.com/a/1049398/470844">Alex Marteilli's answer</a>
works quite well: pass the <code>+Gg</code> option to <code>less</code> via its pager option.</p>
<p>Fo... |
preg_replace(), and the abbreviations that go with it? <p>I've recently been working with a simple Twitter API for PHP and came across this code to make @username be linked with twitter.com/username. Unfortunately this code creates it so @username links to <a href="http://twitter.com/@username" rel="nofollow">http://t... | <p>Easy one:</p>
<pre><code>$ret = preg_replace('/(^|[^\w])@([\d\w\-]+)/', '\\1<a href="http://twitter.com/$2">@$2</a>' ,$ret);
</code></pre>
<p>The only difference is the @ was moved out of the capturing group, which means it has to be manually added to the output within the link.</p>
<p>Also, \w includ... |
How do I express a polymorphic association in JPA? <p>A <a href="http://en.wikipedia.org/wiki/Polymorphic%5Fassociation" rel="nofollow">polymorphic association</a> is similar to a foreign key or many-to-one relationship, with the difference being that the target might be one of a number of types (classes in the languag... | <p>I think you've already hit on an answer. Create an abstract class (either @Entity or @MappedSuperclass) and have the different types extend it. </p>
<p>Something like this might work</p>
<pre><code>@MappedSuperclass
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class Edge {
// . . .
... |
How can I fix this scaling issue with soft deleting items? <p>I have a database where most tables have a delete flag for the tables. So the system soft deletes items (so they are no longer accessible unless by admins for example)</p>
<p>What worries me is in a few years, when the tables are much larger, is that the ov... | <p>I'd partition the table on the <code>DELETE</code> flag.</p>
<p>The deleted rows will be physically kept in other place, but from <code>SQL</code>'s point of view the table remains the same.</p>
|
Anyone using Bing Map Web Services with Delphi? <p>Has anyone gotten Bing Map Web Services (formerly Virtual Earth Web Services) working with Delphi?</p>
<p>Based on my experiences so far (both using Delphi and Visual Studio C#), I'm about ready to give up on it and go with the MapPoint Web Service until a future vers... | <p>My best guess is that Delphi seems to be producing too many Geocode elements - there doesn't appear to be any thing that corresponds to NS2:Geocode in the C# produced XML. If you can intercept the XML and change it so that it looks like this, who knows - it might work:</p>
<pre><code> ...
<NS1:Geocode xml... |
Retrieve single Entity Framework entities using a LINQ query or GetObjectKey? <p>It looks like GetObjectKey has the benefit of searching for existing, instantiated objects, and THEN the data store. However, it also seems like you lose some of the strong typing, and need to cast your resulting object:</p>
<p>GetObject... | <p>I prefer the latter because it is explicitly clear what it is you want. By using EntityKey (and this is something that the ADO.NET team doesn't seem to understand), we have to work around the structure imposed on us by Entity Framework. By using the query language in the way you did in the second example, we're te... |
size the height of a flex component to fill the space available on stage <p>Im trying to create a layout in flex using mxml, the layout contains a Canvas component and a Box. The layout should always be such that the Box sits at the bottom edge of the application and has a fixed height, whereas the Canvas fills the rem... | <pre><code><Module layout="vertical" xmlns="...">
<Canvas width="100%" height="100%">
<HBox width="100%" height="30"/>
</Module>
</code></pre>
<p>By setting <code>layout="vertical"</code> the <code>Module</code> will work more or less like a <code>VBox</code>. The <code>Canvas</code> is set... |
In LabVIEW, get callees without loading a VI <p>Here's an obscure Friday Morning question:</p>
<p>Is it possible in LabVIEW to get the callees of a VI without loading the entire VI into memory? For instance, by reading static information from the binary?</p>
<p>Thanks</p>
| <p>Well there is the private/scriptig method App.<em>Read Linker Info From File</em>, I don't think this will load the VI into memory, for more info have a look at the <a href="http://labviewwiki.org/Linker.Read_info_from_file" rel="nofollow">LabVIEW wiki</a> (<del>currently off-line </del>, here is a <a href="http://7... |
Flex: How does a component know whether one of its styles got changed? <p>I inherited a custom component from TextField. The component needs to know when any of its styles got changed at runtime via setStyle. How would I do that? It's probably obvious but I couldn't find an event or appropriate method to override.</p>
| <p>If you want the text field to play nicely with containers and other components in Flex you may want to wrap it in a <code>UIComponent</code>, or have the subclass implement the <code>IUIComponent</code> and <code>IStyleClient</code> or <code>ISimpleStyleClient</code> interfaces (which <code>UIComponent implements). ... |
Dependency Property Uses in WPF <p>I am having a hard time figuring out good reasons for the dependency property. Why the System.Controls.TextBox "Text" property a dependency property and not a normal property? What benefits does it serve being a dependency property? </p>
<p>One of the things I am trying to accomplish... | <p>The benefits are primarily two fold:</p>
<p>Firstly a dependency property is only created when it is used, this means the TextBox class can be very efficient, with a low memory footprint since it has a minimal number of real properties taking up space on the heap. This is especially important in WPF where all contr... |
Simplest way of updating SQL Server 2005 from a REST web service <p>We have a job management application running (Access) with the database in SQL Server 2005. A third party is going to provide job information to us, which they make available as XML via an SSL web service using a REST style interface. The service nee... | <p>The simplest way would be to write a bit of C# code to call the REST service and write the data into staging tables. Create this code in a Console application and run it periodically using Task Scheduler.</p>
|
Obtain output files from a MSBuild project <p>Is it possible to obtain a list all all the output files from a MSBuild project?</p>
<p>In a simple project, I could do something like </p>
<pre><code><CreateItem Include="$(OutputDir)**\*">
<Output ItemName="AllOutputs" TaskParameter="Include"/>
</Cr... | <p>After looking at your comment again I realized that I mis-intrepreted what you really needed. This is an interesting problem you have on your hands.</p>
<p>If you don't mind editing the project file itself you may be able to get pretty <strong>close</strong> to what you want. There is an item <strong>FileWrites</st... |
RegEx to randomly set case of characters in a string <p>What I'm looking for is a RegEx to mix the character case of a given string for use in functional testing.</p>
<p>Example Input:</p>
<pre><code>The Quick Brown fox jumps over the Lazy Dog.
</code></pre>
<p>Sample Expected Output:</p>
<pre><code>tHe QUiCk BrOwn... | <p><code>RegEx</code> is supposed to do something deterministic and not random. In C# you could achieve it using something like this:</p>
<pre><code>var random = new Random();
var result = new string(((IEnumerable<char>)input.ToLowerInvariant())
.Select(x => random.Next(2) == 0 ? x : Char.ToUppe... |
pl/sql Stored procedure... where does the execution time go? <p>I am currently tracing a performance leak in a stored procedure.
Having a timestamp put out right after the initial "begin" and one right before the final "end" (I am doing a commit <em>before</em>) says the procedure takes abt. 10 secs to finish.
However,... | <p>I think you need to be dividing by 100, not 1000(dbms_utility.get_time gives time in centiseconds). That should give you 100 seconds, which is about 2 minutes.</p>
<p>However, if you're interested in finding out where the 2 minutes of execution time went, and depending on the complexity of the procedure, you may w... |
Where is the VBComponents object in the Excel object model? <p>hi i am working with c# and excel-2007...
i wanted to add a macro to excel and run from c#, for which i think i need access to the VBComponents but unfortunately i cannot see it after i do the following</p>
<pre><code> wb.VBProject.
</code></pre>
<p>sh... | <p>To add the VBIDE, looks like you have to search for the <strong>Microsoft Visual Basic for Applications Extensibility Library</strong>. See <a href="http://support.microsoft.com/kb/303872" rel="nofollow">here</a> for more details.</p>
<p>Hope these help.</p>
|
Unable to understand a permission warning in Mac <p>I have 777 permissions for the app AquaLess installed by MacPorts.</p>
<p>I run</p>
<p>./AquaLess.app</p>
<p>I get</p>
<pre><code>zsh: permission denied: ./AquaLess.app
</code></pre>
<p>This is a strange warning, since I have 777 permissions.</p>
<p><strong>How ... | <p>Type <code>open AquaLess.app</code></p>
<p>A file with <code>.app</code> extension isn't an executable file. It's a directory that contains various resources in ways that Mac OS knows how to open. </p>
<p>You would get the same warning if you tried to execute $HOME.</p>
|
Rapidshare API question <p>When I retrieve response from query <a href="http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login=MY_USERNAME&password=MY_PASSWORD" rel="nofollow">http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login=MY_USERNA... | <p>That number (1251783433) is known as <a href="http://en.wikipedia.org/wiki/Unix%5Ftime" rel="nofollow">Unix time</a>. Most programming languages have methods to convert from Unix time to a date/time format.</p>
|
Tomcat Clustering and HTTPS Issue <p>I have two instances of Tomcat 6 with content accessible via HTTP and HTTPS for other pages. </p>
<p>I have configured the instances this way: </p>
<p>1) Instance one to listen on port 8080(Http) and 8443(Https)
2) Instance two to listen on port 7080(Http) and 7443(Https) </p>
<... | <p>It's better to just use the <a href="http://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html" rel="nofollow">ajp13 connector</a> to attach Apache to Tomcat and let Apache take care of the https vs. http. Then Tomcat just needs to listen on, say 8009 and 7009 for the two instances and you are all set. </p>
|
Java error: java.lang.IllegalArgumentException: Signal already used by VM: INT <p>I am investigating a Java issue (using IBM JVM 1.4.2 64-bit) on Red Hat Linux.
I am wondering if anyone has seen this error message before and knows if there is a workaround to this problem?</p>
<p>Source:</p>
<pre><code>import sun.mis... | <p>This is may very well be a JVM implementation specific problem. We are using an undocumented / unsupported API (<code>sun.misc.Signal/SignalHandler</code>) and therefore no contract on the behavior of the API is guaranteed.</p>
<p>The IBM JVM implementation could do signal-handling-related-things differently from t... |
Can a Ruby method yield as an iterator or return an array depending on context? <p>I have an arbitrary method in Ruby that yields multiple values so it can be handed to a block:</p>
<pre><code>def arbitrary
yield 1
yield 2
yield 3
yield 4
end
arbitrary { |x| puts x }
</code></pre>
<p>I'd like to modify this ... | <pre><code>def arbitrary
values = [1,2,3,4]
return values unless block_given?
values.each { |val| yield(val) }
end
arbitrary { |x| puts x }
arbitrary
</code></pre>
|
What is LogonUser()'s token returned used for? <p>What can you do with the token <a href="http://msdn.microsoft.com/en-us/library/aa378184%28VS.85%29.aspx" rel="nofollow">LogonUser</a> returns? And what is it used for?</p>
<pre><code>BOOL LogonUser(
__in LPTSTR lpszUsername,
__in_opt LPTSTR lpszDomain,
__i... | <p>As MSDN says: "In most cases, the returned handle is a primary token that you can use in calls to the CreateProcessAsUser function". There are no reasons not to believe.</p>
<p>Sample: you could write your own <code>runas.exe</code>. Call <code>LogonUser</code> with username&password from command line. Then cal... |
How to build QTcore4.dll without dependency to MSVCx80.dll? <p>I have a windows screensaver that I want to recompile using the QT libraries, so that I can make available for more platforms.
I am facing problems with the deployment on Vista and XP.</p>
<p>I compile my screensaver statically with MT, and run the depende... | <p>I think they are concerted that parts of your application will be compiled with /MD(d) and parts with /MT(d), but if you control everything (including 3rd party libraries) then its pretty safe to use /MT(d).</p>
|
cakephp with jquery .load <p>i've got a problem, i'm using cakephp and im loading into a div a page</p>
<pre><code> function loadContent(targetDiv, sourceUrl) {
$(targetDiv).empty().html('<img src="/gambu/img/ajax-loader.gif" />');
$(targetDiv).load(sourceUrl);
}
</code></pre>
<p>it work's o... | <p>Your <code>sourceUrl</code> should not contain any <code><script /></code>. They will not get executed.</p>
<p>Either move the script to the main page, or inject <code><script src=...js /></code> on the fly when you <code>.load()</code> the page.</p>
<p>By the way, <code>.live()</code> can help binding... |
Maintain file permissions when extracting from a zip file using JDK 5 api <p>I am using java.util.Zip and java.util.ZipEntry to successfully extra a zip file's contents to disk. I would like to maintain the file permissions set when extracting on a *nix file-system.</p>
<p>Can anyone point me to the "correct" way to ... | <p>I think it is actually impossible to keep the permissions correctly.</p>
<p>Permissions are very OS specific: while POSIX file permissions allow the user to set whether you can read, write or execute a file for the file owner, the group and others, the NTFS file system has a similar system but the concept for an ex... |
How can I tell what module my code is executing in? <p>
For a very long time, when I have an error handler I make it report what Project, Module, and Procedure the error was thrown in. I have always accomplished this by simply storing their name via constants. I know that in a Class you get the name programmatically wi... | <p>There are several questions here.</p>
<p>You can get the Project Name by calling App.Name
You cannot get the name of the method you are in. I recommend using the automated procedure templates from <a href="http://www.mztools.com" rel="nofollow">MZ Tools</a>, which will automatically put in all the constants you ne... |
VB.NET: If I pass a String ByVal into a function but do not change the string, do I have one or two strings in memory? <p>I know strings are immutable, so the minute you change a string reference's value .NET makes a brand new string on the heap. </p>
<p>But what if you don't <em>change</em> the value of a string ref... | <p>By the way, string interning is completely unrelated to that. The rule for passing parameters to functions is the same for all reference types (and really, all types), no matter how they are managed internally.</p>
<p>The rule is simple and you have stated it correctly: pass by value copies the <em>reference</em>, ... |
SQL Server 2000: How can I tell how many plans a stored procedure has cached? <p>Sometimes when diagnosing issues with our SQL Server 2000 database it might be helpful to know that a stored procedure is using a bad plan or is having trouble coming up with a good plan at the time I'm running into problems. I'm wondering... | <p>You can query the cache in a number of different ways, either looking at its contents, or looking at some related statistics.</p>
<p>A couple of commands to help you along your way:</p>
<pre><code>SELECT * FROM syscacheobjects -- shows the contents of the procedure
-- cache for all databases
DBCC PROCCACHE --... |
How can I hide the SiteMapPath root node on home page? <p>How can I hide the root node in a SiteMapPath control when the user is on the root node page? For example, my breadcrumb trail on a child page is:</p>
<blockquote>
<p>Home > Products > Hammers > Ball Peen</p>
</blockquote>
<p>which is fine. But when the user... | <p>One possible solution would be to simply hide the <code>SiteMapPath</code> control on the home page:</p>
<pre><code>mySiteMapPath.Visible = (SiteMap.CurrentNode != SiteMap.RootNode);
</code></pre>
|
VIM Disable Automatic Newline At End Of File <p>So I work in a PHP shop, and we all use different editors, and we all have to work on windows. I use vim, and everyone in the shop keeps complaining that whenever I edit a file there is a newline at the bottom. I've searched around and found that this is a documented beh... | <p>even if the file was already saved with new lines at the end:</p>
<p><code>vim -b file</code>
and once in vim:</p>
<pre><code>:set noeol
:wq
</code></pre>
<p>done.</p>
<p>alternatively you can open files in vim with <code>:e ++bin file</code></p>
<p>Yet another alternative:</p>
<pre><code>:set binary
:set noe... |
T-SQL User defined function overloading? <p>I understand that T-SQL is not object oriented. I need to write a set of functions that mimics method overloading in C#.</p>
<p>Is function overloading supported in T-SQL in any way? If there is a hack to do this, is it recommended?</p>
| <p>No, there is no way to do this.</p>
<p>I recommend you revisit the requirement, as "make apples look like oranges" is often difficult to do, and of questionable value.</p>
|
Adding hours to Javascript Date object? <p>It amazes me that Javascript's Date object does not implement an add function of any kind.</p>
<p>I simply want a function that can do this:</p>
<pre><code>var now = Date.now();
var fourHoursLater = now.addHours(4);
function Date.prototype.addHours(h) {
// how do I impl... | <pre><code>Date.prototype.addHours= function(h){
this.setHours(this.getHours()+h);
return this;
}
</code></pre>
<p>Test:</p>
<pre><code>alert(new Date().addHours(4));
</code></pre>
|
YUI Charts Styling <p>Through my search for a open-source charting system, I found the YUI library. So here is the question. How can I make the x-axis and y-axis transparent.</p>
<blockquote>
<p>style:
{
border: {color: 0xD0D696, size: 1},
font: {name: "Arial", size: 10, color: 0x559330},
... | <p>According to the reference, you should set the size to 0.</p>
<pre><code>xAxis: { size: 0 }, yAxis: { size: 0}
</code></pre>
<p><strong>size</strong>
A numeric value that represents the thickness of the axis itself. A value of 0 will hide the axis (but not the labels).</p>
<p>See this and other settings <a href="... |
How can I get this eval() call to work in IE? <p>I have some javascript that goes out and fetches a javascript "class" on another xhtml page. The remote javascript looks something like the following:</p>
<pre><code> (function() {
this.init = function() {
jQuery("#__BALLOONS__tabs").tabs();
... | <p>This worked with good browsers and bad ones (which means ie) :</p>
<pre><code>var code_evaled;
function eval_global(codetoeval) {
if (window.execScript)
window.execScript('code_evaled = ' + '(' + codetoeval + ')',''); // execScript doesnât return anything
else
code_evaled = eval(codetoeval... |
Catch, Handle, then Rethrow Exception? <p>I ran into an interesting dilemna today. I have a function that handles information and checks for duplicate values, then returns the next number that is not a duplicate. So, I have something like this:</p>
<pre><code>Public Function GetNextNonDuplicateNumber(NumberToCheck as... | <p>If you caught an exception and recovered from it (with your IncrementToNonDuplicate...) then there is no reason to throw an exception anymore. Code between catch and end try should just clean the resources like closing a file or datareader if you will rethrow it.</p>
<p>You could rather return a structure that cont... |
ASP.Net .Config : Saving Custom Config Sections <p>I create new config section for my web app. How could i save it when i modified runtime?</p>
| <p>You can read about <a href="http://weblogs.asp.net/scottgu/archive/2008/01/28/vs-2008-web-deployment-project-support-released.aspx" rel="nofollow">Web Deployment Projects here</a>.</p>
|
Tile Images in Silverlight Controls <p>Warning: Silverlight/WPF n00b</p>
<p>I'm just starting looking at Silverlight. It just became apparent that brushes are not tile-able in Silverlight, unlike WPF.
I'd like to tile a graphic in a grid control. The image is basically tile able per grid cell. Can a use multiple brush... | <p>Have a look at this link...</p>
<p><a href="http://www.silverlightplayground.org/post/2009/03/22/Silverlight-30-Tile-Effect-with-a-Pixel-Shader.aspx" rel="nofollow">Silverlight 3.0: Tile Effect with a Pixel Shader</a></p>
|
How do I calculate the Azimuth (angle to north) between two WGS84 coordinates in a single T-SQL query? <p><a href="http://stackoverflow.com/questions/642555/how-do-i-calculate-the-azimuth-angle-to-north-between-two-wgs84-coordinates/1050914#1050914">I found the solution for this question in C#</a>, but I can't translat... | <p>Replace ifs with CASE expressions:</p>
<pre><code> if (latitudinalDifference == 0)
{
if (longitudinalDifference != 0)
{
azimuth = Math.PI / 2d;
}
}
</code></pre>
<p>replace with:</p>
<pre><code>SELECT CASE WHEN @latitudi... |
How to take a pointer to a template function specialized on a string? <p>I was trying use a set of filter functions to run the appropriate routine, based on a string input. I tried to create matcher functions for common cases using templates, but I get a "type not equal to type" error when I try to store a pointer to ... | <p>Strings as template-value parameters are prohibited by the ISO standard.</p>
|
On Samsung Omnia, a Java MIDLet cannot connect after the GPRS connection is shut down by the phone <p>i have an Java J2ME application that does (at user request) create HttpConnections to a server. The application works properly on most phones, including Samsung Omnia.</p>
<p>The problem on this (Omnia) is that at som... | <p>Well, it turned out that it was a resource management problem. In particular, remember to close every object (input and output streams, connections, etc).</p>
|
Reference to parent node in XSD? <p>In current w3c version of XSD, is there a way to refer to parent node or child node, when defining rules for a particular node?</p>
<p>To make it more clear, can i add a rule in child node that compares the parent node value and vice versa?</p>
<p>Thanks & Regards,
Pavan. </p>
| <p>The subset of XPath used in XSD 1.1's xs:alternative is limited to the attribute axis of the current element. And I don't see what else you could use.</p>
|
How can I control IE6+jQuery+jQuery-ui memory leaks? <p>Here's a <a href="http://jsbin.com/omoya" rel="nofollow">sample page</a> with a couple datepickers. Here's the Drip result for that:</p>
<p><img src="http://www.picvault.info/images/537090308_omoya.png" alt="alt text"></p>
<p>This page leaks indefinitely in IE6s... | <p>I hate to say this, your approach is correct and professional, but I'd be tempted to just leave it.</p>
<p>The consequences of not fixing this is that IE6 users will notice their machine getting slower and slower and ultimately either crashing completely or more likely crashing IE6.</p>
<p>So what?</p>
<p>Really ... |
How to add greater than/less than to Hibernate filters <p>How can you add greater than or less than symbols to the condition on a Hibernate filter specified in the hbm.xml file?</p>
<p>I am trying to add a filter to limit the collection to a specific date range:</p>
<pre><code><filter name="limitTalksByDateRange" ... | <p>Did you try:</p>
<pre><code><filter name="limitTalksByDateRange" condition="talkstart &gt;= :tstart and talkstart &lt;= :tend" />
</code></pre>
<p>Note the <code>&gt;</code> and <code>&lt;</code> instead of the <code>></code> and <code><</code>.</p>
<p>Also, the <a href="http://docs.jb... |
Force all asp.net requests to a single page? <p>Let me state off the bat that I'm not that familiar with ASP.Net MVC, and I don't think I have time for this project to become familiar and switch.</p>
<p>I'm building a website where there's only one physical page, mysite.com/default.aspx. If a user browses to mysite.co... | <p>What you're talking about is called URL rewriting and yes, an ASP.Net forms application is capable of it. This entry seems to explain the technique fairly well here:</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx" rel="nofollow">http://weblogs.asp.net/sco... |
IMAGE_CAPTURE Intent never returns to onActivityResult(int, int, Intent); <p>I start an <code>IMAGE_CAPTURE</code> Intent like this, and my activity's <code>onActivityResult()</code> get called:</p>
<pre><code>Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null);
i.putExtra("return-data", tru... | <p>I think "file:/MyTestFile" is an incorrect uri. Try something like that:</p>
<pre><code>File f=new File(Environment.getExternalStorageDirectory(), "MyTestFile");
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(f));
</code></pre>
<p>The actual path would be "/sdcard/MyTestFile".</p>
|
Why do I need setuid(0) within a setuid-root C program that calls an administrative program with system()? <p>I had to do a dirty Linux hack for somebody so they could start a printer with the <code>cupsenable printername</code> shell command while being a non-root user. I didn't want them to be able to use the entiret... | <p>From <code>man system</code>:</p>
<blockquote>
<p>Do not use <code>system()</code> from a program with set-user-ID or set-group-ID privileges, because strange values for some environment variables might be used to subvert system integrity. Use the <code>exec(3)</code> family of functions instead, but not <code>e... |
Why does the sql select statement fail? <p>In the scenario below, the final select from the Combine view fails, any ideas why? </p>
<p>The Subset table does not have a row that corresponds to the one in MasterCodes that wouldn't cast to an integer value.</p>
<pre><code>CREATE TABLE MasterCodes (
ID INT
, Code VARC... | <p>Probably because in some row, M.Code contains the literal word "three", and the view is trying to cast a non-numeric looking word into an int (you can probably cast "3" into an int, but not "puppy" or "three", etc.).</p>
<p>Edit: Added a comment, but worthwhile to add it here. SQL Server is going to try and execu... |
VS 2008 C++ how to make a project without .net dependency <p>I am writing a plain vanilla c++ console app using VS 2008. When I create the project, the IDE gives me a choice of .net versions. There is no option for 'none'. When I look at the project properties page, the Targeted Framework has whatever value I chose and... | <p>How are you creating the project? If I start Visual Studio 2008 and go File / New / Project... / Other languages / Visual C++ / Win32 / Win32 Console Application, I get a plain old C++ project with no .net dependency.</p>
|
Install a custom ASPX file as part of a ListTemplate definition <p>I am using VSeWSS 1.3 to <strong>create a custom list definition</strong> scoped to 'Site'.</p>
<pre><code> <Elements Id="8924acef-84ef-4584-ade4-e3eaeb8df345" xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate Name="MyListD... | <p>You should also have a schema.xml and in the schema.xml there should be something like this:</p>
<pre><code><Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx... |
SharpZipLib ~ File Version <p>How do I get the version attribute of a file?</p>
<p>I tried the "Version" prop but it gives me the same number for all files</p>
<p>My Code:</p>
<pre><code> while (getNextEntry)
{
ZipEntry entry = inStream.GetNextEntry();
getNextEntry = (entry != null);
if (getNextEntry... | <p>Use <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo.getversioninfo.aspx" rel="nofollow">FileVersionInfo.GetVersionInfo</a>.</p>
|
Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project <p>When creating a new Java project in IntelliJ IDEA, the following directories and files are created:</p>
<pre><code>./projectname.iml
./projectname.ipr
./projectname.iws
./src/
</code></pre>
<p>I want to configure IntelliJ IDEA to include my d... | <p>Steps for adding external jars in IntelliJ IDEA:</p>
<ol>
<li>Click File from File menu</li>
<li>Project Structure (<kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>ALT</kbd> + <kbd>S</kbd> on Windows/Linux, <kbd>â</kbd> + <kbd>;</kbd> on Mac OS X)</li>
<li>Select Modules at the left panel</li>
<li>Dependencies tab</li>... |
Column width of a DataGrid in a Windows Mobile Application <p>I'm having problems trying to adjust the width of a column of a datagrid. I used the answer posted <a href="http://stackoverflow.com/questions/859464/what-is-the-datagrid-mappingname-for-a-non-datatable-datasource">here</a>, but I can't solve it.</p>
<p>I'm... | <p>Change this line</p>
<pre><code>tableStyle.MappingName = lista.GetType().ToString();
</code></pre>
<p>to</p>
<pre><code>tableStyle.MappingName = lista.GetType().Name;
</code></pre>
<p>Oh, and 4000 is a little big for a mobile but I assume that's a typo.</p>
|
Handling error messages using asp.net <p>I've an asp.net page having a server side submit button and 2 textboxes which accept only numeric values.Am also using asp.net validation controls.</p>
<p>If the user types in non-numeric data in both the textboxes, how do i show only 1 error message on the page saying:
"Only n... | <p>Well obviously you'll need to do this with javascript.</p>
<p>I don't know the exact javascript methods to check if input is numeric, I'm guessing you can use a regex. But you could have a hidden div such as</p>
<pre><code><div id="numericErrorMessage" class="error" style="display:none;">
Numeric Va... |
Installing a Total instance for Performance Counters <p>VS 2005, C# 2.0, .NET 2.0/3.0, Win2003</p>
<p>I'm trying to install a set of performance counters for a MultiInstance. I noticed that some system performance counter categories manage to keep a "<strong>total</strong>" alive even when there are no other instances... | <p>Some code has to be actively maintaining the counter. In all the instances you can think of, such as ASP.Net, there is a service keeping the counter up.</p>
<p>As you aren't happy with having a _Total instance only active while some instance of your app is running, <strong>you have to write some code that will main... |
Should I Use a Framework While Learning Web Development <p>I realize that this may be subjective but I truly need an answer to this and I can't seem to find anything close enough to it in the rest of the Forum. I have read some folks say that the framework (any MVC framework) can obscure too many things while others s... | <p><strong><em>I think web development is way more than anyone grasps when they first start getting into it! Read this and know that it is all optional...but required to be really good at what you do.</em></strong></p>
<p>I suggest that you spend time learning your language first. I would suggest learning C# simply ... |
Which IPhone control would be better? <p>I have a situation in which user can single tap a control, which show random images, to peek under it, double tap to mark it, or drag it to a box where it snaps to the box if more than half of its body is inside box.</p>
<p>I was using UIbuttons (with background image) before a... | <p>Yes, it's possible with UIImageView - you can implement the various touch methods just as easily on any UIView descendant, which includes UIImageView.</p>
|
Dictionary class <p>Is it possible to have multiple values, for a single key, in the Java dictionary class?</p>
| <p>First, regarding the dictionary class: That class is considered obselete, the documentation recommends using Map instead.</p>
<p>This kind of collection you are seeking is called a multimap.
You could implement one yourself with a list, but that is tedious.</p>
<p>You may want to use a MultiMap from either Apache ... |
iPhone SDK 3.0 in-app email - changing navigation bar tint color <p>My App uses the iPhone SDK 3.0's new in-app email feature.</p>
<p>I want to change the tint color of the email UI to black and make it translucent.</p>
<p>I tried the following code,</p>
<pre><code>/*
picker.navigationController.navigationBar.tintCo... | <p>Since the MFMailComposeViewController is a subclass of UINavigationController, simply do this:</p>
<pre><code>[[picker navigationBar] setTintColor:[UIColor redColor]];
</code></pre>
|
How to call a .NET Webservice from Android using KSOAP2? <p>I have a problem while calling a webservice. I have a .NET web service on the server, and I am using KSOAP2 (ksoap2-j2se-full-2.1.2) in Android. While running the program I got an runtime exception like "org.ksoap2.serialization.SoapPrimitive". What should I d... | <p>It's very simple. You are getting the result into an <code>Object</code> which is a primitive one.</p>
<p>Your code: </p>
<pre><code>Object result = (Object)envelope.getResponse();
</code></pre>
<p>Correct code: </p>
<pre><code>SoapObject result=(SoapObject)envelope.getResponse();
//To get the data.
String re... |
What is wrong with this clone()? <p>I have written this clone method for when the parent of the Employee class is abstract and the clone() method in the parent class is abstract.I wanted to copy the primitive data type of the Employee's object with this code instead of copying each primitive data type individually, but... | <p>The standard pattern for making a class cloneable is:</p>
<ol>
<li>Implement <code>Cloneable</code></li>
<li>Override the <code>clone()</code> method and make it public</li>
<li>In <code>clone()</code> call <code>super.clone()</code> and then copy any mutable object's state</li>
</ol>
<p>You should <strong>not</s... |
How to create a message box with tkinter? <p>I've been trying to build a fairly simple message box in tkinter that has "YES" and "NO" buttons. When I push the "YES" button internally it must go and write YES to a file. Similarly, when "NO" is pushed, NO must be written to a file. How can I do this?</p>
| <p>You can use the module <a href="http://infohost.nmt.edu/tcc/help/pubs/tkinter/dialogs.html#tkMessageBox" rel="nofollow">tkMessageBox</a> for Python 2.7 or the corresponding version for Python 3 called <code>tkinter.messagebox</code>.</p>
<p>It looks like <code>askquestion()</code> is exactly the function that you w... |
How can I bind a DataGrid to a DataSet returned by a web service? <p>I am making a RIA application using Silverlight and web services. The method of a web service returns a DataSet (a classic ASP.NET DataSet which is found in <code>system.data</code>).</p>
<p>How can I bind a DataGrid of Silverlight with the DataSet w... | <p>Dataset is not supported in SL. If You have fixed datasource then you can create data contract (property class) and transfer data by observable collection which you can easily bind with your datagrid.</p>
<p>But if you want something generic which you would like to bind with your SL Datagrid then in that case you h... |
How do I Emulate/Debug Windows CE 5.0 applications in C#? <p>Here's my problem. I'm currently trying to develop a .Net Compact Framework 2.0 application (in C#) to a Windows CE 5.0 device. </p>
<p>Firstly: How do I debug/emulate the application in Visual Studio 2008 ? I doesn't mean debugging an application already de... | <p>You have a few options. One would be to install the Emulator BSP, roll your own emulator image, build a custom SDK and install it, then debug targeting that emulator. It's fairly simple to do. </p>
<p>That said, I still wouldn't do it. A far better option is to just go buy a cheap WinCE device like an <a href="... |
How to trigger onclick function when user inputs keywords? Jquery <p>I have an input box</p>
<pre><code><input type="text" name="search" id="search" />
<img src="icon.png" alt="" id="doSearch" />
</code></pre>
<p>I use Jquery and I have onclick event for "doSearch". So when I enter some words like "ab" ..... | <p>Something like that?</p>
<pre>
$('#doSearch').keyPress(function(e){
if($(this).val()=='??') $('#doSearch').trigger('click')
});
</pre>
|
Geolocation assisted ATM monitoring <p>we would like to write a web based application to monitor the ATM machines in the bank to have the following functionality:</p>
<ul>
<li>Display location of each terminal</li>
<li>Display general status of the<br />
terminal in color coding or simple<br />
icon (ATM up/Down/needs... | <p>I would suggest using <a href="http://code.google.com/apis/maps/" rel="nofollow">Google's Maps API</a>, it uses a UI familiar to many people online and it can be customized as you see fit.</p>
<p><strong>Advantages</strong></p>
<ul>
<li>Easy to use.</li>
<li>Easy to develop.</li>
<li>Familiar UI.</li>
<li>Very cus... |
Javascript parser for simple expression <p>I would like to find a javascript parser that can handle and evaluate simple expressions. The parser should be able to evaluate the regular mathematical expressions, and support custom functions with parameters. It also has to support strings handling. String concatenation wit... | <p>I have a modified version of an <a href="http://www.undefined.ch/mparser/index.html">ActionScript parser</a> (written in AS, not parses AS) that supports custom functions, but not strings. It would probably be easy to add string support though. I'll upload it somewhere so you can get it at <del><a href="http://silen... |
Custom command line utility. How? <p>Recently, I've released an open-source class - wrapper of API functions available from one of the leading SMS gateway, which provides an HTTP-API access to send an SMS messages.</p>
<p>Now I want to make a custom command line utitity, which can be available for user anywhere in the... | <p>Make sure you have the PHP CLI package installed. On my Ubuntu VPS I had to run:</p>
<pre><code>$ apt-get install php5-cli
</code></pre>
<p>Check that it's installed:</p>
<pre><code>$ /usr/bin/php -v
</code></pre>
<p>Then, create a file called something like <code>sendsms.php</code> with contents similar to this... |
Checking if number is even by looking at the last bit - are there any other "tricks" like this one? <p>Recently I discovered, that if I need to see if variable is even ( or odd ), I could just see if last bit of variable equals 0. This discovery, when implemented, replaced few <em>modulo 2</em> calculations and thus, w... | <p>I doubt that replacing the use of modulo-two calculations by the equivalent bitwise operation produced faster execution times. Any C++ compiler worth its grain of salt will compile <code>n % 2</code> and <code>n & 1</code> to identical machine instructions.</p>
<p>Beware of using bit-twiddling hacks as an optim... |
java.io.IOException: Invalid Keystore format <p>Does anyone know how to solve this?
I tried many things, but none of them worked.</p>
<p>And when I click more details I get this:</p>
<pre><code>at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source)
atsun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown... | <p>You may corrupt the file during copy/transfer.</p>
<p>Are you using maven?
If you are copying keystore file with "filter=true", you may corrupt the file.</p>
<p>Please check the file size.</p>
|
Problems using $.getJSON <p>I'm calling the following URL using YQL</p>
<pre><code>http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22UTG.L%22)%0A%09%09&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=cbfunc
</code></pre>
<p... | <p>You'll have to replace your callback parameter (currently <code>cbfunc</code>) in the URL with <code>?</code>. jQuery will automatically replace the <code>?</code> with a correct callback.</p>
<pre><code>$.getJSON(
"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symb... |
ecommerce dynamic breadcrumb best practice - How Do you do yours? <p>I am looking for a best practice to provide users of my ecommerce website with a breadcrumb trail.</p>
<p>Current Site Setup:</p>
<p>ASp.net 3.5
SQL express 2005 DB</p>
<p>DB Table Setup:</p>
<p>[Category] - ID, parentid, name etc
[Product] - ID c... | <p>There is this <a href="http://msdn.microsoft.com/en-gb/magazine/cc163657.aspx" rel="nofollow">artictle</a> which may help with creating the sql provider that you can use with the default breadcrumb in asp.net. It also has sql caching for a speadier response too.</p>
|
How can I convert a Perl regex with named groups to Python? <p>I am trying to convert the following Perl regex I found in the <a href="http://search.cpan.org/dist/Video-Filename" rel="nofollow">Video::Filename</a> Perl module to a Python 2.5.4 regex to parse a filename</p>
<pre><code># Perl > v5.10
re => '^(?:(?... | <p>There are 2 problems with your translation. First of all, the second mention of <code>openb</code> has extra parenthesis around it making it a <a href="http://perldoc.perl.org/perlre.html#%27%28?%28condition%29yes-pattern|no-pattern%29%27" rel="nofollow" title="Perl RE conditional expression documentation">condition... |
How to show different view sections in an object oriented way <p>I'm developing a website in ASP.NET MVC where I would like to show different sections of a view for users with different security levels. In essence, the views are the same, but users with higher levels of security must be able to see sections that should... | <p>Depending on the complexity of what you are doing, the if statement route may be sufficient. If not, then you could look at using partial views and write an HtmlHelper extension that allow you to render a partial based on a particular role. It might look something like this:</p>
<pre><code><% Html.RenderPartia... |
How can I generate ASP.NET MVC URLs inside a unit test project? <p>How can I generate the URLs corresponding to the controller, action, and parameters (for a given ASP.NET MVC project) in another project (a class library used for testing)?</p>
<p>All I have found so far is <strong>HtmlHelper.GenerateRouteLink</strong>... | <p>Try this:</p>
<pre><code>var routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
var context = new Mock<HttpContextBase>();
var urlHelper = new UrlHelper(new RequestContext(context.Object, new RouteData()), routes);
var url = urlHelper.Action("action", "controller", new { id = ... });
</... |
Does "insert" in SQLite return SQLITE_OK or SQLITE_DONE? <p>What does statement "insert" in SQLite return in case of success?</p>
<p>I always believed that it should be SQLITE_DONE, but recently in my logs I found out the following string:</p>
<pre><code>sqlite3_step error: 'not an error'
</code></pre>
<p>And here i... | <p>SQLITE_DONE</p>
<p><a href="http://www.sqlite.org/c3ref/step.html">http://www.sqlite.org/c3ref/step.html</a></p>
<p>You could also try printing out the error code to find out what the problem is.</p>
|
file put contents with array <p>I am using <code>file_put_contents($file, $data);</code> function for putting contents in file, because these files are created on fly with name of sessions, <strong>$data</strong> is an multi-dimensional array, when i am echoing array it prints out fine but in file no contents get recor... | <p>You want to <code>serialize()</code> the array on writting, and <code>unserialize()</code> after reading the file.</p>
<pre><code>$array = array('foo' => 'bar');
file_put_contents('foo.txt', serialize($array));
$array = unserialize(file_get_contents('foo.txt')));
</code></pre>
<p>Oh, and I really don't now how ... |
How to retrieve current object from collections using DataBinder.Eval? <p>I am retrieving Objects from a collection and assigned objects and objects within objects to web user control from hosting web page.</p>
<pre><code><uc1:bookmarksList runat ="server" Link =<%#DataBinder.Eval(Container.DataItem, "OLinks... | <p><strong>Eval</strong> or <strong>Bind</strong> methods already gets the current object of a collection. You're probably using Eval function in a databound control. Your databound control loops your collection and each loop it gets the current item of the collection. You should eval a property of your control in your... |
LoadLibrary() error code 127 <p>I'm having trouble with LoadLibrary() and getting an error that doesn't make sense to me:</p>
<pre><code> ::SetLastError(0);
m_hDll = ::LoadLibrary(szName);
if (m_hDll == NULL) // Failure to load the DLL.
{
DWORD err = GetLastError();
}
</code></pre>
<p>The error ... | <p>Let's take this step by step:</p>
<ol>
<li><p>The error message means that the dll was found but a required function is missing. (Jitter is right.) This implies that you have the dll you need, but not the right version. (Davefiddes is right, although the problem can be any dll, not just the Microsoft runtime lib... |
Help with the WPF TextCompositionManager events <p>The docs on this are pretty shoddy. There are a number of events you can hook into to monitor and take control of text input that are accessed via the <strong>TextCompositionManager</strong>. If you're wanting to do something like snag card swipe data, this is where ... | <p>The differences between them depend on what type of character you're typing.</p>
<ul>
<li><em>Standard key:</em> printable characters like 'a', 'A', '5', '%', Backspace, and so on.</li>
<li><em>Control key:</em> Ctrl+C, Ctrl+H, Ctrl+M, etc.</li>
<li><em>Decimal key code:</em> things like Alt+numpad 2 5 5 (for IBM e... |
Siverlight setup issue <p>If I just deploy Siverlight application (eithre ASP.Net page or Html page uses XAP files) on Server, no need to develop. On Server side, do I need to install anything?</p>
<p>I have two scenarios,</p>
<ol>
<li>Using Windows Server 2003;</li>
<li>Using Windows Server 2008.</li>
</ol>
<p>than... | <p>You won't need to install anything, just deploy the files. However, if you're on IIS 6 (such as the Server 2003 scenario), you do need to register the MIME type for XAP files (see <a href="http://www.dolittle.com/blogs/einar/archive/2008/07/07/registering-xap-mime-type-in-iis-6-0.aspx" rel="nofollow">here</a> for h... |
What are the common practices for notifying a user of invalid input? <p>In my company, I've seen several approaches for notifying a user when their input is invalid (our validation is generally done when the user clicks some form of a "Submit" button). </p>
<p>Here are the most common approaches I've seen:</p>
<ul>
<... | <p>Using <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.idataerrorinfo.aspx" rel="nofollow">IDataError</a>, you can combine the two first approaches, since it both allows you to provide an error for individual controls, but also an aggregate error message for the entire view.</p>
<p>In some cas... |
Regular Expressions ~ convert UNC to URL <p>I'm looking for a nice tight regex solution to this problem. I'm looking to reformat an UNC into a Uri</p>
<p>Problem:</p>
<p>UNC directory needs to be reformatted into a Uri</p>
<p><strong>\\server\d$\x\y\z\AAA</strong></p>
<p>needs to look like:</p>
<p><strong><a href... | <p>I think a replace is easier to write and understand than Regex in this case. Given:</p>
<pre><code>string input = "\\\\server\\d$\\x\\y\\z\\AAA";
</code></pre>
<p>You can do a double replace:</p>
<pre><code>string output = String.Format("http:{0}", input.Replace("\\d$\\x\\y", String.Empty).Replace("\\", "/"));
<... |
Thousands of new 0 size objects being added to my net total every second, should I be worried? <p>I have just finished ridding my project of leaks, but there are still thousands of objects under the category "GeneralBlock-0". The number of net allocations is through the roof (its approaching a million as I type) but no... | <p>Assuming you can duplicate the behavior under the Simulator, check to make sure your application's RSIZE is not also increasing using 'top -u' in a Terminal.</p>
<p>This is most likely because QuartzCore has implemented its own allocator and allocation zone, but has not fully hooked into the statistics gathering me... |
Which kind of Tomcat 6 to install <p>Each of the Tomcat 6 distros (binary core, binary deployer and source) is available as a zip file and a tarball. But binary core also has a Windows Service Installer option. What's the difference between that and the zip file? All I've been able to figure out so far is that the s... | <p>I think the difference is that the Windows installer will create a Tomcat service that you'll be able to stop and start in the service admin UI. </p>
<p>If you just want to start and stop in a command shell as needed, use the ZIP.</p>
|
How to get Max String Length in every Column of a Datatable <p>I have a DataTable object. Every column is of type string.</p>
<p>Using LINQ, how can I get the maximum string length for every column?</p>
| <p>The maximum string length for the whole table (assuming at least one non-null value there, otherwise, <code>Max</code> will throw an exception):</p>
<pre><code>int maxStringLength = dataTable.AsEnumerable()
.SelectMany(row => row.ItemArray.OfType<string>())
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.