input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Localization for Winforms from designmode? <p>I need to bind labels or items in a toolstrip to variables in Design Mode.
I don't use the buit-in resources not the settings, so the section Data is not useful. I am taking the values out from an XML that I map to a class.</p>
<p>I know there are many programs like:
<a ... | <p>Aleksandar's response is one way to accomplish this, but in the long run it's going to be very time consuming and won't really provide much benefit. The bigger question that should be asked is why do you not want to use the tools and features built-in to .NET and Visual Studio or at least use a commercial third-part... |
Large file download in background, initiated from the browser <p>Is there any reasonable method to allow users of a webapp to download large files? I'm looking for something other than the browser's built-in download dialog - the requirements are that the user initiates the download from the browser and then some other... | <p>This might be a suitable use for BitTorrent. It works using a separate program (in most browsers), and will still run after the browser is closed. Not a perfect match, but meets most of your demands.</p>
|
Icon size of button in Flex <p>How to find the width of the icon which is embedded in a button?</p>
| <p>Try this:</p>
<pre><code>var icon:DisplayObject = button.getChildByName("upIcon");
trace("icon (width: " + icon.width + ", height: " + icon.height + ")");
</code></pre>
|
What interface should I implement to create step driven events for my class? <p>I want to create a similar behavior to the data reader class but for a bespoke emailer program so that I can do the follow</p>
<pre><code>Dim sender As New EmailSender(emailTemplate)
While sender.Send()
Response.Write(sender("HTMLContent... | <p>no - all you have to do is implement the Send() method to prepare the next email for sending and returns true if it exists</p>
<p>you're probably thinking of the IEnumerable interface used for iterators, but you don't need that for what you want</p>
|
SQL Profiler connection details <p>When you startup a standard trace the first settings you see will be the current database connections.</p>
<p>In my case there is about 10 entries, all of whome are the same username, however some are dateformat dmy and some are mdy. The asp website seems to pick a connection from th... | <p>Some ideas:</p>
<ul>
<li>The application is issuing SET DATEFORMAT</li>
<li>The app is using a DSN with/without translation</li>
</ul>
<p>By default, the connection default is defined by SQL Server default settings.</p>
|
Do you know eclipse plugin to change localised text into html entities? <p>I have resource bundle with my country characters - how to change them into html entities.
I prefer plugin integrated with Eclipse to have all tools in one place.</p>
| <p>You might try:</p>
<p><a href="http://andrei.gmxhome.de/anyedit/" rel="nofollow">http://andrei.gmxhome.de/anyedit/</a></p>
<p>Further down the page one of its features is:</p>
<p><em>Convert
Chars to Html entities
Editors - Useful if working in bilingual team to convert é's, ô's, ä's etc between html and ot... |
reference path re javascript intellisense <p>I am trying to get intellisense in VS2008 in a js file, foo.js, from another js library/file I've written but cannot figure out the reference path ?syntax?/?string?</p>
<p>The library is in a file called common.js which is in the same folder as foo.js I'm working on.</p>
<... | <p>First, make sure "common.js" is in your web project. Then drag "common.js" from the solution explorer into the editor window for the file you want to reference it from.</p>
|
Scheduled run of stored procedure on SQL server <p>Is it possible to set up somehow Microsoft SQL Server to run a stored procedure on regular basis?</p>
| <p>Yes, in MS SQL Server, you can create scheduled jobs. In SQL Management Studio, navigate to the server, then expand the SQL Server Agent item, and finally the Jobs folder to view, edit, add scheduled jobs.</p>
|
Setting up SSL in Active Directory how-to <p>I need to set up SSL over Active Directory. I googled a lot but could not found a decent write up about how to do this. Please if you know some good resources about this let me know.
Thanks!</p>
| <p>Sounds easy - but I ran into quite a few problems getting trusted connections with SSL working in our environment. The article was about ADAM but is just as applicable for AD. In our environment I couldn't install domain-related services like cert-server, nor act as domain-admin.</p>
<p>I blogged about how I got ... |
How do you change a hashed password using asp.net membership provider if you don't know the current password? <p>Problem, there's no method:</p>
<pre><code>bool ChangePassword(string newPassword);
</code></pre>
<p>You have to know the current password (which is probably hashed and forgotten).</p>
| <p>This is an easy one that I wasted too much time on. Hopefully this post saves someone else the pain of slapping their forehead as hard as I did.</p>
<p>Solution, reset the password randomly and pass that into the change method.</p>
<pre><code>MembershipUser u = Membership.GetUser();
u.ChangePassword(u.ResetPasswor... |
ASP/VBScript "Gotchas" <p>I'm supporting/enhancing a web application written in Classic ASP/VBScript. It has been about 10 years since I have used either in a day to day capacity. I just ran across an issue that I would consider a "gotcha" and was wondering if others had similar things that I should learn to be aware... | <p><strong>Repeat after me:</strong> All good VB programmers use <code>Option Explicit</code></p>
<p>It will keep you from accidentally declaring a new variable and using it - thus throwing off whatever you are doing.</p>
<p>Beyond that, it depends on what you're doing.</p>
|
How to test a remoting connection (check state) <p>I have an object created in a host application and can access it remotely using remoting, is there any way I can test the connection to ensure it is still "alive"? Maybe an event I can use that fires if the remoting connection gets disconnected, or some property that c... | <p>I generally add another method to the remoting server MarshallByRef class,
(I generally name it Ping(), as in: </p>
<pre><code> public void Ping() {}
</code></pre>
<p>that does nothing, and returns nothing.. Then to "test" my connection, I call this method... If it throws a System.Net.Sockets.Exception, I have l... |
Find out sql server hardware or speed test <p>I use an sql server regularly and have recently been getting frustrated by the performance. It would be difficult for me to get direct access to find out the hardware so:</p>
<p>Is there a direct way in management studio to assess performance or find out the exact hardware... | <p>You can't just ask your server guys? Seems like there's a fair bit of mistrust if you can't get hardware metrics. Count of CPUs, total memory, etc.</p>
<p>If there's that amount of mistrust, even if you found the answer from the database server, rectifying it would be impossible. If you can't get the current parame... |
query join question <p>I have a right outer join, that almost does what I want...</p>
<pre><code>SELECT
users_usr.firstname_usr,
users_usr.lastname_usr,
credit_acc.given_credit_acc,
users_usr.created_usr,
users_usr.sitenum_usr,
users_usr.original_aff_usr,
users_usr.id_usr
FROM
credit_acc
right Outer Join users_usr ON ... | <pre><code>SELECT
users_usr.firstname_usr,
users_usr.lastname_usr,
credit_acc.given_credit_acc,
users_usr.created_usr,
users_usr.sitenum_usr,
users_usr.original_aff_usr,
users_usr.id_usr
FROM
credit_acc
right Outer Join users_usr ON credit_acc.uid_usr = users_usr.id_usr
WHERE credit_acc.type_acc = 'init' OR credit_acc.... |
How do I pre-cache images for quick viewing with javascript? <p>I have a webpage where I want the user to see a new image when they put thier mouse over a certain part of the image. I used an image map.</p>
<pre><code><img src="pic.jpg" usemap="#picmap" />
<map id="picmap" name="picmap"><area shape="re... | <p>You don't need to create any page elements, it can all be preloaded using JavaScript:</p>
<pre><code>tempImg = new Image()
tempImg.src="pic2.jpg"
</code></pre>
<p>EDIT:</p>
<p>If you have a lot of images, you can use the poor-man's multi-preloader:</p>
<pre><code>preloads = "red.gif,green.gif,blue.gif".split(","... |
Submit changes of only one entity <p>If I select many rows from one table with one instance of DataContext.
And then do I some changes in properties in the rows, can I submit changes to database only for one of the selected rows?</p>
| <p>Yes you can.</p>
<p>First you need to isolate the entities you want to undo the changes.
Then, you can use your DataContext class to Override those entities with the values from the Database.</p>
<pre><code>MyEntity e1, e2, e3 // changed entities
...
// keep the changes only for e3
List<MyEntity> undoList = ... |
Is there a way to use RegEx in ASP/VBScript? <p>I have an ASP website which I need to add a RegEx match to. Is there any support for RegEx in ASP/VBScript?</p>
<p>Thank you,</p>
<p>Brett</p>
| <p>Yes, as of VBScript 5 <a href="http://authors.aspalliance.com/brettb/VBScriptRegularExpressions.asp" rel="nofollow">http://authors.aspalliance.com/brettb/VBScriptRegularExpressions.asp</a></p>
<p><a href="http://www.regular-expressions.info/vbscript.html" rel="nofollow">http://www.regular-expressions.info/vbscript... |
Decoding chunked HTTP with Actionscript <p>I have successfully connected to an HTTP server with ActionScript 3 over sockets. The only problem is, the server is sending chunked HTTP. Is there a generic function in any other language I can look at that clearly shows how to decode the chunking? I'm pretty sure there are n... | <p>The <a href="http://www.greenbytes.de/tech/webdav/rfc2616.htm" rel="nofollow">HTTP 1.1 specification</a> (or from <a href="http://www.w3.org/Protocols/" rel="nofollow">W3C</a>) provides a pseudocode example of how to <a href="http://www.greenbytes.de/tech/webdav/rfc2616.html#rfc.section.19.4.6" rel="nofollow">decode... |
How do I look over a javascript array without using indexes in YUI? <p>I know that jQuery and prototype have a $.each() function for iterating over each element in an array. Does YUI offer any help with this?</p>
| <p>YAHOO.util.Dom has the batch function which has the following signature:</p>
<blockquote>
<p>Any | Array <strong>batch</strong>( el , method , o , override )</p>
</blockquote>
<p>Where <em>el</em> is a DOM element or an array of DOM elements, <em>method</em> is a function that that will be passed each element in... |
How does one - without inheritance - override a class method and call the original from within the new method? <p>I found one source which successfully overrode <code>Time.strftime</code> like this:</p>
<pre><code>class Time
alias :old_strftime :strftime
def strftime
#do something
old_strftime
end
end
</... | <p>This is kinda hard to get your head around sometimes, but you need to open the "eigenclass" which is the singleton associated with a specific class object. the syntax for this is class << self do...end. </p>
<pre><code>class Time
alias :old_strftime :strftime
def strftime
puts "got here"
old_st... |
Using Windows Role authentication in the App.config with WCF <p>I am using a WCF service and a net.tcp endpoint with serviceAuthentication's principal PermissionMode set to UseWindowsGroups.</p>
<p>Currently in the implementation of the service i am using the PrincipalPermission attribute to set the role requirements ... | <p>If you are hosting your WCF service in IIS, it will run in the ASP.NET worker process, which means you can configure authentication and authorization as you would do with ASMX web services:</p>
<pre><code><system.Web>
<authentication mode="Windows"/>
<authorization>
<allow roles... |
TortoiseSVN - Ignoring files within a folder already in the repository <p>How do I ignore all files within a folder under source control?</p>
<p><code>/project/published/</code> is a folder I want to keep</p>
<p><code>/project/published/some_file(s)</code> are files/folders I don't want</p>
<p>More Details: Currentl... | <p>You just right click on the <code>published/</code> folder, select TortoiseSVN -> Properties, click New -> Advanced with the following:</p>
<ul>
<li>Property name: <code>svn:ignore</code> </li>
<li>Property value: <code>*</code></li>
</ul>
<p>Then it would work fine.</p>
|
Prime number calculation fun <p>We're having a bit of fun here at work. It all started with one of the guys setting up a Hackintosh and we were wondering whether it was faster than a Windows Box of (nearly) same specs that we have. So we decided to write a little test for it. Just a simple Prime number calculator. It's... | <p>That's a bit worse than my sieve did on a 8 Mhz 8088 in turbo pascal in 1986 or so. But that was after optimisations :)</p>
|
Why isn't MySQL using the index for this subquery? <p>I used to do this:</p>
<pre><code>SELECT layerID
FROM layers
WHERE ownerID = ?
AND collectionID = ?
</code></pre>
<p>Which would give me an array of layerID's, and then I'd loop and do this for each one:</p>
<pre><code>SELECT DATA
FROM drawings
WHERE layerID = ?
... | <p>Try a join. ANY ends up looking a lot like an unoptimizable UNION to the query optimizer.</p>
<pre><code>SELECT d.DATA, d.layerID
FROM drawings AS d
INNER JOIN layers AS l ON d.layerID = l.layerID
WHERE l.ownerID = ? AND l.collectionID = ?
</code></pre>
|
SQL Server 2005 and iTunes Library <p>what's the easiest way to bulk load my iTunes library xml into an existing SQL Server database?</p>
| <p>bcp with xml flag.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms162802.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms162802.aspx</a></p>
<p>It really depends how you want it in there and what you're purposes are, which you haven't explained.</p>
|
Application_End global.asax <p>Can anybody tell me when Application_End is triggered in a lifecycle of an application? When all sessions are ended, will Application_End be triggered automatically? + Are there any other reasons why Application_End could be triggered?</p>
| <p>The <code>application_end</code> event primarily fires when the IIS pool is recycled or the application itself is unloaded. One other thing to note, that a change to a dependent file (say web.config) will cause the application to reload itself, which will in cause the application_end event to fire while it is closin... |
Guidelines for / differences between cache / pool / cache pool <p>I'm doing some design (initially for Java) (but may extend to .NET in the future?) and I'm getting confused between the terms "cache" and "pool".</p>
<p>As far as I can see, the main point of difference is what is contained in them?</p>
<p>Any guidelin... | <p>Although they both refer to keeping objects around, they are quite different, and I wouldn't say they're interchangeable.</p>
<p><strong>Cache</strong> - store frequently used values, typically because the lookup and/or creation is non-trivial. e.g. if a lookup table from a database is frequently used, or values ar... |
How Can I put information in a outputstream from tapestry5? <p>How Can I put information in a outputstream from tapestry5 ?</p>
<p>I need a page when a user enters it open a dialog for save or open the file with the outputstream information.</p>
<p>I write the next code:</p>
<p>public class Index {</p>
<pre><code>@... | <p>Your method should have a return type of StreamResponse. You return an implementation of the interface StreamResponse, which simply returns the data you want with the content type you want.</p>
<p>Look it up here:</p>
<p><a href="http://tapestry.apache.org/tapestry5/apidocs/" rel="nofollow">http://tapestry.apache.... |
SSH hangs on Mac Book Pro; AFS and Network Preferences? <p>I am having an issue with SSH hanging on my Mac Book Pro. This only happens to me once I get home from work after I have used SSH while at work. The three factors I have narrowed the issue down to are SSH, our work AFS network drive and the method of network co... | <p>Can you be more specific about "SSH hanging"?</p>
<p>It sounds like your ssh <strong>client</strong> hangs after losing the connection and you are unable to do anything in the terminal. To get around this, you can use the ssh escape character (default: â~â) to begin an escape sequence, and use the the '.' to te... |
C#: How do you tell which item index is selected in ListView? <p>C#: How do you tell which item index is selected in ListView?</p>
| <pre><code>ListView mylistv = new ListView();
var index = mylistv.SelectedIndices();
</code></pre>
<p>That should do it.</p>
|
Sidebar form <p>How can I create a Sidebar form in delphi.</p>
<p>I try the ScreenSnap and Align properties
but I need that the form stay visible even if the user maximize other forms, without been on top. Just like the windows sidebar do.</p>
<p><strong>update</strong> from the comments: if a window is maximized it ... | <p>What you're looking for is called an <em>AppBar</em>. Begin your research with the <a href="http://msdn.microsoft.com/en-us/library/bb762108.aspx"><code>ShAppBarMessage</code></a> API function.</p>
|
Unpacking _WTS_CLIENT_ADDRESS.Address in vb.net (retreiving IP address from Terminal Services Client) <p>I have the following structure:</p>
<pre><code> <StructLayout(LayoutKind.Sequential)> _
Public Structure _WTS_CLIENT_ADDRESS
Public AddressFamily As Integer
<MarshalAs(UnmanagedType.... | <p>You're almost there with your code. I agree with you, the MSDN is not quite explicit on what's inside that byte array, but here's what you can do :</p>
<pre><code>IPAddress address = new IPAddress(_ClientIPAddress.Address.Skip(2).Take(4).ToArray());
</code></pre>
<p>The first two bytes do not seem to be used, but ... |
How do I specify in my ccnet config file how to do daily builds? <p>How do I specify in my ccnet config file how to do daily builds?</p>
| <p>You set up a scheduleTrigger:</p>
<pre><code><triggers>
<scheduleTrigger time="23:30" />
</triggers>
</code></pre>
<p>would run that project every night at 11:30pm</p>
|
What GOOD tools are available for generating ERD from a SQL Server Database? <p>I am trying to generate an Entity Relationship Diagram from an existing MS SQLServer 2005 database. What tools are available? Specifically,I am not only interested in ERD's more directly I am looking for a tool to help quickly learning and ... | <p>I can see that this post is quite old and <strong>MS SQL Server Management Studio</strong> might have not had this feature back then! Though as far as I know with <strong>SQL Server 2012</strong> you can generate the ER diagrams by taking a few simple steps listed below:</p>
<ol>
<li>MS SQL Server management Studio... |
Why does this regular expression kill the Java regex engine? <p>I have this naive regex "<([\s]|[^<])+?>" (excluding the quotation marks). It seems so
straightforward but it is indeed evil when it works against the below HTML text. It sends the Java regular expression engine to an infinite loop. </p>
<p>I have a... | <p>The reason the Java regex engine crashes is that this part of your regex causes a stack overflow (indeed!):</p>
<pre><code>[\s]|[^<]
</code></pre>
<p>What happens here is that every character matched by \s can also be matched by [^<]. That means there are two ways to match each whitespace character. If we ... |
Get the subdomain from a URL <p>Getting the subdomain from a URL sounds easy at first.</p>
<pre><code>http://www.domain.example
</code></pre>
<p>Scan for the first period then return whatever came after the "http://" ...</p>
<p>Then you remember</p>
<pre><code>http://super.duper.domain.example
</code></pre>
<p>Oh.... | <blockquote>
<p>Anyone have any great ideas besides
storing a list of all TLDs?</p>
</blockquote>
<p>No, because each TLD differs on what counts as a subdomain, second level domain, etc.</p>
<p>Keep in mind that there are top level domains, second level domains, and subdomains. Technically speaking, everything e... |
How to return JSON from a 2.0 asmx web service <p>I am using .Net framework 2.0 / jQuery to make an Ajax call to a 2.0 web service. No matter what I set the contentType to in the ajax call, the service always returns XML. I want it to return Json!</p>
<p>Here is the call:</p>
<pre><code> $(document).ready(functi... | <p>It's no problem to <a href="http://encosia.com/2010/03/08/asmx-scriptservice-mistakes-installation-and-configuration/">return JSON from ASMX services in ASP.NET 2.0</a>. You just need the ASP.NET AJAX Extensions installed.</p>
<p>Do be sure to add the [ScriptService] decoration to your web service. That's what ins... |
How can I convert a string to a number in Perl? <p>How would I convert a string holding a number into its numeric value in Perl?</p>
| <p>You don't need to convert it at all:</p>
<pre><code>% perl -e 'print "5.45" + 0.1;'
5.55
</code></pre>
|
C# List<> Sort by x then y <p>Similar to <a href="http://stackoverflow.com/questions/188141/c-list-orderby-alphabetical-order">List<> OrderBy Alphabetical Order</a>, we want to sort by one element, then another. we want to achieve the functional equivalent of </p>
<pre><code>SELECT * from Table ORDER BY x, y
... | <p>For versions of .Net where you can use LINQ <code>OrderBy</code> and <a href="http://msdn.microsoft.com/en-us/library/vstudio/bb534743(v=vs.100).aspx"><code>ThenBy</code></a> (or <code>ThenByDescending</code> if needed):</p>
<pre><code>using System.Linq;
....
List<SomeClass>() a;
List<SomeClass> b = a.O... |
HTML hyperlink with mouse over image <p>I am having a Html hyperlink. I need to link this hyperlink to another page.When I place the mouse over the link. It should show the image.
how to do this</p>
| <p>That depends on where you need to display the image. If you are looking for something along the lines of an icon next to or behind the link, you could accomplish this through CSS using a background image on the hover state of the link:</p>
<pre><code>a:link
{
background-image:none;
}
a:hover
{
background-ima... |
How can I use Html.ValidationSummary with Ajax.BeginForm? <p>I have an AJAX form that I am creating in my MVC project. If the form is submitted using normal browser function and a page refresh occurs I get validation information rendered in the form (the built in MVC validation based on ViewData.ModelState).</p>
<p>I... | <p>It really depends on where you are getting the content from to display once the form has been posted. The Validation summary is performed created on the server so that is where you have to do the work.</p>
<p>As an example I was using some partial content in an .ascx file to render a form. You get the form in the p... |
Why do requests and responses get lost? <p>Even on big-time sites such as Google, I sometimes make a request and the browser just sits there. The hourglass will turn indefinitely until I click again, after which I get a response instantly. So, the response or request is simply getting lost on the internet. </p>
<p>... | <p>It's possible that a request made from the client took a particular path which happened to not work at that particular moment. These are unavoidable - they're simply a result of the internet, which is built upon unstable components and which TCP manages to ensure a certain kind of guarantee for.</p>
<p>Like someone... |
Updating an associative table in MySQL <p>Below is my (simplified) schema (in MySQL ver. 5.0.51b) and my strategy for updating it. There has got to be a better way. Inserting a new item requires 4 trips to the database and editing/updating an item takes up to <strong>7</strong>!</p>
<p><strong>items</strong>: itemId, ... | <p>There are a number of things you can do to make a bit easier:</p>
<ul>
<li><p>Read about [<code>INSERT...ON DUPLICATE KEY UPDATE</code>][1]</p></li>
<li><p>Delete old categories before you insert new categories. This may benefit from an index better.</p>
<p><code>DELETE FROM map WHERE itemId=2</code>;</p></li>
<li... |
How to identify which lines of code participated in a specific execution of a Java program? <p>Suppose that I have a Java program within an IDE (Eclipse in this case).
Suppose now that I execute the program and at some point terminate it or it ends naturally.</p>
<p>Is there a <strong>convenient</strong> way to determ... | <p><a href="http://www.eclemma.org/" rel="nofollow">eclemma</a> would be a good start: a code coverage tool would allow a coverage session to record the information you are looking for.</p>
<p><img src="http://www.eclemma.org/images/smallscreen.gif" alt="alt text" /></p>
|
Problem dealloc'ing memory used by UIImageViews with fairly large image in an UIScrollView <p>I have a large UIScrollView into which I'm placing 3-4 rather large (320x1500 pixels or so) UIImageView image tiles. I'm adding these UIImageViews to the scroll view inside of my NIB files. I have one outlet on my controller... | <p>I've solved the mystery - and I'm pretty sure this is a bug on Apple's side.</p>
<p>As Kendall suggested (thanks!), the problem lies in how InterfaceBuilder loads images from the NIB file. When you initFromNib, all UIImageViews will init with a UIImage using the imageNamed: method of UIImage. This call uses cachi... |
Is there a fast language that supports portable continuations? <p>I'm looking for a fast language (ie. a language that can be compiled natively to achieve performance not more than 3 or 4 times slower than C), which supports portable continuations. By this I mean a continuation that can be serialized on one computer, ... | <p>Did you checked <strong>OCaml</strong> ? It can be compiled and should be marginally slower than C.</p>
<p><a href="http://okmij.org/ftp/Computation/Continuations.html">Continuations and delimited control</a></p>
|
Need assistance with diagnosing SOAP packet problem with Amazon S3 <p>We are building an application which stores data in an S3 bucket. However, we are having problems with the <strong>PutObject</strong> method. Here is the xml packet we are sending out:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
&l... | <p>If you want to send the data in the SOAP message itself, you need to use PutObjectInline, and not PutObject (which expects the data to be a DIME attachment).</p>
<p>see <a href="http://docs.amazonwebservices.com/AmazonS3/latest/index.html?SOAPPutObjectInline.html" rel="nofollow">PutObjectInline</a> in the s3 docs.<... |
Cannot get regular expression work correctly with multiline <p>I have a quite big XML output from an application. I need to process it with my program and then feed it back to the original program. There are pieces in this XML which needs to be filled out our replaced. The interesting part looks like this:</p>
<pre><c... | <p>i believe the option to use is <code>RegexOptions.Singleline</code> instead of <code>RegexOptions.Multiline</code> (<a href="http://www.regular-expressions.info/dot.html">src</a>). allowing (.) to match newlines should work in your case.</p>
<blockquote>
<p>...the mode where the dot also matches newlines is calle... |
File System indexing <p>I am creating an application were I need to scan a directory hive to find a certain file.</p>
<p>I also want to better understand how indexing works.</p>
<p>Can anyone point me to any resource preferably in C# that shows how I can create a basic index for file system searching?</p>
| <p>So, it sounds like you need a library for doing searches.</p>
<p>Lucene is a java search library, which has been <a href="http://incubator.apache.org/lucene.net/" rel="nofollow">ported to C#</a>. </p>
|
Difference between 2 dates in SQLite <p>How do I get the difference in days between 2 dates in SQLite? I have already tried something like this:</p>
<pre><code>SELECT Date('now') - DateCreated FROM Payment
</code></pre>
<p>It returns 0 every time.</p>
| <pre><code> SELECT julianday('now') - julianday(DateCreated) FROM Payment;
</code></pre>
|
How can I make my image control's imageurl dynamic depending on host? <p>I am trying to convert my web application into a fully dynamic system. One thing I am trying to do is to load a different logo (set in the masterpage template) depending on the host.</p>
<p>But, even though the code is hit (in page_init), there i... | <p>Have you tried using a virtual path to the image relative to you website? Internet Explorer will generally not show images from a users local file system with the default security settings. Try putting the image in an images directory in your project and setting the URL to it's relative path:</p>
<pre><code>Image1.... |
Automatically copying files from a Linux machine to a Windows machine <p>I need to automatically copy files from a linux machine to a windows one every day. </p>
<p>I'm looking for something simple and secure like scp, rsync, sftp. Unfortunately, I'm at a loss of how to set this up on the Windows machine.</p>
<p>Does... | <p>You can try mounting the Windows drive as a mount point on the Linux machine, using smbfs; you would then be able to use normal Linux scripting and copying tools such as cron and scp/rsync to do the copying.</p>
|
What is best thing to call your namespace in .Net <p>In the past I've always gone and called my namespace for a particular project the same as the project (and principle class) e.g.:</p>
<pre><code>namespace KeepAlive
{
public partial class KeepAlive : ServiceBase
{...
</code></pre>
<p>Then from other project... | <p>Having the name of a class being the same as the namespace is a bad idea - it makes it quite tricky to refer to the right thing in some cases, in my opinion.</p>
<p>I usually call the project (and namespace) an appropriate name and then have "EntryPoint" or "Program" for the entry point where appropriate. In your e... |
Where can I find the Maven installation directory in Eclipse 3.4 <p>I have installed m2eclipse plugin from <a href="http://m2eclipse.codehaus.org/" rel="nofollow">http://m2eclipse.codehaus.org/</a>. Now I want to use that as a standalone build tool but I am unable to find the installation directory. Can anyone help me ... | <p>I have both the plugin (with its embedded maven instance) and a full maven download. Both should end up using the same repository in something like <code>C:\Documents and Settings\user\.m2</code>. </p>
<p>There are a few cases where you need a full maven download anyways. For example, trying to build a groovy maven... |
Getting the current stack trace on Mac OS X <p>I'm trying to work out how to store and then print the current stack in my C++ apps on Mac OS X. The main problem seems to be getting dladdr to return the right symbol when given an address inside the main executable. I suspect that the issue is actually a compile option, ... | <p>What releases of OS X are you targetting. If you are running on Mac OS X 10.5 and higher you can just use the backtrace() and backtrace_symbols() libraray calls. They are defined in execinfo.h, and there is a <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/backtrace.3.html">manpage</... |
Auto Font Size For Text (GD via PHP) <p>There is a space of x*y for text to go on $im (GD Image Resource) how can I choose a font size (or write text such that) it does not overflow over that area?</p>
| <p>I think you look for the <a href="http://fr.php.net/manual/en/function.imagettfbbox.php" rel="nofollow" title="imagettfbbox">imagettfbbox</a> function.</p>
<p>I used that some years ago for a script generating localized buttons for a Web interface. I actually resized buttons if the text didn't fit in the template, ... |
Why this union's size is 2 with bitfields? <p>I am working on turbo C on windows where char takes one byte.Now my problem is with the below union.</p>
<pre><code>union a
{
unsigned char c:2;
}b;
void main()
{
printf("%d",sizeof(b)); \\or even sizeof(union a)
}
</code></pre>
<p><p>This program is printing output as ... | <p>Compilers are allowed to add padding to structs and unions and while, I admit, that it's a little surprising that yours does round up the union to a two byte size when you are able to get a one byte struct it is perfectly allowed.</p>
<p>In answer to your second question: no it's not avoidable. Bit fields are a str... |
Apple DMG files over FTP are getting corrupted why? <p>I am trying to FTP some apple DMG files, if we do it by hand through Safari or IE it ends up at the destination just fine and uncorrupted. However, if I use a freeware FTP client that we had been using with great success for zip's and exe's or if I use a Powershell... | <p>Seems like your client treats dmg file as text file.
set Binary transfer mode in your ftp client and it will ftp it as is.</p>
<p>I always thought that ascii transfer mode in ftp is just plain stupid. It causes more trouble then it is worth.</p>
|
Is there a delegate available for properties in C#? <p>Given the following class: </p>
<pre><code>class TestClass {
public void SetValue(int value) { Value = value; }
public int Value { get; set; }
}
</code></pre>
<p>I can do </p>
<pre><code>TestClass tc = new TestClass();
Action<int> setAction = tc.SetVal... | <p>You could create the delegate using reflection :</p>
<pre><code>Action<int> valueSetter = (Action<int>)Delegate.CreateDelegate(typeof(Action<int>), tc, tc.GetType().GetProperty("Value").GetSetMethod());
</code></pre>
<p>or create a delegate to an anonymous method which sets the property;</p>
<pr... |
How can I get the X,Y position of a TWinControl (relative to the screen) <p>I'm trying to show a custom hint in a TWinControl but I can't figure out how to get it's position.</p>
<p>Using position 0,0 shows the hint on the top of my screen (outside the window) so I guess it must be the position of the control on the s... | <p>TControl.ClientToScreen gives you the screen coordinates for a given point within the control.</p>
<pre><code>lPoint := Panel1.ClientToScreen(Point(0,0));
Label1.Caption := Format('Screen: %d, %d', [lPoint.X, lPoint.Y]);
</code></pre>
|
Toolbar and treeview Icons missing when displaying CHM file using HH API <p>Just encountered an interesting problem. I have a CHM file. If I display it using Process.Start it displays correctly.</p>
<p>If however I launch it using the HH API it displays without any icons in the toolbar and treeview; the main content, ... | <p>It seems that the problem was that I was giving HH API a relative path to the help file. Now that I'm using an absolute path the problem seems to have gone away.</p>
|
How to check if DLL is debug-compiled <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/194616/how-to-tell-if-net-app-was-compiled-in-debug-or-release-mode">How to tell if .net app was compiled in DEBUG or RELEASE mode?</a> </p>
</blockquote>
<p>Simple Question... | <p>It depends on how you want to check. If you want to check in code when you are actually running, if the code is in debug mode, you can use:</p>
<pre><code>Debug.Assert(MyFunction())
</code></pre>
<p>Using that code, MyFunction will only run when the dll it is located in is compiled in debug mode.</p>
|
jQuery droppables - Change element on drop <p>I'm a bit new to jQuery and hope somebody can help me out.</p>
<p>I'm trying to change an element (li) to another element (div) after the (li) has been dropped.</p>
<p>Sample code:</p>
<pre><code>$("#inputEl>li").draggable({
revert: true,
opacity: 0.4,
helper: "c... | <p>So, what you want is to keep your original list intact and drop list items into dropEl?
How about this:</p>
<pre><code>drop: function(ev,ui) {
$(this).append("<div>Some content</div>");
}
</code></pre>
<p>Or, if you want to replace the list elements with a div element and also have the div element... |
Sliding Notification bar in java (a la Firefox) <p>I would like to implement a sliding notification bar as the one in Firefox or IE for my java application. But I don't want to reinvent the wheel and I'm sure someone out there has already done it and is willing to share.
Do you know any open-source implementation of th... | <p>There's an example in <a href="http://rads.stackoverflow.com/amzn/click/0596009070" rel="nofollow">Swing Hacks</a> called "Slide Notes Out from the Taskbar" that seems pretty close to what you want (there's a <a href="http://books.google.com/books?id=oNbFfcyAtv4C&pg=PA240&dq=%22Swing+hacks%22+%22slide+notes+... |
Internet Explorer serves up unknown file type <p>I have a web server on port 80 and port 81. IE can connect to the server on either port. This worked fine until I installed an application with a file type (.TPJ) that had a MIME type of text/xml on the client PC. At that point IE no longer opened the web site, but offer... | <p>I found the answer. There is a left-over entry in the registry for the text/xml MIME type. It can be restored to the default value by re-registering the MSXML3.DLL.</p>
<pre><code>regsvr32 msxml3.dll
</code></pre>
|
SQL Server and the Guest Account - what is this for? <p>How is the guest account in SQL Server (2000, 2005, 2008) supposed to be used? What is it good for? I've tried enabling the account but I still can't get certain users to be able to refresh Excel 2007 PivotTables attached to views which I have given SELECT rights ... | <p>Guest is mostly just for allowing access to the database, using the Public role. Don't think it's meant to be something that users actually log in as...</p>
<p>When a database is created, the database includes the Guest user by default. Permissions granted to the Guest user are inherited by users that do not have a... |
Can someone explain the Flickr API and how security is established? Why not use AES instead of md5? <p>Just trying to understand Flickr's API setup, and how secure it really is.</p>
<p><a href="http://www.flickr.com/services/api/auth.howto.web.html" rel="nofollow">Flickr API</a></p>
<p>Why do a MD5 hash and not somet... | <p>The hash is strictly a signature, so a one-way hash like MD5 is good enough for their usage. If there's a collision (unlikely but possible) they'll just re-hash.</p>
<p>No need to make it more complicated than it has to be.</p>
|
ListView Shows Repeated Elements When the Underlying Generic List Does Not Contain Repeated Elements <p>I am binding a generic List to an <asp:ListView /> control to display a tag cloud. The elements in the list are Tag objects, where Tag is basically just something like:</p>
<pre><code>public class Tag {
pu... | <p>Could you put some more code up? Perhaps you are using some reference variables that are using the same memory location? It's hard to tell with the code you uploaded.</p>
|
Advice about forming Hackers Club <p>I'm thinking of forming a <a href="http://www.catb.org/~esr/jargon/html/H/hacker.html" rel="nofollow">Hacker</a>s Club at work. My idea is that we would meet monthly and at each meeting one member would present an interesting hack he had created. (The hacks presented wouldn't nece... | <p>We do this at the office. I call it 'Developer Fight Club'</p>
<p>Usually do challenges of varying difficulty and compete against one another.</p>
<p>At the end of it, we go over our solutions, do code-reviews and discussions, and then use either benchmark results or other people as the deciding factor for who win... |
control lost focus event when using keyboard shortcut <p>For both .NET Winforms and Windows Presentation Foundation, if I have a text box that the user has just entered text into, and a button, if the user clicks the button the "LostFocus" event fires before the button click event fires. However if the user uses a key... | <p>You could try tracking whether or not the lost focus logic has occured before firing the button logic. You shouldn't really have code directly in the handler anyway. You could do something like this:</p>
<pre><code>public partial class Form1 : Form
{
private Boolean _didLostFocusLogic;
public F... |
Updating sort keys after delete <p>I have a table which has a field <code>sort_id</code>. In this field there are numbers from 1 to n, that define the order of the data sets.
Now I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that "finds" the gaps and changes the <co... | <p>Mladen and Arvo have good ideas, but unfortunately in MySQL you can't <code>SELECT</code> and <code>UPDATE</code> the same table in the same statement (even in a subquery). This is a known limitation of MySQL.</p>
<p>Here's a solution that uses MySQL user variables:</p>
<pre><code>SET @i := 0;
UPDATE mytable
SET ... |
DB-side encryption via NHibernate <p>We're looking to encrypt a field using DB-side encryption via NHibernate (most examples we've come across are app-side, which is not what we would like). The issue has been raised a couple of times, but no answers yet it seems. </p>
<p>On SQL Server 2005, for instance, and forgetti... | <p>Posted outline of nasty hack on the <a href="http://forum.hibernate.org/viewtopic.php?p=2400105#2400105" rel="nofollow">NHibernate forum</a></p>
|
How can you concatenate two huge files with very little spare disk space? <p>Suppose that you have two huge files (several GB) that you want to concatenate together, but that you have very little spare disk space (let's say a couple hundred MB). That is, given <code>file1</code> and <code>file2</code>, you want to end... | <p>time spent figuring out clever solution involving disk-sector shuffling and file-chain manipulation: 2-4 hours</p>
<p>time spent acquiring/writing software to do in-place copy and truncate: 2-20 hours</p>
<p>times median $50/hr programmer rate: $400-$1200</p>
<p>cost of 1TB USB drive: $100-$200</p>
<p>ability to... |
Toolbar moves up when call finishes <p>While in a call, if the user wants to use my application, and if the call finishes, and the user is still in the application, the toolbar moves up, well all the view moves up, and so the toolbar now has a space in the bottom. Basically the height "Touch to return to call" has. I a... | <p>In general setting your auto resize masks properly should fix things. Could you update with a screenshot to show exactly where the resizing issues are happening?</p>
|
Array slicing / group_concat limiting in MySQL <p>Let's say I have a table:</p>
<pre>
i j
---
a 1
a 2
a 3
a 4
b 5
b 6
b 7
b 8
b 9
</pre>
<p>Obvoiusly <code>SELECT a, GROUP_CONCAT(b SEPARATOR ',') GROUP BY a</code> would give me</p>
<pre>
a 1,2,3,4
b 5,6,7,8,9
</pre>
<p>But what if I want to get only a LIMITED num... | <p>Best way is to use <code>SUBSTRING_INDEX()</code> and <code>GROUP_CONCAT()</code>.</p>
<pre><code>SELECT i, SUBSTRING_INDEX( GROUP_CONCAT(j), ',', 2)
FROM mytable
GROUP BY i;
</code></pre>
<p>You don't have to know the length of <code>j</code> field here.</p>
|
Sample web Page using Mono and XSP on windows box <p>I'm attempting to get my first ASP.NET web page working on windows using <a href="http://www.mono-project.com/Main_Page" rel="nofollow">Mono</a> and the XSP web server.</p>
<p>I'm following this chaps <a href="http://www.codeproject.com/KB/cross-platform/introtomono... | <p>Can you paste the command line you are using to start xsp? If you are just running a single webapp something like this isn't really needed, and could be the source of the problem:</p>
<p>xsp --applications /SimpleWebApp:C:\Projects\Mono\ASPExample\ </p>
<p>just cd to the ASPExample directory and run xsp with no p... |
Inconsistencies with viewstate/function/server vs development server <p>The code goes something like this:</p>
<pre><code>protected bool IsOKToSend()
{
bool IsOK = true;
lblErrorSending.Visible = false;
if (txtUserName.Text == "" )
{
lblErrorSending.Text = "Please enter your username before s... | <p>I will take a wild guess here and say you are not using sticky sessions in production and you have multiple web servers. But in development you have only one server. You are using load balancing and every so often you get kicked to a different server with a different machinekey in your maching.config. App goes boom.... |
Determine whether browser allows focus on radios/checkboxes <p>Does anyone know if it's possible to determine, using JavaScript, whether the user's browser allows checkboxes and radio buttons to be focused? In other words, whether you can tab to select them.</p>
<p>I can't just use browser detection to do this, becaus... | <p>One approach is to try to set the focus and then detect if it was successful. Do this by assigning an onfocus event that set a variable to true, try to focus it and then check if the variable is true. </p>
|
Migrating from one DBMS to another <p>Does anyone have any experience migrating from one DBMS to another? If you have done this, why did you do it? Features? Cost? Corporate Directive?</p>
<p>At times, I've worked with DBAs who insisted that we not use features specific to a DBMS (for example, CLR Stored Procedures i... | <p>In my opinion its silly not to take advantage of all the features of the db your using. Changing DBMS regardless of how many features you use is going to be difficult. There are minute differences between the systems (like some record Date and some record date and time) that will cause a huge headache to change. ... |
Windows Forms Error: "A strongly-named assembly is required" <p>I have a Windows forms project (VS 2005, .net 2.0). The solution has references to 9 projects. Everything works and compiles fine on one of my computers. When I move it to a second computer, 8 out of the 9 project compile with no problem. When I try to com... | <p>I just got it to build by doing the following:</p>
<p>There had been a licenses file in the Properties of the project in question. After deleting the file (it was no longer needed) the project was able to build successfully. So it looks like that was the culprit.</p>
|
Tree library for PHP using left & right ids <p>I'm looking for a library in PHP that can create a tree structure from a database (or array of values) with left and right ids. For the result when getting values I am only looking for an array so I can create any type of view. For adding and removing, it would be nice if ... | <p><a href="http://ezcomponents.org/docs/tutorials/Tree#database-based-back-ends" rel="nofollow">ezComponents Tree</a> library has different backends (tie-ins), that you can choose between. The documentation is pretty good as well.</p>
|
invalid QName when transforming a .net XSLTransform <p>I have a piece of XML that is structured similar to this:</p>
<pre><code> <root>
<score name="Exam 1"><value>76</value></score>
<score name="Exam 2"><value>87</value</score>
</root>
</code></pre... | <p>You cannot have a space in an element name.</p>
|
Does .NET 3.5 installer include 3.0 SP2? <p>We're trying to track down some .Net assembly dependency problems.</p>
<p>On Windows XP, does the .Net 3.5 installer include 3.0 SP2 automatically?</p>
| <p>.NET 3.5 contains .NET 3.0 SP1</p>
<p>.NET 3.5 SP1 contains .NET 3.0 SP2</p>
|
Rails & Windows <p>Is Rails development really this hard on Windows? I'm a PHP developer looking forwards to using Rails (mainly because every single PHP framework I've tried has some quirk that I just hate).</p>
<p>I downloaded Aptana Studio (w/ RadRails) as it seemed to be a good solution (and because I love anythin... | <p>My advice to get started is to purchase <a href="http://rads.stackoverflow.com/amzn/click/0977616630" rel="nofollow">Agile Web Development with Rails</a> and use it like a tutorial, just following along with the book. If you have a Windows machine just use that. Make sure you have a text editor that you like. This s... |
Modifying WordPress's "post-new.php" File for Custom Blog Entries <p>Has anyone ever modified the "post-new.php" file in their WordPress installation? </p>
<p>I want to modify the look of this page to include pieces that I standardly include in my blog posts, and I just don't know if it is do-able/easy/worth my time.... | <p>No reason to modify the core files - you can add stuff via plugins. See, for example, <a href="http://wordpress.org/extend/plugins/more-fields/" rel="nofollow">the more fields plugin</a> - it adds to the new/edit post form without breaking your ability to upgrade the core installation.</p>
<p>Drupal's great, but if... |
Mark parameters as NOT nullable in C#/.NET? <p>Is there a simple attribute or data contract that I can assign to a function parameter that prevents <code>null</code> from being passed in C#/.NET? Ideally this would also check at compile time to make sure the literal <code>null</code> isn't being used anywhere for it a... | <p>There's nothing available at compile-time, unfortunately.</p>
<p>I have a bit of a <a href="https://web.archive.org/web/20081231232311/http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/non-nullable-reference-types.aspx">hacky solution</a> which I posted on my blog recently, which uses a new struct and conversion... |
What is needed to execute visual studio 2005 web tests? <p>Our test department has a series of web tests created using Visual Studio 2005 Team Tester Edition.</p>
<p>I would like to be able to execute these tests against my local machine. I attempted to use the mstest command line tool to accomplish this as described ... | <p>You need VSTS Test Edition. No bueno.</p>
<p><a href="http://msdn.microsoft.com/en-us/vsts2008/test/default.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/vsts2008/test/default.aspx</a></p>
|
another sound as with subtitles <p>is it possible to get other sounds to a divx as it is with getting subtitles?
what is that format of that?</p>
| <p>Yes, you can have multiple audio streams in your video file. <a href="http://www.doom9.org/index.html?/dual-audio.htm" rel="nofollow">Here</a>'s some more information (I'm guessing you're using AVI as your container format).</p>
|
How to assign Date parameters to Hibernate query for current timezone? <p>When you assign a date to a named SQL parameter Hibernate automatically converts it to GMT time. How do you make it use the current server timezone for all dates?</p>
<p>Lets say you have a query:</p>
<pre><code>Query q = session.createQuery("f... | <p>As it turned out Hibernate doesn't convert dates to GMT automatically, it just cuts off time if you use <code>query.setDate()</code>, so if you pass "2009-01-16 12:13:14" it becomes "2009-01-16 00:00:00". </p>
<p>To take time into consideration you need to use <code>query.setTimestamp("date", dateObj)</code> instea... |
How do I split a huge text file in python <p>I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it. </p>
<p>What I think I want the program to... | <p>linux has a split command</p>
<p>split -l 100000 file.txt</p>
<p>would split into files of equal 100,000 line size</p>
|
MVC and jQuery validation, where to 'weave' the javascript and how to embed into master page? <p>If my header/footer are in the master page, and my .js files are referenced in the master page, how can I add jQuery validation on my login page?</p>
<p>If there is an error detected, how will I modify the .js file to disp... | <p>Have you looked at the jquery <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow">validation plugin</a>? The plugin handles a lot of different validation tasks automatically -- i.e., you might be able to get away with doing:</p>
<pre><code>$(document).ready( function { $(form).v... |
New to functional programming <p>Hey, I'm really new to Haskell and have been using more classic programming languages my whole life. I have no idea what is going on here. I'm trying to make a very simple Viterbi algorithm implementation, but for only two states (honest and dishonest casino)</p>
<p>I have a problem ... | <p>I copied the code from the edit window (something in stackoverflow's parser is eating part of the code) and tried it on ghci, which found several errors. The first error was:</p>
<pre><code>foo.hs:34:71:
Couldn't match expected type `[e]' against inferred type `(a, b)'
In the second argument of `listArray',... |
Groovy in Ant build.xml (with Java classes) <p>I have to include Groovy classes into existing Java apps, and include Groovy into Ant's <code>build.xml</code> file.</p>
<p>What is the best way to configure Ant's <code>build.xml</code> for it? </p>
<p>Update: Are there more specifics in combining Java and Groovy compil... | <p>@VonC is correct about including Groovy scripting in your Ant build.</p>
<p>To expand a bit:</p>
<p>To compile <code>.groovy</code> and <code>.java</code> sources <em>together</em> for use in the same application, use the <a href="http://groovy.codehaus.org/The+groovyc+Ant+Task" rel="nofollow"><code><groovyc>... |
Do you just code, or just design, or some of both? <p>Since I hold the job of both coder and designer I wonder if a lot of others are in the same boat. What percentage of your time is each?</p>
<p>For me it's as close to 50/50 as you can get and I think I do a pretty good job at each: <a href="http://rpmware.com" rel=... | <p>Chances are, a good generalist won't quite be able to do the same quality job a specialist in that given area could do. At the same time, having too many specialists on staff can be a problem, because a lack of common understanding on a given topic may not allow them to collaborate as fluidly as they'd like. A team ... |
File Access from Excel COM object fails when run from NT Service on Vista <p>We use COM objects to access excel spreadsheets in an NT service (via the Windows Scripting Host). Prior to Vista, this worked beautifully, but starting with Vista, we receive this error:</p>
<p>Microsoft Office Excel cannot access the file ... | <p>just some further questions:</p>
<ul>
<li>Which version of Excel are you using? </li>
<li>Have you tried running the service with elevated privileges?</li>
</ul>
|
ASP.NET shared hosting provider that allows multiple websites (not just applications)? <p>Most ASP.NET hosts give you a single website in IIS. Then, they let you set subfolders as applications. Are there any shared ASP.NET 3.5 hosts that give you multiple websites with a single account?</p>
<p>I have several low tra... | <p>WebHost4Life offers this, though there's a small charge per domain. ($15/year or so). I'm sure most hosts can do this, but fees vary.</p>
|
How wrong is it to have a unique and normal index on the same column? <p>I have the following table structure</p>
<pre><code>CREATE TABLE `table` (
`id` int(11) NOT NULL auto_increment,
`date_expired` datetime NOT NULL,
`user_id` int(11) NOT NULL,
`foreign_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE ... | <p>I believe if you created your unique index as (<code>user_id</code>, <code>date_expired</code>, <code>foreign_id</code>), you'll get the same benefit of having a normal index on <code>user_id</code> with just the unique index. MySQL can use the first columns of any index to pare down the number of rows in the join i... |
Opening a VS 2003 C++ project in VS 2008 <p>Found some old code, circa VS 2003. Now I have just VS 2008 (SP1) installed. When I try opening the *.sln file, it tries converting the projects. The report notifies me it was done successfully, but the solution is empty, marked with "project file was unloaded".
VS 2008 doesn... | <p>I suggest manually converting the project by creating a new proj. If you are having trouble now then there will be no way that you can be certain later by trying some other import method.</p>
<p>On a side note- I am on vs2005 and I often get 2008 projects handed to me. I go into the sln and proj files and rename ... |
How to discard everything after a certain string character in PHP? <p>I want to take a string in PHP and discard everything after a certain character. However, it needs to search for not just one character, but an array of them. As soon as it gets to one of the characters in the array, it should return the string befor... | <p>The <a href="http://php.net/manual/en/function.strcspn.php">strcspn</a> function is what you are looking for.</p>
<pre><code><?php
$mask = "abc";
$string = "log dog hat bat";
$result = substr($string,0,strcspn($string,$mask));
var_dump($result);
?>
</code></pre>
|
Wrapping Visual C++ in C# <p>I need to do some process injection using C++ but I would prefer to use C# for everything other than the low level stuff. I have heard about "function wrapping" and "marshaling" and have done quite a bit of google searching and have found bits of information here and there but I am still re... | <p>I think P/Invoke is really the most straightforward approach:</p>
<ul>
<li>Create a DLL in <em>unmanaged</em> C++, containing all the functionality you need to do the injection.</li>
<li>In your C# code, declare some <code>static extern</code> methods, and use the <code>DllImport</code> attribute to point them to y... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.