input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
java ee | ejb3 | runtime dispatch <p>I would like to call an ejb3 at runtime. The name of the ejb and the method name will only be available at runtime, so I cannot include any remote interfaces at compile time.</p>
<pre><code>String bean = 'some/Bean';
String meth = 'doStuff';
//lookup the bean
Object remoteInterfac... | <p>ejb3 calls use RMI. RMI supports remote class loading, so i'd suggest looking into that.</p>
<p>also, JMX mbeans support fully untyped, remote invocations. so, if you could use mbeans instead of session beans, that could work. (JBoss, for instance, supports ejb3-like mbeans with some custom annotations).</p>
<p... |
Is there a guide to path referencing in PHP? <p>I know how to include files that are in folders further down the heirachy but I have trouble finding my way back up.
I decided to go with the set_include_path to default all further includes relative to a path 2 levels up but don't have the slightest clue how to write it ... | <p>I tend to use <strong><a href="http://uk3.php.net/dirname" rel="nofollow">dirname</a></strong> to get the current path and then use this as a base to calculate all future path names.</p>
<p>For example,</p>
<pre><code>$base = dirname( __FILE__ ); # Path to directory containing this file
include( "{$base}/includes/... |
With wicket where does hibernate.cfg.xml file go? <p>I'm new to Wicket and Hibernate and can't get past the "org.hibernate.HibernateException: /hibernate.cfg.xml not found" error. I've put that file in every location imagineable but I'm still stuck. Where exactly does that file go and/or am I missing a wicket file conf... | <p>Ensure hibernate.cfg.xml file placed in classpath.</p>
|
Excel: 'Unable to set the Calculation property of the Application class' <p>I'm trying to automate some stuff in MS Excel. When I try to set the Calculation property I get the following error message: 'Unable to set the Calculation property of the Application class'</p>
<p>I believe this property should be settable.</... | <p>Googling produces this suggestion:</p>
<p>You need to have a open workbook, ie</p>
<pre><code>xl.Workbooks.Add
xl.Calculation = xlCalculationManual
</code></pre>
|
Without creating a list, how can I query the integers between two values in Prolog? <p>For example, if I make a query like 'between(1,4,X)?' I would expect something like X=2,X=3. Is this possible?</p>
| <pre><code> between(A,B,X):-X is A+1,X<B.
between(A,B,X):-A2 is A+1,A2<B-1,between(A2,B,X).
</code></pre>
|
ASP.NET v1.1 Could not load type TBRWEB.frmLogin <p>I have a web app that I wanted copy to a new project.</p>
<p>I created the new app with VS2003 and copied across the web forms, config, global asa, etc. and made sure IIS says it is a web app.</p>
<p>However, I still get this error when I run the app using IE from V... | <p>These error normally occurs if the .aspx page or the Global.asax page contains a reference to a code-behind module and if the application has not been built.</p>
<p>Look in your project settings and check the value of the <strong>default namespace</strong> (in the application section).</p>
<p>Then check the <stron... |
How can I get Html.CheckBox() as boolean during POST in custom IModelBinder? <p>I am using <code>Html.CheckBox()</code>. The resulting HTML is:</p>
<pre><code><input id="IsMultiGraph" name="IsMultiGraph" value="true" type="checkbox">
<input name="IsMultiGraph" value="false" type="hidden">
</code></pre>
<... | <p>One way is to use the <code>GetValues</code> method of the <code>NameValueCollection</code> class in order to get the first value of the array property like this:</p>
<pre><code>bindingContext.HttpContext.Request.Form.GetValues("IsMultiGraph")[0]
</code></pre>
|
Castle MonoRail & ELMAH <p>Is anyone using Castle MonoRail and ELMAH with success?</p>
<p>We are using a number of Resuces to present users with friendly error messages, but if we do this the exceptions never get as far as ELMAH as the MonoRail rescue intercepts them.</p>
<p>Ideally we want the user to see the rescue... | <p>After looking at the links Macka posted, I wrote this simple monorail exception handler:</p>
<pre><code>public class ElmahExceptionHandler : AbstractExceptionHandler {
public override void Process(IRailsEngineContext context) {
ErrorSignal.FromCurrentContext().Raise(context.LastException);
}
}
</cod... |
How do I get rid of TagExtraInfo JSTL warning in Eclipse? <p>I'm working with JSTL in Eclipse, using the WTP. I have jstl and standard.jar in my WEB-INF/lib directory, and everything works. Eclipse is giving me this warning in my JSP:</p>
<p>The TagExtraInfo class for c:forEach (org.apache.taglibs.standard.tei.ForEa... | <p>Add the standard.jar from the web-inf directory to your build path jars.</p>
|
ASP.NET MVC on IIS 6 - wildcard mapping - the incoming request does not match any route <p>I have been trying to set up my Beta 1 MVC app on IIS 6 and cannot get it to run correctly. I have added a Wildcard mapping to the .net isapi DLL as suggested in other blog posts but get the following error when I access the root... | <p>Here's what I did to get extensionless URLs working with IIS 6 and ASP.NET MVC Beta 1.</p>
<ul>
<li>Create a default ASP.NET MVC Beta
project and compile it.</li>
<li>Create a new IIS website pointing to
the application directory.</li>
<li>In the IIS properties for the
website, click the HomeDirectory
tab.</li>
<li... |
import mechanize module to python script <p>I tried to import mechanize module to my python script like this,</p>
<p>from mechanize import Browser</p>
<p>But, Google appengine throws HTTP 500 when accessing my script.</p>
<p>To make things more clear, Let me give you the snapshot of my package structure,</p>
<pre><... | <p>The mechanize main page says:</p>
<blockquote>
<p>mechanize.Browser is a subclass of mechanize.UserAgentBase, which is, in turn, a subclass of urllib2.OpenerDirector</p>
</blockquote>
<p>My understanding is that urllib2 is one of the sandboxed modules in GAE, with its functionality being replaced by the Google-p... |
mvc framework for winforms .net <p>Please suggest a good MVC framework for Winforms.</p>
| <p><a href="http://www.codeplex.com/CompositeWPF" rel="nofollow">http://www.codeplex.com/CompositeWPF</a> (MVC application block for WPF/Silverlight)</p>
<p><a href="http://blogs.msdn.com/priozersk/archive/2008/11/04/mobile-mvc-framework-part-4-passing-data-between-controllers.aspx" rel="nofollow">http://blogs.msdn.co... |
std::wcout to console window in XCode <p>In an XCode project, if I use <code>std::cout</code> to write to the console the output is fine.</p>
<p>However, if I use <code>std::wcout</code> I get no output.</p>
<p>I know that this is a thorny issue in C++, and I've been googling around to try and find a specific solutio... | <p>std::wcout should work just like std::cout.</p>
<p>The following works fine on my MAC:</p>
<pre><code>#include <iostream>
int main()
{
std::cout << "HI" << std::endl;
std::wcout << L"PLOP" << std::endl;
}
</code></pre>
<p>Maybe (though some code would have been nice) its bec... |
_configthreadlocale and localeconv <p>As we all know, global data, like the locale settings affecting the numeric decimal point printf() and strtod() are using, is evil. Fortunately, MSVC++ 9 allows to use per-thread locales by a <code>_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)</code> call. Unfortunately, it seems ... | <p>Despite the suggestion that this is expected behaviour from rubenvb, this is actually a bug that I ran into a while ago. I suspect rubenvb misread this part of the question:</p>
<blockquote>
<p>Unfortunately, it seems that the localeconv() function does not notice this and still returns the global locale settings... |
How do you connect/retrieve data from a MYSQL database using objects in PHP? <p>Generally I connect and retrieve data using the standard way (error checking removed for simplicity):</p>
<pre><code>$db = mysql_select_db("dbname", mysql_connect("host","username","passord"));
$items = mysql_query("SELECT * FROM $db");
w... | <p>Since version 5.1, PHP is shipped with the PDO driver, which gives a class for prepared statements.</p>
<pre><code>$dbh = new PDO("mysql:host=$hostname;dbname=$db", $username, $password); //connect to the database
//each :keyword represents a parameter or value to be bound later
$query= $dbh->prepare('SELECT * F... |
Server monitoring and alerting software? <p>What software does everyone use to monitor hardware? I know about nagios and cacti, but does anyone use any other software?</p>
| <p><a href="http://www.solarwinds.com/products/ipmonitor/" rel="nofollow">SolarWinds IPMonitor</a> is pretty useful. A bit like cacti or nagios, but more pleasing to the eye. Windows only, and not free (not even as in "free beer"), though. ;-)</p>
|
Is there an OpenID 2.0 plugin for Symfony? <p>I am using sfOpenID plugin for Symfony, which doesn't support OpenID 2.0. That means, for example, that people using Yahoo! OpenID can't login to my site.</p>
<p>There is an OpenID 2.0 plugin that works with sfGuard, but I am not using nor planning to use sfGuard. Plus, it... | <p>I think you've covered all your options with sfOpenID and taOpenIDsfGuardPlugin for Symfony's plugins.</p>
<p>Without studying OpenID's specs in detail though, you could try one of those PHP libraries (<a href="http://wiki.openid.net/Libraries">http://wiki.openid.net/Libraries</a>) by dropping it in your lib and co... |
Is there a way to measure parse time in PHP? <p>Optimization of PHP code via runtime benchmarking is straight forward. Keep track of $start and $end times via microtime() around a code block - I am not looking for an answer that involves microtime() usage.</p>
<p>What I would like to do is measure the time it takes P... | <p>Yes. There is.</p>
<pre><code><?php return; rest of the code ?>
</code></pre>
<p>or</p>
<pre><code><?php whole code; $%^parse erorr!@! ?>
</code></pre>
<p>and then compare time of running empty script</p>
<pre><code>time php empty.php
</code></pre>
<p>with time it takes to run (or fail) regular scr... |
Multi file upload with PHP/Javascript and no flash <p>I'm trying to make a webpage that allows the uploading of multiple files at the same times. I will limit the file extensions to the most common images like JPG, JPEG, PNG and GIF.</p>
<p>I've done some research on this and everywhere I look it's flash this and flas... | <p>You can keep adding 'file' inputs but use a name of something like 'upload[]'</p>
<pre><code><input type="file" name="upload[]">
</code></pre>
<p>Then in $_FILES['upload'] you will have an array of files you can loop over like </p>
<pre><code>foreach ($_FILES['upload'] as $file) {
echo $file['size'];
}
... |
How can I place a MFC CFormView inside a CDockablePane? <p>How can I place a MFC CFormView inside a CDockablePane which was introduced in the VS 2008 MFC Feature Pack?</p>
| <p>Check the <a href="http://www.bcgsoft.com/samples/docview.htm" rel="nofollow">BCGSoft</a> Samples for doing this with a cview. The class names are a little different but its more or less the same stuff since they provided CDockablePane to Microsoft.</p>
|
iPhone UIwebview with embedded quicktime video? <p>When I load a HTML page with a .MOV embedded video on my App using a UIWebview it appears a broken icon, any idea? The same HTML page on Iphone Safari works fine and the media player is started without problem...</p>
| <p>Where is the webpage? Is it embedded in your app? If you not giving the UIWebView a URL to load it from the server where it is make sure you set the baseURL properly so that the webview knows how to handle handle relative URLs.</p>
|
Preventing Duplicate Inserts Into SQL With PHP <p>I'm going to running thousands of queries into SQL and I need to prevent the duplication of field 'domain'. Never had to do this before and any help would be appreciated.</p>
| <p>You probably want to create a "UNIQUE" constraint on the field "Domain" - this constraint will raise an error if you create two rows that have the same domain in the database. For an explanation, see <a href="http://www.w3schools.com/sql/sql_unique.asp" rel="nofollow">this tutorial in W3C school</a> -</p>
<p><a hre... |
Level of database rebuilding in a daily build routine <p>I am in the process of designing a daily build routine for my project. We are using Flex 3 and SQL Server 2005. I am unsure to what degree I should be rebuilding the database on a daily build. Should I be dropping all tables and stored procedures and adding th... | <p>This really depends on your current stage of project development. </p>
<p>While in active development without any production deployments the simple thing to do is just drop and re-create your database every time. This way your code and database should be in sync, especially if you are doing unit testing. This is... |
How to develop *real life* oop skills? <p>I've been studying OOP for quite a while now and I have a good grasp of the theory. I read the <a href="http://rads.stackoverflow.com/amzn/click/0596008678">Head First</a> book on OOP and, while it reinforced a lot of the theory, I found the case studies to be somewhat trivial... | <p>Read <a href="http://rads.stackoverflow.com/amzn/click/0201485672">Refactoring</a> by Martin Fowler, and apply it to your own work.</p>
<p>It will take you through a litany of malodorous characteristics of software code that describe how to detect improperly constructed classes, and even more importantly, how to fi... |
How can I override the OnBeforeUnload dialog and replace it with my own? <p>I need to warn users about unsaved changes before they leave a page (a pretty common problem). </p>
<pre><code>window.onbeforeunload=handler
</code></pre>
<p>This works but it raises a default dialog with an irritating standard message that w... | <p>You can't modify the default dialogue for <code>onbeforeunload</code>, so your best bet may be to work with it.</p>
<pre><code>window.onbeforeunload = function() {
return 'You have unsaved changes!';
}
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/ms536907%28VS.85%29.aspx">Here's a referenc... |
Is it possible to get a list of added or deleted files from Subversion? <p>I want to retrieve a list of the files that has been added or deleted from our Subversion repository over, for example, the last month.</p>
<p>I'd prefer to have the file names, and not just a count.</p>
<p>Is this possible from the Subversion... | <p>I don't think you can do it with just the command-line tools, but outputting it with an XML format and doing some grepping or filtering would probably give you what you want.</p>
<p>Try this for a start:</p>
<pre><code>svn log -v --xml | grep 'action="[A|D]"'
</code></pre>
|
Making an Image Greyscale with GD Library <p>My mission is to create a little app where you can upload a picture, and the app will turn it into ASCII art. I'm sure these exist already but I want to prove that I can do it myself.</p>
<p>This would involve taking an image, making it greyscale and then matching each pixe... | <p>As pointed out by <a href="http://stackoverflow.com/users/9021/nickf">nickf</a> in his <a href="http://stackoverflow.com/questions/276780/making-an-image-greyscale-with-gd-library#276811">comment</a>, the simple formula <code>(pixel.r + pixel.g + pixel.b) / 3</code> is not correct. Use the GD-included function <code... |
How would I express this Scheme function more clearly? <pre><code>(define (repeated f n)
if (= n 0)
f
((compose repeated f) (lambda (x) (- n 1))))
</code></pre>
<p>I wrote this function, but how would I express this more clearly, using simple recursion with repeated?</p>
<p>I'm sorry, I forgot to define my c... | <p>I'm assuming that (repeated f 3) should return a function g(x)=f(f(f(x))). If that's not what you want, please clarify. Anyways, that definition of repeated can be written as follows:</p>
<pre><code>(define (repeated f n)
(lambda (x)
(if (= n 0)
x
((repeated f (- n 1)) (f x)))))
(define (squ... |
ASP.NET MVC and Ajax <p>From what I've read about ASP.NET MVC, it appears it requires posting to work, is there any working example (With source available) of a ASP.NET MVC website that has no postbacks with the help of Ajax?</p>
<p>(I checked the related questions earlier but couldn't find what I was looking for)</p>... | <p>This is from Preview 4...</p>
<p><a href="http://www.hanselman.com/blog/ASPNETMVCPreview4UsingAjaxAndAjaxForm.aspx" rel="nofollow">http://www.hanselman.com/blog/ASPNETMVCPreview4UsingAjaxAndAjaxForm.aspx</a></p>
<p>With jquery</p>
<p><a href="http://weblogs.asp.net/mikebosch/archive/2008/02/15/asp-net-mvc-submitt... |
Detect another host with the same MAC address <p>How can I detect if another host is using the same MAC address as the current host, e.g. because the other host is spoofing?</p>
<p>I'm working in an embedded environment, so looking for answers on a protocol level, rather than âuse such and such a toolâ.</p>
<p><s... | <p>This question is too interesting to put down! After several false starts I started thinking about the essential components of the problem and scoured the RFCs for advice. <strong>I haven't found a definitive answer,</strong> but here's my thought process, in the hope that it helps:</p>
<ul>
<li><p>The original qu... |
What are the benefits to marking a field as `readonly` in C#? <p>What are the benefits of having a member variable declared as read only? Is it just protecting against someone changing during the lifecycle of the class or are there any compiler speed improvements due to this keyword</p>
| <p>I don't believe there are any performance gains from using a readonly field. It's simply a check to ensure that once the object is fully constructed, that field cannot be pointed to a new value. </p>
<p>However "readonly" is very different from other types of read-only semantics because it's enforced at runtime by... |
AccessControlException when attempting to delete a file <p>We have a java web service application that uses log4j to do logging. An exception gets thrown when log4j tries to delete its rolling log files</p>
<pre><code>Exception:java.security.AccessControlException: access denied
(java.io.FilePermission /var/opt/SUNWa... | <p>As a quickfix you can start the application using a policy file with the following content:</p>
<pre><code>grant {
permission java.security.AllPermission;
};
</code></pre>
<p>using the command line option:</p>
<p>-Djava.security.policy=file:<your_policy_file></p>
<p>See <a href="http://java.sun.com/j2s... |
Define an Extension Method for IEnumerable<T> which returns IEnumerable<T>? <p>How do I define an Extension Method for <code>IEnumerable<T></code> which returns <code>IEnumerable<T></code>?
The goal is to make the Extension Method available for all <code>IEnumerable</code> and <code>IEnumerable<T></co... | <p>The easiest way to write any iterator is with an iterator block, for example:</p>
<pre><code>static IEnumerable<T> Where<T>(this IEnumerable<T> data, Func<T, bool> predicate)
{
foreach(T value in data)
{
if(predicate(value)) yield return value;
}
}
</code></pre>
<p>The k... |
Is there a good Python GUI shell? <p>I saw this the other day (scroll <em>all the way</em> down to see some of the clever stuff): </p>
<blockquote>
<p><a href="http://www.mono-project.com/docs/tools+libraries/tools/repl/" rel="nofollow">http://www.mono-project.com/docs/tools+libraries/tools/repl/</a></p>
</blockquot... | <p>One project I'm aware of that provides similar features (inline plotting, customisable rendering) is <a href="http://fishsoup.net/software/reinteract/">Reinteract</a>. Another (though possibly a bit heavyweight for general usage) is <a href="http://www.sagemath.org/">SAGE</a> which provides functionality for web-ba... |
I need to get the password which is Hashed in ASP.net <p>I am storing all my passwords in the form hashed. I need to retrieve these passwords
Eg</p>
<p>My password is "123456" I save this as hashed "3453474852dfdsfdsfdf" value.</p>
<p>I need to retrieve the original password from the hashed value. (Get Password).</p>... | <p>This is not possible. SHA1 is, very carefully and deliberately, a <a href="https://secure.wikimedia.org/wikipedia/en/wiki/One-way_function" rel="nofollow">one-way function</a>.</p>
<p>Why are you trying to recover the original password? It is not needed for authentication, because you simply hash the input password... |
What is the best way to transfer a file using Java? <p>I am writing code for uploading a file from a client to my server and the performance isn't as fast as I think it should be.</p>
<p><strong>I have the current code snippet that is doing the file transfer and I was wondering how I could speed up the transfer.</stro... | <p>Reading a single byte at a time will be horribly inefficient. You're also relying on <code>available</code>, which is rarely a good idea. (It will return 0 if there are no bytes <em>currently</em> available, but there may be more to come.)</p>
<p>This is the right sort of code to copy a stream:</p>
<pre><code>publ... |
is it worth keeping the OS look and feel? <p>Is it worth to try to keep your GUI within the system looks ?</p>
<p>Every major program have their own anyways...
(visual studio, iexplorer, firefox, symantec utilities, adobe ...)</p>
<p>Or just the frame and dialogs should be left in the system look 'n feel range ?</p>
... | <p>I think, that unless your program becomes a very major part of the users life, you should strive to minimize "surprises" and maximimze recognizability (is that even a word?).</p>
<p>So, if you are making something that is used by 1.000 people for 10 minutes a day, go with system looks, and mechanisms.</p>
<p>If, o... |
MS Access: How to bypass/suppress an error? <p>I'm executing a query like this</p>
<pre><code>select field from table;
</code></pre>
<p>In that query, there is a loop running on many tables. So, if the field is not present in a table I get a </p>
<blockquote>
<p>Runtime Error 3061</p>
</blockquote>
<p>How can I b... | <p>Use the <code>On Error</code> statement that VBA supplies:</p>
<pre><code>Sub TableTest
On Error Goto TableTest_Error
' ...code that can fail... '
Exit Sub
:TableTest_Error
If Err.Number = 3061 Then
Err.Clear()
DoSomething()
Else
MsgBox Err.Description ' or whatever you find appropriate '
... |
MySql: MyISAM vs. Inno DB! <p>What are the differences between MyISAM and Inno DB types in MySql?</p>
| <p>The main difference is that InnoDB supports transactions while MyISAM does not.</p>
<p>There are numerous other differences, however the common one's i am aware of are:</p>
<ul>
<li>MyISAM has typically been considered faster at searching, but recent InnoDB improvements are removing this difference and improving h... |
How do I get Ltk to display what the user is writing and what the functions print? <p>The kind of functions are of the sort of:</p>
<pre><code>(defun display-all ()
"Display all items in the database."
(dolist (item *database*)
(format t "~{~a:~10t~a~%~}~%" item)))
(defun prompt-read (prompt)
(format *query... | <p>You create the text widget like every other widget. The Lisp-side object has <code>text</code> accessor function with writer method which sets the text on Tk side. Minimal example:</p>
<pre><code>(with-ltk ()
(let* ((text-widget (make-instance 'text :width 15 :height 2))
(b1 (make-instance 'button
... |
What are the best PDC 2008 videos that I need to look at? <p>Considering the full list of PDC videos published <a href="http://channel9.msdn.com/posts/pdc2008/RSS/Default.aspx" rel="nofollow">here</a> what are, in your opinion, the best session to download and see, considering their relevance to your work, technology a... | <p>I would have to say that my favorite session was the "future of C#" video, very nice to be able to see what is coming in the future for C# and the .NET framework.</p>
|
What is the equivalent of the .NET Framework 2.0 SDK for the .NET Framework 3.5? <p>On our build server, we've installed the .NET Framework 2.0 SDK in order to kick off MSBuild and run our builds. Now we are upgrading to the .NET Framework 3.5. We do not want to install the complete Visual Studio, but we cannot find a ... | <p>.net 3.5 comes with compiler and msbuild bundled with it. just download the normal .net 3.5 framework (not the client profile) and you'll be fine.</p>
|
Hibernate JPA Sequence (non-Id) <p>Is it possible to use a DB sequence for some column that <strong>is not the identifier/is not part of a composite identifier</strong>? </p>
<p>I'm using hibernate as jpa provider, and I have a table that has some columns that are generated values (using a sequence), although they are... | <p>Looking for answers to this problem, I stumbled upon <a href="http://forum.hibernate.org/viewtopic.php?p=2405140">this link</a></p>
<p>It seems that Hibernate/JPA isn't able to automatically create a value for your non-id-properties. The <code>@GeneratedValue</code> annotation is only used in conjunction with <code... |
MOSS 2007: SPListItem.GetFormattedValue for DateTime fields has a bug? <p>SPListItem.GetFormattedValue seems to have a strange behavior for DateTime fields.
It retrieves the DateTime value through SPListItem's indexer which according to this <a href="http://msdn.microsoft.com/en-us/library/ms197282.aspx">MSDN article</... | <p>Converting the date back to universal time before calling GetFieldValueAsHtml works just fine.</p>
<pre><code>DateTime localTime = (DateTime)item["DueDate"];
// this is local time but if you do localDateTime.Kind it returns Unspecified
// treats the date as universal time..
// let's give it the universal time :)
D... |
Seen this binary date format? <p>3/10/2008 = 1822556159</p>
<p>2/10/2008 = 1822523391</p>
<p>1/10/2008 = 1822490623</p>
<p>30/09/2008 = 1822392319</p>
<p>29/09/2008 = 1822359551</p>
<p>This is all the information that I know at the current time. </p>
<p>Dates increment by 32768 except when changing month when the... | <p>September 30th 2008</p>
<pre><code>1822392319 = 0x6c9f7fff
0x6c = 108 = 2008 (based on 1900 start date)
0x9 = 9 = September
0xf7fff - take top 5 bits = 0x1e = 30
</code></pre>
<p>October 1st 2008</p>
<pre><code>1822490623 = 0x6ca0ffff
0x6c = 108 = 2008
0xa = 10 = October
0x0ffff - take top 5 bits = 0x01 = 1
</c... |
XPath vs DeSerialization: which one is better in performance for read operations <p>I'm passing small (2-10 KB)XML documents as input to a WCF service. now I've two option to read data values from incoming XML</p>
<ol>
<li>Deserialize to a strongly typed object and use object properties to access values</li>
<li>use X... | <p>I would deserialize it.</p>
<p>If you use xpath, you will deserialize (or "load") it to XmlDocument or something anyway. So both solutions use time deserializing. After this is done, xpath will be slower because of the time spent parsing that string, resolving names, executing functions and so on. Also, if you go w... |
Recurring Payments in PayPal <p>I am trying to use the Recurring payment API offered by PayPal.
I have a scenario which I am not able to address directly. It goes like this.</p>
<p>We have a website where we sell some services. Now the services are charged per user license. A user can buy/cancel user license in betwee... | <p>I realize this is a very old post, but it still shows up for Google searches, so I thought I'd add:</p>
<p>Paypal does allow you to do this now, using their new <a href="https://www.x.com/community/ppx/adaptive_payments">adaptive payments api</a>.</p>
<p>Authorize.net also has a service that might work called <a h... |
Input Audio as a Stream in CF 3.5 <p>I googled around and coulnd't really find an answer.</p>
<p><strong>How do I open an audio input device</strong> (namely a microphone) <strong>as a stream</strong> (preferably) <strong>on a CE/WinMobile device using Compact Framework?</strong></p>
<p>I looked at WindowsMobile.Dire... | <p>The usual answer for "trying to do something with the CF and can't" is OpenNetCF.</p>
<p>Here's the <a href="http://www.opennetcf.com/library/sdf/html/f3fc3169-4143-54bc-1594-186da1fb01c2.htm" rel="nofollow">page for WaveAudio</a> which includes a Recorder class with a RecordFor method that records to a stream for ... |
How can I run sql server stored procedures in parallel? <p>I want to do something like:</p>
<pre><code>exec sproc1 and sproc2 at the same time
when they are both finished exec sproc3
</code></pre>
<p>I can do this in dts.
Is there a way to do it in transact sql?
Or is there a way to do it with a batch script (eg vbs ... | <p>You could create a CLR Stored Procedure that (using C#) would call the first two on their own threads, and then block until both are complete... then run the third one.</p>
<p>Are you able to use CLR sprocs in your situation? If so, I'll edit this answer to have more detail.</p>
|
How do I add custom column to existing WSS list template <p>I need to use feature stapler to add some text columns to Posts list inside OOTB blog site definition. I plan not to use site columns, but only to add those columns to list (I don't use site columns because I have multiple site collections and there will be on... | <p>Perhaps you can create a feature that uses the object model from the feature receiver to add (and remove as appropriate) the columns to just the specific list when the feature is activated.</p>
<p>I would use the XML Schema approach for creating the columns in order to ensure the same GUID for each column. <a href=... |
Unable to turn on SecureSocketLayer with DirectoryServices.Protocols.LdapConnection <p>I am trying to fix a bug with SSL in a product and noticed that although the code sets SSL to be true, in the next line in the code SSL is still at false. I wrote a unit test for this and the unit test confirms my suspicions. </p>
<... | <p>It turns out that the way that the DirectoryServices.Protocols implements it's LDAP calls is by passing them through to a low-level LDAP API. This LDAP API is what is queried when a get is done on the property.</p>
<p>The low-level API is only updated when the methods are executed. You can think about this like it ... |
How can I create or read OpenOffice spreadsheets from Perl? <p>What is a good way to create and read an OpenOffice spreadsheet in Perl?</p>
| <p>I think that the open office native document format is based around the OpenDocument specifications, and is bascially a zip compressed XML format. This being true you could probably manipulate it using your perl XML manipulation tools of choice. </p>
<p>Alternatively, there's the <a href="http://search.cpan.org/per... |
ASP.Net Client Events on DropDownList? <p>Is there a client event that I can use for when a DropDownList's data has been loaded/bound onto the control? I need to trigger event on their side when this happens.</p>
<hr>
<p>Basically, I am trying to lock out the controls while the data is being loaded as if there is a s... | <p>Since data will be bound on the server side, you don't have a client-side event for that specific event, however, one the page has rendered, the data will be there, so you may want to run your client script in the document.load event, or using something like jQuery's document.ready event. That will trigger your scri... |
Simulating connection problems for .NET HttpWebRequest <p>Are there ways to programmatically simulate connection problems (slow connection, response does not complete, connection gets dropped, etc.) when using the HttpWebRequest class?</p>
<p>Thanks</p>
<p>EDIT: To elaborate more, I need this for debugging but would ... | <p>@Chris
Unfortunately, Microsoft neglected to <a href="http://bartling.blogspot.com/2009/01/net-base-class-library-types-not.html" rel="nofollow">make many of the BCL objects easily mockable</a>, as they tend to use abstract classes, and .NET classes are closed by design (in other words, for a method to be overridde... |
How to implement CEditListCtrl <p>How to implement CEditListCtrl?. List control with edit capabality (Report/Grid view).
I have a list view in Report View. It has some values. I need to extend this to edit the values present in the list view.
I declared a class which inherits from CListCtrl. And I have handled the two ... | <p>There are some neat grid controls on Code Project which might help:</p>
<p><a href="http://www.codeproject.com/KB/miscctrl/gridctrl.aspx" rel="nofollow">http://www.codeproject.com/KB/miscctrl/gridctrl.aspx</a></p>
<p><a href="http://www.codeproject.com/KB/library/gridprojects.aspx" rel="nofollow">http://www.codepr... |
Partial sharing of git repositories <p>I am new to git. I am wondering whether the following scenario is supported, and if so how (i.e. git commands for setup and update).</p>
<p>A repository is available from three different places: 'local', 'mirror' and 'github'. 'mirror' mirrors 'local' completely and 'github' mirr... | <p>You could use the <a href="http://git-scm.com/docs/git-submodule" rel="nofollow">git submodule</a> support to hold the "copyrighted" directory in a separate Git repository. Keep this separate repository somewhere accessible to people who should be able to see it, and don't push it to github. For people accessing the... |
DropDownList with LinqDataSource and an empty option <p>Is there some elegant way to add an empty option to a DropDownList bound with a LinqDataSource?</p>
| <p>Here's how to add a value at the top of the list. It can be an empty string, or some text.</p>
<pre><code><asp:DropDownList ID="categories" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="categoriesDataSource" DataTextField="CategoryName" DataValueField="CategoryID" EnableViewState="... |
Sql Server CE 3.5 Merge Replication Synchronise is Hanging <p>I am using SQL Server 2005 CE framework 3.5 and attempting to use merge replication between my hand held and my SQL Server. When I run the code to synchronise it just seems to sit forever, and when I put a breakpoint in my code it never gets past the call t... | <p>Another thing you can do to speed up the Synchronize operation is to specify a db file path that is in your PDA's main program memory (instead of on the SD Card as in your example). You should see a speed improvement of up to 4X (meaning the Sync may take only 25% as long as it's taking now).</p>
<p>If you're runn... |
How do you override ToString in a static class? <p>I have a public static class in which I would like to have a ToString() method. </p>
<p>I have defined it as public static string ToString(), but get the following warning: </p>
<blockquote>
<p>'Class.ToString()' hides inherited member 'object.ToString()'. To ma... | <p>Yes, using the "new" modifier will effectively silence the compiler warning but you are <strong>explicitly hiding</strong> an instance method with a static method. (This is different than overriding the method.) Typically you don't want to hide an instance method except with very good reasons and you really shouldn'... |
Perform a modulus in a huge number? <p>I need to do a modulus operation on very large integers. The biggest integer supported by my platform (edit: .NET 2.0) is a 64 bit integer, which aren't big enough for the numbers I'm working with.</p>
<p>How can I do a modulus on really big integers, like 1265487563212642487538... | <p>You haven't specified where the numbers are coming from, but you might be able to make some simplifications. If the numbers are originally smaller, then consider things like:</p>
<pre><code>(a + b) MOD n = ((a MOD n) + (b MOD n)) MOD n
</code></pre>
<p>or</p>
<pre><code>ab MOD n = (a MOD n)(b MOD n) MOD n
</code... |
Best process for auto-zipping of multiple MP3s <p>I've got a project which requires a fairly complicated process and I want to make sure I know the best way to do this. I'm using ASP.net C# with Adobe Flex 3. The app server is Mosso (cloud server) and the file storage server is Amazon S3. The existing site can be viewe... | <p>The bit about updating the zip but not having the temporary files if the user adds or removes a track leads me to suspect that you want to build zips containing multiple tracks, possibly complete albums. If this is incorrect and you're just putting a single mp3 into each zip, then StingyJack is right and you'll pro... |
Does VS2008 have somewhat C++0x support? <p>Does VS2008 have somewhat C++0x standard support?</p>
<p>DUPLICATE <a href="http://stackoverflow.com/questions/146381/visual-studio-support-for-new-c-c-standards">http://stackoverflow.com/questions/146381/visual-studio-support-for-new-c-c-standards</a></p>
| <p>No afaik. I believe VS2010 will have more support:</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&displaylang=en" rel="nofollow">http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&displaylang=en</a></p>... |
Script Minification and Continuous Integration with MSBuild <p>On a recent project I have been working on in C#/ASP.NET I have some fairly complicated JavaScript files and some nifty Style Sheets. As these script resources grow in size it <a href="http://developer.yahoo.com/yui/compressor/">is advisable to minify the ... | <p>The <a href="https://github.com/loresoft/msbuildtasks/" rel="nofollow">MSBuildCommunityTasks Project</a> has a few MSBuild tasks that may do what you are looking for including Merge and JSCompress. </p>
<p>You could add these into your MSBuild project in the AfterBuild target to allow the project to perform this a... |
Membership.GetUser() & MARS <p>I'm using asp.net membership, and need to make a call to Membership.GetUser() while I have another open SQL connection, but my code dies at that call. I have MultipleActiveResultSets=True in the connection string that is used by both my code and the Membership provider. It appears that ... | <p>Did you try to use separate connection string (one for data one for Membership provider) without option âMultipleActiveResultSets=Trueâ ? </p>
<p>Does it work then ? If it works you can use <em>SqlConnectionStringBuilder</em> to create new connection string (from the original) without MARS option.</p>
|
How do I collapse elements in a Report Table? <p>I have an SSRS report where I need to collapse data into a summary column like so:<br>
+Program<br>
-Program2<br>
Program2DataElement1 | Program2DataElement2 | etc.</p>
<p>How does one doe this? I see it in other reports, but can't for the life of me find the ar... | <p>I believe these are the steps:</p>
<ol>
<li>Edit group</li>
<li>Click on Visibility Tab</li>
<li>For Initial Visibility, select the "hidden" radio button.</li>
</ol>
|
Vertical Text with jQuery <p>I'm looking to vertically align text by adding <code><br /></code> tags between characters with jQuery.</p>
<pre><code><div id="foo"><label>Vertical Text</label></div>
</code></pre>
<p>would look like this:</p>
<p>V<br />
e<br />
r<br />
t<br />
i<br />
c<b... | <p>Let's go golfing!</p>
<pre><code>$('#foo label').html($('#foo label').text().replace(/(.)/g,"$1<br />"));
</code></pre>
<p>Completely untested, but the pattern in the regex looks like a boob.</p>
|
question on how to use sql server integrated service <p>I have a table called book with, the attrbutes are booked_id, yearmon, and day_01....day_31. Now i need to unpivot the table and transform day_01...day_31 into rows, I have successed in doing that, but the problem is that my yearmon is a format of 200805 and i nee... | <p>You should be able to use the Unpivot component and the Derived Column component to do what you need. Look into those and post back if they don't seem to do what you need.</p>
|
What's the best way to implement friendly URL in ASP.net? <p>What's the best way to implement friendly URL in ASP.net?</p>
| <p>The <a href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" rel="nofollow">ASP.NET Routing Framework</a> provided in .NET 3.5 SP1 is a good one.</p>
<p>Although it is very new, it can handles many URL-related tasks and most frequently used URL-friendly schemes very ... |
External Tool Development for SQL Server Management Studio 2005 <p>Does anyone have any experience of developing external tools for SSMS 2005. </p>
<p>Ideally I would like to be able to interact with the query windows directly, for example, taking the query text from the window to perform some processing on it.</p>
... | <p>Have you looked at Sql Server Management Objects (SMO)?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms162557.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms162557.aspx</a></p>
|
UTF-8 all the way through <p>
I'm setting up a new server, and want to support UTF-8 fully in my web application. I have tried in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.</p>
<p>Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apa... | <p><strong>Data Storage</strong>:</p>
<ul>
<li><p>Specify the <code>utf8mb4</code> character set on all tables and text columns in your database. This makes MySQL physically store and retrieve values encoded natively in UTF-8. Note that MySQL will implicitly use <code>utf8mb4</code> encoding if a <code>utf8mb4_*</co... |
How can I get a collection of all the colors in System.Drawing.Color? <p>How can I extract the list of colors in the System.Drawing.Color struct into a collection or array?</p>
<p>Is there a more efficient way of getting a collection of colors than using this struct as a base?</p>
| <p>So you'd do:</p>
<pre><code>string[] colors = Enum.GetNames(typeof(System.Drawing.KnownColor));
</code></pre>
<p>... to get an array of all the collors.</p>
<p>Or... You could use reflection to just get the colors. KnownColors includes items like "Menu", the color of the system menus, etc. this might not be wh... |
How to invoke a C# web service through PHP? <p>I've written a web service using ASP.NET (in C#) and I'm attempting to write an example PHP client using NuSOAP. Where I'm tripped up on are examples of how to do this; some show <code>soapval</code> being used (and I don't quite understand the parameters - for example pa... | <p>You have to wrap things in tons of nested arrays.</p>
<pre><code><?php
require_once('lib/nusoap.php');
$client = new nusoap_client('http://localhost:3333/Service.asmx?wsdl');
$params = array(
'anId' => 3,
'action' => 'OMNOMNOMNOM',
'parameters' => array(
'Param' => ar... |
How can I style XML with CSS for viewing in a browser without first transforming to (X)HTML? <p>I know that CSS can be used to control the presentation of (X)HTML in modern browsers. I was under the impression that this was possible for arbitrary XML as well. (Am I mistaken?)</p>
<p><strong>A concrete example</strong... | <p>It is indeed possible to use CSS to format an XML document.</p>
<p><a href="http://www.w3schools.com/Xml/xml_display.asp" rel="nofollow">W3 schools example</a></p>
<p>(The W3C do recommend using xslt to do this sort of thing instead CSS though)</p>
|
Which style of Ruby string quoting do you favour? <p>Which style of Ruby string quoting do you favour? Up until now I've always used <code>'single quotes'</code> unless the string contains certain escape sequences or interpolation, in which case I obviously have to use <code>"double quotes"</code>.</p>
<p>However, is ... | <p>Don't use double quotes if you have to escape them. And don't fall in "single vs double quotes" trap. Ruby has excellent support for arbitrary delimiters for string literals:</p>
<p><a href="http://rors.org/2008/10/26/dont-escape-in-strings">http://rors.org/2008/10/26/dont-escape-in-strings</a></p>
|
Can CCK take care of my fields for a programatically defined node type in drupal? <p>Does the CCK api allow me to create a node type, from a custom module, with a bunch of fields that use CCK to store their state? If so can these fields be locked so that users may not alter them, but still allow the user to add more f... | <p>I <em>think</em> the answer to your first question is "yes" (for Drupal 6, at least, which has elements of the CCK integrated into Drupal Core). I believe the <a href="http://drupal.org/project/amazon" rel="nofollow" title="Amazon module">Amazon module</a> does this sort of thing, albeit it with just one field. </... |
Why does Log4Net run so slow in my Windows Service? <p>I have a windows service that uses log4net. We noticed that the service in question was running painfully slow so we attached a debugger to it and stepped through. It appears that each time it tries to write an entry to the log via log4net that it takes anywhere fr... | <p>Jeff mentioned a performance problem with Log4Net in <a href="http://blog.stackoverflow.com/2008/09/podcast-20/" rel="nofollow">Podcast 20</a>. It's possible that you are seeing a similar issue.</p>
|
OpenCV Object Detection - Center Point <p>Given an object on a plain white background, does anybody know if OpenCV provides functionality to easily detect an object from a captured frame? </p>
<p>I'm trying to locate the corner/center points of an object (rectangle). The way I'm currently doing it, is by brute force... | <p>There's already an example of how to do rectangle detection in OpenCV (look in samples/squares.c), and it's quite simple, actually.</p>
<p>Here's the rough algorithm they use:</p>
<pre><code>0. rectangles <- {}
1. image <- load image
2. for every channel:
2.1 image_canny <- apply canny edge detector to t... |
How do you check for ajax updates using a WebBrowser control in .net 2.0? <p>I have a web page that is being displaying in a winform app using the WebBrowser Control. I need to perform an event when the HTML in the web page changes; however, I cannot find an event that is triggered for situations when the pages is upda... | <p>I have been using a a timer, and just watching for a change in a specific elements content.</p>
<pre><code>Private AJAXTimer As New Timer
Private Sub WaitHandler1(ByVal sender As Object, ByVal e As System.EventArgs)
'Confirm that your AJAX operation has completed.
Dim ProgressBar = Browser1.Document.All("p... |
file path portability <p>I have a program that I need to run under *nix and windows. because the program takes file paths from files the issue is what to do about the <code>\</code> vs <code>/</code> issue. </p>
<p>My current thought is to put in a regex that converts the wrong one to the right one depending on what s... | <p>The / is fully supported in win32 too.</p>
<p>Also see this <a href="http://stackoverflow.com/questions/122455/handling-file-paths-cross-platform">related question</a></p>
|
Email Notification Service <p>What are some ideas (using .NET and SQL 2005) for implementing a service that sends emails? The emails are to be data-driven. The date and time an email is to be sent is a field in a table.</p>
| <p>I have built several high volume email notification services used to send data driven emails in the past. A few recommendations:</p>
<ul>
<li>Look into using a high quality email service provider that specializes in managing bounces, unsubscribes, isp and black list management, etc. If sending email is critical to ... |
Create DB2 History Table Trigger <p>I want to create a history table to track field changes across a number of tables in DB2. </p>
<p>I know history is usually done with copying an entire table's structure and giving it a suffixed name (e.g. user --> user_history). Then you can use a pretty simple trigger to copy the ... | <p>I don't think this is a good idea, as you generate even more overhead per value with a big table where more than one value changes. But that depends on your application.</p>
<p>Furthermore you should consider the practical value of such a history table. You have to get a lot of rows together to even get a glimpse ... |
How do I get projects to place their build output into the same directory with Scons? <h2>Background</h2>
<p>I'm trying out Scons by setting up a basic C++ sample project that has two sub-projects: </p>
<ul>
<li>Prj1 is an EXE that depends on Prj2</li>
<li>Prj2 is a DLL that exports some functions</li>
</ul>
<p>The ... | <p>Ok Third try is a charm. I am just placing this in a new answer to keep it cleaner. I talked with my local scons guru, and he stated that the install method should work, but there is a much easier way.</p>
<p>Simply define the full path where you want the executable (or dll) to go. So:</p>
<pre><code>prj2_env.Prog... |
Where can I find sample code on mouse movements and polygon spins in OpenGL? <p>Where can I find sample code on mouse movements and polygon spins in OpenGL?
I am using Java, so sample code in Java is preferred.</p>
| <p>You'd probably find this useful:</p>
<p><a href="http://pepijn.fab4.be/software/nehe-java-ports/" rel="nofollow">http://pepijn.fab4.be/software/nehe-java-ports/</a></p>
|
Corner radius in Adobe Air application <p>How can we make rounded corners on the vbox control in the Air
application?</p>
<p>I am hiding the header and setting transparent to true, but then it does not show
me rounded corners on the VBox in the application. I am showing this VBox
to the user.</p>
<p>Thanks in advance... | <p>You can do this by implementing a custom Border:</p>
<pre><code>package your.package
{
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import mx.skins.halo.HaloBorder;
import mx.utils.GraphicsUtil;
public class RoundedBorder extends HaloBorder
{
private var topCornerRadius:... |
3D laser scanner capturing normals? <p>The Lab university I work at is in the process of purchasing a laser scanner for scanning 3D objects. All along from the start we've been trying to find a scanner that is able to capture real RAW normals from the actual scanned surface. It seems that most scanners only capture poi... | <p>Highly unlikely. Laser scanning is done using ranges. What you want would be combining two entirely different techniques. Normals could be evaluated with higher precision using well controlled lighting etc, but requiring a very different kind of setup. Also consider the sampling problem: What good is a normal with h... |
i18n - best practices for internationalization - XLIFF, gettext, INI, ...? <p>EDIT: <strong>I would really like to see some general discussion about the formats, their pros and cons!</strong></p>
<p>EDIT2: The 'bounty didn't really help to create the needed discussion, there are a few interesting answers but the compr... | <p>POEdit isn't really hard to get a hang of. Just create a new .po file, then tell it to import strings from source files. The program scans your PHP files for any function calls matching <code>_("Text"), gettext("Text")</code>, etc. You can even specify your own functions to look for.</p>
<p>You then enter a transla... |
Does LINQ to Entities reuse instances of objects? <p>Using LINQ to Entities sounds like a great way to query against a database and get actual CLR objects that I can modify, data bind against and so forth. But if I perform the same query a second time do I get back references to the same CLR objects or an entirely new ... | <p>Within the same DataContext, my understanding is that you'll always get the same objects - for queries which return full objects instead of projections.</p>
<p>Different DataContexts will fetch different objects, however - so there's a risk of seeing stale data there, yes.</p>
|
Enabling/Disabling Aero from a Windows Service <p>I have some code to enable/disable the Windows Aero service in Vista, and I would like to run it in a Windows Service. The code works in a standalone application, but when I run it from a Service, nothing happens. No errors or exceptions are thrown.</p>
<p>I realise th... | <p>I had the same error code, when creating WPF FlowDocuments through a service running under 64-bit Vista. After digging around I can accross <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361469" rel="nofollow">this post on Microsoft Connect</a>, which points out that </p>
... |
Java File.canWrite() on Vista and super hidden files <p>I have some code that effectively does this :</p>
<pre><code>File file = new File("C:\\Program Files (x86)\\Something\\fred.txt");
System.out.println("file.canWrite() = " + file.canWrite());
</code></pre>
<p>It prints true.
Now the odd thing is, I can create the... | <p>You are most likely a "victim" of folder redirection. When UAC is enabled, any writes to Program Files is redirected to somewhere else when you're not running the program as an administrator.</p>
<p>You should find your file in C:\Users\<username>\AppData\Local\VirtualStore\<insert>\<expected>\<... |
Random image picker PHP <pre><code>$images = array();
$images[0][0] = "boxes/blue.jpg";
$images[0][1] = "blah.html";
$images[1][0] = "boxes/green.jpg";
$images[1][1] = "blah.html";
$images[2][0] = "boxes/orange.jpg";
$images[2][1] = "blah.html";
$images[3][0] = "boxes/pink.jpg";
$images[3][1] = "blah.html";
$images[4][... | <p>This might be a nicer way of doing it:</p>
<pre><code>foreach (array_rand($images, 5) as $key) {
$boxes[] = $images[$key];
}
</code></pre>
|
Alternative to HttpListener? <p>I'm developing an application that is so far using HttpListener to provide a small standalone http server. However, I've recently discovered that HttpListener needs to be run as Administrator, which is not always going to be possible.</p>
<p>What would the best alternative be? I need ht... | <p>One alternative that I've found is <a href="http://www.codeplex.com/webserver">C# Webserver</a> on CodePlex.</p>
<p><i>"... a flexible http server which can be embedded in any .Net application. It has a modular design where features are added using modules. The server also supports REST and all http verbs ..."</i><... |
How do I automatically fail a nant build if NDepend query raises a warning <p>OK first some background. I am busy automating our build process. We run a mixture of Vs 2005 and VS 2008 both targeting platform 2.0. We use Nant to do our builds using the MSBUILD task to do the compile and Cruise Control .net to do our C... | <p>What we do is actually have a powershell script run right after that parses through the output file, and throws a series of errors with an appropriate message depending on which condition it found. As soon as powershell throws an error the build fails.</p>
|
Calling a C function with a varargs argument dynamically <p>I am programming in C against a third party library (in HP/Mercury Loadrunner) that allows a varargs-style variable size argument list for one of it's functions. I want to call this function but I do not know up front how many arguments I will have. </p>
<p>T... | <p>Variable length arguments are basically just a pointer to a bunch of packed data that is passed to the required function. It is the responsibility of the called function to interpret this packed data.</p>
<p>The architecture safe way to do this is to use the va_list macros (that n-alexander mentioned), otherwise y... |
Protecting Javascript Code in a FF extension <p>I am looking to protect the code of my Firefox extension because it has server calls in it that no would be a security risk if someone could make them outside of the extension. Any suggestions on how to encrypt it?</p>
| <p>This is basically impossible. You want to give executable code to an untrusted client that has "secret" calls in it, yet not let the client know the secrets? How, then, is it going to execute the code?</p>
<p>At some point, it must be decrypted. Which means the client has everything it needs to perform the decrypti... |
RegEx to replace value including new lines <p>I have a snippet looking something like the below.</p>
<pre><code>string bodyTypeAssemblyQualifiedName = "XXX.XX.XI.CustomerPayment.Schemas.r1.CustomerPayments_v01, XXX.XX.XI.CustomerPaym" +
"ent.Schemas.r1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=... | <p>This works:</p>
<blockquote>
<p>(?<=string\sbodyTypeAssemblyQualifiedName\s=\s)(?s:[^;]*)(?=;)</p>
</blockquote>
<p>Which is the equivalent of:</p>
<ol>
<li>After the string "string
bodyTypeAssemblyQualifiedName = "</li>
<li>Turn on single line (treat \r\n as
any other character) ( this is what
(?s: ) does)<... |
Is there a good HttpClient library for J2ME/MIDP? <p>I want to call some RESTful web services from a J2ME client running on a MIDP enabled mobile device. I read the MIDP api for HTTPConnections and thought this is just crying out for a simple wrapper to hide all those unpleasant byte arrays and such like. Before I writ... | <p>You might want to check out this little gem, Mobile Ajax for Java ME:</p>
<p><a href="https://meapplicationdevelopers.java.net/mobileajax.html" rel="nofollow">https://meapplicationdevelopers.java.net/mobileajax.html</a></p>
<p>One part is (from the site):</p>
<blockquote>
<p>Asynchronous I/O for Java ME</p>
... |
Win32 WriteProcessMemory() magical offset value <p>I'm trying to read the data in a Win32 ListView owned by another process. Unfortunately, my WriteProcessMemory() call fails with the error "This function is not supported on this system." when I specify "NULL" for the base address in my VirtualAlloc() call. If, however... | <p>Instead of trying to allocate memory in another process, why not use named shared memory instead. This article will take you through the basic setup of <a href="http://msdn.microsoft.com/en-us/library/aa366551(VS.85).aspx" rel="nofollow">shared memory</a>, and I did a quick check to make sure these functions are su... |
Unpacking MSI in .Net <p>I have an installer that deploys web services to IIS. After this has finshed a custom action fires that updates the database with the scripts required by the webservices. The scripts are currently deploying to IIS aswell because they are part of the .net project. How can I configure the inst... | <p>If you are using the standard Visual Studio setup projects do this:</p>
<ol>
<li>Add your scripts as files to your setup project</li>
<li>Right-click on the files</li>
<li>Select "Properties"</li>
<li>Change the "PackageAs" property to "vsdpaLoose"</li>
</ol>
<p>Your files will now be output alongside your MSI so ... |
Is it possible to use/access scalar functions with LINQ to SQL? <p>We have scalar functions in our database for returning things like "number of tasks for a customer" or "total invoice amount for a customer". </p>
<p>We are experimenting and looking to try to do this w/o stored procedures ... normally we would just c... | <p>LINQ-to-SQL supports use with UDFs, if that is what you mean. Just drag the UDF onto the designer surface and you're done. This creates a matching method on the data-context, marked <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.mapping.functionattribute.aspx"><code>[Function(..., IsComposable=tru... |
RGB back buffer in Win32 <p>I have an array of RGB values, whose size I can guarantee to match the client area of a window on screen.</p>
<p>Using the Win32 API, what are the easiest and fastest ways to get the contents of my array on the screen in response to a WM_PAINT message?</p>
<p>If it makes it simpler/faster,... | <p>If you have complete control over your backing format, use a DIB format and a dummy BITMAPINFO structure. Then use <a href="http://msdn.microsoft.com/en-us/library/ms532346(VS.85).aspx" rel="nofollow">SetDIBitsToDevice</a> to copy to the DC.</p>
<p>Be aware of the peculiarities of the DIB format - every line has to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.