instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am looking for a well tested class for manipulating URLs in .NET. Specifically I want to be able to add/update querystring values given a url.</p>
<p>I have found various classes on the web that do this but none seem really robust and well tested. I also cannot find anything in the .NET framework; the Uri class... | <p>shouldn't a simple string Dictionary suffice for this? an ordinary ASP.NET query string is just composed of key-value pairs separated by ampersands.</p>
| <p>Long time back we used <a href="http://dotnetjunkies.com/Article/3ABCD244-CC7C-4CED-B64E-BCF05191CDAB.dcik" rel="nofollow noreferrer">SecureQueryString 2.0</a>. since it inherits from NameValuePair (if I remember correctly), it provides ability to add, remove key values easily. It also provides support for encryptio... | 19,092 |
<p>At the moment a default entry looks something like this:</p>
<pre><code>Oct 12, 2008 9:45:18 AM myClassInfoHere
INFO: MyLogMessageHere
</code></pre>
<p>How do I get it to do this?</p>
<pre><code>Oct 12, 2008 9:45:18 AM myClassInfoHere - INFO: MyLogMessageHere
</code></pre>
<p>Clarification I'm using java.util.lo... | <p>As of Java 7, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/logging/SimpleFormatter.html#format%28java.util.logging.LogRecord%29" rel="noreferrer">java.util.logging.SimpleFormatter</a> supports getting its <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax" rel="noreferre... | <p>This logging is specific to your application and not a general Java feature. What application(s) are you running?</p>
<p>It might be that this is coming from a specific logging library that you are using within your own code. If so, please post the details of which one you are using.</p>
| 23,667 |
<p>I have a <code>ListBox</code> <code>DataTemplate</code> in WPF. I want one item to be tight against the left side of the <code>ListBox</code> and another item to be tight against the right side, but I can't figure out how to do this.</p>
<p>So far I have a <code>Grid</code> with three columns, the left and right on... | <p>I also had to set:</p>
<pre><code>HorizontalContentAlignment="Stretch"
</code></pre>
<p>on the containing <code>ListBox</code>.</p>
| <p>Taeke's answer works well, and as per vancutterromney's answer you can disable the horizontal scrollbar to get rid of the annoying size mismatch. However, if you do want the best of both worlds--to remove the scrollbar when it is not needed, but have it automatically enabled when the ListBox becomes too small, you c... | 16,399 |
<p>I have to write a reliable, totally-ordered multicast system from scratch in Python. I can't use any external libraries. I'm allowed to use a central sequencer.</p>
<p>There seems to be two immediate approaches:</p>
<ol>
<li>write an efficient system, attaching a unique id to each multicasted message,
having the ... | <p>The flooding approach can cause a bad situation to get worse. If messages are dropped due to high network load, having every node resend every message will only make the situation worse.</p>
<p>The best approach to take depends on the nature of the data you are sending. For example:</p>
<ol>
<li>Multimedia data: n... | <p>IMHO, you should choose an existing reliable UDP protocol. There are several you can choose, take a look at this SO question: <a href="https://stackoverflow.com/questions/107668/what-do-you-use-when-you-need-reliable-udp/">What do you use when you need reliable UDP?</a></p>
<p>I personally like and use <a href="http... | 21,225 |
<p>I have a legacy MS Access 2007 table that contains 52 fields (1 field for each week of the year) representing historical sales data (plus one field for the year actually). I would like to convert this database into a more conventional Time/Value listing.</p>
<p>Does anyone knows how to do that without writing queri... | <p><a href="http://msdn.microsoft.com/en-us/library/ms177410%28SQL.90%29.aspx" rel="nofollow noreferrer">Using PIVOT and UNPIVOT</a>.</p>
<blockquote>
<p><code>UNPIVOT</code> performs almost the reverse
operation of <code>PIVOT</code>, by rotating
columns into rows. Suppose the table
produced in the previous e... | <p>No need to export to SQL Server. In Access, try the /View/PivotTable View submenu. (It's in my Access 2003, at any rate.) I like it better than the one in Excel.</p>
| 43,382 |
<p>I've been trying to use Firebug's profiler to better understand the source of some JavaScript performance issues we are seeing, but I'm a little confused by the output.</p>
<p>When I profile some code the profiler reports <strong>Profile (464.323 ms, 26,412 calls)</strong>. I suspect that the 464.323 ms is the sum ... | <p>Each column has a description of what it means if you set your mouse to hover over it in Firebug. I'll assume you can read up on how each column works on your own then. However, you have definitely come across some odd behavior which needs to be explained.</p>
<p>The <em>own time</em> is the amount of time the fu... | <p>From what I understand this is how it works... total profiler time is the sum of the 'Own Time' column. However, you may notice that some <strong>single</strong> Time values may be greater than the total profiler time. Those overtimes were spent outside of JavaScript, eg. in a plugin call. If your JS function makes ... | 33,565 |
<p>In Visual Studio I can type e.g. </p>
<blockquote>
<p>for <kbd>TAB</kbd> <kbd>TAB</kbd></p>
</blockquote>
<p>and a code snippet pops in. </p>
<p>Are there built-in code snippets for private, public, etc. methods as well?</p>
| <p><em>ctor</em>: Default constructor</p>
<p><em>prop</em>: Property</p>
<p><em>propg</em>: Read-only property</p>
<p><em>sim</em>: <code>static int main</code> method</p>
<p><em>svm</em>: <code>static void main</code> method</p>
<p>There's a good list <a href="http://www.developer.com/net/net/article.php/3557701/... | <p>The code snippet for properties is:</p>
<blockquote>
<p>prop<kbd>TAB</kbd><kbd>TAB</kbd></p>
</blockquote>
| 37,279 |
<p>I'm thinking about starting work on a fairly large scale .NET or ASP.NET project (I haven't decided yet, but it is likely that, eventually, it will be accessible from both a desktop application written in .NET as well as an ASP.NET web application). However, I'm not sure if there's a conventional way to structure th... | <p>If you are working with the web forms technology and want the ability to create a desktop application with the same code base I would suggest using the Model View Presenter pattern to break out the UI from the business coding. In addition to this approach, I would recommend creating a service layer that handles the... | <p>For code tree layout, I usually do something like this:</p>
<pre><code>projectname/
/source/
/source/projectname.sln
/source/DataAccess/
/source/DataAccess/DataAccess.csproj
/database/schema/
/database/schema/something.sql
/database/testda... | 37,887 |
<p>I have my nozzle close to the substrate that I am printing on, so that a piece of paper can just about slide underneath it freely, without catching.</p>
<p>Is this the right way to do it?</p>
| <p>Traditionally, using a piece of paper (about 0.004" thick) gets you close to your appropriate standoff. However, if you adjust your layer thickness, your standoff should reflect this. Ideally, you will set your standoff <strong>roughly</strong> with a piece of paper or other type of shim stock, then "fine-tune" the ... | <p>Using a piece of paper won't guarantee you get exactly the "correct" height (because different papers have different thicknesses, and it's hard to determine exactly when it no longer catches on the nozzle) but it gets the bed level and the distance will be close to correct.</p>
<p>You can then further adjust the he... | 405 |
<p>I have the very same delphi version, bpls, components, everything. And yet in three machines the resulting executables are different in size.
What else can influence in the size of the exe?</p>
<p>In my machine I get this size (Vista 6.0.6001):</p>
<pre><code>4.547.584 bytes
</code></pre>
<p>In my colleague's mac... | <p>It would seem that it is configuration differences, or if maybe you have different versions of components installed between the three machines. I would suggest creating a blank form and trying it on all 3 after you verify that the build settings are the same. If that is the same then add some 3rd party components ... | <p>Actually it's much more interesting than than. </p>
<p>Even re-building the same application on the same machine, several times in succession, making absolutely NO changes to the configuration whatsoever in between compiles, produces executables of slightly different sizes. I built a particular project 10 times and... | 35,629 |
<p>I've noticed that boost.asio has a lot of examples involving sockets, serial ports, and all sorts of non-file examples. Google hasn't really turned up a lot for me that mentions if asio is a good or valid approach for doing asynchronous file i/o.</p>
<p>I've got gobs of data i'd like to write to disk asynchronously... | <h2>Has boost.asio any kind of file support?</h2>
<p>Starting with (I think) Boost 1.36 (which contains Asio 1.2.0) you can use [boost::asio::]windows::stream_handle or windows::random_access_handle to wrap a HANDLE and perform asynchronous read and write methods on it that use the OVERLAPPED structure internally.</p>... | <p>Linux has an asio Library that is no harder to use than Windows APIs for this job (I've used it). Both sets of operating systems implement the same conceptual architecture. They differ in details that are relevant to writing a good library, but not to the point that you cannot have a common interface for both OS pla... | 49,577 |
<p>I am working on lock free structure with g++ compiler. It seems that with -o1 switch, g++ will change the execution order of my code. How can I forbid g++'s optimization on certain part of my code while maintain the optimization to other part? I know I can split it to two files and link them, but it looks ugly.</p>
| <p>Tail-call optimization is where you are able to avoid allocating a new stack frame for a function because the calling function will simply return the value that it gets from the called function. The most common use is tail-recursion, where a recursive function written to take advantage of tail-call optimization can ... | <p>In a functional language, tail call optimization is as if a function call could return a partially evaluated expression as the result, which would then be evaluated by the caller.</p>
<pre><code>f x = g x
</code></pre>
<p>f 6 reduces to g 6. So if the implementation could return g 6 as the result, and then call th... | 40,074 |
<p>My application uses measurement instruments that are connected to the PC. I want to make it possible to use similar instruments from different vendors. </p>
<p>So I defined an interface: </p>
<pre><code>interface IMeasurementInterface
{
void Initialize();
void Close();
}
</code></pre>
<p>S... | <p>You might be better off coming up with an abstract "Parameters" class that is extended by each different instruments parameters... e.g. and then using Generics to ensure that the correct parameters are passed to the correct classes...</p>
<pre><code>public interface IMeasurement<PARAMTYPE> where PARAMTYPE : P... | <p>That would probably work. Another option is to pass the parameters in a dictionary.</p>
| 29,462 |
<p>I found this question in an old question in your website so i thought i can do it but I think I was mistaken :-)</p>
<p>the old post was <a href="https://stackoverflow.com/questions/360943/read-text-from-file-and-apply-some-operations-on-it">here</a></p>
<p>I'm new at the jagged array thing so did the following co... | <p>The bad news: there are GUI tools to help with this, but its a skilled and wide ranging job. So they don't cover everything, its likely you will need to use command line stuff/sql statements etc to help. I've only really used the command line tools. I'll give a bit of an overview of things I know/have used:</p>
<p>... | <p>I found <a href="http://webyog.com/en/" rel="nofollow noreferrer">MONyog</a> to be a BIG help when I had a suffering mysql server.</p>
<p>It's a webbased system that analyses your system 24/7 and gives you decent suggestions for better values of system variables, cache sizes, etc...</p>
<p>It also has a built in my... | 47,273 |
<p>I am wondering how I can break up my index.php homepage to multiple php pages (i.e. header.php, footer.php) and build a working index.php page using those separate php pages. I know WordPress uses this with different functions like:</p>
<pre><code>GetHeader();
GetFoodter();
</code></pre>
<p>But when I tried to us... | <pre><code>include 'header.php';
include 'footer.php';
</code></pre>
| <p>Use include statements to just include those files to your Page</p>
<p>I think it's </p>
<pre><code>include '[filename]'
</code></pre>
| 31,763 |
<p>Can you provide a good example of rule definition language written in C#.<br>
Java guys have <a href="http://herzberg.ca.sandia.gov/" rel="noreferrer">JESS</a>, is there anything good for C#?</p>
| <p>This page shows some examples of open-source rules engines in C#: <a href="http://csharp-source.net/open-source/rule-engines" rel="noreferrer">http://csharp-source.net/open-source/rule-engines</a></p>
| <p>There is the Microsoft Business Rules Engine: <a href="http://msdn.microsoft.com/en-us/library/aa561216.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa561216.aspx</a>. Not sure if it can only be used inside Biztalk - it does says it is a .Net Class Library.</p>
| 6,540 |
<p>Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time.</p>
| <p>How about something like this?</p>
<pre><code><html>
<head>
<script type="text/javascript">
var HoverListener = {
addElem: function( elem, callback, delay )
{
if ( delay === undefined )
{
delay = 1000;
}
var hoverTimer;
addEvent( elem, 'mouseover', function()
{... | <p>I don't think you need/want the timeout.</p>
<p>onhover (hover) would be defined as the time period while "over" something. IMHO</p>
<pre><code>onmouseover = start...
onmouseout = ...end
</code></pre>
<p>For the record I've done some stuff with this to "fake" the hover event in IE6. It was rather expensive and ... | 32,893 |
<p>I'm trying to create a WPF Shape (PolyLine) editor, which is a control that I want to use to, edit shapes in a canvas.</p>
<p>What the editor needs to do is to be able to display the points and lines of the shape and to move those around.</p>
<p>Can anyone provide me with a idea of how I can accomplish this, or a ... | <p>There is good series of texts about this on <a href="http://www.codeproject.com/" rel="noreferrer">CodeProject</a></p>
<p><a href="http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part1.aspx" rel="noreferrer">WPF Diagram Designer - Part 1</a></p>
<p><a href="http://www.codeproject.com/KB/WPF/WPFDiagramDesigner... | <p>I also liked the WPF DrawTools article on CodeProject, which has a very nicely formatted set of source classes. It provides a simpler example of outline shapes - ellipse, rectangle, line, polyline and text. Unfortunately, it was deleted in 2015, as someone just pointed out to me.</p>
<p>A <a href="https://web.archi... | 30,280 |
<p>Markdown is a great tool for formatting plain text into pretty html, but it doesn't turn plain-text links into URLs automatically. Like this one:</p>
<p><a href="http://www.google.com/" rel="noreferrer">http://www.google.com/</a></p>
<p>How do I get markdown to add tags to URLs when I format a block of text?</p>
| <p>I couldn't get superjoe30's regular expression to compile, so I adapted his solution to convert plain URLs (within Markdown text) to be Markdown compatible.</p>
<p>The modified filter:</p>
<pre><code>urlfinder = re.compile('^(http:\/\/\S+)')
urlfinder2 = re.compile('\s(http:\/\/\S+)')
@register.filter('urlify_mark... | <p>I know this question is almost a decade old, but markdown-urlize covers every possible use case I could think of including not requiring http(s):// before a url, leaving the parenthesis in <code>(google.com)</code>, removing the angle brackets from <code><google.com></code>, ignoring urls in code blocks, and m... | 24,940 |
<p>I'm looking for a control that the Visual Studio "Toolbox" menu uses. It can be docked and can retract (pin).</p>
<p>Would you know where I can find a control or COM I could use which would look like this?</p>
| <p>I would recommend the <a href="http://sourceforge.net/projects/dockpanelsuite" rel="nofollow noreferrer">DockPanel Suite</a> by Weifen Luo.</p>
| <p>You don't mention what language you want to use. For C++, use the Feature Pack.</p>
| 8,725 |
<p>I need to create value objects from struts form beans. Is it a good idea to use Bean Utils or create the VO manually?</p>
<p>Anyone faced any isues with bean utils?</p>
| <p>value object is not created by developer side but it is automatically created by struts framework software in which form bean class plays role to create it.</p>
<p>****Definition:**** when the huge data transfering from one layer to another layer which can be transfering whaen as individual value for multiple no. o... | <p>I have never faced any issues in using BeanUtils. It is always a good idea to use BeanUtils to get this job done as we can avoid rewriting code for this.</p>
| 46,021 |
<p>I want to refactor this mumbo jumbo of a method to make it more readible, it has way to many nested IF's for my liking.</p>
<p>How would you refactor this?</p>
<pre><code>public static void HandleUploadedFile(string filename)
{
try
{
if(IsValidFileFormat(filename)
{
int folderID = GetFolderIDFrom... | <p>I would reverse the conditions in the test to <i>if bad then deleteAndLog</i> as the example below. This prevent nesting and puts the action near the test.</p>
<pre><code>try{
if(IsValidFileFormat(filename) == false){
DeleteFile(filename);
LogError("invalid file format");
return;
}
... | <p>It's the elses above that throw my eye. Here's <strong>an</strong> alternative, inside the try {}</p>
<p>You can make this even shorter by returning after MoveToSafeFolder (Even though you're returning the finally block will be executed.) Then you don't need to assign an empty string to errorMessage, and you don't ... | 46,429 |
<p>I have a field in my form labeled "Name" that will contain both the First & Last name.</p>
<p>Our existing dynamic server (to which the form is being POSTed to), expects two separate fields (first name, last name). </p>
<p>Can I use Javascript to split the user input into two separate variables before the form... | <p>You should not rely on client side parsing whenever possible. If you are sending this form to an app you can't modify, use the Javascript method mentioned above because you have no control over it (but then why not just have a first and last name field). But if you are controller the backend app, perform all your ... | <p>You can do something like this:</p>
<pre><code>var yourForm = document.getElementById('yourFormId');
yourform.onsubmit = new function()
{
var nameBox = document.getElementById('nameBox');
var fname = document.createElement('INPUT');
var lname = document.createElement('INPUT');
fname.type = 'HIDDEN';... | 39,536 |
<p>I have an SQL Server database where I have the data and log files stored on an external USB drive. I switch the external drive between my main development machine in my office and my laptop when not in my office. I am trying to use sp_detach_db and sp_attach_db when moving between desktop and laptop machines. I f... | <p>Crazy as it sounds, did you try manually granting yourself perms on the files via right-click / properties / security? I think SQL Server 2005 will set permissions on a detached file exclusively to the principal that did the detach (maybe your account, maybe the account under which the SQL Server service runs) and n... | <p>I had the same issue. Someone had detached the files and left, and we were unable to move it to another drive. But after taking ownership of the file (security-->advanced-->take ownership to your login id), and then adding your login id to the security tab and giving access on the file, was able to move.</p>
| 10,400 |
<p>I have to integrate a large Java library in a quite large C++ application. A solution is to use JNI but this requires to hand code all the classes. Python has, for example, a wonderful solution with JPype (<a href="http://jpype.sourceforge.net/" rel="nofollow noreferrer">http://jpype.sourceforge.net/</a>) that autom... | <p><a href="http://www.swig.org/" rel="nofollow noreferrer">SWIG</a> is a tool that lets you auto-generate bindings from one language to another. It supports C++ and Java and a dozen other languages.</p>
| <p>Not sure if this commercial tool makes life any easier, but you might wanna explore -- <a href="http://www.teamdev.com/jniwrapper/index.jsf" rel="nofollow noreferrer">http://www.teamdev.com/jniwrapper/index.jsf</a></p>
| 21,782 |
<p>I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?</p>
| <p>Check the <code>AUTH_USER</code> request variable. This will be empty if your web app allows anonymous access, but if your server's using basic or Windows integrated authentication, it will contain the username of the authenticated user.</p>
<p>In an Active Directory domain, if your clients are running Internet Exp... | <p>try this code :</p>
<pre><code>$user= shell_exec("echo %username%");
echo "user : $user";
</code></pre>
<p>you get your windows(AD) username in php </p>
| 20,356 |
<p>Is there any way to have a reset button in the SSRS parameter window?</p>
| <p>No, or i haven't heard how to do it. But you can simulate it.</p>
<p>One way to do this is to create a textbox that has an action set to jump to itself. You can or jump to the default values, or jump to itself with some parameters already assigned.</p>
| <p>Modify the ReportViewer.aspx...</p>
<p>I came across this article on how to do it but didn't try it as I was only looking into whether it can be done/has been done before and need confirmation before I can develop it:</p>
<p><a href="https://github.com/MagnusJohansson/CustomSSRSReportViewer" rel="nofollow">https:/... | 39,274 |
<p>Does Office 2007 PIA also require Office 2007 to be installed?
Can I deploy Office 2007 PIA with VSTO 3.0 (without having Office 2007 installed)?</p>
<p>EDIT: I have a windows application that generates MS Word files. I have added the Office 2007 PIA as custom pre-requisite in the setup, but Office 2007 PIA needs M... | <p>In order to use VSTO you must have Office Installed. The VSTO PIA's only provide a shim between .NET and the COM interfaces that Office exposes. So the PIA's can do nothing w/o Office.</p>
| <p>What do you want to do with the Primary Interop Assemblies exactly? I think you need to clarify your question a bit.</p>
<p>If you plan on making any method calls to the Microsoft Office PIA DLLs without Office installed you can expect your code to blow up with a COMException when you run it since Office isn't ther... | 48,388 |
<p>I would like to display certain meta data fields in the edit form based on the value of a fields. </p>
<p>Example: Users upload a document to the Doclib to be approved by there manager. They are allowed to change the meta data Name,Case No, Location until the item is approved by the manager. Once the item is approv... | <p>This can be easily solved with SharePoint Designer.</p>
<ul>
<li>You will need to modify <strong>EditForm.aspx</strong> for your list</li>
<li>Hide the default <strong>ListFormWebPart</strong> (Do not delete it!)</li>
<li>Insert custom edit item form (<a href="http://office.microsoft.com/en-us/sharepointdesigner/HA... | <p>Follow Toni's comments but for your <em>_ModerationStatus</em> field use following XSLT function:</p>
<pre><code><xsl:when test="not(starts-with(@_ModerationStatus,'0'))">
</code></pre>
| 47,009 |
<p>Can someone explain me how it works, starting from when you select to run a test</p>
| <p>When you select to run a test, </p>
<ul>
<li>it will create an instance of the parent class of that test method. </li>
<li>It then proceeds to run the method marked with TestFixtureSetup attribute if one exists (once for the the test class).</li>
<li>Next is the method marked with the Setup attribute is called if o... | <p>What do you mean how does it work? </p>
<p>You define your test classes with [TestFixture] and your tests with [Test]</p>
<p>It's nothing more than a testing framework, you still have to write the tests and all of that jazz :)</p>
| 13,631 |
<p>I need to determine if a Class object representing an interface extends another interface, ie:</p>
<pre><code> package a.b.c.d;
public Interface IMyInterface extends a.b.d.c.ISomeOtherInterface{
}
</code></pre>
<p>according to <a href="http://web.archive.org/web/20100705124350/http://java.sun.com:80/j2se/1... | <p>Use Class.getInterfaces such as:</p>
<pre><code>Class<?> c; // Your class
for(Class<?> i : c.getInterfaces()) {
// test if i is your interface
}
</code></pre>
<p>Also the following code might be of help, it will give you a set with all super-classes and interfaces of a certain class:</p>
<pre><co... | <p>Take a look at Class.getInterfaces();</p>
<pre><code>List<Object> list = new ArrayList<Object>();
for (Class c : list.getClass().getInterfaces()) {
System.out.println(c.getName());
}
</code></pre>
| 14,203 |
<p>I'd like to build a pretty simple plug-in for Visual Studio, but I don't really know how this has to be done. Is this doable in (non-managed) C++? </p>
<p>I'd like to know what resources you'd recommend me.</p>
| <p>I've never tried, so I don't know about doing it in C++, but this website has loads of information: <a href="http://msdn.microsoft.com/en-us/vsx/default.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vsx/default.aspx</a></p>
| <p>Found this MSDN tutorial: <a href="http://msdn.microsoft.com/en-us/library/aa699351%28VS.60%29.aspx" rel="nofollow noreferrer">Creating Add-ins Using Visual C++</a>. Thanks Matt.</p>
| 6,554 |
<p>I have a "watcher" module that is currently using global hierarchies inside it. I need to instantiate a second instance of this with a second global hierarchy.</p>
<p>Currently:</p>
<pre><code>module watcher;
wire sig = `HIER.sig;
wire bar = `HIER.foo.bar;
...
endmodule
watcher w; // instantiation
</code></pre>
... | <p>My preference is to have a single module (or a small number of modules) in your testbench that contains all your probes but no other functionality. All other modules in your testbench that require probes then connect to that "probe module". Use SystemVerilog interfaces in preference to raw wires if that's an option ... | <p>Can you use the SystemVerilog <code>bind</code> keyword to bind the module into every hierarchy that requires it? (This requires that you use SystemVerilog, and have a license for a simulator.)</p>
<p>Using bind is like instantiating a module in the normal way, except that you provide a path to hierarchy into which... | 9,296 |
<p>What's the easiest way to figure out if a window is opened modally or not?</p>
<p><strong>CLARIFICATION:</strong></p>
<p>I open a window calling </p>
<pre><code>myWindow.ShowDialog();
</code></pre>
<p>I have a footer with an "OK" & "Cancel" button that I only want to show if the window is opened modally. Now... | <p>From <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c95f1acb-5dee-4670-b779-b07b06afafff/" rel="noreferrer">http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c95f1acb-5dee-4670-b779-b07b06afafff/</a></p>
<p><em>"System.Windows.Interop.ComponentDispatcher.IsThreadModal can tell you if the c... | <p>Would it be possible to check the window's parent to see if it is disabled? I'm not sure if this can be done via WPF APIs or not, but if nothing else you could get the HWND of the WPF window, get its parent via Win32 P/Invoke (or whatever), and then check to see if it is disabled or not.</p>
<p>Definitely not a cle... | 48,167 |
<p>Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value.
If the user changes another value (or the same value again by clicking many times... | <p>Try interrupt() as some have said to see if it makes any difference to your thread. If not, try destroying or closing a resource that will make the thread stop. That has a chance of being a little better than trying to throw Thread.stop() at it.</p>
<p>If performance is tolerable, you might view each 3D update as... | <p>Maybe this can help you: <a href="http://www.jguru.com/forums/view.jsp?EID=1268343" rel="nofollow noreferrer">How can we kill a running thread in Java?</a></p>
<blockquote>
<p>You can kill a particular thread by setting an external class variable.</p>
</blockquote>
<pre><code> Class Outer
{
public stati... | 11,964 |
<p>I have an existing fairly large classic asp website, with virtual directories configured to centralize certain resources. My problem is for some reason I can't access any of my namespaces and classes. I tried adding a reference to another project where I have classes in a namespace "DAL" and even though intellisense... | <p>Using an NTFS Junction Point to achieve what sounds like the same goal has been working for me.</p>
<p>By way of an example, I have a web site with 20+ child IIS Applications that are largely identical (don't ask!), rather than duplicating the 'bin' folder in each of these (they would be identical) each child appli... | <p>Maybe make the website route folder a nested application in IIS?</p>
| 49,185 |
<p>Lets say I am currently at:
<code>http://example.com/folder/page.html</code></p>
<p>Is it possible to create a relative link on this page that points to <code>http://example.com/folder/</code> without specifying <code>folder</code> anywhere? (And using only HTML.)</p>
<p><strong>UPDATE:</strong>
<strong>As it turn... | <p>Just dot is working. The doctype makes a difference however as sometimes the ./ is fine as well.</p>
<pre><code><a href=".">Link to this folder</a>
</code></pre>
| <p>Both of the below seem to work</p>
<p>./</p>
<p>.</p>
| 37,966 |
<p>As I mention in an earlier question, I'm refactoring a project I'm working on. Right now, everything depends on everything else. Everything is separated into namespaces I created early on, but I don't think my method of separtion was very good. I'm trying to eliminate cases where an object depends on another object ... | <p>You seem to have two conflicting requirements: </p>
<blockquote>
<p>Inside GameName.Gui I
have a <strong>MapView object that displays</strong> a
Map and <strong>any IRenderable</strong> objects on it.</p>
</blockquote>
<p>and</p>
<blockquote>
<p>But, the <strong>MapView also needs the object
to implemen... | <p>What you might consider, but I guess I am no expert in the area, is to split the engine in two, a renderer and a location-manager. You could then add ILocateable objects to the latter and IRenderable ones to the former. However if you think this doesn't make any sense and/or is far too complex, creating this merged ... | 25,454 |
<p>I'm a long-time emacs user, and I'm now working about 1/2 time in Java.</p>
<p>What are the best emacs libraries for</p>
<ol>
<li>Debugging Java</li>
<li>Code Completion/Intellisense</li>
<li>Javadoc browsing</li>
</ol>
<p>?</p>
| <p>I've used <a href="http://jdee.sourceforge.net/" rel="noreferrer">JDEE</a> on several projects. It handles Code Completion. I've never used it for debugging or browsing docs, but it's a big step up from a basic text editor.</p>
| <p>I've had good success with <a href="http://code.google.com/p/jdibug/" rel="nofollow noreferrer">jdibug</a> for debugging Java code with Emacs.</p>
| 6,236 |
<p>In my host, I currently have installed 2 wordpress applications, 1 phpBB forum and one MediaWiki.</p>
<p>Is there a way to merge the login so that all applications share the same credentials?</p>
<p>For instance, I want to register only in my phpBB and then I want to access all other applications with the given us... | <p>when you integrate the system. Just remember 2 things:</p>
<ol>
<li><p>Login to system<br/>
Check username/password with both systems.</p></li>
<li><p>Change of Password<br/>
Update the password on both systems.</p></li>
</ol>
| <p>Having tried to do this some years ago I remember it not being very easy. </p>
<p>The way I did it was to create totally new table to user/pass and then replace these columns in the respective software with foreign keys to your new table - this required <strong>a lot</strong> of custom tweaking of core files in eac... | 6,066 |
<p>Having installed Hibernate Tools in Eclipse, how can I view the would-be generated SQL query of from the JPA query language? (I'm using Hibernate as my JPA implementation)</p>
<p>My Java DAO class looks something like:</p>
<pre><code>public List<Person> findById(int id)
{
return entityManager.find(Person... | <p>In order to see the SQL query you can just configure hibernate.show_sql=true in your hibernate.cfg.xml file. Then you should see the queries in the console window during application execution.</p>
<p>That's the feature of the hibernate runtime, when Tools provide you with HQL editor, so you can test the queries bef... | <p>In order to see the SQL query you can just configure hibernate.show_sql=true in your hibernate.cfg.xml file. Then you should see the queries in the console window during application execution.</p>
<p>That's the feature of the hibernate runtime, when Tools provide you with HQL editor, so you can test the queries bef... | 45,793 |
<p>I would like to know if anyone here knows an API where it's possible for me to create a live webcam broadcast from inside my website?</p>
<p>I was checking the uStream API and it seems that you can't create anything, just retrieve data... Does anyone knows anything like this?</p>
<p>Thanks in advance!</p>
| <p>you can use Flash Media Server or Flash Comm Server and code in actionscript to connect to the server for live streaming. AS3 has got inbuilt support for web cam programming using Flash Communication Server/Media Server.</p>
| <p>See <a href="http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000252.html" rel="nofollow noreferrer">Basics of video</a> at adobe.com</p>
| 32,114 |
<p>I'm still new with C#, and I'm working on a project where we also use WPF, and the WPF DataGrid Toolkit (See at CodePlex), which hasn't yet been released into the framework. Due to the nature of the project, it's 100% sure we will be altering some controls of the assembly later.
My co-workers have decided to redefi... | <p>What kind of alterations are you talking about? It seems like a waste of time to pre-emptively derive from each of the classes before you know what you'll actually need to change.</p>
<p>When you <em>do</em> need to change something, it shouldn't be too hard to create the derived class at that point, and fix up any... | <p>I agree with you. The alterations, or better said, the changes, can be of any kind. Behavior and etc. And the changes should be make just in time.
Unfortunately, that is not my decision. Some stubborns are at work :)</p>
<p>But what is interesting me is if a complete different approach to the whole idea exists?
Say... | 44,650 |
<p>I am attempting to get the <a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">Resharper</a> test runner to recognize my MSTest unit tests via <a href="http://www.gallio.org/" rel="nofollow noreferrer">Gallio</a>.</p>
<p>I have the following installed:
VSTS 2005 8.0.50727.762
Resharper 4.1
Galli... | <p>It looks like this is a Gallio problem. It appears to only support the version of MSTest that comes with VS2k8. The XML format for vsmdi has changed between versions.</p>
| <p>You do not need resharper to support standalone mstest installation. I explain how to make a standalone mstest installation without the VS in my post here - <a href="http://www.shunra.com/shunrablog/index.php/2009/04/running-mstest-without-visual-studio" rel="nofollow noreferrer">http://www.shunra.com/shunrablog/ind... | 11,970 |
<p>I'm trying to use the < C-a> (<kbd>CTRL</kbd>+<kbd>A</kbd>) shorcut under vim to increment a variable under the cursor. This works fine under vim running on Linux. However when I try to do this in gvim under windows it "selects all" (i.e. highlights or visually selects all text in the current window). How can I c... | <p>This is because of mswin.vim that is sourced by the default _vimrc generated when you install vim.
Just override your _vimrc with the .vimrc you are using under *nix, or delete mswin.vim.</p>
| <p>Vim on Windows has specialized key mappings by default to make shortcuts more "windows-y". These are specified in the $VIMRUNTIME\mswin.vim file, which is loaded via your vimrc unless you disabled it. You can edit the mswin.vim file (you may want to edit a copy instead, changing your vimrc to use your edited copy in... | 36,898 |
<p>I need to recursively search directories and replace a string (say <a href="http://development:port/URI" rel="nofollow noreferrer">http://development:port/URI</a>) with another (say <a href="http://production:port/URI" rel="nofollow noreferrer">http://production:port/URI</a>) in all the files where ever it's found. ... | <p>Try this:</p>
<pre><code>find . -type f | xargs grep -l development | xargs perl -i.bak -p -e 's(http://development)(http://production)g'
</code></pre>
<p>Another approach with slightly more feedback:</p>
<pre><code>find . -type f | while read file
do
grep development $file && echo "modifying $file" &... | <p>Use <code>zsh</code> so with advanced globing you can use only one command.
E.g.:</p>
<pre><code>sed -i 's:pattern:target:g' ./**
</code></pre>
<p>HTH</p>
| 15,137 |
<p>I have this Array i wrote a function MostFreq that takes an array of integers and return 2 values : the more frequent number in the array and its frequency check this code i worte what do you think ? is there a better way to do it?</p>
<pre><code>static void Main()
{
int [] M={4,5,6,4,4,3,5,3};
int x;
... | <p>LINQ it up. I know this is in VB but you should be able to convert it to C#:</p>
<pre><code>Dim i = From Numbers In ints _
Group Numbers By Numbers Into Group _
Aggregate feq In Group Into Count() _
Select New With {.Number = Numbers, .Count = Count}
</code></pre>
<p>EDIT: Now ... | <pre><code>int count = 1;
int currentIndex = 0;
for (int i = 1; i < A.Length; i++)
{
if (A[i] == A[currentIndex])
count++;
else
count--;
if (count == 0)
{
currentIndex = i;
count = 1;
}
}
int mostFreq = A[currentIndex];
</code></pre>
| 35,292 |
<p>I've heard that projects developed using TDD are easier to refactor because the practice yields a comprehensive set of unit tests, which will (hopefully) fail if any change has broken the code. All of the examples I've seen of this, however, deal with refactoring implementation - changing an algorithm with a more ef... | <blockquote>
<p>Plus it seems that having to
synchronize a comprehensive test suite
with constantly changing code would be
a pain. I understand that the unit
test suite could help tremendously
during maintenance, once the software
is built, stable, and functioning, but
that's late in the game wheras TDD... | <p>Kent Beck's TDD book.</p>
<p>Test first. Following S.O.L.I.D OOP principles and a using a good refactoring tool are indispensable, if not required.</p>
| 31,879 |
<p>Say I have the following:</p>
<pre><code><ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
</code></pre>
<p>How would I select all the child elements after the first one using jQuery? So I can achieve something like:</p>
<pre><code><ul&g... | <p>You should be able to use the "not" and "first child" selectors.</p>
<pre><code>$("li:not(:first-child)").addClass("something");
</code></pre>
<p><a href="http://docs.jquery.com/Selectors/not" rel="noreferrer">http://docs.jquery.com/Selectors/not</a></p>
<p><a href="http://docs.jquery.com/Selectors/firstChild" re... | <p>Use jQuery .not() method</p>
<pre><code>$('li').not(':first').addClass('something');
</code></pre>
<p>OR</p>
<pre><code>var firstElement = $('li').first();
$('li').not(firstElement).addClass('something');
</code></pre>
| 21,503 |
<p>Can you import (or migrate) SQL Server 2005 databases to SQL Server 2008?</p>
<p>Is it possible to have the same 2005 and 2008 running on the same machine without complications?</p>
| <p>Yes. You can restore a backup from SQL 2005 in SQL 2008. You can also have instances of both on the same machine.</p>
<p>Edit: This question has been asked before (more or less). <a href="https://stackoverflow.com/questions/204212/can-an-ms-sql-2005-backup-be-restored-onto-an-instance-of-ms-sql-2008">See here</a></... | <p>Yes, and Yes.</p>
<p>The fastest way to move from one to the other that I have found is just to do a backup from SQL 2005 and a restore to SQL 2008.</p>
<p>I have both running side-by-side on my dev box without issue.</p>
| 30,664 |
<p>How can I find the public facing IP for my net work in Python?</p>
| <p>This will fetch your remote IP address</p>
<pre><code>import urllib
ip = urllib.urlopen('http://automation.whatismyip.com/n09230945.asp').read()
</code></pre>
<p>If you don't want to rely on someone else, then just upload something like this PHP script:</p>
<pre><code><?php echo $_SERVER['REMOTE_ADDR']; ?>
... | <p>You can also use DNS which in some cases may be more reliable than http methods:</p>
<pre><code>#!/usr/bin/env python3
# pip install --user dnspython
import dns.resolver
resolver1_opendns_ip = False
resolver = dns.resolver.Resolver()
opendns_result = resolver.resolve("resolver1.opendns.com", "A&quo... | 20,118 |
<p>What's the best Python idiom for this C construct?</p>
<pre><code>while ((x = next()) != END) {
....
}
</code></pre>
<p>I don't have the ability to recode next().</p>
<p>update: and the answer from seems to be:</p>
<pre><code>for x in iter(next, END):
....
</code></pre>
| <p>@Mark Harrison's answer:</p>
<pre><code>for x in iter(next_, END):
....
</code></pre>
<p>Here's an excerpt from <a href="http://docs.python.org/library/functions.html" rel="noreferrer">Python's documentation</a>:</p>
<pre><code>iter(o[, sentinel])
</code></pre>
<blockquote>
<p>Return an iterator object.
... | <p>What are you trying to do here?
If you're iterating over a list, you can use <code>for e in L</code> where e is the element and L is the list. If you're filtering a list, you can use list comprehensions (i.e. <code>[ e for e in L if e % 2 == 0 ]</code> to get all the even numbers in a list).</p>
| 4,817 |
<p>What VBA code is required to perform an HTTP POST from an Excel spreadsheet?</p>
| <pre><code>Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "http://www.somedomain.com"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ""
</code></pre>
<p>Alterna... | <p>I did this before using the MSXML library and then using the XMLHttpRequest object, see <a href="http://web.archive.org/web/20060904064108/http://scriptorium.serve-it.nl/view.php?sid=40" rel="nofollow noreferrer">here</a>.</p>
| 19,188 |
<p>I have a movie which is made up of a series of SWF files that read XML. Is there any way to burn it to a CD/DVD or at least convert it to a 'burnable' format such as AVI, MPEG, or ISO? Currently in order to burn it I have to so some funky screen capture stuff and recorded it to a DVD that way.</p>
| <p>Flash CS3 has a nifty way to export any swf (including those that use scripts) to video, but for some reason this is only available when exporting to .mov</p>
<p>Open up your animation in Flash, if you don't have a .fla available making a simple wrapper that loads your swf should work too. Then go File -> Export ->... | <p>If you're targeting disc media, embedding the XML in your SWFs may help. Here's a snippet example -- this is with JSON data, but XML files will works more or less the same.</p>
<pre><code>package ost.panda.map.core {
/// ...
public dynamic class Signatories extends EventDispatcher {
[Embed(source='../build/j... | 37,695 |
<p>I'm trying to call a web service from Excel 2003 module.
The way i've implemented it is creating a .NET COM library with all the classes/methods i need to be exposed.
When i try to call a method that queries a web service from Excel the execution just stops on that line without any error.
May be it has to do with re... | <p>To solve the problem i used Access instead of Excel. In Access it was showing me errors. It turned out that the location of all the reference assemblies should be the location of caller application (in this case it was C:\Program Files\Microsoft Office\OFFICE11). Sencondly my web services proxies were loading the en... | <p>To solve the problem i used Access instead of Excel. In Access it was showing me errors. It turned out that the location of all the reference assemblies should be the location of caller application (in this case it was C:\Program Files\Microsoft Office\OFFICE11). Sencondly my web services proxies were loading the en... | 20,832 |
<p>I try to instantiate an instance of <code>SPSite</code> on the farm server in a custom process (MyApp.exe) and I give it as parameter the whole URI (<a href="http://mysite:80/" rel="nofollow noreferrer">http://mysite:80/</a>). I also made sure that the account running <code>MyApp.exe</code> is <code>Site Collection ... | <p>The FileNotFoundException is thrown by SharePoint when it cannot find the requested site collection in the SharePoint configuration database. My guess is that you have not yet created a site collection on the URL <a href="http://mysite:80" rel="noreferrer">http://mysite:80</a>. I see the following stack trace if I t... | <p>I was plagued by this a few weeks ago. Ultimately I discovered that the file that could not be found was the SharePoint assembly itself. The runtime was failing to load the satellite assembly via late-binding. </p>
<p>The solution to my problem was to register the SharePoint 12.0.0.0 Assemblies in the GAC. It d... | 33,384 |
<p>i could call a page inside the same domain, but its not working when i calling a page in a sub domain due to security issues. what i have to do? help me!!!</p>
| <p>You can set the document.domain but if I remember correctly a few browsers (Opera) will not even allow this. I am afraid your answer is to create some sort of proxy on the subdomain that you can talk through</p>
| <p>Due to security reasons, most browsers don't allow ajax requests to different domains. So as far as I know, you won't be able to do that.</p>
| 38,261 |
<p>I'm just getting back into C++ after a couple of years of doing a lot of C#, and recently Objective C.</p>
<p>One thing I've done before is to roll my own iterator adapter for std::map that will deref to just the value part, rather than the key-value pair. This is quite a common and natural thing to do. C# provides... | <p>I don't think there's anything out of the box. You can use boost::make_transform.</p>
<pre><code>template<typename T1, typename T2> T2& take_second(const std::pair<T1, T2> &a_pair)
{
return a_pair.second;
}
void run_map_value()
{
map<int,string> a_map;
a_map[0] = "zero";
a_map[1... | <p>Continuing David's answer, there's another possibility to put the boile by creating a derived class from boost::transform_iterator. I'm using this solution in my projects:</p>
<pre><code>namespace detail
{
template<bool IsConst, bool IsVolatile, typename T>
struct add_cv_if_c
{
typedef T type;
};
templat... | 32,382 |
<p>I'm trying to get Wininet to ignore Internet Explorer's "Work Offline" mode, for both HTTP and FTP.</p>
<p>So I'm trying to use <code>InternetSetOption()</code> with <code>INTERNET_OPTION_IGNORE_OFFLINE</code>. The documentation says "This is used by <code>InternetQueryOption</code> and <code>InternetSetOption</co... | <p>I checked use of <code>INTERNET_OPTION_IGNORE_OFFLINE</code> with the IE 9 version of WinInet and it does seem to work.</p>
<p>Make sure you call InternetSetOption <em>before</em> you call HttpOpenRequest and pass in the hInternet handle instead. The option must be set before the request actually gets sent to the s... | <p>Did you tried <code>GET</code> instead of <code>POST</code> which sends additional data in headers? </p>
<p>For example in REST-ful API POST request is equivalent to Create, Update, Delete and GET to Read and that might break the offline mode. Just guessing...</p>
| 28,610 |
<p>I'm running Windows XP SP3 and I do have the latest .NET libraries installed, as well as Visual Studio 2008. I'm also running (and would like to continue to run) Apache HTTP Server as well, if that matters.</p>
<p>Perhaps someone can provide a list of software that I need and then I can look up configuration or ask... | <p>You already have everything you need to run ASP.NET applications; Visual Studio 2008 has an inbuilt web server '<a href="http://www.asp.net/Downloads/archived/cassini/" rel="nofollow noreferrer">Casinni</a>' that starts up and hosts your asp.net site when you compile and run from the development environment (Press F... | <p>Press F5 in Visual Studio.</p>
| 37,139 |
<p>I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this:</p>
<p>DataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell());</p>
<p>You see that I need a CheckBox cell templa... | <p>Well, after more than 4 hours of debugging, I have found that the DataGridView row height was too small for the checkbox to be painted, so it was not displayed at all. I have found this after an accidental row height resizing.</p>
<p>As a solution, you can set the AutoSizeRowsMode to AllCells.</p>
<p><code>richDat... | <p>Create a TemplateField and bound the id to it, something like this:</p>
<pre><code><asp:TemplateField HeaderText="Whatever" SortExpression="fieldname" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox runat="server" ID="rowCheck" key='<%# Eval("id") %>' />
<... | 9,670 |
<p>How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendly.</p>
<p>There are probably a nice little function that re... | <p>This is an old question but I had the same problem now and maybe this can help others.</p>
<p>In Delphi 7 there is an procedure in ADODB that return a TStringList with the provider names.</p>
<p>Usage example:</p>
<pre><code>names := TStringList.Create;
ADODB.GetProviderNames(names);
if names.IndexOf('SQLNCLI10'... | <p>I believe the OLEDB objects in question are buried someplace in the registry, since OLEDB / ADO is a COM solution. My guess would be to see if you can find the GUID that your driver is installed as in the registry.</p>
| 13,901 |
<p>I was wondering if you know somewhere where I can find information on how to build a signature file for docuement retrieval. <br>
Do you know if there is some code out there that I can use or look at?<br>
I have to create a signature file in C++ under linux platform.<br>
<br>
<b>UPDATE: Sorry, I appreciatte the help... | <p>Firstly, lets clarify some terminology.</p>
<p>A Digital Signature is intended to be equivilent to a handwritten signature (see <a href="http://en.wikipedia.org/wiki/Digital_signature" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Digital_signature</a> for a better description and overview).</p>
<p>When a... | <p><a href="http://en.wikipedia.org/wiki/Md5sum" rel="nofollow noreferrer">md5sum</a> might be what you are looking for. Source code for generating md5 signatures is available if you Google around.</p>
<p>From Wikipedia:</p>
<blockquote>
<p>Because almost any change to a file
will cause its MD5 hash to also
cha... | 21,860 |
<p>I am looking for a way to do a keep alive check in .NET. The scenario is for both UDP and TCP.</p>
<p>Currently in TCP what I do is that one side connects and when there is no data to send it sends a keep alive every X seconds.</p>
<p>I want the other side to check for data, and if non was received in X seconds, t... | <p>If you literally mean "KeepAlive", try the following.</p>
<pre><code> public static void SetTcpKeepAlive(Socket socket, uint keepaliveTime, uint keepaliveInterval)
{
/* the native structure
struct tcp_keepalive {
ULONG onoff;
ULONG keepalivetime;
ULONG keepaliveinterva... | <p>Since you cannot use the blocking (synchronous) receive, you will have to settle for the asynchronous handling. Fortunately that's quite easy to do with .NET. Look for the description of BeginReceive() and EndReceive(). Or check out this <a href="http://www.codeguru.com/csharp/csharp/cs_network/sockets/article.php/c... | 20,417 |
<p>Why is there a minimum character count for posting questions? o.O</p>
<p>Do you use int, bigint, tinyint, whatever?</p>
<p>It seems like a small thing I guess, I was just wondering what the usual practice is</p>
| <p>It all depends ... my favorite answer to a question! =)</p>
<p>Most of the time we use Guids. While they are larger, size-wise, than int, tinyint and so on, I like the fact that my business objects can <strong>know</strong> what the value is <strong>before</strong> inserting records into the database. </p>
<p>At... | <p>Wouldn't it depend on how many ids you're likely to need to store over the lifetime of the app?</p>
| 25,880 |
<p>What CSS should I use to make a cell's border appear even if the cell is empty?</p>
<p>IE 7 specifically.</p>
| <p>If I recall, the cell dosn't exist in some IE's unless it's filled with something...</p>
<p>If you can put a <code>&nbsp;</code> (non-breaking space) to fill the void, that will usually work. Or do you require a pure CSS solution?</p>
<p>Apparently, IE8 shows the cells by default, and you have to hide it with ... | <p>"IE" isn't a useful term in this context anymore now that IE8 is out.</p>
<p>IE7 always does "empty-cells:show" (or so I'm told ... Vista).
IE8 in any of its "Quirks" or "IE7 Standards" modes always does "empty-cells:hide".
IE8 in "Standards" mode defaults to "empty-cells:show" and supports the attribute via CSS.</... | 8,119 |
<p>I have created a template for Visual Studio 2008 and it currently shows up under File->New Project->Visual C#. However, it is only really specific to Visual C#/Windows but I can't work out how to get it to show up under the "Windows" category and not the more general "Visual C#".</p>
| <p>Check out MSDN "<a href="http://msdn.microsoft.com/en-us/library/y3kkate1.aspx" rel="noreferrer">How to: Locate and Organize Project and Item Templates</a>"</p>
<p>Create a folder within one of these</p>
<pre><code><VisualStudioInstallDir>\Common7\IDE\ItemTemplates\CSharp\
My Documents\Visual Studio 2008\Tem... | <p>Categorization of templates depends on settings (for example, if you choose "C#" settings, all of a sudden all other languages move to an "other languages" tree).</p>
<p>What folder is your template in?</p>
| 3,331 |
<p>What are some good toolsets for graphing/charting in a web application? Preferably open-source/freeware, and particularly looking at developing with ASP.NET MVC or Silverlight 2.0.</p>
| <p><a href="http://www.dundas.com/" rel="nofollow noreferrer">Dundas Chart</a> is one of the best out there. It's not free, but it's worth it.</p>
| <p><a href="http://code.google.com/apis/chart/" rel="nofollow noreferrer">Googel Charts</a> was the first thing that came to my mind. I had also used <a href="http://www.ejschart.com/#Features" rel="nofollow noreferrer">Emprise Javascript Charts</a> at a previous employer with some luck; but it is not free to use.</p>
| 18,502 |
<p>I'm trying to do the following in my Django template:</p>
<pre><code> {% for embed in embeds %}
{% embed2 = embed.replace("&lt;", "<") %}
{{embed2}}<br />
{% endfor %}
</code></pre>
<p>However, I always get an invalid block or some syntax error when I do anything like that... | <p>I am quite sure that Django templates does not support that.
For your replace operation I would look into different filters.</p>
<p>You really should try to keep as much logic as you can in your views and not in the templates.</p>
| <p>Django templates use their own syntax, not like <a href="http://en.wikipedia.org/wiki/Kid_%28templating_language%29" rel="nofollow noreferrer">Kid</a> or <a href="http://en.wikipedia.org/wiki/Genshi_%28templating_language%29" rel="nofollow noreferrer">Genshi</a>.</p>
<p>You have to roll your own <a href="http://doc... | 34,846 |
<p>Imagine I have a chunk of initialisation code at the top of a stored procedure with a number of variable assignments:</p>
<pre><code>SET @proc = 'sp_madeupname'
SET @magic_number = 42
SET @tomorrows_date = DATEADD(dd, 1, GETDATE())
...
</code></pre>
<p>Clearly doing all of the above as one SELECT would be faster:<... | <p>In this case, SELECT wins, performance-wise, when performing multiple assignments.</p>
<p>Here is some more information about it:</p>
<p><a href="http://www.sqlmag.com/Articles/ArticleID/94555/94555.html" rel="nofollow noreferrer">SELECT vs. SET: Optimizing Loops</a></p>
| <p>I've thought about it but never tested it.</p>
<p>In my experience, the optimizer is pretty good, so I would think it makes no difference, but I'd run some tests if you thought it was really useful.</p>
<p>I think doing multiple assignments can be useful from a maintenance point of view, if you want some things wh... | 23,002 |
<p>I have an ASP.NET page which has a script manager on it.</p>
<pre><code><form id="form1" runat="server">
<div>
<asp:ScriptManager EnablePageMethods="true" ID="scriptManager2" runat="server">
</asp:ScriptManager>
</div>
</form>
</code></pre>
<p>The page ov... | <p>I can compile your code sample fine, you should check your designer file to make sure everything is ok.</p>
<p>EDIT: the only other thing I can think of is that this is some sort of reference problem. Is your System.Web.Extensions reference using the correct version for your targeted framework? (should be 3.5.0.0 f... | <p>I found out that my referenced System.Web.Extensions (v3.5.sth) library did not have the same version with the reference in web.config (v.1.0.6sth). Replacing the dll (3.5) with the old version of System.Web.Extensions solved the problem.</p>
| 12,022 |
<p>The last line of my file is:</p>
<blockquote>
<p>29-dez,40,</p>
</blockquote>
<p>How can I modify that line so that it reads:</p>
<blockquote>
<p>29-Dez,40,90,100,50</p>
</blockquote>
<p>Note: I don't want to write a new line. I want to take the same line and put new values after <code>29-Dez,40,</code></p>
... | <p>Unless the file is huge, you'll probably find it easier to read the entire file into a data structure (which might just be a list of lines), and then modify the data structure in memory, and finally write it back to the file.</p>
<p>On the other hand maybe your file <em>is</em> really huge - multiple GBs at least. ... | <p>Don't work with files directly, make a data structure that fits your needs in form of a class and make read from/write to file methods.</p>
| 42,519 |
<p>In C# we can define a generic type that imposes constraints on the types that can be used as the generic parameter. The following example illustrates the usage of generic constraints:</p>
<pre><code>interface IFoo
{
}
class Foo<T> where T : IFoo
{
}
class Bar : IFoo
{
}
class Simpson
{
}
class Program
{
... | <p>As someone else has mentioned, C++0x is getting this built into the language. Until then, I'd recommend <a href="http://en.wikipedia.org/wiki/Bjarne_Stroustrup" rel="noreferrer">Bjarne Stroustrup</a>'s <a href="http://www.stroustrup.com/bs_faq2.html#constraints" rel="noreferrer">suggestions for template constraints... | <p>Look at the CRTP pattern (Curiously Recursive Template Pattern). It is designed to help support static inheritence.</p>
| 14,879 |
<p>Friends/family/etc ask me what I do and it always causes me pause while I think of how to explain it. They know what a software developer is but how can I explain what SCM is in 10 words?</p>
| <p>Surprising they know what a software developer does!</p>
<p>Anwyay, this sounds like a challenge for Haiku enthusiasts:</p>
<p>in 5-7-5 (I'm lazy when doing english haiku and my seasonal reference is flakey - try a 3-5-3 if you like)</p>
<pre><code>from many good parts:
one programme on your PC;
lose track, get w... | <p>The guy who makes sure that what gets deployed is what's meant to get deployed.</p>
| 20,271 |
<p>I am creating a custom content type feature for MOSS that will also include a Word 2007 document as the document template. The same Word document will also have a <em>Document Information Panel</em> (DIP) and <em>Quick Parts</em> for all the fields in the content type.</p>
<p>The problem is that when my feature is ... | <p>It may be possible to define a custom template for the DIP and deploy that to the site, setting the content type to link to that template.</p>
| <p>I found a solution in a blog, but you have to use InfoPath... Here is the link:
Using SharePoint Metadata in Word Documents – The Lookup Column </p>
<p><a href="http://vspug.com/maartene/2009/03/13/using-sharepoint-metadata-in-word-documents-the-lookup-column-issue/" rel="nofollow noreferrer">http://vspug.com/maar... | 11,309 |
<p>I'm using the VBO extension for storing Vertex, normal and color buffers (glBindBufferARB)
For some reason when changing buffers or doing some operation the application crashes with an access violation. When attaching The debugger I see that the crash is in some thread that is not my main thread which performs the o... | <p>Assuming this is about Windows, NVIDIA has a <a href="http://developer.nvidia.com/object/glexpert_home.html" rel="nofollow noreferrer">GLExpert</a> tool. It can print various OpenGL warnings/errors.</p>
<p>In some other cases, using <a href="http://glintercept.nutty.org/" rel="nofollow noreferrer">GLIntercept</a> O... | <p>One of the best OpenGl/D3D debugging tools is nVidia's NvPerfHUD. It won't help you find your exact problem, but it does provide another view of what you are sending into the rendering pipeline.</p>
<p>However, I will say that I've only used it with D3D applications so I don't know if it helps as much with OpenGL ... | 9,154 |
<p>This may be a no-brainer for the WPF cognoscenti, but I'd like to know if there's a simple way to put text on the WPF ProgressBar. To me, an empty progress bar looks naked. That's screen real estate that could carry a message about <strong>what</strong> is in progress, or even just add numbers to the representation.... | <p>If you are needing to have a reusable method for adding text, you can create a new Style/ControlTemplate that has an additional TextBlock to display the text. You can hijack the TextSearch.Text attached property to set the text on a progress bar. </p>
<p>If it doesn't need to be reusable, simply put the progress b... | <p>Right click <code>ProgressBar</code>, and click Edit Template > Edit a Copy.</p>
<p>Then put the <code>TextBlock</code> as shown below just above the closing tag of <code>Grid</code> in the Style generated by VS.</p>
<pre><code> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBin... | 10,156 |
<p>I'm currently writing an edit-in-place script for MooTools and I'm a little stumped as to how I can make it degrade gracefully without JavaScript while still having some functionality. I would like to use progressive enhancement in some way. I'm not looking for code, but more a concept as to how one would approach t... | <p>It sounds like you might be approaching this from the wrong direction. Rather than creating the edit-in-place and getting it degrade nicely (the Graceful Degradation angle), you should really be creating a non-Javascript version for editing and then adding the edit-in-place using Javascript after page load, reffered... | <p>If it's textual content, you could show the editable content as an input type submit button, with as caption the content. When clicked, it would submit the entire form, preserving the other values, and show an edit dialog. Afterwards the form values could be restored.</p>
| 18,470 |
<p>On destruction of a restful resource, I want to guarantee a few things before I allow a destroy operation to continue? Basically, I want the ability to stop the destroy operation if I note that doing so would place the database in a invalid state? There are no validation callbacks on a destroy operation, so how does... | <p>You can raise an exception which you then catch. Rails wraps deletes in a transaction, which helps matters.</p>
<p>For example:</p>
<pre><code>class Booking < ActiveRecord::Base
has_many :booking_payments
....
def destroy
raise "Cannot delete booking with payments" unless booking_payments.count == 0... | <p>Use ActiveRecord context validation in Rails 5.</p>
<pre class="lang-rb prettyprint-override"><code>class ApplicationRecord < ActiveRecord::Base
before_destroy do
throw :abort if invalid?(:destroy)
end
end
</code></pre>
<pre class="lang-rb prettyprint-override"><code>class Ticket < ApplicationRecord
... | 14,978 |
<p>I am starting a new company using 3D printers and doing an advertisement, and I want to use the word FabLab to describe the kinds of field that my company is in.</p>
<p>Can I be sued by using the word FabLab in an advertisement? Is it a trademark? I mean, I can find <a href="https://www.ebay.fr/sch/i.html?_from=R40&... | <p>I did a simple search at <a href="http://www.huski.ai" rel="nofollow noreferrer">www.huski.ai</a>, and found 11 trademarks with the mark word "FabLab".</p>
<p><a href="https://i.stack.imgur.com/PXPXU.png" rel="nofollow noreferrer" title="Screenshot of search"><img src="https://i.stack.imgur.com/PXPXU.png" ... | <p>Sorry, I needed to learn to use the site. This site shows Fablab as a word mark, the same way it shows Apple: <a href="https://www.trademarkengine.com/free-trademark-search/trademark-search" rel="nofollow noreferrer">https://www.trademarkengine.com/free-trademark-search/trademark-search</a></p>
| 1,867 |
<p>I'm currently trying to create a kernel module that will produce data based on kernel events and push them to a file. After reading that this is bad (and I agree), I decided it would make more sense to have the data in a /proc file that a user program could pull from when necessary. However, this idea led to all s... | <p>Instead of making a named pipe, what you want to do is create a "Character device". If you want simple interaction or streaming data from kernel to userspace and back, this is the usual method. I'd recommend looking up similar devices in the Linux kernel and seeing what they do.</p>
| <p>There are some good suggestions. There are a number of ways supported by the kernel:</p>
<ul>
<li>character / block device suggested by Ana betts, and Michael Trausch</li>
<li>mmap device (you can access as /proc/memshare/mybuffer for example)</li>
<li>custom system. Writing a kernel module means you can really make... | 40,393 |
<p>If you call a web service from Silverlight like this:</p>
<pre><code>MyServiceClient serviceClient = new MyServiceClient();
void MyMethod()
{
serviceClient.GetDataCompleted += new EventHandler<GetDataCompletedEventArgs>(serviceClient_GetDataCompleted);
serviceClient.GetDataAsync();
// HOW DO I WAIT/JOI... | <p>No you cannot do this way. You will end up in a deadlock. GetDataCompleted is called by the mainthreed. The same threed thait is waiting in WaitOne.</p>
| <p>You could also use a lambda and closure to get similar behavior:</p>
<pre><code>serviceClient.GetDataCompleted += (s,e) =>
{
// Your code here
};
serviceClient.GetDataAsync();
</code></pre>
| 40,569 |
<p>How can I find the XY coordinates of an HTML element (DIV) from JavaScript if they were not explicitly set?</p>
| <p>Here's how I do it:</p>
<pre><code>// Based on: http://www.quirksmode.org/js/findpos.html
var getCumulativeOffset = function (obj) {
var left, top;
left = top = 0;
if (obj.offsetParent) {
do {
left += obj.offsetLeft;
top += obj.offsetTop;
} while (obj = obj.offse... | <p>I am not sure what you need it for, and such things are always relative (screen, window, document). But when I needed to figure that out, I found this site helpful:
<a href="http://www.mattkruse.com/javascript/anchorposition/source.html" rel="nofollow noreferrer">http://www.mattkruse.com/javascript/anchorposition/so... | 19,367 |
<p>I've got a list in a Python program that contains a series of numbers, which are themselves ASCII values. How do I convert this into a "regular" string that I can echo to the screen?</p>
| <p>You are probably looking for 'chr()':</p>
<pre><code>>>> L = [104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100]
>>> ''.join(chr(i) for i in L)
'hello, world'
</code></pre>
| <pre><code>Question = [67, 121, 98, 101, 114, 71, 105, 114, 108, 122]
print(''.join(chr(number) for number in Question))
</code></pre>
| 21,789 |
<p>Is there a way to show IE/Firefox Back button style, dropdown menu button?</p>
| <p>Sure. Put a toolbar on the page. Right-click on the toolbar, add a button. Set the button's style to tbsDropDown. Put a PopupMenu on the page. Double click on the PopupMenu to define menu items. Then, go back to the button you created and set its DropdownMenu property to point to the PopupMenu you just created.... | <p>If you don't want to use a toolbar, the raize (www.raize.com) and express editors (www.DevExpress.com) libraries have components that can do this.</p>
| 29,154 |
<p>I have a webapp from which I'd like to insert diagrams and images quickly and easily. I expect there is, somewhere out there, a webservice which will take a URL with a parameter that describes the vector graphics or diagram and returns an image.</p>
<p>No unlike what google charts does for graphing data.</p>
<p>A... | <p>Check out <a href="http://raphaeljs.com/" rel="nofollow noreferrer">Raphael</a>. Done by a bloke here in Australia.</p>
| <blockquote>
<p>No unlike what google charts does for graphing data.</p>
</blockquote>
<p>Why not just use the Google Chart API?</p>
<p><a href="http://code.google.com/apis/chart/" rel="nofollow noreferrer">http://code.google.com/apis/chart/</a></p>
| 39,081 |
<p>I have a scenario where I need to make a call to a telephone(landline/mobile) or send SMS to a particular set of users only using ASP.NET and C#. The web application is not a mobile application.</p>
<p>How do I go about doing these? What typically would be the hardware requirements? I would be <strong>extremely gr... | <p>Most carriers provide an email address that you can send text messages to — for example, with Verizon, you can send an email to <em>phonenumber@vtext.com</em> and it will show up as a text message to that number.</p>
<p><a href="http://en.wikipedia.org/wiki/SMS_gateway#Carrier-provided_Email_or_Web_to_SMS_gat... | <p>Via <a href="http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=20" rel="nofollow noreferrer">WebServiceX</a>, you can send SMS messages anywhere in the world. For phone calls I'd use <a href="http://www.codeproject.com/KB/IP/AsteriskIAXClientWrapper.aspx" rel="nofollow noreferrer">Asterisk</a>.</p>
| 6,714 |
<p>I have a method with an out parameter that tries to do a type conversion. Basically:</p>
<pre><code>public void GetParameterValue(out object destination)
{
object paramVal = "I want to return this. could be any type, not just string.";
destination = null; // default out param to null
destination = Conv... | <blockquote>
<p>So is there any way to get the type of an object that is set to null? I would think there would have to be a way to know what type a storage location is without it being assigned anything.</p>
</blockquote>
<p>Not necessarily. The best that you can say is that it is an <code>object</code>. A <code>... | <p><a href="http://msdn.microsoft.com/en-us/library/58918ffs.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/58918ffs.aspx</a></p>
<p>or </p>
<pre><code>private Hashtable propertyTable = new Hashtable();
public void LoadPropertyTypes()
{
Type t = this.GetType();
System.Reflection.MemberInfo[] m... | 31,746 |
<p>Consider a simple table with an auto-increment column like this:</p>
<pre><code>CREATE TABLE foo
(
`fooid` bigint unsigned NOT NULL auto_increment,
....snipped.... other columns
PRIMARY KEY (`fooid`)
)
ENGINE=InnoDB AUTO_INCREMENT=10
</code></pre>
<p>How does one redesign this so that we don't hit the max... | <p>Suppose you insert one row every millisecond. </p>
<p>18446744073709551615 millseconds =
18446744073709552 seconds =
307445734561826 minutes =
5124095576030 hours =
213503982335 days =
584942417 years</p>
<p>So it's not <em>really</em> like the Y2K problem</p>
<p>You could insert a <em>million</em> rows per milli... | <p>Don't know about MySQL, but in case of <a href="http://www.postgresql.org/docs/8.1/static/sql-createsequence.html" rel="nofollow noreferrer">Postgresql</a>, you can specify whether the sequence is a CYCLE/NO CYCLE. If created with a CYCLE option, it will come back again to 1 (or the minvalue) and would throw the err... | 47,261 |
<p>I'm using the following code within a VB 6.0 application to allow give the application a system tray icon:</p>
<pre><code>Option Explicit
'user defined type required by Shell_NotifyIcon API call
Public Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Lon... | <p>This is what I use when I am closing my programs for the Query_Unload:</p>
<pre><code>Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Select Case UnloadMode
Case 1, 2, 3 'If the program is being terminated by Code, Windows shutting down, or Task Manager
Cancel = False ... | <p>Here is an example implementation from vbnet
<a href="http://vbnet.mvps.org/index.html?code/subclass/shellnotifybasic.htm" rel="nofollow noreferrer">http://vbnet.mvps.org/index.html?code/subclass/shellnotifybasic.htm</a></p>
| 47,958 |
<p>For my server app, I need to check if an ip address is in our blacklist. </p>
<p>What is the most efficient way of comparing ip addresses? Would converting the IP address to integer and comparing them efficient?</p>
| <p>Depends what language you're using, but an IP address is usually stored as a 32-bit unsigned integer, at least at the network layer, making comparisons quite fast. Even if it's not, unless you're designing a high performance packet switching application it's not likely to be a performance bottleneck. Avoid premature... | <p>if you receive the IP address as a string, comparing it to a string may be more efficient than converting it to integer representation</p>
<p>but i'd profile both solutions to be certain, if a few milliseconds (nanoseconds!) are going to matter on this operation ;-)</p>
| 19,430 |
<p>I've already asked which wires I should use, and I believe I have that covered now, but I was also wondering what solder / specs on the solder are considered safe when attaching my wires to my heat bed. I have some solder here at the house, it's quite new (never been opened) it's Radio Shack <code>64-008 E</code> 6... | <p>Old-style lead/tin solder has a melting range of about 180 to 250 degrees (the transition solid to liquid is spread out). This ought to be fine for the bed (even at the hottest hotspot) but wouldn't be good <em>in</em> the hotend.</p>
<p>Modern electronics lead-free solder varies since there are several different c... | <p>That solder sounds like it should be fine.</p>
<p>Any solder should work, the only difference you might find is some of the older solder will include lead. if you were overly concerned about safety you might want to check your solder doesn't contain lead. However, for the amount you are doing, even a solder that co... | 432 |
<p>Is there a way to lock a row in the SQL 2005-2008 database without starting a transaction, so other processes cannot update the row until it is unlocked?</p>
| <p>You can use <a href="http://blog.sqlauthority.com/2007/04/27/sql-server-2005-locking-hints-and-examples/" rel="nofollow noreferrer">RowLock or other hints</a> but you should be <a href="http://www.sqlteam.com/article/row-locking" rel="nofollow noreferrer">careful</a>..</p>
<p>The HOLDLOCK hint will instruct SQL Ser... | <p>Do you need to lock a <strong>row</strong>, or should <a href="http://www.sqlteam.com/article/application-locks-or-mutexes-in-sql-server-2005" rel="nofollow noreferrer">Sql Server's Application locks</a> do what you need?</p>
<p>An Application Locks is just a lock with a name that you can "lock", "unlock" and check... | 13,687 |
<p>An svn repository I'm mirroring through git-svn has changed URL.</p>
<p>In vanilla svn you'd just do <code>svn switch --relocate old_url_base new_url_base</code>.</p>
<p>How can I do this using git-svn? </p>
<p>Simply changing the svn url in the config file fails.</p>
| <p>This handles my situation pretty well:</p>
<p><a href="https://git.wiki.kernel.org/index.php/GitSvnSwitch" rel="noreferrer">https://git.wiki.kernel.org/index.php/GitSvnSwitch</a></p>
<p>I cloned using the <code>file://</code> protocol, and wanted to switch to the <code>http://</code> protocol.</p>
<p>It is tempti... | <p>The above <code>git svn rebase -l</code> solution didn't work for me. I decided to go about it a different way:</p>
<ol>
<li>Clone old SVN repo into git repo <code>old</code> and new SVN into git repo <code>new</code></li>
<li>Fetch <code>old</code> into <code>new</code>
<ul>
<li><code>cd new</code></li>
<li><code>... | 33,731 |
<p>Sometimes I use a DIY 3D printer running Marlin firmware and I have a hard time to set my heat bed temperature. when I set it to 70 °C for PLA, after a few minutes it decreases to 67 °C and I see these error:</p>
<pre><code>READ: Error:Thermal Runaway, system stopped! Heater_ID: bed
READ: Error:Pr... | <p>I had a similar issue when printing with ABS, because my print cooling fan only activated once it got to a certain height above the bed. I'd say you need to do a PID tuning session, insulate the bottom of the bed better, and see if you can make sure your cooling fan doesn't blow air over the bed itself.</p>
| <p>I had a similar issue when printing with ABS, because my print cooling fan only activated once it got to a certain height above the bed. I'd say you need to do a PID tuning session, insulate the bottom of the bed better, and see if you can make sure your cooling fan doesn't blow air over the bed itself.</p>
| 1,305 |
<p>In one of our commercial applications (Win32, written in Delphi) we'd like to implement full text search. The application is storing user data in some kind of binary format that is not directly recognizable as a text.</p>
<p>Ideally, I'd like to find either an in-process solution (DLL would be OK) or a local server... | <p>There are a number of options on the market. Either fully fledge commercial products or open source variants. Your choice of a search provider is very dependent on the customers you are targetting.</p>
<p>Microsoft has a free Express version of their Search Server. As far as I know the Express edition is limited to... | <p>I'd recommend having a look at SQLite -- full-text search is included in the latest version.</p>
| 10,994 |
<p>I have an Excel 2003 workbook that contains a macro to copy certain of its sheets across to a new workbook, then save and close the new workbook. It does this several dozen times, with slightly different sheet selections each time.</p>
<p>I would like to add an extra step to the macro to export the secondary workb... | <p>Office 2007 allows for this. I have found <a href="http://sourceforge.net/projects/pdfcreator/" rel="noreferrer">PDFCreator</a> to be good, the VBA is included in sample files, and have heard that <a href="http://www.cutepdf.com/" rel="noreferrer">CutePDF</a> is also good. PDFCreator and CutePDF are free.</p>
| <p>This may help: <a href="http://www.pdf995.com" rel="nofollow noreferrer">http://www.pdf995.com</a></p>
<p>One feature is "Three auto-name options to bypass Save As dialog"</p>
| 27,709 |
<p>If you use an <code>EnumSet</code> to store conventional binary values (1,2,4 etc), then when there are less than 64 items, I am led to believe that this is stored as a bit vector and is represented efficiently as a long. Is there a simple way to get the value of this long. I want a quick and simple way to store the... | <p>As far as I'm aware, this isn't exposed. You could basically rewrite it yourself - have a look at the code for EnumSet to get an idea of the code - but it's a pity there isn't a nicer way of getting at it :(</p>
| <p>The (typical - it's not mandated) implementation of EnumSet uses the enum values' ordinals. You should not assume that ordinals will always stay the same. So, if you want to store enum sets efficiently using ordinals, you should also store a map from enum name to ordinal (probably stored as a sequence of enum names)... | 47,467 |
<p>I am using <a href="http://cxxtest.tigris.org/" rel="nofollow noreferrer">cxxtest</a> as the test framework for my C++ classes, and would like to figure out a way to simulate sending data to classes which would normally expect to receive it from standard input. I have several different files which I would like to s... | <p>The appropriate method is to rewrite your classes so that they are testable. They should accept as a parameter the handle, stream or file from which they are supposed to read data - in your test framework, you can then mock in the stream or supply the path to the file containing the test data.</p>
| <p>You should be able to use freopen() to point stdin to an arbitrary file.</p>
| 17,304 |
<p>I would like to encrypt strings which could potentially only be about three or four characters but run to about twenty characters. A hashing function (<a href="http://www.php.net/md5" rel="noreferrer">md5</a>, <a href="http://www.php.net/sha1" rel="noreferrer">sha1</a>, <a href="http://www.php.net/crypt" rel="norefe... | <p>I like to use GnuPG for anything that needs to be encrypted on a server and then possibly decrypted either on the server or on another server (which is usually my case). This allows for an extra level of security since in my scenario the encrypting server doesn't have the key to decrypt the data. It also allows for ... | <p>Any one-way encryption algorithm such as Blowfish will do, I guess. Blowfish is fast and open. You can use Blowfish through the crypt() function. AFAIK there are no encryption algorithm that work especially well on small strings. One thing to be aware of though is that brute-forcing such small strings will be very e... | 12,838 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.