instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm in the process of building a site with embedded videos. I'd prefer not dealing with the videos myself and instead use something like Vimeo Plus. I also would like the future administrators of the site to be able to upload videos directly from the administration interface of the site (i.e. so that they don't have... | <p>Brightcove is definitely one way to go. They have full API's that allows you build a component for upload. They also provide a batch ingest process. I know this doesn't solve your embeddable component desire, but this can get on your way to creating one.</p>
| <p>I just deployed a site where the administrators can upload videos to the server using <a href="http://www.fckeditor.net/" rel="nofollow noreferrer">FCKEditor</a>'s upload functionality hooked into a Drupal site. Security isn't as much of a worry since the capability is locked down by role, and like you say you can ... | 37,092 |
<p>I have GridView which I can select a row. I then have a button above the grid called Edit which the user can click to popup a window and edit the selected row. So the button will have Javascript code behind it along the lines of</p>
<pre><code>function editRecord()
{
var gridView = document.getElementById("<%=... | <p>I worked it out based on JasonS response. What I did was create a hidden field in the Grid View like this:</p>
<pre><code><asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:HiddenField ID="hdID" runat="server" Value='<%# Eval("JobID") %>' />
</ItemTemplate>
</a... | <p>one could avoid javascript altogether, by setting anchor tags pre-populated with the query string for each row (although this will effect your table layout, it will need only one click rather than 2 from the user) </p>
<p>insert in the gridview template:</p>
<pre><code><asp:HyperLink runat="server" ID="editLink... | 28,281 |
<p>Suppose we have <em>n</em> elements, <em>a</em><sub>1</sub>, <em>a</em><sub>2</sub>, ..., <em>a</em><sub>n</sub>, arranged in a circle. That is, <em>a</em><sub>2</sub> is between <em>a</em><sub>1</sub> and <em>a</em><sub>3</sub>, <em>a</em><sub>3</sub> is between <em>a</em><sub>2</sub> and <em>a</em><sub>4</sub>, <e... | <p>Let's first ask the question "how many 0-1 sequences of length n are there with no two consecutive 1s?" Let the answer be A(n). We have A(0)=1 (the empty sequence), A(1) = 2 ("0" and "1"), and A(2)=3 ("00", "01" and "10" but not "11").</p>
<p>To make it easier to write a recurrence, we'll compute A(n) as the sum of... | <p>Throwing my naive script into the mix. Plenty of opportunity for caching partial results, but it ran fast enough for small n that I didn't bother.</p>
<pre><code>def arcCombinations(n, lastDigitMustBeZero):
"""Takes the length of the remaining arc of the circle, and computes
the number of legal combinati... | 46,198 |
<p>My requirements:</p>
<ul>
<li>Support .NET Compact Framework 2.0 and Windows Mobile 6.0 devices.</li>
<li>Only need to unzip the contents to a directory on a storage card. Creation of zip files is not required.</li>
<li>Must be able to use in corporate/commercial software.</li>
<li>Can be open source, but not have ... | <p>Have a look at #ziplib (www.icsharpcode.com). It's GPL, but you can use it in closed-source, commercial applications. They don't say anything specifically on their page about using it with the Compact Framework, so you'd have to give it a test yourself (that said, it's pure C# without any external dependencies, so t... | <p>I use the Resco MobileForms toolkit for a variety of functionality: <a href="http://www.resco.net/developer/mobileformstoolkit/overview.aspx" rel="nofollow noreferrer">http://www.resco.net/developer/mobileformstoolkit/overview.aspx</a></p>
<p>It includes a good ZIP library.</p>
| 2,895 |
<p>In C#, I can do this:</p>
<pre><code>class Program
{
static void Main(string[] args)
{
List<Animal> animals = new List<Animal>();
animals.Add(new Dog());
animals.Add(new Cat());
foreach (Animal a in animals)
{
Console.WriteLine(a.MakeNoise())... | <p>edit: added more code for your updated question</p>
<p>disclaimer: I haven't used Ruby in a year or so, and don't have it installed on this machine, so the syntax might be entirely wrong. But the concepts are correct.</p>
<hr>
<p>The exact same way, with classes and overridden methods:</p>
<pre><code>class Anima... | <p>This is how I would write it:</p>
<pre><code>class Animal
def make_noise; '' end
def sleep; puts "#{self.class.name} is sleeping." end
end
class Dog < Animal; def make_noise; 'Woof!' end end
class Cat < Animal; def make_noise; 'Meow!' end end
[Dog.new, Cat.new].each do |animal|
puts animal.make_noise... | 16,650 |
<p>I am just getting started with Silverlight and have recently added a Silverlight project to an established solution. In this particular scenario my solution included an existing ASP.NET web site (not application) which Visual Studio kindly offered to integrated my Silverlight application into, which I accepted.</p>
... | <p>The copying of the XAP to the ClientBin is a MSBuild task. If you're using a standard ASP.NET project template it can be found under the Silverlight Link section.</p>
<p>For everything else you might be able to figure out the name of the MSBuild task and add it to your ASP.NET MVC project. The easier solution would... | <p>Go to the property pages of your Silverlight application, Choose Build Events Tab, Enter following line in Post-Build events command line:</p>
<pre><code>copy $(TargetDir)*.xap $(SolutionDir)<youar web solution folder name such as app.web>\ClientBin
</code></pre>
<p>Now onwards, on each successful build, the... | 25,398 |
<p>Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application.
Users can save "products" in the database and give them names and descriptions, but since the whole ... | <p>I would suggest checking out <a href="http://code.google.com/p/django-multilingual/" rel="noreferrer">django-multilingual</a>. It is a third party app that lets you define translation fields on your models.</p>
<p>Of course, you still have to type in the actual translations, but they are stored transparently in th... | <p>It depends on who will provide the translations. If you want to provide a web interface to translation, then you need to develop that yourself, and also represent the translations in the database.</p>
<p>If the same translators who translated the site will also translate the data, you can provide them with the same... | 47,876 |
<p>I have a DataGridViewComboBoxColumn in a DataGridView in a windows application. The user can change settings elsewhere to potentially invalidate a selection in a DataGridViewComboBoxColumn. I have a requirement to retain/display the invalid item while only leaving valid items selectable in the list.</p>
<p>Withou... | <p>I found a very strange solution:</p>
<p>Set the autosizecolumnmode to none...</p>
<p>Here's an explaination</p>
<p><a href="http://www.kebabshopblues.co.uk/2007/03/24/more-on-that-datagridviewcombobox-error/" rel="nofollow noreferrer">http://www.kebabshopblues.co.uk/2007/03/24/more-on-that-datagridviewcombobox-er... | <p>Presumably your bound datasource to populate the combobox is read only. If so, why not just temporarily insert the invalid value into the underlying datasource. That way it would still be displayed. You could add a temporary column to flag invalid items and not allow the user to leave it selected and then delete it ... | 21,779 |
<p>I need to return a list of record id's from a table that may/may not have multiple entries with that record id on the same date. The same date criteria is key - if a record has three entries on 09/10/2008, then I need all three returned. If the record only has one entry on 09/12/2008, then I don't need it.</p>
| <pre><code>SELECT id, datefield, count(*) FROM tablename GROUP BY datefield
HAVING count(*) > 1
</code></pre>
| <p><code>GROUP BY</code> with <code>HAVING</code> is your friend:</p>
<pre><code>select id, count(*) from records group by date having count(*) > 1
</code></pre>
| 10,235 |
<p>Example</p>
<p>I have <code>Person</code>, <code>SpecialPerson</code>, and <code>User</code>. <code>Person</code> and <code>SpecialPerson</code> are just people - they don't have a user name or password on a site, but they are stored in a database for record keeping. User has all of the same data as <code>Person</c... | <p>There are generally three ways of mapping object inheritance to database tables. </p>
<p>You can make one big table with all the fields from all the objects with a special field for the type. This is fast but wastes space, although modern databases save space by not storing empty fields. And if you're only looking ... | <p>Personally, I would store all of these different user classes in a single table. You can then either have a field which stores a 'Type' value, or you can imply what type of person you're dealing with by what fields are filled in. For example, if UserID is NULL, then this record isn't a User.</p>
<p>You could link... | 6,756 |
<p>What's everyone take on tieing code enum's to row ID's in a database table? I'm really looking for a cleaner alternative. What if for example your static rows in a given table are ID's 1,2,3, and then that table gets filled with user transactional data using ID's 4-100, and then you later want to add a new row ID wh... | <p>Don't do that. ;-)</p>
<p>If you have static rows, values that never change, in a table that has user data that is transactional or at least mutable, then I'd say you have at least a normalization issue in the schema.</p>
<p>Reference data belongs in it's own table, usually. If the table itself contains only the ... | <p>Maybe you could post an example to help us better understand, but if you have some rows that are designated as "system" entries, you could consider adding a column to the table called Order and then, when you create an entry that is designed to be the system entry, you can increment the Order column. </p>
<p>For mo... | 28,620 |
<p>We've been using <a href="http://www.jboss.org/community/docs/DOC-10525" rel="nofollow noreferrer">jbossmq</a> and <a href="http://csil.sourceforge.net" rel="nofollow noreferrer">csil</a>. The implementation has been successful in production for 6 years, but I'm wondering if something better is available.</p>
<p>On... | <p>IKVM for compiling .NET from Java looks interesting.</p>
<p>For .NET messaging check out <a href="http://www.rabbitmq.com/" rel="nofollow noreferrer">RabbitMQ</a>.</p>
| <p>I am author of <a href="http://jni4net.sf.net/" rel="nofollow noreferrer">jni4net</a>, open source intraprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.</p>
| 32,464 |
<p>Being new to Cocoa, and probably not knowing all of the potential classes available that already have this functionality neatly wrapped in an OO class, here's an algorithm inquiry. What's the best bet to count how many times a particular key occurs in an array of multiple <code>NSDictionary</code> instances?</p>
<p... | <pre><code>NSDictionary * dict1 = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:1], @"foo",
[NSNumber numberWithInt:2], @"bar", nil];
NSDictionary * dict2 = [[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithI... | <pre><code>NSCountedSet *keyCounts = [NSCountedSet set];
for (NSDictionary *dict in myDictionaries)
[keyCounts unionSet:[NSSet setWithArray:[dict allKeys]]];
</code></pre>
| 39,611 |
<p>I'm jealous of the rails guys. They can do this:</p>
<pre><code><%= javascript_include_tag "all_min" %>
</code></pre>
<p>... and I'm stuck doing this:</p>
<pre><code><script src="/public/javascript/jquery/jquery.js" type="text/javascript"></script>
<script src="/public/javascript/jquery/jquer... | <p>You can use a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx" rel="nofollow noreferrer">ScriptManager</a>/<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanagerproxy.aspx" rel="nofollow noreferrer">ScriptManagerProxy</a> control and define the scripts in the <... | <p>That is a helper method in rails.</p>
<p>passing it :all will include the default protoype libaries.</p>
<p>ASP.net MVC tried to copy rails but you can never get the internal asthetics right.</p>
<p>My Advice:</p>
<p>Instead of copying everything good from open source just use the real stuff i.e. rails</p>
| 38,493 |
<p>I just started with the WCF REST Starter Kit.</p>
<p>I created a simple service that return an array of an object.</p>
<p>Using the browser, everything works fine but when I use a WCF client, I get an ArgumentException.</p>
<p>I'm not using IIS and here is the code:</p>
<p><strong>The contract:</strong></p>
<pr... | <p>In his book "<a href="https://rads.stackoverflow.com/amzn/click/com/0120887975" rel="noreferrer" rel="nofollow noreferrer">SQL Programming Style</a>," Joe Celko suggests a number of conventions, for example that a collection (e.g. a table) should be named in the plural, while a scalar data element (e.g. a column) sh... | <p><a href="http://www.ssw.com.au/ssw/standards/Default.aspx" rel="nofollow noreferrer">Here you can find a lot of Rules to better SQL /SQL Server.</a><br>
Yes, it's the company that I am working for, but they are good!
And these rules come from experience with client projects.</p>
<p>Have a look and take what you lik... | 49,670 |
<p>If you have a situation where a TCP connection is potentially too slow and a UDP 'connection' is potentially too unreliable what do you use? There are various standard reliable UDP protocols out there, what experiences do you have with them?</p>
<p>Please discuss one protocol per reply and if someone else has alrea... | <p>It's difficult to answer this question without some additional information on the domain of the problem.
For example, what volume of data are you using? How often? What is the nature of the data? (eg. is it unique, one off data? Or is it a stream of sample data? etc.)
What platform are you developing for? (eg. deskt... | <p>The best way to achieve reliability using UDP is to build the reliability in the application program itself( for example, by adding acknowledgment and retransmission mechanisms)</p>
| 13,308 |
<p>I'm working on a site (<a href="http://easy2speak.com" rel="nofollow noreferrer">http://easy2speak.com</a>) with about 10 flash SWFs on each page. Each of the SWFs are playing back a sound when clicked. Loading the sound, and playing it without any latency works fine, but in Flash player version 9 on all major brows... | <p>I would discourage from /FI (<a href="http://msdn.microsoft.com/en-us/library/8c5ztk84.aspx" rel="noreferrer">MSDN</a> says it's called /FI . Not sure whether i looked at the right page though), simply because people or yourself reading the files don't notice a header is magically included anyway. </p>
<p>You can ... | <p>Save this function for when something weird comes up - like if you want to include a header in a generated source file. Even then there are likely better ways.</p>
| 41,495 |
<p>Every time I start Visual Studio 2008, the first time I try to run the project I get the error CS0006 The metadata file ... could not be found. If I do a rebuild of the complete solution it works.</p>
<p>Some information about the solution:</p>
<ul>
<li><p>I'm building in debug mode and Visual Studio complains abo... | <p>i had the similar issue where "metadata could not be found". on the solution property, make sure that the "build" check box is marked in <em>Build/Configuration Manager</em> for each project.</p>
| <p>Same thing happened. I have several solutions referencing the same library projects (.net 3.5). I noticed when one was built in debug/normal config, and another using some other compiler directive (sqlite/local mode), this would happen. Simply get both projects building with the same directives and you should be fin... | 42,652 |
<p>Recently, <a href="https://stackoverflow.com/users/5200/lee-baldwin">Lee Baldwin</a> showed how to write a <a href="https://stackoverflow.com/questions/129877/how-do-i-write-a-generic-memoize-function#141689">generic, variable argument memoize function</a>. I thought it would be better to return a simpler function ... | <p>I guess you could go into the debug info and determine this from the source-code, but basically it's a "no", sorry.</p>
| <p>I'm pretty sure you can't do that in Lua.</p>
| 17,213 |
<p>I have a report in SSRS 2005 that's based on a query that's similar to this one: </p>
<pre><code>SELECT * FROM MyTable (NOLOCK)
WHERE col1 = 'ABC'
AND col2 LIKE '%XYZ%'
</code></pre>
<p>I need to be able to dynamically include the AND part of the WHERE clause in the query based on whether the user has checked a c... | <p>Charles almost had the correct answer.</p>
<p>It should be:</p>
<pre><code>SELECT * FROM MyTable (NOLOCK)
WHERE col1 = 'ABC'
AND (@checked = 0 OR col2 LIKE '%XYZ%')
</code></pre>
<p>This is a classic "pattern" in SQL for conditional predicates. If <code>@checked = 0</code>, then it will return all rows match... | <p>You can also take another approach and use the Exec function:</p>
<pre><code>DECLARE @CommonSelectText varchar(2000)
DECLARE @CompleteSelectText varchar(2000)
SELECT @CommonSelectText = 'SELECT * FROM MyTable (nolock) Where Col = ''ABC'' '
IF @checked = 1
SELECT @CompleteSelectText = @CommonSelectText... | 16,666 |
<p>I have transferred a Classic asp site running on windows server 2003 to windows server 2008 but suddenly the below code has stopped working.</p>
<pre><code>Const connStr_FC08 = "Provider=SQLNCLI10;Server=DS-47500;Database=TestDB;Uid=TestLogin;Pwd=test;Network=dbmssocn;"
Function connDB(OpenDB)
DIM conn
SET... | <p>I see a few possible syntax issues with the code you posted:</p>
<pre><code> ...
conn.open = connStr_FC08
...
connDB = conn
...
cn = connDB("Y")
</code></pre>
<p>Should it be updated to the following?</p>
<pre><code> ...
conn.ConnectionString = connStr_FC08
...
Set connDB = conn
...
... | <p>You have that SQL Provider installed right?</p>
<p>You can put that function into a simple VBScript script to test without altering your pages any. </p>
| 38,894 |
<p>This is a bit of a weird one, and I could well be coding this completely wrong - hence why I've hit the same error twice in two days, in completely different parts of a script. The code I'm using is below:</p>
<pre><code>
public function findAll( $constraints = array() ) {
// Select all records
... | <p>That's because <a href="http://docs.php.net/manual/en/pdostatement.bindparam.php" rel="noreferrer"><code>bindParam</code></a> works by binding to a variable, and you are re-using the variable (<code>$value</code>) for multiple values. Try with <a href="http://docs.php.net/manual/en/pdostatement.bindvalue.php" rel="n... | <p>As mentioned, using <a href="http://docs.php.net/manual/en/pdostatement.bindvalue.php" rel="nofollow"><code>bindValue</code></a> instead of <a href="http://docs.php.net/manual/en/pdostatement.bindparam.php" rel="nofollow"><code>bindParam</code></a> will certainly accomplish this. However, after spending a considerab... | 17,684 |
<p>I'm looking for a CMS system to manage a simple and small website. The website will be made with pure HTML and some JavaScript (perhaps prototype library).
The reason while I'm looking for a CMS system is, because the customer will have the ability to change the content later by him self, and of course he didn't hav... | <p>Personally I would recommend <a href="http://wordpress.org/" rel="nofollow noreferrer">WordPress</a>. Although it's 'marketed' as a blogging platform, it has very nice support for just "pages".</p>
<ul>
<li>It's free;</li>
<li>It's commonly available on cPanel installations, or it's easy to set up on your own serve... | <p>A good .Net one is Umbraco...</p>
| 43,755 |
<p>We're building an C# .NET app which will be running on computers sitting inside trucks. We need to talk to Digital IO ports on the truck computers which do not exist on our developer machines, so I need to write a dummy library which will be included in our dev builds, but will be replaced with our actual Digital I... | <p>I recently developed something similar where I assumed an interface for communicating with some embedded computers that operated servos. To write the software that controlled these computers I <a href="http://code.google.com/p/moq/" rel="nofollow noreferrer">used Moq to mock</a> the interfaces I wrote, and then lat... | <p>I would go for the IoC+Mock approach, but if u would like to do it with msbuild, take a look <a href="http://realfiction.net/?q=node/164" rel="nofollow noreferrer">here</a> for a great resource on conditions in msbuild</p>
| 33,577 |
<p>I am a fan of <a href="https://stackoverflow.com/questions/112277/best-intro-to-c-static-metaprogramming">static metaprogramming in C++</a>. I know Java now has generics. Does this mean that static metaprogramming (i.e., compile-time program execution) is possible in Java? If so, can anyone recommend any good res... | <p>No, this is not possible. Generics are not as powerful as templates. For instance, a template argument can be a user-defined type, a primitive type, or a value; but a generic template argument can only be <code>Object</code> or a subtype thereof.</p>
<p>Edit: This is an old answer; since 2011 we have Java 7, which ... | <p>No, generics in Java is purely a way to avoid casting of Object.</p>
| 13,746 |
<p>How can I extend a builtin class in python?
I would like to add a method to the str class.<br />
I've done some searching but all I'm finding is older posts, I'm hoping someone knows of something newer.</p>
| <p>Just subclass the type</p>
<pre><code>>>> class X(str):
... def my_method(self):
... return int(self)
...
>>> s = X("Hi Mom")
>>> s.lower()
'hi mom'
>>> s.my_method()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdi... | <p>Assuming that you can not change builtin classes.
To simulate a "class reopening" like Ruby in Python3 where <code>__dict__</code> is an mappingproxy object and not dict object :</p>
<pre><code>def open(cls):
def update(extension):
for k,v in extension.__dict__.items():
if k != '__dict__':
... | 45,907 |
<p>I'm working on an intranet with several subdomains. I have control over each subdomain, so security of cross-site requests is not a concern. I have PHP scripts with JSON responses I'd like to call from multiple subdomains without duplication. For GET requests, I can do this with AJAX and JSONP, but that doesn't work... | <p>just look at this <a href="https://developer.mozilla.org/En/HTTP_access_control" rel="nofollow noreferrer">https://developer.mozilla.org/En/HTTP_access_control</a> page. All what you need - add header to all you scripts that accept post request.
Example:</p>
| <p>I use REST approach in such cases.
Search google for more information about REST.</p>
| 25,432 |
<p>File uploads through web pages using the standard HTML input always seems clunky to me. If the user tries to upload a large file, it can go on forever and they get no queue that the file is actually being uploaded.</p>
<p>I have tried to do things like provide a gif graphic that is an animated graphic bar, but it... | <p>There are a number of client side controls that one can use.</p>
<p>You can </p>
<ul>
<li>Build your own ActiveX control. Windows/IE only</li>
<li>Use Flash to queue up files and upload them one at a time to the server using the stanard file upload protocol. </li>
<li>Use a signed java applet to upload.</li>
<li>W... | <p>If you running a mod_perl2 apache there is the <a href="http://search.cpan.org/~ceeshek/Apache2-UploadProgress-0.2/lib/Apache2/UploadProgress.pm" rel="nofollow noreferrer">Apache2::UploadProgress</a> module. This adds an id to the http upload request, you then query the server for the progress of that upload. Has bu... | 47,165 |
<p>This one is weird,</p>
<p><a href="http://www.pickledegg.orchardhostings6.co.uk/bug/wp-test.php" rel="nofollow noreferrer">I have a page that consists of a html table in a div called 'rates-viewer'</a>. If you load this page in IE (6 or 7), you will notice that the contents of the table headers is misaligned over t... | <p>File -> Source Control -> Advanced -> Change Source Control and then unbind and/or disconnect all projects and the solution.</p>
<p>This should remove all bindings from the solution and project files. (After this you can switch the SCC provider in Tools -> Options -> Source Control -> Plug-in Selection).</p>
<p>Th... | <p><a href="http://blog.instance-factory.com/?p=565" rel="nofollow">Here you can find another tool</a> (including source code) to remove both SCC footprint from the solution and project files and the .vssscc and .vspscc files. In addition, it removes the output and other configurable directories.</p>
<p>Hth</p>
<p>St... | 46,809 |
<p>I have two tables, <code>movies</code> and <code>categories</code>, and I want to get an ordered list by <strong>categoryID</strong> first and then by <strong>Name</strong>.</p>
<p>The movie table has three columns <strong>ID, Name and CategoryID</strong>.
The category table has two columns <strong>ID and Name</stro... | <p>This should work for you:</p>
<pre><code>var movies = _db.Movies.OrderBy(c => c.Category).ThenBy(n => n.Name)
</code></pre>
| <p>If use generic repository</p>
<pre><code>> lstModule = _ModuleRepository.GetAll().OrderBy(x => new { x.Level,
> x.Rank}).ToList();
</code></pre>
<p>else</p>
<pre><code>> _db.Module.Where(x=> ......).OrderBy(x => new { x.Level, x.Rank}).ToList();
</code></pre>
| 38,251 |
<p>I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008) by downloading and installing the client administration tools and Visual Studio 2008 on my laptop.</p>
<p>The installation footprint for Oracle Client tools was over 200Mb, and quite long winded.</p>
<p>Does anyone know what the... | <p>You need an Oracle Client to connect to an Oracle database. The easiest way is to install the <a href="http://www.oracle.com/technology/software/tech/windows/odpnet/index.html" rel="noreferrer">Oracle Data Access Components</a>.</p>
<p>To minimize the footprint, I suggest the following :</p>
<ul>
<li>Use the Micro... | <p>ODAC xcopy will get you away with about 45MB.
<a href="http://www.oracle.com/technology/software/tech/windows/odpnet/index.html" rel="nofollow noreferrer">http://www.oracle.com/technology/software/tech/windows/odpnet/index.html</a></p>
| 9,604 |
<p>I'm pretty sure the answer to this is no. I know that I can write</p>
<blockquote>
<p>if lcase(strFoo) = lcase(request.querystring("x")) then...</p>
</blockquote>
<p>or use inStr, but I just want to check there isn't some undocumented setting buried in the registry or somewhere that makes the content of VBScript... | <p>There is a <a href="http://msdn.microsoft.com/en-us/library/ya4w6fwy(VS.85).aspx" rel="noreferrer"><code>StrComp</code></a> function which allows performing a case-insensitive comparison of two strings by passing <code>vbTextCompare</code> as the third argument. The main documentation doesn't make that obvious, but ... | <p>I doubt the existence of such an option since if there were something like that and you use it, you'll lose the ability to compare strings in a case sensitive manner.</p>
| 39,326 |
<p>Should I be writing Doc Comments for all of my java methods? </p>
| <p>@Claudiu</p>
<blockquote>
<p>When I write code that others will use - Yes. Every method that somebody else can use (any public method) should have a javadoc at least stating its obvious purpose.</p>
</blockquote>
<p>@Daniel Spiewak</p>
<blockquote>
<p>I thoroughly document every public method in every API class. Cla... | <p>at a previous company, we used to use the jalopy code formatter with eclipse. That would add javadoc to all the methods including private.</p>
<p>It made life difficult to document setters and getters. But what the heck. You have to do it -- you do it. That made me learn some macro functionality with XEmacs :-) You... | 25,917 |
<p>For my project I have to serialize and deserialize a random tree using Java and XStream. My teacher made the Tree/RandomTree algorithms, so I don't have to worry about that. What I don't know how to do is this: I am using FileInputStream to read/write the xml file that I serialized and deserialized, but when I de... | <p>Why not just build a proper app in PHP instead of going through the hassle? Recent PHP is <a href="http://us2.php.net/manual/en/language.types.object.php" rel="nofollow noreferrer">fully object-oriented</a> and lets you do some pretty decent stuff. There are even <a href="https://stackoverflow.com/questions/20709/wh... | <p>It's better that you learned good development practices in PHP than use code-generators. PHP might be a scripting language but it is quite potent, has a nice <a href="http://www.php.net/zend-engine-2.php" rel="nofollow noreferrer">OO</a> model, <a href="http://www.cakephp.org/" rel="nofollow noreferrer">plenty</a> o... | 47,189 |
<p>I am looking for a simple C++ library for tokenizing and parsing RTF (Rich Text Format) files. I am planning to edit them with Qt's QTextEdit.</p>
<p>More the Formatting preserved the better -- but actually I am planning to use Bold and Italics only.</p>
<p>In perl I would use <a href="http://search.cpan.org/%7Esarg... | <p>I helped writing the RTF import export filter in KOffice. You can have a look at the code at <a href="https://cgit.kde.org/koffice.git/tree/filters/kword/rtf" rel="nofollow noreferrer">https://cgit.kde.org/koffice.git/tree/filters/kword/rtf</a>. The code is modular and it depends only on Qt.</p>
| <p>You can ask the <code>#koffice</code> guys on <code>irc.freenode.org</code> over irc. Their program <code>kword</code> is able to open RTF files, and is indeed also written in Qt. I'm sure they would be glad to tell you about how they do it.</p>
| 37,573 |
<p>I'm using .NET Regular Expressions to strip HTML code.</p>
<p>Using something like:</p>
<pre><code><title>(?<Title>[\w\W]+?)</title>[\w\W]+?<div class="article">(?<Text>[\w\W]+?)</div>
</code></pre>
<p>This works for 99% of the time, but sometimes, when parsing...</p>
<pre><co... | <p>Your regex will work just fine when your HTML string actually contains HTML that fits the pattern. But when your HTML does not fit the pattern, e.g. if the last tag is missing, your regex will exhibit what I call "<a href="http://www.regular-expressions.info/catastrophic.html" rel="nofollow noreferrer">catastrophi... | <p>You're asking your regex to do a lot there. After every character, it has to look ahead to see if the next bit of text can be matched with the next part of the pattern.</p>
<p>Regex is a pattern matching tool. Whilst you can use it for simple parsing, you'd be better off using a specific parser (such as the HTML Ag... | 41,944 |
<p>I have a solution with other 70 projects into it. My question is : How can I know where the project is used? I do not want to open all those 70 projects to verify the References one by one. How can I see which project use one project in particular?</p>
<p><strong>Edit</strong>
I do not want to do 1 by 1 search in X... | <p>There's a pretty cool codeplex project that creates dependecy visualizations that I've used before. Although, with 70 projects, you probably won't be able to read it very well unless you only have a few dependencies per project.</p>
<p>Anyway, it's still worth checking out-- you could probably even repurpose some ... | <p>The project files are in XML, so writing something to parse them should be no big deal. If you just want to find which projects reference particular other projects, "grep" would probably work well enough.</p>
| 19,371 |
<p>Anyone have any thoughts on how/if it is possible to integrate Google Code commits to cause a Google AppEngine deployment of the most recent code?</p>
<p>I have a simple Google AppEngine project's source hosted on Google Code and would love if everytime I committed to Subversion, that AppEngine would reflect the la... | <p>Google Code Project Hosting now supports <a href="http://code.google.com/p/support/wiki/PostCommitWebHooks" rel="nofollow noreferrer">Post-Commit Web Hooks</a>, which ping a project-owner-specified URL after every commit. This would eliminate the need to regularly poll your Google Code repository.</p>
| <p>Very interesting, but not yet possible, AFAIK. I have been looking for that option in Google Code with no success.</p>
<p>The only solution I can figure out is to install something in your machine that checks for changes in your SVN repository.</p>
<p>I'll be happy to hear about other approaches.</p>
| 29,822 |
<p>From what I've seen the tag is ignored when hosting a WCF service in IIS. I understand that when self-hosting this is required but is this harmful or even used when operating under IIS?</p>
<p>ex.</p>
<pre><code><system.serviceModel>
<service blah blah blah>
<host>
<baseAddresses... | <p>As you have guessed, the baseAddresses element is completely ignored when hosting in IIS. The service's base address is determined by the web site & virtual directory into which your wcf service is placed.</p>
<p>Even when self-hosting, baseAddresses is not required. It is merely a convenience that avoids you ... | <p>base address required for selfhosting. IIS/WAS hosts ignores the base address.</p>
| 8,013 |
<p>I teach a sort of "lite" C++ programming course to novices ("lite" meaning no pointers, no classes, just plain old C, plus references and STL string and vectors). Students have no previous experience in programming, so I believe that using an interactive debugger would help them understand program flow, variables, a... | <p><a href="http://www.gnu.org/software/ddd/" rel="noreferrer">ddd</a> is a graphical front-end to gdb that is pretty nice. One of the down sides is a classic X interface, but I seem to recall it being pretty intuitive.</p>
| <p>You may want to check out Eclipse CDT. It provides a C/C++ IDE that runs on multiple platforms (e.g. Windows, Linux, Mac OS X, etc.). Debugging with Eclipse CDT is comparable to using other tools such as Visual Studio.</p>
<p>You can check out the <a href="http://download.eclipse.org/tools/cdt/docs/tutorials/debu... | 10,494 |
<p>Under what circumstances will the Win32 API function OleGetClipboard() fail and return <code>CLIPBRD_E_CANT_OPEN</code>?</p>
<p>More background: I am assisting with a Firefox bug fix. Details here:</p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=444800#c19" rel="nofollow noreferrer" title="cannot re... | <p>The documentation says that <code>OleGetClipboard</code> can fail with this error code if <code>OpenClipboard</code> fails. In turn, if you read that documentation, it says:</p>
<p>"<strong>OpenClipboard</strong> fails if another window has the clipboard open."</p>
<p>It's an exclusive resource: only one window ca... | <p>Is your test running over Terminal Services? See <a href="https://stackoverflow.com/questions/68666/clipbrdecantopen-error-when-setting-the-clipboard-from-net">CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET</a>.</p>
| 16,894 |
<p>How to enable and perform a "full text" search on a table in SQL Server 2005? <br /></p>
<p>I did not quite understand the solution in: <a href="https://stackoverflow.com/questions/206142/how-do-i-use-full-text-search-accross-multiple-tables-mssql-2005">How do I use full text search across multiple tables, SQL Serv... | <p><a href="https://stackoverflow.com/questions/202440/how-hard-is-it-to-incorporate-full-text-search-with-sql-server#202474">How hard is it to incorporate full text search with SQL Server?</a></p>
| <p>You can also have a look at <a href="http://msdn.microsoft.com/en-us/library/ms142583.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms142583.aspx</a></p>
| 48,763 |
<p>If you are using php5 and mysql5, is there a substantial advantage to using stored procs over prepared statements? ( i read somewhere you may not get substantial performance gains from mysql5 stored proc)</p>
| <p>They are not really the same thing - with stored procedures, your database logic resides inside the database. Prepared statements basically avoid re-parsing queries if they are called multiple times - the performance benefit can vary greatly.</p>
<p>The choice to use one or the other is really dependent on your spe... | <p>Not familiar with php, but in general stored procedures are already "compiled" so may produce marginally faster performance over an sql statement.</p>
<p>Though my preference usually to stick with SQL from code management/deployment and unit testing perspective. </p>
| 23,888 |
<p>I've followed the ADAM Step by Step Guide from Microsoft and setup an ADAM instance on my local machine. I'm attempting to authenticate using the "Mary Baker" account, but every time I get a COM exception on the <code>if (entry.Guid != null)</code> line below. The exception states that there's an unknown user name... | <p>ADAM stores the unique identifier for a user in the <code>displayName</code> attribute of the <code>user</code> class. They need to be unique in the ADAM instance for the user to authenticate. If two users both had their <code>displayName</code> attribute set to 'jsmith' then neither user could authenticate in ADA... | <p>I haven't used ADAM or System.DirectoryServices, but I do have experience with LDAP and AD; hopefully the following is applicable.</p>
<p>I've never seen a user ID given in that format before. (It looks like some sort of relative DN, as indicated by the trailing comma?) Have you tried specifying the user ID as a ... | 39,010 |
<p>I need to change color of TextBox whenever its required field validator is fired on Clicking the Submit button</p>
| <p>What you can do is register a Javascript function that will iterate through the global Page_Validators array after submission and you can set the background appropriately. The nice thing about this is that you can use it on all of your controls on the page. The function looks like this:</p>
<pre><code>function fnOn... | <p>Here's some self-contained HTML/JS that does the trick:</p>
<pre><code><html>
<head>
<script type="text/javascript">
function mkclr(cntl,clr) {
document.getElementById(cntl).style.backgroundColor = clr;
};
</script>
</head>
<body>
<form>... | 23,923 |
<p>Please, provide code examples in a language of your choice.</p>
<p><strong>Update</strong>:
No constraints set on external storage.</p>
<p>Example: Integers are received/sent via network. There is a sufficient space on local disk for intermediate results.</p>
| <p><a href="http://neopythonic.blogspot.com/2008/10/sorting-million-32-bit-integers-in-2mb.html" rel="noreferrer">Sorting a million 32-bit integers in 2MB of RAM using Python by Guido van Rossum</a></p>
| <p>As people above mention type int of 32bit 4 MB.</p>
<p>To fit as much "Number" as possible into as little of space as possible using the types int, short and char in C++. You could be slick(but have odd dirty code) by doing several types of casting to stuff things everywhere.</p>
<p>Here it is off the edge of my s... | 16,242 |
<p>I have configured Tomcat to use LDAP / AD.</p>
<p>How can I get more details about the logged in user; the userid is returned by <code>request.getRemoteUser()</code> but not the full name that I need.</p>
<p>How do I get the actual "<code>displayName</code>" (full name) from AD ?</p>
<p>I am using ldap/activedi... | <p>I suppose the configuration of tomcat with LDAP/AD is about logins (e.g. the Realm). Therefor Natalia is correct: You'll have to query your LDAP-Server for more info. The comment field is too short for this comment, so I've opted for another answer, stating the same.</p>
<p>The reason for this is, that the Realm in... | <p>You will need to directly query your LDAP directory to get further information on the user.</p>
| 46,854 |
<p>I have an array of hashes, and I want the unique values out of it. Calling <code>Array.uniq</code> doesn't give me what I expect.</p>
<pre><code>a = [{:a => 1},{:a => 2}, {:a => 1}]
a.uniq # => [{:a => 1}, {:a => 2}, {:a => 1}]
</code></pre>
<p>Where I expected:</p>
<pre><code>[{:a => 1},... | <p>I can get what I want by calling <code>inject</code></p>
<pre><code>a = [{:a => 1},{:a => 2}, {:a => 1}]
a.inject([]) { |result,h| result << h unless result.include?(h); result }
</code></pre>
<p>This will return:</p>
<pre><code>[{:a=>1}, {:a=>2}]
</code></pre>
| <p>The answer you give is similar to the one discussed <a href="http://mikeburnscoder.wordpress.com/2008/01/18/uniquify-an-array-of-hashes-in-ruby/" rel="nofollow noreferrer">here</a>. It overrides the <code>hash</code> and <code>eql?</code> methods on the hashes that are to appear in the array which then makes <code>u... | 21,851 |
<p>Is there a way to take substrings of a string with .bat/.cmd files?</p>
<p>For example given the string "hello.txt" is there a way to strip the .txt?</p>
<p>EDIT: Also is there a more general way to do this, not under the assumption that it is a file name or file path?</p>
| <p>If this is a file passed as a parameter, you can use %~n1, like this:</p>
<pre><code>test.bat
----------
echo %~n1 %~n2
c:\> test.bat myfile.txt my.long.file.bat
myfile my.long.file
</code></pre>
<p>If you know the length of the string you can use the substring operator:</p>
<pre><code>echo %variable:0,4% ... | <p>For an arbitrary string, I don't think so.</p>
<p>For this very example, <code>%~n1</code> will resolve to a name without extension.</p>
| 21,804 |
<p>Are there any automatic, online or off, tools for testing xhtml/css for compliance with screen readers and other visual guidelines of the <a href="http://www.access-board.gov/sec508/guide/1194.22.htm" rel="nofollow noreferrer">Americans with Disabilities Act (ADA)</a>?</p>
| <p>Mike Cohn in his <a href="https://rads.stackoverflow.com/amzn/click/com/0131479415" rel="noreferrer" rel="nofollow noreferrer">Agile Estimating and Planning</a> consider FPs to be great but difficult to get right. He (obviously) recommends to use story points-based estimation instead. I tend to agree with this as wi... | <ol>
<li>No because any particular requirement can have an arbitrary amount of effort based on how precise (or imprecise) the author of the requirement is, and the level of experience of the function point assessor.</li>
<li>No because administration of imprecise derivations of abstract functionality yield no reliable ... | 14,363 |
<p>We've talked about <b>personal</b> password management <a href="https://stackoverflow.com/questions/11362/what-is-your-favorite-password-storage-tool">here</a> but how do you guys manage your passwords at a company wide level?</p>
| <p>We have managed to plan our company applications so they are mainly web based and open source or in-house developed. This then allowed us to use LDAP to hook into active directory for logging into our intranet. From there we modified the logins into various products we use (MediaWiki, Wordpress, SugarCRM etc.) so th... | <p>We had a look at a product that had these features:</p>
<ul>
<li>Can give access privleges to password using roles.</li>
<li>Handles delegation.</li>
<li>Logs access to passwords.</li>
<li>Can Randomize passwords.</li>
<li>Can automatically re-randomize a password X days after access to it.</li>
</ul>
<p>Unfortuna... | 22,406 |
<p>When doing <a href="http://en.wikipedia.org/wiki/Test_driven_development" rel="nofollow noreferrer">TDD</a>, how to tell "that's enough tests for this class / feature"?</p>
<p>I.e. when could you tell that you completed testing all edge cases?</p>
| <p>With Test Driven Development, you’ll write a test before you write the code it tests. Once you’re written the code and the test passes, then it’s time to write another test. If you follow TDD correctly, you’ve written enough tests once you’re code does all that is required.</p>
<p>As for edge cases, let's take an... | <p>You could always use a test coverage tool like EMMA (<a href="http://emma.sourceforge.net/" rel="nofollow noreferrer">http://emma.sourceforge.net/</a>) or its Eclipse plugin EclEmma (<a href="http://www.eclemma.org/" rel="nofollow noreferrer">http://www.eclemma.org/</a>) or the like. Some developers believe that 10... | 16,441 |
<p>I would like to do full-text searching of data in my Ruby on Rails application. What options exist?</p>
| <p>There are several options available and each have different strengths and weaknesses. If you would like to add full-text searching, it would be prudent to investigate each a little bit and try them out to see how well it works for you in your environment.</p>
<p>MySQL has built-in support for full-text searching. ... | <p>I've been compiling a <a href="https://stackoverflow.com/questions/73527/whats-the-best-option-for-searching-in-ruby-on-rails">list of the various Ruby on Rails search options in this other question</a>. I'm not sure how, or if to combine our questions.</p>
| 6,990 |
<p>I'm trying to use the Grid from WPFToolkit, but I'm getting the error:</p>
<pre><code>DisplayDataMapping.xaml (9,89):
errorMC1000: Unknown build error,
'Could not load type 'System.Windows.Controls.Primitives.MultiSelector' from assembly
'PresentationFramework, Version=3.0.0.0, Culture=neutral, Public... | <p>The WPF Toolkit is dependent on .NET Framework 3.5 SP1 (just in case you don't know already).</p>
| <p>Try to install VS08 SP1</p>
| 29,859 |
<p>All the member variables and member functions in my class ClassA are static. </p>
<p>If a user is trying (by mistake) to create an object of this class, he receives a warning: "ClassA, local variable never referenced", because all the functions are static, so this object is never referenced. So, I want to prevent t... | <p>Creating a private default constructor should be sufficient. Both of the other default constructs (copy constructor and assignment) rely on having an instance to work correctly. If there is no default constructor then there is no way to create an instance, hence no way to actually get to the copy construction part... | <p>The best way to prevent creation of non-heap objects is to make destructor private. Then there is no way compiler can destruct the object when it goes out of scope and it will complain.
This will not prevent anyone from doing new however.</p>
| 46,048 |
<p>How do you shade alternating rows in a SQL Server Reporting Services report?</p>
<hr>
<p><strong>Edit:</strong> There are a bunch of good answers listed below--from <a href="https://stackoverflow.com/questions/44376/add-alternating-row-color-to-sql-server-reporting-services-report#44378">quick</a> and <a href="htt... | <p>Go to the table row's BackgroundColor property and choose "Expression..."</p>
<p>Use this expression: </p>
<pre><code>= IIf(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")
</code></pre>
<p>This trick can be applied to many areas of the report.</p>
<p>And in .NET 3.5+ You could use:</p>
<pre><code>= If(Ro... | <p>Just because none of the answers above seemed to work in my matrix, I'm posting this here:</p>
<p><a href="http://reportingservicestnt.blogspot.com/2011/09/alternate-colors-in-matrixpivot-table.html" rel="nofollow">http://reportingservicestnt.blogspot.com/2011/09/alternate-colors-in-matrixpivot-table.html</a></p>
| 6,613 |
<p>Can I set timeouts for JSP pages in tomcat either on a per page or server level?</p>
| <p>For server level, you can try this.<br>
you have to change <code>catalina.bat</code> / <code>catalina.sh</code> file<br></p>
<pre><code>jvm OPTIONS : -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000
</code></pre>
| <p>For server level, you can try this.<br>
you have to change <code>catalina.bat</code> / <code>catalina.sh</code> file<br></p>
<pre><code>jvm OPTIONS : -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000
</code></pre>
| 24,798 |
<p>I am currently trying to print a gear with the possibility to connect it to the shaft of a DC motor. The following picture best describes what the shaft of the motor looks like by showing the hole printed in the gear:</p>
<p><a href="https://i.stack.imgur.com/UNHn5.png" rel="nofollow noreferrer"><img src="https://i.... | <blockquote>
<p>Design a different connection to the shaft, however I don't know of any</p>
</blockquote>
<p>Use a shaft/flange coupler to be fastened to your shaft and to your printed part.</p>
<hr />
<p>Without knowing the length of the shaft, you could connect a flange/coupler to design this into your gear. This is ... | <p>A good option would be to use a (set-)screw to press against the flat of the motor shaft, similar to how pulleys are mounted on stepper motors.</p>
| 1,733 |
<p>I accidentally moved a very important and large folder from the root project into a sub-folder. Now when I try to move the folder back, it gives me an error message "Cannot create a file when that file already exists." How do I move things back?</p>
<p>Additional Information: I am also under SVN and now it wants ... | <p>Are you using any source control plugins like AnkhSVN.</p>
<p>By the sound of it, you've moved the folder which has created it at the new location, and updated the solution file as such, but for some reason, left a copy of the original folder at the original location on the filesystem.</p>
<p>If thats the case you... | <p>But does the folder, or a file with the same name, exist on the root folder? </p>
<p>If so, I would try to delete it first. Make sure you have the button "Show All Files", on 'Solution Explorer' pressed, in order to visualize all of your tree on VS2008.</p>
| 32,134 |
<p>Has anyone got any suggestions for unit testing a Managed Application Add-In for Office? I'm using NUnit but I had the same issues with MSTest.</p>
<p>The problem is that there is a .NET assembly loaded inside the Office application (in my case, Word) and I need a reference to that instance of the .NET assembly. ... | <p>This is how I resolved it.</p>
<ol>
<li><p>Just about everything in my add-in runs from the Click method of a button in the UI. I have changed all those Click methods to consist only of a simple, parameterless call.</p></li>
<li><p>I then created a new file (Partial Class) called EntryPoint that had lots of very s... | <p>Consider the various mocking frameworks <a href="http://www.nmock.org/" rel="nofollow noreferrer">NMock</a>, <a href="http://ayende.com/projects/rhino-mocks.aspx" rel="nofollow noreferrer">RhinoMocks</a>, etc. to fake the behavior of Office in your tests. </p>
| 15,392 |
<p>How do I link an external .jar into my Xcode java project? That is, have it in the classpath during compilation and execution. I'm using Xcode 3.0 and this seems to have changed since 2.4.</p>
| <p>In Xcode 3.1.2 <br>
Checking in file <b>build.xml</b> we see: <br></p>
<p><code><!-- lib directory should contain any pre-built jar files needed to build the project
AppleJavaExtensions.jar is included to allow the built jars to run cross-platform if you depend on Apple eAWT or eIO classes.
See... | <p>I don't have a Mac to hand, but what if you drop the jar file into your ~/Library/Java/extensions (IIRC) folder?</p>
<p>Edit: I presume that you are using Mac OS X specific Java libraries, hence your use of Xcode? Otherwise I would recommend Eclipse. Actually I'd be willing to bet that Eclipse can use the Mac OS X ... | 19,524 |
<p>What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:</p>
<pre><code>git log $(git merge-base HEAD branch)..branch
</code></pre>
<p>The documentation for <a href="http://git-scm.com/docs/git-diff" rel="noreferrer">git-diff</a> indica... | <p>In the context of a revision list, <code>A...B</code> is how <code>git-rev-parse</code> defines it. git-log takes a revision list. <code>git-diff</code> does not take a list of revisions - it takes one or two revisions, and has defined the <code>A...B</code> syntax to mean how it's defined in the <code>git-diff</cod... | <p>With Git 2.30 (Q1 2021), "git diff A...B(man)" learned "git diff --merge-base A B(man), which is a longer short-hand to say the same thing.</p>
<p>Thus you can do this using <code>git diff --merge-base <branch> HEAD</code>. This should be equivalent to <code>git diff <branch>...HEAD</code>... | 7,708 |
<p>In the unmanaged development world, you could observe the DWORD return value of a method by typing '@eax' into the watch window of the debugger.</p>
<p>Does anyone know of an equivalent shortcut in managed code?</p>
<p>Related point: I have learned that VS2008 SP1 supports <b>$exception</b> as a magic word in the ... | <p>The watch window tricks like @eax are called [Psuedovariables]. They are actually <a href="http://msdn.microsoft.com/en-us/library/ms164891(VS.80).aspx" rel="nofollow noreferrer">documented.</a> I wrote a <a href="http://blogs.msdn.com/stevejs/archive/2005/10/18/482300.aspx#comments" rel="nofollow noreferrer">blog ... | <p>@EAX in managed code is a little tricky to implement since CIL has higher-order primitives for function returns (which happen semantically on the virtual execution stack).</p>
<p>That said, if your function is returning a value type and that type's size is less than or equal to 32-bits, then the @EAX will most like... | 49,096 |
<p>I want to read an specific xml node and its value for example</p>
<pre><code><customers>
<name>John</name>
<lastname>fetcher</lastname>
</customer>
</code></pre>
<p>and my code behind should be some thing like this (I don't know how it should be though):</p>
<pre><code>Response.Wr... | <p>The most basic answer:<br>
Assuming "xml" is an XMLDocument, XMLNodeList, XMLNode, etc... </p>
<pre><code>Response.Write(xml.SelectSingleNode("//name").innerText)
</code></pre>
| <p>haven't tried testing it but should point you in the right direction anyway</p>
<pre><code> 'Create the XML Document
Dim l_xmld As XmlDocument
'Create the XML Node
Dim l_node As XmlNode
l_xmld = New XmlDocument
'Load the Xml file
l_xmld.LoadXml("XML Filename as String"... | 47,012 |
<p>We have a Java program run as <strong>root</strong> on Unix, that therefore can read for example the content of the folders <code>/home/user1</code> and <code>/home/user2</code>. However, if the Unix user "user1" is logged in in our application, he should not be able to access "/home/user2" data.
We would like to u... | <p><strong>Use SecurityManager!</strong></p>
<ol>
<li>Put current unix user id into ThreadLocal</li>
<li>Create your own SecurityManager that checks unix user permissions on checkRead() and checkWrite()</li>
<li>System.setSecurityManager(new MySecurityManager())</li>
<li>Enjoy</li>
</ol>
<p><strong>Update</strong></p... | <p>if you only want the app to be allowed to read files by user1 i strongly suggest the app runs as user1. </p>
| 33,160 |
<p>I'm currently working on putting together a fairly simple ORM tool to serve as a framework for various web projects for a client. Most of the projects are internal and will not require massive amounts of concurrency and all will go against SQL Server. I've suggested that they go with ORM tools like SubSonic, NHibe... | <p>For the love of all that's holy (and the women and the children), do everything possible to convince them not to go with a custom O/RM solution. Why are people wanting to re-invent the wheel when there are perfectly-good, open-source wheels already in existence?!?!</p>
| <p>No-one has mentioned it yet; but go with <a href="http://www.llblgen.com/" rel="nofollow noreferrer">LLBLGen</a>. You may customise the template as you like, and you may also, obviously, write your own custom code in the generated classes. Buy it. You will never look back, and you will be saying "Thank you silky!" w... | 7,316 |
<p>I always forget to write subject in email, so I want make the subject field compulsory.
Can you help me please?</p>
| <pre><code>Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean)
If Item.Subject = "" Then
Item.Subject = InputBox("Please do not always forget the subject!")
End If
If Item.Subject = "" Then
MsgBox "Won't send this without a subject."
Cancel = True
End If
End Sub
</code>... | <pre><code>Do While Item.Subject = ""
Item.Subject = InputBox("..")
Loop
</code></pre>
| 48,891 |
<p>Scenario:</p>
<p>I'm currently writing a layer to abstract 3 similar webservices into one useable class. Each webservice exposes a set of objects that share commonality. I have created a set of intermediary objects which exploit the commonality. However in my layer I need to convert between the web service objects ... | <p>Alternative answer: generics.</p>
<pre><code>public static T[] CreateProperties<T>(IProperty[] properties)
where T : class, new()
{
//Empty so return null
if (properties==null || properties.Length == 0)
return null;
//Check the type is allowed
CheckPropertyTypes("CreateProperties(... | <p>That's correct, but that doesn't mean that you can cast containers of type Object to containers of other types. An Object[] is not the same thing as an Object (though you, strangely, could cast Object[] to Object).</p>
| 26,109 |
<p>I'm sorting out a series of SQL scripts for my company written in Oracle PL/SQL. I came across an essential script with a strangely placed slash near the bottom. It is checked into CVS this way. Is this a pure syntax error or does it have some function I'm not aware of. The slightly obfuscated script:</p>
<pre>... | <p>The slash has <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12004.htm#SQPUG162" rel="noreferrer">a meaning</a>:</p>
<blockquote>
<p>Executes the most recently executed
SQL command or PL/SQL block which is
stored in the SQL buffer. You can
enter a slash (/) at the command
prompt... | <p>It is not an error. It executes the script. </p>
<p>It is useful when you concatenate various scripts together in one file and want each separate task to execute before the next one.</p>
<p>ie Create function
/
Create stored procedure that uses the function </p>
<p>Without the slash the stored procedure may get... | 23,489 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/390900/cant-operator-be-applied-to-generic-types-in-c">Can’t operator == be applied to generic types in C#?</a> </p>
</blockquote>
<p>I've got the following generic class and the compiler complains that "<code>... | <p>Did you try something like this?</p>
<pre><code>public class Example<TValue>
{
private TValue _value;
public TValue Value
{
get { return _value; }
set
{
if (!object.Equals(_value, value))
{
_value = value;
OnPropertyC... | <p>I think the <code>!=</code> operator cannot be applied here because there are cases where it can't be used. For instance, <code>!=</code> can't be used for comparing structs, unless the compare operators (<code>==</code> <code>!=</code>) are overloaded.</p>
<p>Of course, you can compare language structs, like <code... | 43,702 |
<p>Can I use LoadLibrary method for to import a data of type struct??
excuse me for my English.
thanks.</p>
| <p>Let me assume some things that are left out in the question:</p>
<ol>
<li>You have a dynamic library called <strong>flubber.dll</strong></li>
<li>The library exports the function <code>bool GetFlubber(Flubber* flubber)</code>.</li>
<li>The function and the type <code>Flubber</code> (which just happens to be a <code... | <p>As other responses have suggested it's hard to tell what's being asked here, but I'll throw in a response for another interpretation of the question. I'm not sure if it's "officially supported", but you can have a DLL export a global variable and then dynamically access it via GetProcAddress.</p>
<p>For instance, ... | 43,673 |
<p>I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't:</p>
<pre><code>DocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance();
docfactory.setIgnoringElementContentWhitespace(true);
</code></pre>
<p>I see in Javadoc... | <p>‘IgnoringElementContentWhitespace’ is not about removing <em>all</em> pure-whitespace text nodes, only whitespace nodes whose parents are described in the schema as having ELEMENT content — that is to say, they only contain other elements and never text.</p>
<p>If you don't have a schema (DTD or XSD) in use, elemen... | <p>Try this:</p>
<pre><code>private static Document prepareXML(String param) throws ParserConfigurationException, SAXException, IOException {
param = param.replaceAll(">\\s+<", "><").trim();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringE... | 28,383 |
<p>I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed.</p>
<p>Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup.</p>
<p>Is there a third (or fourth etc) opt... | <p>You will almost certainly want to use a database for flexible, record based access and to take advantage of the database's ability to handle concurrent data access. If you need to track information that may need to be undone, having it in a structured format is a benefit, as is having the ability to update a row ind... | <p>I'd use a database simply for maintainability - also multiple edits on a file may cause some getting missed out.</p>
| 5,653 |
<p>I'm looking for a 3D printer for applications in the dental field, for printing digital dental models (not for itra-oral use parts).</p>
<p>Resolution and finish are the main requirements that we consider necessary.</p>
<p>Any suggestion?</p>
| <p>If resolution is your upmost concern then resin 3d printers are the way to go. They use a liquid resin that does not harden until a UV laser is shined through them. Apparently they get ultra high resolution and smooth finishes right out of the box. The downside is they are generally more expensive machines and the r... | <p>As mentionned by Andrew, resins should do the trick : most commons processes are SLA and DLP (DLP is faster but more expensive).</p>
<ul>
<li>If you aren't looking for precisions (or looking for low budget), FDM
machines should do the trick. </li>
<li>If you need metal, I think Solidscape or micro SLM should both w... | 372 |
<p>Okay, I've seen but haven't programmed in C# before. You can assume I'm competent in C++, and advanced in C (for what good that'll do me). I understand inheritance, polymorphism, etc so OO concepts aren't going to be a huge problem.</p>
<p>Let's say I've been given a task to prototype a quick and dirty program th... | <p>It sounds like for this app, you could use <a href="http://www.asp.net/dynamicdata/" rel="nofollow noreferrer">Microsoft Dynamic Data</a> or <a href="http://www.castleproject.org/activerecord/index.html" rel="nofollow noreferrer">Castle Active Record</a>, and have the application working a few minutes after you fini... | <p>If you already have MS Access installed, then yes the mdb is probably your quickest way to get started.</p>
<p>Also you will want to just started with a quick ADO.NET tutorial. There are hundreds of these (well almost hundreds, I haven't counted).</p>
| 10,178 |
<p>The most common way of changing a cursor in Flash apps seems to be based on simply <strong>hiding the native OS cursor</strong> and <strong>displaying a graphic</strong> (drawn by the Flash Player) inside the Flash rectangle where the (hidden) cursor would be. This is what <a href="http://livedocs.adobe.com/flex/3/l... | <p>Native cursors are available in Flash Player 10.2 beta. So you should give it a try! See: <a href="http://www.bytearray.org/?p=2373" rel="nofollow">http://www.bytearray.org/?p=2373</a></p>
| <p>I understand your complaints, I too have been frustrated with how laggy the display-update can be. Thinking about the solution to use CSS to set a cursor-style in the browser though is an interesting approach... It smells, but off the top you may be able to implement control over the CSS cursor attribute from Action... | 37,423 |
<p>On a web page I want to dynamically render very basic flow diagrams, i.e. a few boxes joined by lines. Ideally the user could then click on one of these boxes (<code>DIVs</code>?) and be taken to a different page. Resorting to Flash seems like an overkill. Is anyone aware of any client-side (i.e. <code>server agnost... | <p>Does the rendering have to be client side?</p>
<p>If yes, you could try Processing:</p>
<p><a href="http://ejohn.org/blog/processingjs/" rel="nofollow noreferrer">http://ejohn.org/blog/processingjs/</a></p>
<p>If you can do it server side, then Graphviz is a good choice.</p>
<p><a href="http://www.graphviz.org/"... | <p>This kind of flowchart can be accomplished using CSS, resorting to JavaScript graphing libraries (canvas) might be overkill. You may wish to checkout how some Genealogy sites do this to get a family tree.</p>
| 4,729 |
<p>Short version: I want to trigger the Form_Load() event without making the form visible. This doesn't work because Show() ignores the current value of the Visible property:</p>
<pre><code>tasksForm.Visible = false;
tasksForm.Show();
</code></pre>
<p>Long version: I have a WinForms application with two forms: main a... | <p>I totally agree with Rich B, you need to look at where you are placing your application logic rather than trying to cludge the WinForms mechanisms. All of those operations and data that your Tasks form is exposing should really be in a separate class say some kind of Application Controller or something held by your ... | <p>If you make the method public, then you could access it directly.... however, there could be some unexpected side effects when you call it. But making it public and calling it directly will not draw the screen or open the form.</p>
| 9,249 |
<p>I write a lot of dynamically generated content (developing under PHP) and I use jQuery to add extra flexibility and functionality to my projects.</p>
<p>Thing is that it's rather hard to add JavaScript in an unobtrusive manner. Here's an example:</p>
<p>You have to generate a random number of <code>div</code> elem... | <p>You need to add something to the divs that defines what type of behaviour they have, then use jQuery to select those divs and add the behaviour. One option is to use the class attribute, although arguably this should be used for presentation rather than behaviour. An alternative would be the rel attribute, but I usu... | <p>It's a bit hard to tell from your question, but perhaps you can use different jQuery selectors to set up different click behaviours? For example, say you have the following:</p>
<pre><code><div class="section-1">
<div></div>
</div>
<div class="section-2">
<div></div>... | 15,373 |
<p>Given a function:</p>
<pre><code>function x(arg) { return 30; }
</code></pre>
<p>You can call it two ways:</p>
<pre><code>result = x(4);
result = new x(4);
</code></pre>
<p>The first returns 30, the second returns an object.</p>
<p>How can you detect which way the function was called <strong>inside the function... | <p><strong>NOTE: This is now possible in ES2015 and later. See <a href="https://stackoverflow.com/a/31060154/96100">Daniel Weiner's answer</a>.</strong></p>
<p>I don't think what you want is possible [prior to ES2015]. There simply isn't enough information available within the function to make a reliable inference.</p... | <p>Use <code>this instanceof arguments.callee</code> (optionally replacing <code>arguments.callee</code> with the function it's in, which improves performance) to check if something is called as a constructor. <strong>Do not</strong> use <code>this.constructor</code> as that can be easily changed.</p>
| 48,002 |
<p>From C#, I want to do the equivalent of the following:</p>
<pre><code>arp -a |findstr 192.168.1.254
</code></pre>
<p>Alternatively, the answer could call the <a href="http://msdn.microsoft.com/en-us/library/aa366358.aspx" rel="noreferrer">SendARP</a> function and get the results.</p>
<p>This will allow my applica... | <p>SendARP P/Invoke goes like this:</p>
<pre><code>[DllImport("iphlpapi.dll", ExactSpelling=true)]
public static extern int SendARP( int destIp, int srcIP, byte[] macAddr, ref uint physicalAddrLen );
</code></pre>
<p><a href="http://www.pinvoke.net/default.aspx/iphlpapi/SendARP.html" rel="noreferrer">PInvoke.NET</a> ... | <p>Hook into the WMI subsystem. Some VBScript code to get going in the right direction is <a href="http://www.microsoft.com/technet/scriptcenter/resources/qanda/jun05/hey0614.mspx" rel="nofollow noreferrer">here</a></p>
| 22,771 |
<p>I am searching for a host for a new commercial website. Among other things, I'd like to know what the various OS - Webserver combinations have in terms of vulnerabilities. What are the vulnerabilities of Windows 2003 + Apache?</p>
| <p>You could look here: <a href="http://httpd.apache.org/security/vulnerabilities_20.html" rel="nofollow noreferrer">http://httpd.apache.org/security/vulnerabilities_20.html</a></p>
<p>As for the windows side, it's windows. There are going to be vulnerabilities. Just stay up to date with service packs and patches, and... | <p>As suggested <a href="https://stackoverflow.com/questions/87393/what-are-the-major-vulnerabilities-of-windows-2003-iis">here</a>, I could check out the <a href="http://www.kb.cert.org/vuls/" rel="nofollow noreferrer">CERT Database</a>.</p>
| 11,291 |
<p>I've got a stock Debian Etch system, using Exim4. The domains are mostly local but there are some that are remote. To handle the delivery of remote mail I use the Debian configuration file:</p>
<pre><code> /etc/exim4/hubbed_hosts
</code></pre>
<p>This file lists the domain names, and remote MX machines to delive... | <p>I was hoping for something a little more dynamic - and this solution works:</p>
<pre><code> port = ${if exists{/etc/exim4/ports.list}\
{${lookup{$domain}lsearch{/etc/exim4/ports.list}\
{$value}{25}}}{25}}
</code></pre>
<p>Then a simple file may have a list of ports on a per-domain basis... | <p>make a new transport that specifies the port</p>
<pre><code>remote_hub_2525:
driver = smtp
port = 2525
</code></pre>
<p>and then create a router for the domains needing non-standard delivery</p>
<pre><code>non_standard_hub:
driver = manualroute
domains = example.org : example.com
transport = remote_hub_2525
no_mo... | 18,701 |
<p>I have a .NET Web app which consumes a Java-based Web service. One of the objects, named Optional, contains search criteria fields. The schema is the following:</p>
<pre><code><xsd:complexType name="Optional">
<xsd:sequence>
<xsd:element name="FromAmount" nillable="true" type="xsd:float" minOccurs... | <p>in .NET WS for non-nullable types (in .NET) that are marked optional in the schema have an additional specified property generated for them that control if the element appears. Very annoyingly, the setter for the value does not set the additional specified flag, so you need do this.</p>
<pre><code>x.ToAmmount = 24.... | <p>This schema does not define any xml document type. It just provides a declaration for a compex type named "Optional", but there is no reference to this type from anywhere.</p>
<p>The xml document being defined must have at least a top element. this top element needs to be defined somewhere (at a global scope). Ther... | 38,272 |
<p>I have an MFC application compiled with /clr and I'm trying to implement a final handler for otherwise un-caught managed exceptions. For native exceptions, overriding <code>CWinApp::ProcessWndProcException</code> works.</p>
<p>The two events suggested in Jeff's <a href="http://www.codeproject.com/KB/exception/Excep... | <p>Taking a look around the internets, you'll find that you need to install a filter to get the unmanaged exceptions passing the filters on their way to your AppDomain. From <a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2007/12/30/clr-and-unhandled-exception-filters.aspx" rel="nofollow noreferrer">CLR and U... | <p>Using those two exception handlers should work. Are you sure you've added them in a place where they're going to be called and properly set (ie, in your application's <em>managed</em> entry point -- you did put one in, right?)</p>
| 3,019 |
<p>I frequently find myself writing code like this:</p>
<pre><code>List<int> list = new List<int> { 1, 3, 5 };
foreach (int i in list) {
Console.Write("{0}\t", i.ToString()); }
Console.WriteLine();
</code></pre>
<p>Better would be something like this:</p>
<pre><code>List<int> list = new List<... | <p>Do this:</p>
<pre><code>list.ForEach(i => Console.Write("{0}\t", i));
</code></pre>
<hr>
<p>EDIT: To others that have responded - he wants them all on the same line, with tabs between them. :)</p>
| <pre><code>public static void WriteLine(this List<int> theList)
{
foreach (int i in list)
{
Console.Write("{0}\t", t.ToString());
}
Console.WriteLine();
}
</code></pre>
<p>Then, later...</p>
<pre><code>list.WriteLine();
</code></pre>
| 7,626 |
<p>What happens when I do the following?</p>
<pre><code>(define ((func x) y)
(if (zero? y)
((func x) 1)
12))
</code></pre>
<p>I understand that I can do this:</p>
<pre><code>(define curried (func 5))
</code></pre>
<p>And now I can use curried. What I'm curious about is in the definition of the f... | <p>In the Scheme standard it is specified that</p>
<pre><code>(define (f x) 42) is short for (define f (lambda (x) 42)) .
</code></pre>
<p>The natural (non-standard) generalization implies:</p>
<pre><code>(define ((f x) y) (list x y)) is short for (define (f x) (lambda (y) (list x y)))
which is short... | <p>soegaard's answer is correct - this is the traditional expansion. However, drscheme is smart!</p>
<p>The following code I've found to be equivalent in running time:</p>
<p>Original source:</p>
<pre><code>(define ((substitute lv value) e)
(cond [(LogicVar? e)
(type-case LogicVar e
[lv-any (id) (if (s... | 46,592 |
<p>I am printing a small cylinder, but when the object is finished, it's smaller than the measures I used when create the model.</p>
<p>I used thincerkad to make a simple model, the measures are:</p>
<ul>
<li>width: 90 mm</li>
<li>height: 2 mm</li>
</ul>
<p>After the print was done, the actual dimensions were:</p>
... | <p>Let's do the math, you printed something of size 9 cm and got a size of 7 cm. This implies that the scale equals <span class="math-container">$\frac{7}{9}=0.778$</span>. In order to print it at the correct size, you should have printed the object at scale <span class="math-container">$\frac{1}{0.778}=1.286... | <p>Are you using the stock firmware of your printer? Sounds like to me that you have 16 tooth pulleys and your firmware is set to 20 tooth i.e. 80 steps per mm</p>
<p>The calculation behind the steps per mm is <span class="math-container">$\frac{\text{Steps per Revolution} \times Microsteps}{Teeth \times Pitch}$</span... | 1,364 |
<p>In my engine I have a need to be able to detect DXT1 textures that have texels with 0 alpha (e.g. a cutout for a window frame). This is easy for textures I compress myself, but I'm not sure about textures that are already compressed.</p>
<p>Is there an easy way to tell from the header whether a DDS image contains a... | <p>As far as I know, there's no way to tell from the header. There's a DDPF_ALPHAPIXELS flag, but I don't think that will get set based on what's in the pixel data. You'd need to parse the DXT1 blocks, and look for colours that have 0 alpha in them (making sure to check that the colour is actually used in the block, to... | <p>I agree with the accepted answer. Your job may be made a bit easier by using the "squish" library to decompress the blocks for you.</p>
<p><a href="http://www.sjbrown.co.uk/?code=squish" rel="nofollow noreferrer">http://www.sjbrown.co.uk/?code=squish</a></p>
| 3,991 |
<p>Currently when I build my site I have to manually open validate it at the 3wbc site (means when opera pops up, press ctr+alt+shft+u) for every page.
Is it possible to automatically validate every page whenever I build my pages?</p>
<p>P.s.: This page doesn't validate ;)</p>
| <p>You can download and install your own copy of the validator - <a href="http://validator.w3.org/source/" rel="nofollow noreferrer">http://validator.w3.org/source/</a> - and invoke it locally instead of trekking out to w3.org for each page. Still, this requires piggybacking over a web server through plain HTTP or the ... | <p>If you've got the HTML files in source control like SVN or Git, you can use a pre-commit hook script to run client-side validators on them. Or if you're feeling adventurous, you could use that method to ping another script on the server that validates the live pages...</p>
| 27,229 |
<p>I need to search all cpp/h files in svn working copy for "foo", excluding svn's special folders completely. What is the <strong>exact</strong> command for GNU grep?</p>
| <p>I use <a href="http://petdance.com/ack/" rel="nofollow noreferrer">ack</a> for this purpose, it's like grep but automatically knows how to exclude source control directories (among other useful things).</p>
| <p>This is a RTFM. I typed 'man grep' and '/exclude' and got:</p>
<p>--exclude=GLOB
Skip files whose base name matches GLOB (using wildcard
matching). A file-name glob can use *, ?, and [...] as
wildcards, and \ to quote a wildcard or backslash character
... | 25,519 |
<p>I am creating an application for a Windows Mobile computer. The catch is that the device (<a href="http://www.motorola.com/business/v/index.jsp?vgnextoid=d4397b103d175110VgnVCM1000008406b00aRCRD" rel="nofollow noreferrer">Motorola MC17</a>) does not have a touch screen or universal keys - there are only six programm... | <p>Last time I checked, you could use the <a href="http://developers.sugarcrm.com/tutorials/Customizing_Sugar/4/" rel="nofollow noreferrer">module builder</a> to extend the interface. From 5.0 (or maybe 4.x) on, Sugar added all those APIs, which should enable you to extend SugarCRM without hacking it in and losing it w... | <p>Basically, the Account name should be a related field in your new invoices module (base the module creation on something like QUOTES that has similar fields. Once you create the module (so simple you can almost guess your way through it in the ADMIN section) and the fields you like (using Studio) just add the RELATE... | 5,856 |
<p>I'm about to start a project for a customer who wants CMS-like functionality. They want users to be able to log in, modify a profile, and a basic forum. They also wish to be able to submit things to a front page.</p>
<p>Is there a framework or barebones CMS that I could expand on or tailor to my needs? I don't need... | <p><a href="http://tinycms.sourceforge.net/" rel="nofollow noreferrer">tinyCMS</a> is about as barebones as you can get. (<strong>edit</strong>: fixed link, I had gotten a little click happy and linked to the wrong thing)</p>
<p>@modesty, I would definitely NOT use SharePoint, as it is anything <strong>but</strong> ba... | <p>Might want to check out <a href="http://drupal.org/" rel="nofollow noreferrer">Drupal</a>. </p>
<p>Here are the details of the <a href="http://drupal.org/node/176052" rel="nofollow noreferrer">technology stack</a> that it uses. </p>
<p>I have never used it so I can't vouch for the quality etc but definitely wort... | 2,616 |
<p>I am just starting to learn javascript, so I don't have the skills to figure out what I assume is a trivial problem.</p>
<p>I'm working with a Wordpress blog that serves as a FAQ for our community and I am trying to pull together some tools to make managing the comments easier. <a href="https://stackoverflow.com/u... | <p>In Firefox, you could do something like this:</p>
<pre><code>javascript:alert(
document.getSelection().match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g)
.join("\n"))
</code></pre>
<p>How this works:</p>
<ul>
<li>Gets the selection text from the browser ("document.getSelection()" in FF, in IE it would be "docum... | <p><a href="http://javascript.about.com/library/blip.htm" rel="nofollow noreferrer">Here</a> is a good article on obtaining the IP address of your visitors. You could display this in addition to their comment if you wanted or include it as a label or field in your page so you can reference it later.</p>
| 9,852 |
<p>I'm in the process of building the <a href="http://www.thingiverse.com/thing:1001065" rel="nofollow noreferrer">D-Bot core XY</a> printer, and I was hoping to know if the Z-axis 'zero' is near the hot end or near the bottom of the printer furthest away from the hotend? In this printer the Z-platform moves up and dow... | <p>Generally, Z-axis zero is when the hot end and the build plate are close to each other. Some printers keep the hot end up at the top, and bring the build plate up to reach it. Other printers keep the build plate at the bottom, and lower the hot end down to reach it. As such, "Z axis zero" doesn't specify top or b... | <p>Yes, Z-Zero is typically at the "top" of the printer, closest to the nozzle(s). X and Y zeros are also typically in the lower-left corner of the buildplate.</p>
<p>However, the XY zeros are re-interpreted in slicing software to produce cleaner G-Code as it's sometimes difficult to read G-Code in negative coordinate... | 456 |
<p>I'm having a problem using CSS's <code>display:inline</code> property with the <code>list-style-image:</code> property on <code><li></code> tags. Basically, I want to output the following:</p>
<pre><code>* Link 1 * Link 2
</code></pre>
<p>where <code>*</code> represents an image.</p>
<p>I'm doing this with... | <p>Try using <code>float: left</code> (or <code>right</code>) instead of <code>display: inline</code>. Inline display replaces list-item display, which is what adds the bullet points.</p>
| <p>I would suggest not to use <code>list-style-image</code>, as it behaves quite differently in different browsers, especially the image position</p>
<p>instead, you can use something like this</p>
<pre><code>ol.widgets,
ol.widgets li { list-style: none; }
ol.widgets li { padding-left: 20px; backgroud: transparent ("... | 46,152 |
<p>Recently I noticed my application appears to be eating memory that never gets released. After profiling with CLRProfiler I've found that the Castle Windsor container I'm using is holding onto objects. These objects are declared with the lifestyle="transient" attribute in the config xml.</p>
<p>I've found if I put a... | <p>I think the answers here are missing a vital point - that this behavior is configurable out of the box via release policies - check out the documentation on the castle project site <a href="http://www.castleproject.org/container/documentation/trunk/advanced/releasepolicy.html" rel="nofollow noreferrer">here</a>.</p>... | <p>You can set a lifestyle of singleton or transient though on objects in the container. Singleton objects I understand should last the life of the application, but I don't understand the usefulness of this behvaviour being the same for transient ones!</p>
<p>Custom lifestyles can be created by implementing <code>ILif... | 16,102 |
<p>I know RIM has their own IDE (<a href="http://na.blackberry.com/eng/developers/downloads/jde.jsp" rel="nofollow noreferrer">BlackBerry JDE</a>) for building BlackBerry apps, but does anyone know how to configure <a href="http://www.jetbrains.com/idea/index.html" rel="nofollow noreferrer">IntelliJ IDEA</a> to build/d... | <p>RE: Chris' question about what is different... Blackberry applications can be standard MIDP apps or CLDC apps that make use of the Blackberry specific APIs. Most developers tend to take the latter approach, and then using Blackberry's tools is required - especially if you are using some of their secured APIs and ha... | <p>Not sure if this will help but here are instructions for <a href="http://www.blackberryforums.com/developer-forum/138210-setup-up-eclipse-blackberry-development.html" rel="nofollow noreferrer">setting up Eclipse</a> for blackberry development.</p>
<p>Maybe you can use that information to figure out what changes to ... | 7,594 |
<p>Is there any way to make Visual Studio word-wrap at 80 characters? I'm using VS2008.</p>
<p><a href="https://stackoverflow.com/questions/84209/vertical-line-after-a-certain-amount-characters-in-visual-studio">This post is loosely related.</a></p>
| <p>Tools >> Options >> Text Editor >> All Languages >> General >> Select Word Wrap. </p>
<p>I dont know if you can select a specific number of columns?</p>
| <p>See also <a href="https://stackoverflow.com/a/315531/193017">this answer</a> in order to switch the mode conveniently.</p>
<p>Citation:</p>
<blockquote>
<p>I use this feature often enough that I add a custom button to the command bar.</p>
<p>Click on the Add or Remove -> Customize
<br>Click on the Commands tab
<b... | 29,271 |
<p>We have a situation where a C# application is working with SQL CE 3.5 . To allow for a legacy program to use some of its features we have produced a C++ dll which uses interop to extract the info that it needs from the C# program. For this to work, the C#-program needs to access the database. Its not a very complex ... | <p>add the following files to your application folder:</p>
<ul>
<li>sqlceca35.dll</li>
<li>sqlcecompact35.dll</li>
<li>sqlceer35E.dll</li>
<li>sqlceme35.dll</li>
<li>sqlceoledb35.dll</li>
<li>sqlceqp35.dll</li>
<li>sqlcese35.dll</li>
<li>System.Data.SqlServerCe.dll</li>
</ul>
<p>then it will work.</p>
<p>that is nec... | <p>You can add a foo.dll.config file and make sure it lives alongside the DLL. You just need to make sure that you have code in your DLL to determine where it lives on disk, and read the configuration from the same location.</p>
<p>Good luck!</p>
| 29,695 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.