instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've created a jQuery wee plugin for myself which takes care of showing, hiding and submitting a form to give in-place editing. Currently I have several of these on a page which function independently and I am happy. However, I'm thinking that an 'Edit All' might be useful. I'd therefore want to be able to access al... | <p>Use the custom events in jQuery to make this easy.</p>
<p>Something like this:</p>
<pre><code>(function($) {
$.fn.myPlugin = function() {
return this.each(function(){
//Plugin Code Goes Here
$(this).bind("pluginEdit",function(){
internalEditFu... | <p>Hmmm I guess I could create an array of instances...</p>
<pre><code>var plugins = new Array();
plugins.push($('first_editable_section').pluginThing());
plugins.push($('second_editable_section').pluginThing());
</code></pre>
<p>and access them through that.</p>
| 25,546 |
<p>Any suggestions for an accurate Web Log analysis tool to generate reports on the IIS logs? We used WebTrends, but I don't feel it was accurate.</p>
| <p>To analyze weblogs, I don't think you can go wrong with Analog: <a href="http://www.analog.cx/" rel="nofollow noreferrer">http://www.analog.cx/</a></p>
<p>If you are analyzing your own logs, which are often huge files, you will want the fastest analyzer you can find. Analog is fast.</p>
<p>You'll want one that's b... | <p>There is a logging package for free from MSFT for viewing this information using SQL Reporting Services. Google it.</p>
| 46,473 |
<p>I am wondering how to tell NHibernate to resolve dependencies on my POCO domain objects.</p>
<p>I figured out that methods like CalculateOrderTax should be in the Domain object because they encode domain specific business rules. But once I have two of those I am violating SRP. </p>
<p>It would be no problem to ext... | <p>I've been using interceptors for similar tasks:</p>
<p>An interceptor that modifies loaded entities:</p>
<pre><code>public class MyInterceptor : EmptyInterceptor
{
public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types)
{
return InjectDependencie... | <p>As no-one seems to be able to answer your question at the moment I thought I'd suggest restructuring your code to remove the need for the Order to calculate it's own tax.</p>
<p>You could delegate it to a OrderTaxService which takes an Order object and returns an OrderValue object or something along those lines.</p... | 44,236 |
<p>I've recently acquired a second monitor and now run VS2008 SP1 maximized on my secondary (and bigger) monitor. This theoretically has the benefit of opening the application under development on the primary monitor, where -- as it seems to me -- all newly started applications go. So far, so good. The problem though i... | <p>Quick'n'dirty:</p>
<pre class="lang-csharp prettyprint-override"><code>int value = 0x48454C4F;
Console.WriteLine(Encoding.ASCII.GetString(
BitConverter.GetBytes(value).Reverse().ToArray()
));
</code></pre>
<p>Converting the int to bytes, reversing the byte-array for the correct order and then getting the ASCII cha... | <p>Do get the 8-byte-blocks:</p>
<pre><code>int a = i & 255; // bin 11111111
int b = i & 65280; // bin 1111111100000000
</code></pre>
<p>Do break the first three bytes down into a single byte, just divide them by the proper number and perform another logical and to get your final byte.</p>
<p>Edit: Jason's s... | 14,725 |
<p>The only plug-ins I use are the ones required to do my job like SoapUI, Maven and SVN. I'm wondering if maybe there are some plug-ins out there that might make my life easier. Are there any Eclipse plug-ins that you find invaluable? </p>
| <p><a href="http://findbugs.sourceforge.net/" rel="noreferrer">findbugs</a> without a doubt!</p>
| <p>You might find <a href="http://fast-code.sourceforge.net/" rel="nofollow">fast code</a> plug-in pretty useful sometimes.</p>
| 48,246 |
<p>Any good ones?
So far I have found IZWebFileManager, OXFileManager and AWS File Picker. The file manager should be able to delete, copy, rename, download & upload files.</p>
| <p>You have <a href="http://www.codeproject.com/KB/aspnet/WebFileManager.aspx" rel="nofollow noreferrer">WebFileManager</a> created by our very own <a href="https://stackoverflow.com/users/1/jeff-atwood">Jeff Atwood</a></p>
| <p>I used <a href="http://www.element-it.com/asp-net-explorer-browser/online-share/web-file-manager.aspx" rel="nofollow">HTTPCommander</a>. Telerik also has a file manager control in their asp.net suite.</p>
| 13,704 |
<p>I'm playing around with a native (non-web) single-player game I'm writing, and it occured to me that having a daily/weekly/all-time <strong>online highscore list</strong> (think Xbox Live Leaderboard) would make the game much more interesting, adding some (small) amount of community and competition. However, I'm afr... | <p>At the end of the day, you are relying on trusting the client. If the client sends replays to the server, it is easy enough to replicable or modify a successful playthrough and send that to the server.</p>
<p>Your best bet is to raise the bar for cheating above what a player would deem worth surmounting. To do th... | <p>Usually, the biggest defender against cheating and hacking is a community watch. If a score seems rather suspicious, a user can report the score for cheating. And if enough people report that score, the replay can be checked by the admins for validity. It is fairly easy to see the difference between a bot an an actu... | 4,557 |
<p>I have a Google Map that suddenly stopped working for no apparent reason (I hadn't touched the code for months, but the wrapper code from our CMS may have changed without Corporate telling me).</p>
<p><a href="http://www.democratandchronicle.com/section/builder" rel="nofollow noreferrer">http://www.democratandchron... | <p>I've had random problems with Google Maps API at times and more than once it has been fixed by going back one API version. i.e. if your google maps API javascript inclusion string is like this <code>http://maps.google.com/maps?file=api&v=2.xd&key=XXXXX</code>
change the <strong>2.x</strong> to something a f... | <p>Try forcing JavaScript to make a new variable out of your HTML:</p>
<pre><code>GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html+'', { maxWidth: 500 });
});
</code></pre>
| 28,081 |
<p>I've recently been lifted out of the .Net world into the Java world and I miss my unit tests.</p>
<p>Using Visual Studio I used NUnit and TestDriven.net to run my unit tests.</p>
<p>What is a comparable system for Java Using Eclipse?</p>
<p>I'm looking specifically for the plugins that will get me going, or a gui... | <p>Using JUnit with eclipse is actually very easy. Just go to File->New... and select JUnit Test Case. Eclipse will handle adding the JUnit library and all of the imports.</p>
| <p>I've used the <a href="http://testng.org" rel="nofollow noreferrer">testNG</a> which has a plug in for <a href="http://code.google.com/p/testng-eclipse/" rel="nofollow noreferrer">eclipse</a>.</p>
| 30,680 |
<p>I have a <code>vector</code> that I want to insert into a <code>set</code>. This is one of three different calls (the other two are more complex, involving <code>boost::lambda::if_()</code>), but solving this simple case will help me solve the others.</p>
<pre><code>std::vector<std::string> s_vector;
std::set... | <blockquote>
<p>The error is really nasty, but boils down to the fact that it can't figure out which set::insert to use, since there's three overloads.</p>
</blockquote>
<p>You can work around the ambiguity by giving bind a helpful hand, by specifying a pointer to the function you wish to use:</p>
<pre><code>typede... | <p>Unfortunately, this:</p>
<pre><code>std::for_each(s_vector.begin(), s_vector.end(),
lambda::bind(&std::set<std::string>::insert, s_set, lambda::_1));
</code></pre>
<p>doesn't work. (Note that I used set::insert, because that's what s_set is.) The error is really nasty, but boils down to the fact ... | 35,344 |
<p>Im trying to create an app to control a pc remotely using java , i want to use red5 to let the admin control desktops using a flash movie
so i need to find java classes to :</p>
<ul>
<li>capture desktop as live video</li>
<li>-control mouse and keyboard</li>
</ul>
| <p><a href="http://www.tightvnc.com/download.html" rel="nofollow noreferrer">TightVNC</a> has a Java viewer so you can easily manage your server through VNC protocol and use a Java client (usable as an applet too).</p>
<p>There are tools, though not in Java, such as <a href="http://www.sodan.org/~penny/vncrec/" rel="n... | <p>Just use VNC. You can call the VNC server executable from Java. On the client you can use the Java VNC Viewer. I'm sure there's source code somewhere if you really need to make changes to it. You could use AppletWindow from <a href="http://www.bluej.org/resources/classes.html" rel="nofollow noreferrer">BlueJ</a> to ... | 43,015 |
<p>What is the quickest way to get a large amount of data (think golf) and the most efficient (think performance) to get a large amount of data from a MySQL database to a session without having to continue doing what I already have:</p>
<pre><code>$sql = "SELECT * FROM users WHERE username='" . mysql_escape_string($_P... | <p>I came up with this and it appears to work.</p>
<pre><code>while($row = mysql_fetch_assoc($result))
{
$_SESSION = array_merge_recursive($_SESSION, $row);
}
</code></pre>
| <p>OK, this doesn't answer your question, but doesn't your current code leave you open to SQL Injection?</p>
<p>I could be wrong, never worked in PHP, just saw the use of strings in the SQL and alarm bells started ringing!</p>
<h3>Edit:</h3>
<p>I am not trying to tamper with your post, I was correcting a spelling error... | 4,536 |
<p>I'm just reading up on SOA and the service registry / UDDI get mentioned regularly. It sounds nice but how is used in reality?</p>
<ul>
<li>Is the registry meant to decouple a logical service from its' physical implementation (port, url etc)? </li>
<li>Is the registry meant to be browsed by a human looking for an i... | <p>I find it to be more theoretically useful than practically useful. It is infrequently implemented and infrequently used. In reality, DNS provides a sufficient abstraction tool for the location of resources on the network. </p>
| <p>how about using multicast to disover the service? Like using jgroups or SLP? All the services will discover each other and inject the one they need into a proxies. Then building abstraction over the actual transport implementation. (e.g. rest, soap, rmi) </p>
| 15,411 |
<p>I want to merge multiple rss feeds into a single feed, removing any duplicates. Specifically, I'm interested in merging the feeds for the <a href="https://stackoverflow.com/tags">tags</a> I'm interested in.</p>
<p>[A quick <a href="http://www.google.com/search?q=rss+merge+reader" rel="nofollow noreferrer">search</a... | <p>Have you heard of <strong><a href="http://pipes.yahoo.com/pipes/" rel="noreferrer">Yahoo's Pipes</a></strong>. </p>
<blockquote>
<p>Its an interactive feed aggregator and
manipulator. List of 'hot pipes' to
subscribe to, and ability to create
your own (yahoo account required).</p>
</blockquote>
<p>I played... | <p><a href="http://pipes.yahoo.com/pipes/" rel="nofollow noreferrer">Yahoo Pipes</a>?</p>
<p><em>23 minutes later:</em>
Aww, I got answer-sniped by @<a href="https://stackoverflow.com/users/1992/bernie-perez">Bernie Perez</a>. Oh well :)</p>
| 4,679 |
<p>I have a web service which returns tab delimited data (see sample below).</p>
<p>I need to parse this into an array or similar so I can create a navigation view of it.</p>
<p>I've managed to perform the web request and could parse an XML file, but my knowledge of Objective-C is small.</p>
<pre><code>433 Eat
5... | <p>I'm not sure I understand your format exactly (it displays a little strange to me) but the easiest way to do this is <code>with - (NSArray *)componentsSeparatedByString:(NSString *)separator</code> which is a method in the NSString class... example:</p>
<pre><code>NSArray *components = [myString componentsSeperated... | <p>I had a feeling more than a flat list is wanted. If you want a multidimensional structure you can do something like this:</p>
<pre><code>NSArray *lines = [data componentsSeparatedByString:@"\n"];
for (NSString *line in lines) {
NSArray *fields = [line componentsSeparatedByString:@"\t"];
// Do something her... | 45,968 |
<p>I was wondering if anyone knew of any limitations to using Windows XP as a File and SQL server. I am asking because one of the applications we sell, requires the customer to setup a server for filesharing and as a SQL Server. We already allow them to use SQL Express, but we wanted to see if we can suggest Windows XP... | <p>There is a <a href="http://support.microsoft.com/default.aspx?kbid=314882" rel="nofollow noreferrer">limit of 10 inbound connections</a> on XP professional, and 5 on XP Home. So it would only be practicable for a very small company.</p>
| <p>Presumably you are meaning SQL Express, as you can't run SQL Server on XP, it's a server product.</p>
<p>If the customer can afford your product, they can afford a copy of Server 2003, or whatever, the file sharing's built-in. Admittedly SQL Server's fairly expensive, but if your product needs it, that's the way i... | 7,585 |
<p>We're working with a semi-centralized git repository here where I work. Each developer has their own subtree in the central git repository, so it looks something like this:</p>
<pre>master
alice/branch1
alice/branch2
bob/branch1
michael/feature
release/1.0
release/1.1</pre>
<p>Working locally in my tree I have <co... | <p>If you can, I suggest you use the same branch names locally & remotely. Then <code>git push</code> will push all of your local branches to corresponding branches in the central repository.</p>
<p>To use different prefixes in local and remote repos, you need to add a mapping to your config file each time you cr... | <p>You can map your branch to different tracking branch on the remote with something like this:</p>
<pre><code>git remote add heroku git@heroku.com:YOURAPPNAME.git
git checkout -b heroku -t heroku/master
</code></pre>
<p>Your config ends up similar to what @Paul suggests (a tad "simpler" actually).</p>
<p>See this g... | 20,256 |
<p>Let's say you want to start contributing to an open source project with thousands LOC. I am interesting in ways/suggestions on how you would start learning/hacking the new system. </p>
| <p>Skim through the code, looking for places where you think you know what is occuring. Read through those sections to see if your initial thought holds up, and then try modifying it to see if you can change it to do something else.</p>
<p>I'd suggest that this be guided slightly by the project roadmap so you can then... | <p>If you're familiar with the project and have some idea of what you want to contribute, then get the latest version of the code and make the change that you want to make. Don't try to digest the whole body of code at one time. Look for patterns and conventions that are being used and try to adhere to them as much a... | 43,304 |
<p>Oracle has this concept of allowing database users to be identified by the operating system user who is running the program that is connecting to Oracle. See <a href="http://www.oracle-base.com/articles/misc/OsAuthentication.php" rel="noreferrer">here</a>.</p>
<p>This allows you to do, as that user on a unix machin... | <p>The JDBC Thin driver is a 100% pure Java implementation that cannot collect the needed information from the operating system. </p>
<p>The JDBC OCI driver can do this! Use <code>jdbc:oracle:oci8:/@MYDBSID</code>, it will require that the Oracle driver be installed on that machine, not a problem if this is a server ... | <p><code>jdbc:oracle:oci:@</code> works with ojdbc6.jar and Oracle 11g2</p>
| 25,931 |
<p>I'm customizing a SugarCRM 5, and in my <strong>SugarCRM database</strong> I have all invoices which were imported from our ERP. Now, I would like to know if it is possible to create a new sub-panel in the Accounts Panel <strong>without editing the original SugarCRM files</strong>, so that my client invoices index a... | <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,855 |
<p>Is there a way to reformat code, i.e. force correct indentation in FlashDevelop as you can do with CTRL-SHIFT-F in Eclipse?</p>
| <p>Since FlashDevelop 4 there is a reformater included: press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>2</kbd></p>
| <p>open netbeans 6.5, create an xml file and then paste your mxml code; right click, format code, finally copy this formatted text from netbeans and past it in flex builder. it´s all.... i hope to be usefull</p>
| 28,334 |
<p>I have a huge database with some 100 tables and some 250 stored procedures. I want to know the list of tables affected by a subset of stored procedures. For example, I have a list of 50 stored procedures, out of 250, and I want to know the list of tables that will be affected by these 50 stored procedures. Is there ... | <p>This would be your SQL Server query:</p>
<pre><code>SELECT
[NAME]
FROM
sysobjects
WHERE
xType = 'U' AND --specifies a user table object
id in
(
SELECT
sd.depid
FROM
sysobjects so,
sysdepends sd
WHERE
so.name = 'NameOfStor... | <p>One very invasive option would be to get a duplicate database and set a trigger on every table that logs that something happened. Then run all the SP's. If you can't do lots of mods to the DB that wont work</p>
<p>Also, be sure to add the logging to existing triggers rather than replace them with logging if you als... | 14,511 |
<p>I have YAML data that looks sort of like this, but ~150k of it:</p>
<pre><code>---
all:
foo: 1025
bar:
baz: 37628
quux:
a: 179
b: 7
</code></pre>
<p>...or the same thing in JSON:</p>
<pre><code>{"all":{"bar":{"baz":"37628","quux":{"a":"179","b":"7"}},"foo":"1025"}}
</code></pre>
<p>I want... | <p>I finally came up with a super-elegant way to do this in about 5 lines of code, based on the fact that the simple <a href="http://en.wikipedia.org/wiki/YAML" rel="nofollow noreferrer">YAML</a> looks a lot like <a href="http://en.wikipedia.org/wiki/Markdown" rel="nofollow noreferrer">Markdown</a>.</p>
<p>We're start... | <p>Version 2.6 of YUI's TreeView now does take a JavaScript object but not in this format and won't sort it automatically. You would have to use YUI's JSON utility to convert it to an actual JavaScript which you will have to traverse. Your sample will have to be converted to something like this:</p>
<pre><code>{labe... | 30,333 |
<p>I've recently acquired a Flashforge Adventurer 3 and am having difficulty printing with ABS. The initial layers seem to lay and stay pretty well, though after a few more moments, one side will peel up from the heated platform. I'd like to know if anyone has optimal and tested temperatures for the use of ABS on my pr... | <p>The most commonly used print temperature range for ABS is 220 to 240 °C with the major bulk around 230 °C. Some filaments are blended with inhibitors or PC, increasing their print temperature to up to 260 °C. Note that the color of the filament just as the brand can have an impact on the print temperature!</p>
<p>T... | <p><em>Note that some of the other advice is general advice which is not applicable to the Adventurer 3.</em></p>
<p>Temperature control is somewhat limited on Adventurer 3. The maximum bed temperature is 100 °C. There is no "glass bed". My Adventurer 3 is struggling to get the bed temperature to 98 &de... | 1,249 |
<p>After rebooting the Windows 2003 Server with the IIS I receive the follow error message:</p>
<blockquote>
<p>Cannot connect to the configuration database</p>
</blockquote>
<p>in the browser. The error occur on different pages and with different clients. that I think it is a server problem.</p>
<p>What can I do ... | <p>A quick web search suggests that this error message is probably coming from SharePoint Services, and indicates that SharePoint cannot connect to its database.</p>
<p>There seem to be several reasons suggested:</p>
<ul>
<li>The SQL database is not running, has been removed, or you otherwise can't connect to it (fir... | <p>I hade the same problem, and it did happen just after a windows update, hmm...
First of all, someone (windows update) hade change the user account on the service "Windows Internal Database (MICROSOFT##SSEE)". Changed back to the right account and the WSS started to work, but with an error (Application / error or som... | 13,970 |
<p>My Situation: I love <a href="http://www.e-texteditor.com" rel="nofollow noreferrer">e editor</a>, however I'm on a new computer and my license is being used on my old one. I can't exactly afford another license, so I'm looking for a free editor that meets the follow criteria:</p>
<ul>
<li>Decent syntax highlightin... | <p>You're willing to spend all this time and effort asking about and evaluating other editors which will almost certainly not have all the features you want, yet you can't shell out $35 for another licence?</p>
<p>When I'm making decisions like this, I always value my time at $100/hour so if this were going to take me... | <p>You also might want to take a look at <a href="http://www.editplus.com" rel="nofollow noreferrer">EditPlus</a>.</p>
| 17,523 |
<p>I was wondering if there is some way to name or rename a property on an Anonymous type to include a space in the property name. For example:</p>
<pre><code>var resultSet = from customer in customerList
select new
{
FirstName = customer.firstName;
};
</code></pre>
<p>In this example I would lik... | <p>What about doing something like this:</p>
<pre><code>var resultSet = from customer in customerList
select new
{
Value = customer.firstName,
Title = "First Name"
};
</code></pre>
<p>Then in your user control use Value as the co... | <p>I'd add an attribute to the property where you can specify a custom name, and you can provide more user friendly names using the attribute.</p>
| 26,318 |
<p>I have a very large (~6GB) SVN repository, for which I've written a batch file script to do an incremental backup each day. The script checks when the last backup was run and dumps only the revisions since then.</p>
<p>The files are named: <code>backup-{lower_revision}-{higher_revision}.svn</code> eg: <code>backup-... | <p>You should rename your files just by numbering the day [01, 02,..31] so your files can easily be sorted
For the dump it is not important to know which revisions are inside.</p>
<p>I follow a different approach, because loading back a huge Repo like this takes some time, so you should consider the following:<br>
You... | <p>I would suggest running a dump command every day and just keep the last 5 dumps. That's 30 gigs for you.</p>
<p>Here's a script to run automated dumps that I use but I do manually delete backups:</p>
<pre>
::This script backs up the subversion repository.
::Reset Temp backup storage
rmdir /S /Q C:\SVNBACKUP
mkdi... | 23,111 |
<p>I know I can do this:</p>
<pre><code>IDateTimeFactory dtf = MockRepository.GenerateStub<IDateTimeFactory>();
dtf.Now = new DateTime();
DoStuff(dtf); // dtf.Now can be called arbitrary number of times, will always return the same value
dtf.Now = new DateTime()+new TimeSpan(0,1,0); // 1 minute later
DoStuff(dt... | <p>I know this is an old question, but thought I'd post an update for more recent Rhino Mocks versions. </p>
<p>Based on the previous answers which use Do(), there is a slightly cleaner (IMO) way available if you are using <a href="http://www.ayende.com/wiki/Rhino+Mocks+3.5.ashx#Arrange,Act,Assert" rel="noreferrer">AA... | <p>You can use Expect.Call to accomplish this. Here's an example using the record/playback model:</p>
<pre><code>using (mocks.Record())
{
Expect.Call(s.GetSomething()).Return("ABC"); // 1st call will return ABC
Expect.Call(s.GetSomething()).Return("XYZ"); // 2nd call will return XYZ
}
using (mocks.Playback())
{
... | 15,014 |
<p>Why are the split lists always empty in this program? (It is derived from the code on the <a href="http://en.wikipedia.org/wiki/Linked_List#Language_support" rel="nofollow noreferrer">Wikipedia</a> page on Linked Lists.)</p>
<pre><code>/*
Example program from wikipedia linked list article
Modified to find... | <pre><code> temp = list_nth(current, ind);
while (current != NULL) {
count = count+step;
temp->next = list_nth(head, count);
current = current->next;
}
</code></pre>
<p>You are finding the correct item to begin the split at, but look at what happens to temp from then on ... you only... | <p>The program, actually, has more than one problem.</p>
<ul>
<li><p>Indexes are not a native way to address linked list content. Normally, pointers to nodes or iterators (which are disguised pointers to nodes) are used. With indexes, accessing a node has linear complexity (<code>O(n)</code>) instead of constant <code... | 42,005 |
<p>I've updated <strong>php.ini</strong> and moved <strong>php_mysql.dll</strong> as explained in <a href="https://stackoverflow.com/questions/11919/how-do-i-get-php-and-mysql-working-on-iis-70#94341">steps 6 and 8 here.</a></p>
<p>I get this error…</p>
<pre>Fatal error: Call to undefined function mysql_connec... | <p>As the others say these two values in php.ini are crucial.</p>
<p>I have the following in my php.ini: note the trailing slash - not sure if it is needed - but it does work.</p>
<pre><code>extension_dir = "H:\apps\php\ext\"
extension=php_mysql.dll
</code></pre>
<p>Also it is worth ensuring that you only have one c... | <p>In the php.ini file, check if the extention path configuration is valid.</p>
| 19,136 |
<p>I'm trying to get information like OS version, hard disk space, disk space available, and installed RAM on a Linux system in C++. I know I can use <code>system()</code> to run different Linux commands and capture their output (which is what I'm currently doing) but I was wondering if there's a better way? Is there... | <p>If you are using *nix commands via system.<br></p>
<p>Then do man scroll to the bottom of the man page and it will usually show you what relevant C system calls are related.</p>
<pre><code>Example: man uname:
SEE ALSO
uname(2), getdomainname(2), gethostname(2)
Explanation of numbers:
(1): User UNIX Com... | <p>If you don't want to use <a href="http://www.freedesktop.org/wiki/Software/hal" rel="nofollow noreferrer">HAL</a> as litb suggests, you can read things straight out of the <a href="http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/ref-guide/ch-proc.html" rel="nofollow noreferrer">/proc filesystem</a>, provided... | 44,402 |
<p>I am looking to get a list of the column names returned from a Model. Anyone know how this would be done, any help would be greatly appreciated.</p>
<p>Example Code:</p>
<pre><code>var project = db.Projects.Single(p => p.ProjectID.Equals(Id));
</code></pre>
<p>This code would return the Projects object, how wo... | <p>This would be nice to have as an extension method:</p>
<pre><code>public static class LinqExtensions
{
public static ReadOnlyCollection<MetaDataMember> ColumnNames<TEntity> (this DataContext source)
{
return source.Mapping.MappingSource.GetModel (typeof (DataContext)).GetMetaType (typeof (TEnt... | <p>Your columns should be mapped as properties on your Project model. I'm not sure if you can get the underlying database structure when using LINQ to SQL. The entire point of LINQ to SQL is to abstract the database away.</p>
| 47,111 |
<p>I am looking for some advice on what should I concentrate my efforts to get the needed skills to become a Java developer for Oracle applications. I'm bit confused as there are lot of technologies in the Java world. Where should I start? What to avoid? Is JDeveloper a good IDE for a beginner?</p>
| <p>To become an Oracle Developer there is a bit more to learn than jdbc. You should take a look at the Oracle web site. It is kind of slow and not very intuitive but has a lot of good information. There are OUGs that have good info as well.</p>
<p>If you just want to access Oracle via JAVA then you should use a framew... | <p>Your question is very simple so I have listed a few simple steps to start developing a Java application using Oracle technologies.</p>
<ol>
<li>Install Oracle XE Database.</li>
<li>Install [JDeveloper]. Choose the install with Weblogic if you are developing a J2EE application.</li>
<li>Build and run a jdbc applicat... | 6,594 |
<p>I am trying to write a JavaScript script to add to greasemonkey that adds a button after an element. The onClick for this button should copy the parents element text to the keyboard. I have seen plenty of examples that copy already selected text to the clipboard such as this:</p>
<pre><code> <SCRIPT LANGUAGE=... | <p>If you took the time to read the full article, the author states this doesn't work for Firefox...<br>
Actually, I think it doesn't even work for IE, as it does nothing related to the clipboard!</p>
<p>There is a technique using Flash, because by default, Firefox inhibits clipboard access for security reasons.<br>
O... | <p>Are you sure your example works? It does not in my browser. But take a look at the following page: <a href="http://www.jeffothy.com/weblog/clipboard-copy/" rel="nofollow noreferrer">http://www.jeffothy.com/weblog/clipboard-copy/</a></p>
| 40,869 |
<p>I find the solution explorer is a bit slow to get around in sometimes, and think that there might be a better UI solution out there. I like Ctrl+T but sometimes a visual cue is better than remembering the class name?</p>
<p>I think it would be nice you had a second, similar window, that only shows files that have b... | <p>If you want to upgrade your experience to the next level, you need to have Visual AssistX.
It enables links between your code and the files it comes from. And it's also light-weight. You will forget the Solution Explorer quite rapidly.</p>
<p><a href="http://www.wholetomato.com" rel="nofollow noreferrer">http://www... | <p>In the toolbar's search box, you can type ">of ". It will give you an intellisense-like dropdown of files in your solution as you type out the filename (e.g. ">of def" will show "default.aspx" and "default.aspx.vb" if those two files are in your solution).</p>
<p>I'm not sure if this any more/less cryptic than ctr... | 44,747 |
<p>Recently I noticed that Cura always is giving me less printing time than the print itself takes on my TEVO Tarantula with Marlin firmware.</p>
<p>The time difference is about 15 %, at requested 50 mm/s printing speed.</p>
<p><strong>How could I verify real printing speed?</strong></p>
| <p><strong>Printing speed is dependent by the firmware and physical properties of your printer</strong>.</p>
<p>Slicers typically compute the expected time by assuming the printer will execute <em>exactly</em> what it is instructed to do, but a printer is a real object, with mass and momentum, and stepper motors that ... | <p>I use a Anet A8 which has a system acceleration and jerk of 400 and 20
When i slice with Cura, then I use a gcode without acceleration control, because the printer does this by its own and a combination with the gcode acceleration/jerk control gets me some strange behavior (e.g. sometimes some ultra slow movement i... | 874 |
<p>I'm doing some PHP stuff on an Ubuntu server.</p>
<p>The path I'm working in is <strong>/mnt/dev-windows-data/Staging/mbiek/test_list</strong> but the PHP call <code>getcwd()</code> is returning <strong>/mnt/dev-windows/Staging/mbiek/test_list</strong> (notice how it's dev-windows instead of dev-windows-data).</p>
... | <p>Which file are you calling the getcwd() in and is that file is included into the one you are running (e.g. running index.php, including startup.php which contains gwtcwd()).</p>
<p>Is the file you are running in /dev-windows/ or /dev-windows-data/? It works on the file you are actually running.</p>
<hr>
<p>Here's... | <p><a href="https://stackoverflow.com/questions/30307/why-would-getcwd-return-a-different-directory-than-a-local-pwd#30313">@Ross</a></p>
<p>I thought that getcwd() was returning a filesystem path rather than a relative url path.</p>
<p>Either way, the fact remains that the path /mnt/dev-windows <strong>doesn't</stro... | 5,020 |
<p>A legacy backend requires the email body with a .tif document, no tif and it fails. So i need to generate a blank .tif, is there a fast way to do this with ghostscript? </p>
<hr>
<p>edit: make once in project installation use when i need it.</p>
| <p>The following line will produce a 1 pixel Tiff file (340 bytes). That's the smallest Tiff file I could get.</p>
<pre><code>gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffpack -g1x1 -sOutputFile=small.tif -c newpath 0 0 moveto 1 1 lineto closepath stroke showpage quit
</code></pre>
<p>Actually, you can even reduce the comm... | <p>Couldn't you make your blank .tif file once and then attach the same file every time it is needed?</p>
| 28,280 |
<p>The <a href="http://win32.perl.org/" rel="noreferrer">win32.perl.org</a> web site provides references to several Perl distributions for MS Windows.</p>
<p>For a long time I have been using ActivePerl from
<a href="http://www.activestate.com/" rel="noreferrer">ActiveState</a> but recently I switched to
<a href="ht... | <p><a href="http://strawberryperl.com/" rel="noreferrer">Strawberry Perl</a> is just getting better and better. One problem I've repeatedly had with ActiveState is that my modules sometimes fail to install because I need an upgrade to a core module, but they won't allow that. Thus, everybody who <em>doesn't</em> use ... | <p>The code I write lands in Fortune 500 companies so a "corporate" feeling is helpful. I've used ActivePerl so far, and it's worked fine for both internal tooling and for distribution to those large'ish customers.</p>
| 9,702 |
<p>If you've ever used SharePoint Designer, you'll know it's bad. Really bad.</p>
<p>Is there any good replacement for that? Is there any consideration I must take account of if I want to build my own Visual Studio Add-in connector to connect to it?</p>
<p>Anything you know that I should be aware of?</p>
<p>I just h... | <p>You can get the Sharepoint Explorer add-in for Visual Studio which will allow you to browse around sites:</p>
<p><a href="http://blog.thekid.me.uk/archive/2007/10/29/vs-net-developer-add-in-for-sharepoint-available-for-download.aspx" rel="nofollow noreferrer">http://blog.thekid.me.uk/archive/2007/10/29/vs-net-devel... | <p>It depends on what you want to do. As <a href="https://stackoverflow.com/questions/285630/is-there-any-good-replacement-for-sharepoint-designer#285669">Cruiser</a> mentioned, there are options like SharePoint Explorer for exploring a SharePoint farm or site collection. However there are a lot of things that there is... | 36,272 |
<p>I am wondering what experiences people are having using the ASP.NET MVC Framework? In particular I am looking for feedback on the type of experience folks are having using the framework.</p>
<p>What are people using for their view engine? What about the db layer, NHibernate, LINQ to SQL or something else?</p>
<p... | <p>I've been getting into some pretty heavy use of NHibernate with ASP.NET MVC lately, and am really loving it.</p>
| <blockquote>
<p>Why the choice of NHibernate over
anything else?</p>
</blockquote>
<p>It's a very powerful tool, and is (relatively) easy to learn. It takes away all the monotony and repetitiveness of manually implementing object-relational mapping.</p>
| 4,379 |
<p>I'm having some trouble running a groovy servlet (groovlet) in tomcat that imports a library class. When I don't import anything the groovlet works correctly, but if I do import something that I expect to be on the classpath (I can import the same class successfully in a regular servlet), I see the following error:<... | <p>I'm using Groovy plugin for Eclipse. Exporting Groovlets in a war file does also work.</p>
<p>When I do export my Groovlet-based application, this helpful plugin puts .groovy files in the /WEB-INF/classes directory (in the classpath). And it works when I deploy the war file in my Tomcat Server.</p>
<p>Hope that th... | <p>A stupid mistake I made was that I needed to reload the webapp before the jar I copied into WEB-INF/lib would be loaded (i.e. either restarting entire Tomcat server, or reload just the specific app from the Tomcat manager). Dynamically editing the .groovy files right inside the Tomcat/webapps/ dir and seeing the up... | 46,190 |
<p><strong>Edit</strong> </p>
<p>I noticed that the Object Test Bench is a good example of what I'm looking for, but it doesn't seem to work with ASP.net. I always get an error that an instance could not be created.</p>
<hr>
<p>Is there a way to test your functions in ASP.net without needing to create a web page and... | <p>Put all your non-presentation code (which excludes serializing to JSON—i.e., put all the code that goes before serialization) in a class library and link to the DLL directly from the unit tests.</p>
<p>Also, to get any expression to be evaluated in the debugger, you have to be in <em>break mode</em> (hit a breakpoi... | <p>There use to be a project call <a href="http://nunitasp.sourceforge.net/" rel="nofollow noreferrer">NUnitASP</a> that's now dead. But the last version may help you in some ways.</p>
<p>Your next choice is to use the Unit Testing functions in Visual Studio. There were many features that were only available in the ... | 31,240 |
<p>When do you call <code>Microsoft.Security.Application.AntiXss.HtmlEncode</code>? Do you do it when the user submits the information or do you do when you're displaying the information? </p>
<p>How about for basic stuff like First Name, Last Name, City, State, Zip?</p>
| <p>You do it when you are displaying the information. Preserve the original as it was entered, convert it for display on a web page. Let's say you were displaying it in some other way, like exporting it into Excel. In that case, you'd want to export the preserved original.</p>
<p>Encode every single string.</p>
| <p>Encoding is not a property of the data, it is a property of the transport mechanism. Therefore you should unencode data when you receive it, and encode it appropriately before transmission. The transport mechanism determines what sort of encoding is necessary.</p>
<p>This principle holds true whether your transpo... | 36,801 |
<p>In one of his <a href="http://www.codinghorror.com/blog/archives/001152.html" rel="nofollow noreferrer">blog articles</a>, the proprietor of this web site posed this question to the reader, "You're automatically measuring all the queries that flow through your software, right?"</p>
<p>How do you do this? Every lin... | <p><a href="http://msdn.microsoft.com/en-us/library/ms181091.aspx" rel="nofollow noreferrer">SQL Server Profiler</a> is my tool of choice, but only for the DB end obviously.</p>
<p>It should be noted, this is for optimizing queries and performance, and debugging. This is not a tool to be left running all the time, as ... | <p>For Perl, <a href="http://search.cpan.org/perldoc?DBI::Profile" rel="nofollow noreferrer">DBI::Profile</a>.</p>
| 20,368 |
<p>What is people's prefered method of storing application configuration data in a database. From having done this in the past myself, I've utilised two ways of doing it.</p>
<ol>
<li>You can create a table where you store key/value pairs, where key is the name of the config option and value is its value. Pro's of thi... | <p>You can expand option 1 to have a 3rd column, giving a data-type. Your application can than use this data-type column to cast the value.</p>
<p>But yeah, I would go with option 1, if config files are not an option. Another advantage of option 1 is you can read it into a Dictionary object (or equivalent) for use in ... | <p>Where do you you store the configuration settings your app needs to connect to the database?</p>
<p>Why not store the other config info there too?</p>
| 29,765 |
<p>I have a listview with a DataTemplate that has a ComboBox. I want the ComboBox to look flat like a label until the user actually wants to change the value. I had the example below working before, but I changed things around a bit, and now it doesn't work anymore and I'm not sure why. </p>
<p>The IsMouseOver propert... | <p>I took the code you provided, supplied some data for the collections, and it worked just like you wanted it to. I would suggest using <a href="http://blois.us/Snoop/" rel="nofollow noreferrer">Snoop</a> to look to see if there are any other elements consuming the events you expect the ListView to handle.</p>
| <p>Usually when your are having issues with Mouse events firing correctly it's due to the background missing. If the element you expect to receive events has a null reference for a background, the control will not receive the events; only the control underneath of it will. Try setting the background of your ContentCont... | 43,866 |
<p>I have a REST Java server implemented with Jersey running on Jetty. It seems that certain browsers (IE7) internally caches all requests made to the server. </p>
<p>What I would like to do is to send a certain HTTP header in the response from the REST server indicating the browser that it shouldn't cache that respon... | <p>There's nothing you can do about rogue clients, but Jetty can send the appopriate HTTP headers. Try <a href="http://docs.codehaus.org/display/JETTY/LastModifiedCacheControl" rel="nofollow noreferrer">here</a> for info on configuring the Last-Modified and Cache-Control headers.</p>
| <p>@Dave Cheney: well, what I understand from <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9" rel="nofollow noreferrer">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9</a> is that Cache-control makes sense for the request as well as for the response. And when the response is a ca... | 15,539 |
<p>Our application is well structured (well we did our best!) and we have split the Model from the View, Now, we need to let some information to our client with a web access. We would like to build something small with IIS and some webform.</p>
<p>Here some information you might think are useful:</p>
<ol>
<li>Our contr... | <p>I think the "synchronizing" Michael is talking about is the data in the database and the view presented by the Winform app.</p>
<p>We had a similar problem, and the solution we came up with is to create a Web service that exposes the data via XML and use the service from both the web app and Winform app. Every time... | <p>The biggest challenge is going to be synchronizing your database between the local Winforms application and the hosted Webforms application. Once you do that, creating the web app is easy.</p>
<p>If your web application is read only, then you can set up replication. Find a tool that you like. Three that I found thr... | 25,818 |
<p>Has anyone ever heard of a UNIX shell written in a reasonable language, like Python?</p>
| <ul>
<li><a href="http://www.gnu.org/software/emacs/manual/html_node/eshell/index.html" rel="noreferrer">Eshell</a> is a Bash-like shell in Emacs Lisp.</li>
<li>IPython can be <a href="http://ipython.org/ipython-doc/stable/interactive/shell.html" rel="noreferrer">used as a system shell</a>, though the syntax is a bit w... | <p>Try <a href="https://github.com/willghatch/racket-rash" rel="nofollow noreferrer">rash</a>. It's a shell language written in Racket. It has a nice interactive-friendly syntax. You can embed Rash inside any normal Racket file as well as embedding normal Racket inside Rash. It's extensible and you can define new p... | 20,649 |
<p>I just got my first 3D printer today, QIDI X-ONE[2], and so far so good with the setup and getting my 1<sup>st</sup> print. I wanted to power off the printer, but I don't see any instructions on how to properly power off the machine.</p>
<p>Does anyone know how long I should wait, or what the minimum temperature wo... | <p>Kinda, sort of, but not really. I'll look at the A4988 (<a href="https://www.pololu.com/file/0J450/a4988_DMOS_microstepping_driver_with_translator.pdf" rel="nofollow noreferrer">datasheet</a>).</p>
<p>The motor pins are connected by diodes to ground and Vbb (the motor suppply voltage). Essentially, they act as a br... | <p>"Inductive kickback" from motor coils is caused by the inductance of the coils and the wiring. It is not some strange effect. Inductance is charged with current, just as capacitance is changed with voltage. Most bipolar motor drivers use an H-bridge on the output. By driving the H-bridge correctly, the driver ca... | 830 |
<p>I'm using a third-party library that returns "XML" that is not valid, because it contains invalid characters, as well as non-declared entities. I need to use a Java XML parser to parse this XML, but it's choking.</p>
<p>Is there a generic way to sanitize this XML so that it becomes valid?</p>
| <p>I think your options are something like: </p>
<ul>
<li><a href="http://home.ccil.org/~cowan/XML/tagsoup/" rel="nofollow noreferrer">Tag Soup</a></li>
<li><a href="http://jtidy.sourceforge.net/" rel="nofollow noreferrer">JTidy</a></li>
<li>Roll your own.</li>
</ul>
<p>The first two are more heavyweight, given that ... | <p>For illegal characters, I would recommend implementing filtering Reader; just convert them (assuming these are control characters) with space, or strip out.</p>
<p>Undeclared entities are trickier; some xml parsers allow you to define alternative DTD to use (<a href="http://woodstox.codehaus.org" rel="nofollow nore... | 30,231 |
<p>I have written jQuery code, in files <code>Main.html</code> and <code>ajax.php</code>. The <code>ajax.php</code> file returns the link of images to <code>Main.html</code>.</p>
<p>Now in <code>Main.html</code>, I have Image1, Image2, Image3, etc.</p>
<p>My <code>Main.html</code> file:</p>
<pre><code><html>
... | <p>It sounds like you might want to take a look at the <a href="http://leandrovieira.com/projects/jquery/lightbox/" rel="nofollow noreferrer">jQuery lightbox plugin</a>.</p>
| <p>You could do something like this:</p>
<p>Define this div in your html:</p>
<pre><code><div id="pictureframe"></div>
</code></pre>
<p>Now add an onclick handler on the image links to do the following:</p>
<pre><code>$("#pictureframe").load(image_url);
</code></pre>
<p>You need to structure your code ... | 48,433 |
<p>We're a .NET team which uses the Oracle DB for a lot of reasons that I won't get into. But deployment has been a bitch. We are manually keeping track of all the changes to the schema in each version, by keeping a record of all the scripts that we run during development. </p>
<p>Now, if a developer forgets to check-... | <p>Red Gate Schema Compare for Oracle has now been released!</p>
<p><a href="http://www.red-gate.com/products/schema_compare_for_oracle/index.htm" rel="nofollow noreferrer">http://www.red-gate.com/products/schema_compare_for_oracle/index.htm</a></p>
<p>There is a 28-day fully functional free trial. Please give it a g... | <p>There are various tools out there that you can use, I haven't used any of them myself though so I've got no comments to make about them, but another "trick" that you can use is to create a trigger on DDL events, so you can basically capture (to a table, or log file or whatver) any changes done between deployments.</... | 6,958 |
<p>What libraries/methods do you know of that can do some basic HTML representation in Swing? Can you comment on your experience?</p>
| <p>Many of the Swing controls (like JLabel) can render basic HTML content. <a href="http://java.sun.com/javase/6/docs/api/javax/swing/JEditorPane.html" rel="nofollow noreferrer">JEditorPane</a> can be used to display HTML pages. However, these controls are limited to <a href="http://www.w3.org/TR/REC-html32" rel="nofol... | <p>Came across <a href="http://lobobrowser.org/java-browser.jsp" rel="nofollow noreferrer">Lobo</a> java web browser the other day.</p>
<blockquote>
<p>Lobo is being actively developed with the aim to fully support HTML 4, Javascript and CSS2.</p>
</blockquote>
<p>No experience with it though, but thought it may fi... | 4,615 |
<p>Can you post a short example of real, overdone spaghetti code, possibly saying what it does? Can you show me a little debugger's nightmare?</p>
<p>I don't mean <a href="http://www0.us.ioccc.org/main.html" rel="noreferrer">IOCCC</a> code, that is science fiction. I mean real life examples that happened to you...</p>... | <p>To me, a more <strong>modern</strong> example of spaghetti code is when you have 20 dlls and every DLL references each other in one way or another. Your dependency graph looks like a huge blob, and your code hops all over the place with no real order. Everything is inter-dependent.</p>
| <p>Spaghetti code: Originating in the early 60's in Italy as an alternate recipe for certain pasta dishes, spaghetti code was cooked up by one restaurant entrepreneur who attempted to automate the creation of a fool-proof entree. Pressed by the lack of time to complete the design the engineer/chef cut corners which int... | 23,753 |
<p>What is the simplest way to count # of visits by a user in an ASP.NET web app?</p>
<p>Our app services anonymous users, registered users and an intermediate user, called a "prospect". Prospects are users that request information but do not create an account.</p>
<p>We leave an ID cookie for every type of user, an... | <p>Since you're using 1.1... in the Global.aspx... in the App_EndRequest (or whatever), insert a record into a DB with Name, IPAddress, timestamp, etc.</p>
<p>EDIT: Don't do the session thingy, sessions can be cleared, plus how will you report on them days, or weeks later... insert a record (including the Request.Url.... | <blockquote>
<p>We leave an ID cookie for every type of user, <strong>and that's the key into our database for visit information</strong></p>
</blockquote>
<p>Sounds to me like you already have a counter, you just need to figure out a way to make this data useful.</p>
<pre><code>SELECT COUNT(1) FROM TblUsers WHERE ... | 44,932 |
<p>Here are some tools that I have found to test web services consumers:</p>
<p><a href="http://www.soapui.org/" rel="nofollow noreferrer">http://www.soapui.org/</a>
<a href="https://wsunit.dev.java.net/" rel="nofollow noreferrer">https://wsunit.dev.java.net/</a></p>
<p>Are there any others? I would prefer testing fr... | <p>I have used soapui by a maven plugin. It can create junit-linke reports to be run and analysed like unit tests. This can be easily integrated in continious build, also with the free distribution of soapui.</p>
| <p>The Grinder is right up your ally with both Java and Python, that handles most web services, (SOAP/REST/CORBA/RMI/JMS/EJB) etc.</p>
<p><a href="http://grinder.sourceforge.net/" rel="nofollow noreferrer">http://grinder.sourceforge.net/</a></p>
| 34,389 |
<p>I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:</p>
<ul>
<li><code>1-234-567-8901</code></li>
<li><code>1-234-567-8901 x1234</code></li>
<li><code>1-234-567-8901 ext1234</code></li>
<li... | <p>Better option... just strip all non-digit characters on input (except 'x' and leading '+' signs), taking care because of the British tendency to write numbers in the non-standard form <code>+44 (0) ...</code> when asked to use the international prefix (in that specific case, you should discard the <code>(0)</code> e... | <p>If at all possible, I would recommend to have four separate fields—Area Code, 3-digit prefix, 4 digit part, extension—so that the user can input each part of the address separately, and you can verify each piece individually. That way you can not only make verification much easier, you can store your phone numbers i... | 15,032 |
<p>I'm a Git newbie. I recently moved a Rails project from Subversion to Git. I followed the tutorial here: <a href="http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/" rel="noreferrer">http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subv... | <blockquote>
<p><code>1.</code> Find out where Git thinks 'origin/master' is using <a href="http://schacon.github.com/git/git-remote.html#_commands" rel="noreferrer"><code>git-remote</code></a></p>
</blockquote>
<pre><code>git remote show origin
</code></pre>
<p>..which will return something like..</p>
<pre><code>... | <p>I had the problem "Your branch is ahead of 'origin/master' by nn commits." when i pushed to a remote repository with:</p>
<pre><code>git push ssh://git@xxx.repositryhosting.com/yyy/zzz.git
</code></pre>
<p>When i found that my remote adress was in the file .git/FETCH_HEAD and used:</p>
<pre><code>git push
</code>... | 34,958 |
<p>We have been having serious trouble getting an application we devlop running with UAC enabled for long.</p>
<p>Once installed (the installer fails almost immediately with UAC) it appears that UAC can be turned on and have the application work. However, after a while, it will stop working with strange errors about c... | <p>After all this time I found a solution that works.</p>
<ol>
<li><p>Install somewhere else besides Program Files. This neatly sidesteps the filesystem virtualization that seems to be causing all the problems.</p></li>
<li><p>Disable virtualization on the application's HLKM registry key. this fixes the one remaining ... | <p>Where is the application trying to write the file? If it is trying to write to it's install location under Program Files you may get strange errors since writing here is not allowed under Vista and any files created here are actually created in a virtual folder elsewhere - though to the application they (usually) ap... | 32,614 |
<p>When spliting a solution in to logical layers, when is it best to use a separate project over just grouping by a folder?</p>
| <p>By default, <strong>always just create new folder</strong> within the same project</p>
<ul>
<li>You will get single assembly (without additional ILMerge gymnastic)</li>
<li>Easier to obfuscate (because you will have less public types and methods, ideally none at all)</li>
</ul>
<p>Separating your source code into ... | <blockquote>
<p>Separating your source code into
multiple projects makes only sense if
you...
... More developers involved
and you want to treat their work as
consumable black box. (not very
recommended) ...</p>
</blockquote>
<p>Why isn't this recommended? I've found it a very useful way to manage an ... | 2,396 |
<p>Using C# 2.0 what is the best way to implement dynamic form controls?</p>
<p>I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way?</p>
| <p>You can use panels with automatic layout such as <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.flowlayoutpanel.asp" rel="nofollow noreferrer">FlowLayoutPanel</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel.aspx" rel="nofollow noreferrer">TableLay... | <p>What do you mean by “dynamic”? A new, fixed set of controls for each data row in the data set? Then use a <code>UserControl</code> that contains your controls.</p>
<p>Or do you mean that, depending on your data layout, you want to provide the user with a customized set of controls, say, one <code>TextBox</code> for... | 6,516 |
<p>I have a page that contains a form. This page is served with content type text/html;charset=utf-8. I need to submit this form to server using ISO-8859-1 character encoding. Is this possible with Internet Explorer?</p>
<p>Setting accept-charset attribute to form element, like this, works for Firefox, Opera etc. but ... | <p>There is a simple hack to this:</p>
<p>Insert a hidden input field in the form with an entity which only occur in the character set the server your posting (or doing a GET) to accepts.</p>
<p>Example: If the form is located on a server serving ISO-8859-1 and the form will post to a server expecting UTF-8 insert so... | <p>I am pretty sure it won't be possible with older versions of IE. Before the <code>accept-charset</code> attribute was devised, there was no way for <code>form</code> elements to specify which character encoding they accepted, and the best that browsers could do is assume the encoding of the page the form is in will ... | 18,535 |
<p>What is the easiest way to encode a PHP string for output to a JavaScript variable?</p>
<p>I have a PHP string which includes quotes and newlines. I need the contents of this string to be put into a JavaScript variable.</p>
<p>Normally, I would just construct my JavaScript in a PHP file, à la:</p>
<pre><code><... | <p>Expanding on someone else's answer:</p>
<pre><code><script>
var myvar = <?php echo json_encode($myVarValue); ?>;
</script>
</code></pre>
<p>Using <a href="http://php.net/json_encode" rel="noreferrer">json_encode()</a> requires:</p>
<ul>
<li>PHP 5.2.0 or greater</li>
<li><code>$myVarValue</code... | <p>If you use a templating engine to construct your HTML then you can fill it with what ever you want!</p>
<p>Check out <a href="http://www.phpxtemplate.org" rel="nofollow noreferrer">XTemplates</a>.
It's a nice, open source, lightweight, template engine.</p>
<p>Your HTML/JS there would look like this:</p>
<pre><cod... | 20,313 |
<p>In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical border still appears down the page even if there isn't any content to display.</p>
<p>Here is my <stron... | <p>Your problem is not that the div is not at 100% height, but that the container around it is not.This will help in the browser I suspect you are using:</p>
<pre><code>html,body { height:100%; }
</code></pre>
<p>You may need to adjust padding and margins as well, but this will get you 90% of the way there.If you ne... | <p>I know this is not the best method, but I couldnt figure it out without messing my header, menu, etc positions. So.... I used a table for those two colums. It was a QUICK fix. No JS needed ;)</p>
| 17,762 |
<p>Is there a way to create a blank solution, or some type of file-based project solution within Visual Studio so that I can point to a root folder, and have all of the sub-folders and files in that root, show up in my solution explorer? I realize I can create a blank solution and then add the individual items manually... | <p>You can also create the blank solution and then click the second-from-the-right icon at the top of the solution explorer (it looks like three files with one "cut out"). Once you click that button to show the files in the solution directory that are not in a project, you can select all the files (with shift-click) a... | <p>You can also create the blank solution and then click the second-from-the-right icon at the top of the solution explorer (it looks like three files with one "cut out"). Once you click that button to show the files in the solution directory that are not in a project, you can select all the files (with shift-click) a... | 28,950 |
<p>How are you handling the entry of numeric values in WPF applications?</p>
<p>Without a NumericUpDown control, I've been using a TextBox and handling its PreviewKeyDown event with the code below, but it's pretty ugly.</p>
<p>Has anyone found a more graceful way to get numeric data from the user without relying on a... | <p>How about:</p>
<pre><code>protected override void OnPreviewTextInput(System.Windows.Input.TextCompositionEventArgs e)
{
e.Handled = !AreAllValidNumericChars(e.Text);
base.OnPreviewTextInput(e);
}
private bool AreAllValidNumericChars(string str)
{
foreach(char c in str)
{
if(!Char.IsNumber(c... | <p>Call me crazy, but why not put plus and minus buttons at either side of the TextBox control and simply prevent the TextBox from receiving cursor focus, thereby creating your own cheap NumericUpDown control?</p>
| 2,742 |
<p>Here's the core problem: I have a .NET application that is using <a href="http://en.wikipedia.org/wiki/COM_Interop" rel="noreferrer">COM interop</a> in a separate AppDomain. The COM stuff seems to be loading assemblies back into the default domain, rather than the AppDomain from which the COM stuff is being called.<... | <p>Unfortunately, A COM component is loaded within Process Space and not within the context of an AppDomain. Thus, you will need to manually tear-down (Release and Unload) your Native DLLs (applies to both COM and P/Invoke). Simply destroying an appdomain will do you no good, but respawning the whole process shouldn't ... | <p>Don't make your Controller MBR. Create a small proxy, which loads the Controller in the second domain and starts it. That way Controller dll will not be loaded in the first domain.</p>
| 30,002 |
<p>I read some properties from an xml file, amongst which is a string that refers to an llblgen object for example 'article'. For now I have set up a rather long </p>
<pre><code>Select Case myString
Case "article"
return New ArticleEntity()
</code></pre>
<p>Etc. which is getting rather ugly as it gets longer an... | <p>you could create a dictionary mapping strings to factory methods eg</p>
<pre><code>Dictionary<string, Func<Animal>> _map = new Dictionary
{
("cat", () => new Cat()),
("dog", () => new Dog())
...
}
</code></pre>
<p>Then your case statement becomes</p>
<pre><code>return _map[myString]();
</c... | <p>Notice that <code>Activator.CreateInstance</code> has got a generic version that makes a cast to a base class unnecessary (if such a base class or interface is available):</p>
<pre><code>public static IMyTrait MakeMyTrait(Type t) {
return Activator.CreateInstance<IMyTrait>(t);
}
</code></pre>
| 30,412 |
<p>I want something like this:</p>
<pre><code><msxsl:script language="C#">
??? getNodes() { ... return ... }
</msxsl:script>
<xsl:for-each select="user:getNodes()">
...
</xsl:for-each>
</code></pre>
<p>What return type should i use for <code>getNodes()</code> and what should i put in i... | <p>In principle you need to use the XPathNodeIterator to return node sets (as Samjudson says). I take it that the example you gave is a degenerated function, as you do not supply it with any parameters. However, I think it is instructive the see how you <em>could</em> fabricate nodes out of thin air. </p>
<pre><code>&... | <p>A quick google for C# xslt msxml revealed a link to the following page which gives many examples of extending XSLT in microsoft environments. </p>
<p><a href="http://msdn.microsoft.com/en-us/magazine/cc302079.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc302079.aspx</a></p>
<p>Specific... | 18,436 |
<p>I.e., a web browser client would be written in C++ !!!</p>
| <p>There are a two choices. Managed C++ (/clr:oldSyntax, no longer maintained) or C++/CLI (definitely maintained). You'll want to use /clr:safe for in-browser software, because you wnat the browser to be able to verify it.</p>
| <p>Sure, Visual Studio can compile "managed" C++. I'm not sure I understand your "web browser client" reference though; do you mean you want to compile your C++ to something that will run with Silverlight?</p>
| 11,556 |
<p>We have many WIDE html grids which scroll horizontally within a DIV in our web application.</p>
<p>I would like to find the best strategy for printing these grids on a portrait A4 page.</p>
<p>What I would like to know is what is the best way to present/display grids/data like this. </p>
<p>This question is not ... | <p>There's actually a whole book dedicated (amongst other things) to fast methods for the computation of \pi: 'Pi and the AGM', by Jonathan and Peter Borwein (available on Amazon).</p>
<p>I studied the AGM and related algorithms quite a bit: it's quite interesting (though sometimes non-trivial).</p>
<p>Note that to i... | <p>I guess it really depends on what your purpose is.</p>
<ul>
<li><strong>In a book format</strong>: I usually try span two facing pages.</li>
<li><strong>For a conference or poster</strong>: Find an extra wide printer and print it out on a large sheet of paper.</li>
<li><strong>Something more informal</strong>: Span... | 34,022 |
<p>In Java, there is a practice of declaring every variable (local or class), parameter final if they really are.</p>
<p>Though this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intention is clearly marked.</p>
<p>What are your thoughts on this a... | <p>I think it all has to do with good coding style. Of course you can write good, robust programs without using a lot of <code>final</code> modifiers anywhere, but when you think about it... </p>
<p>Adding <code>final</code> to all things which <em>should not</em> change simply narrows down the possibilities that you ... | <p>Using final <strong>for constants</strong> is strongly encouraged. However, I wouldn't use it for methods or classes (or at least think about it for a while), because it makes <strong>testing</strong> harder, if not impossible. If you absolutely must make a class or method final, make sure this class implements some... | 16,675 |
<p>In Java, I use a class in which some fields can be <code>null</code>. For example:</p>
<pre><code>class Foo {
String bar;
//....
}
</code></pre>
<p>I want to write a BarComparator for this class,</p>
<pre><code> private static class BarComparator
implements Comparator<Foo> {
p... | <p>I guess you could wrap the call to the field compareTo method with a small static method to sort nulls high or low:</p>
<pre><code>static <T extends Comparable<T>> int cp(T a, T b) {
return
a==null ?
(b==null ? 0 : Integer.MIN_VALUE) :
(b==null ? Integer.MAX_VALUE : a.com... | <p>I think early return statements would be the other alternative to lots of ifs</p>
<p>e.g.</p>
<pre><code>if(o1==null) return x;
if(o2==null) return x;
if(o1.getBar()==null) return x;
if(o2.getBar()==null) return x;
// No null checks needed from this point.
</code></pre>
| 15,586 |
<p>How do I do a regexp search against a Mandarin string?</p>
| <p>No different that against any other string; of course it requires a language and a regexp library that correctly uses unicode for its strings and doesn't assume that a string is just a byte array interpreted as ASCII. </p>
| <p>In what language? In PHP, use UTF-8 and the /u modifier.</p>
| 46,664 |
<p>I need an algorithm to store a key/value pair, where the key is an Int64. I'm currently using a sorted IntList (same as a TStringList, but stores int64s). This gives me O(log n) for search, Insert and delete operations. Since I don't ever need the items sorted, this is a little inefficient. I need some kind of hasht... | <p>Delphi 2009 and later has added Generics.</p>
<p>So starting Delphi 2009, you can implement your key/value pair in a similar manner as you do in .NET using a TDICTIONARY.</p>
<p>And TDICTIONARY in Delphi uses a hash table table and has O(1) operations.</p>
| <p>Some thoughts, not a full blown solution.</p>
<p>Unless there is definite proof that the search itself is the bottleneck (don't use your "feeling" to detect bottlenecks, use a code profiler) I would stick with the IntList... If the time spent in the actual search/insert/delete does not amount for at least 20% of th... | 35,523 |
<p>I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE. </p>
<p>What are the steps to create such an executable?</p>
| <p>Single Assembly Deployment of Managed and Unmanaged Code
Sunday, February 4, 2007</p>
<p>.NET developers love XCOPY deployment. And they love single assembly components. At least I always feel kinda uneasy, if I have to use some component and need remember a list of files to also include with the main assembly of t... | <p>PostBuild from <a href="http://www.xenocode.com/" rel="nofollow noreferrer">Xenocode</a> can package up both managed and unmanged into a single exe.</p>
| 9,789 |
<p>I ported gchecky to the google app engine. you can <a href="http://web2py.appspot.com/plugin_checkout" rel="nofollow noreferrer">try it here</a></p>
<p>It implements both level 1 (cart submission) and level 2 (notifications from google checkout).</p>
<p>Is there any other payment option that works on the google ap... | <p>I think you can have a look into the official toolkit from PayPal's X Platform <a href="http://code.google.com/p/paypalx-gae-toolkit/" rel="noreferrer">http://code.google.com/p/paypalx-gae-toolkit/</a></p>
| <p>Paypal has a <a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_soap_PayPalSOAPAPIArchitecture" rel="nofollow noreferrer">SOAP interface</a>. You can certainly access that from within GAE--though you might run into timeout issues while waiting for the response.</p>
| 32,423 |
<p>I'd like to send mail without bothering with the SMTP-Server which is used for delivery.</p>
<p>So <a href="http://java.sun.com/products/javamail/" rel="noreferrer">JavaMail API</a> doesn't work for me because I have to specify a SMTP server to connect to.</p>
<p>I'd like the library to find out on its own which S... | <p>One possible solution: get the MX record on your own and use <a href="http://java.sun.com/products/javamail/" rel="noreferrer">JavaMail API</a>.</p>
<p>You can get the MX record using the <a href="http://www.dnsjava.org/" rel="noreferrer">dnsjava</a> project:</p>
<p>Maven2 dependency:</p>
<pre><code><dependenc... | <p>Don't.</p>
<p>Sending email is much more complex than it seems. Email servers excel at (or should excel at) reliable delivery.</p>
<p>Set up a separate email server if you need to- that will be essentially the same as implementing one in Java (I doubt you will find libraries for this task- they would be essentiall... | 34,190 |
<p>I am writing a client-side validation function for <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.aspx" rel="nofollow noreferrer">CustomValidator</a> and I need to check length of entered string. But before, to counteract cheaters a little, I want to remove all leading and... | <p>The easiest way is to call the ValidatorTrim(value) javascript function on your page. This function comes from the javascript that every asp.net validator includes when added to a page.</p>
<p>But i don't think its a documented feature, so you cant rely on it being available in future versions of the validators. So... | <p>Have to say the question I asked could be easy googled, and I have already investigated it. But I want to contribute to StackOverflow community a solution which is the simplest if you are writing a client validation function for a ASP.NET page. </p>
<p>It's known what RequiredFieldValidator also trims spaces of a s... | 44,614 |
<p>Does Python have a unit testing framework compatible with the standard xUnit style of test framework? If so, what is it, where is it, and is it any good?</p>
| <p>Python has several testing frameworks, including <code>unittest</code>, <code>doctest</code>, and <code>nose</code>. The most xUnit-like is <code>unittest</code>, which is documented on Python.org.</p>
<ul>
<li><a href="https://docs.python.org/3/library/unittest.html" rel="nofollow noreferrer"><code>unittest</code>... | <p>There is also <a href="http://pyunit.sourceforge.net/" rel="nofollow noreferrer">PyUnit</a> which might be what you're looking for.</p>
| 5,726 |
<p>Is it true that the smallest amount of memory that I can allocate in managed code is a byte? </p>
<p>Do I understand correctly that a Boolean variable takes up much more than a bit of memory? </p>
<p>Is there a way for me to allocate memory, in .net, in chunks smaller than a byte?</p>
| <p>You cannot allocate memory on any computer - that I'm aware of - in amounts smaller than one byte, definetly not on a PC.</p>
<p>Also, with .net <em>you</em> aren't allocating any memory, thats all looked after for you unless you're using C++ in .Net (with garbage collection it's possibly better to say you're "usin... | <p>Try migrating to a <a href="http://en.wikipedia.org/wiki/Intel_4040" rel="nofollow noreferrer">Intel 4040</a>. Then your booleans will only use 4-bits. However if you don't find one in the flea market, or happen to have on in the attic, I'd recommend bit-arrays, because with the incredible advent of 64-bit, your boo... | 45,851 |
<p>When I am working with ASP.NET, I find that there are always unexpected things I run into that take forever to debug. I figure that having a consolidated list of these would be great for those "weird error" circumstances, plus to expand our knowledge of oddness in the platform.</p>
<p>So: answer with one of your "G... | <p>Don't dynamically add controls after the page init event as it will screw up the viewstate tree.</p>
| <p>(VB.NET) If you send an Object via a Property's Get accessor into a function with a ByRef keyword, it will actually attempt to update the object using the Set accessor for the Property.</p>
<p>Ex:</p>
<p><code>UpdateName(ByRef aName as String)</code></p>
<p><code>UpdateName(Employee.Name)</code> will attempt to u... | 9,178 |
<p>My problem is that all the textbox's my formview are getting cleared when I hit the submit button.</p>
<p>I currently have a page with a small section that has an update panel around it. This small section adds an address to my databse. To the left of this form there is a gridview that is tied into the formview. So... | <p>in the page_load are you using if(!Page.IsPostback) { ... } so if it's a postback nothing gets re-bound?</p>
| <p>Yup many hours later I found that a single panel that was wrapped around the section had a EnableViewState="false" added to it. Sad part is that I know I didn't add that because I didn't even know what it was until craig here mentioned it. Visual Studio must have added it sometime.</p>
| 31,374 |
<p>I have to choose a technology to connect my <strong>Application/Presentation Layer</strong> (Java Based) with the <strong>Service Layer</strong> (Java Based). Basically looking up appropriate Spring Service from the Business Delegate Object.</p>
<p>There are so many options out there that it is confusing me. Here a... | <p>It mostly boils down to do you want to use Spring Remoting (which Spring RMI and <a href="http://activemq.apache.org/camel/spring-remoting.html" rel="nofollow noreferrer">Apache Camel</a> are implementations of) - or do you want to use JAX-WS for web services (which CXF or Metro implement). i.e. do you want automati... | <p>Spring Remoting would seem like the simplest approach. It also would leave you open to more complex approaches in the future if that is the direction you want to take. </p>
<p>From the limited view of your requirements, I would stick with a simple solution with a lower learning curve, and leave the ESB till you d... | 43,831 |
<p>I thought I understood what the default method does to a hash... </p>
<p>Give a default value for a key if it doesn't exist:</p>
<pre><code>irb(main):001:0> a = {}
=> {}
irb(main):002:0> a.default = 4
=> 4
irb(main):003:0> a[8]
=> 4
irb(main):004:0> a[9] += 1
=> 5
irb(main):005:0> a
=>... | <p><code>Hash.default</code> is used to set the default value <strong>returned</strong> when you query a key that doesn't exist. An entry in the collection is not created for you, just because queried it.</p>
<p>Also, the value you set <code>default</code> to is an instance of an object (an Array in your case), so wh... | <p>I'm not sure if this is what you want, but you can do this to always return an empty array when a missing hash key is queried.</p>
<pre><code>h = Hash.new { [] }
h[:missing]
=> []
#But, you should never modify the empty array because it isn't stored anywhere
#A new, empty array is returned every time
h[:miss... | 23,153 |
<p>Just how much slower are events? I have written a streaming XML parser (that can handle open-ended and incomplete documents) and by tearing out the events and using an interface instead I got a significant speed boost.</p>
<p>Does any one else have any war stories?</p>
<p>(Let's not open the GC can of worms here, ... | <p>Events firing are delegate invocations, which are a <a href="http://msdn.microsoft.com/en-us/magazine/cc163759.aspx" rel="nofollow noreferrer">a bit slower than virtual calls</a></p>
<p><a href="https://i.stack.imgur.com/xExdh.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xExdh.gif" alt="alt te... | <p>If there's no reflection involved in the calls then I assume the overhead is pretty negligible. Assumption could be wrong of course . Do you have a micro benchmark to demonstrate this?</p>
| 19,607 |
<p>I have the following rails migration:</p>
<pre><code>create_table :articles do |t|
t.integer :user_id, :allow_null => false
t.integer :genre_id, :allow_null => false
t.string :url, :limit => 255, :allow_null => false
t.string :title, :limit => 60, :allow_null => false
t.text :summary, :l... | <p>Not much if you mean in terms of performance or storage efficiency. However, it's just good practice to push as many of your low-level constraints into the database layer. For one thing, it guarantees that a subtle bug in Rails isn't going to lead to some randomly <code>NULL</code> data in a not-null field. Likew... | <p>This doesn't seemt o affect mySQL, but you should be aware of 2 recently fixed migration issues (one when you don't specify default)</p>
<p><a href="http://blog.codefront.net/2008/05/04/living-on-the-edge-of-rails-19-change_table-for-migrations-and-more/" rel="nofollow noreferrer">http://blog.codefront.net/2008/05/... | 29,777 |
<p>I want to use javascript to insert some elements into the current page.
Such as this is the original document:
<p>Hello world!</p></p>
<p>Now I want to insert an element in to the text so that it will become:</p>
<p><p>Hello <span id=span1>new</span> world!</p></p>
<p>I need th... | <p>Simply override any span styles. Set layout properties back to browser defaults and set formating to inherit from the parent:</p>
<pre><code>span#yourSpan {
/* defaults */
position: static;
display: inline;
margin: 0;
padding: 0;
background: transparent;
border: none;
/* inherit from parent node *... | <p>Include the class definition that's defined in CSS on your JavaScript version of the <code><span></code> tag as well.</p>
<pre class="lang-html prettyprint-override"><code><span class="class_defined_in_css">
</code></pre>
<p>(where this <code><span></code> tag would be part of your JavaScript cod... | 10,563 |
<p>What is the best way to issue a http get in VB.net? I want to get the result of a request like <a href="http://api.hostip.info/?ip=68.180.206.184" rel="noreferrer">http://api.hostip.info/?ip=68.180.206.184</a> </p>
| <p>In VB.NET:</p>
<pre><code>Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://api.hostip.info/?ip=68.180.206.184")
</code></pre>
<p>In C#:</p>
<pre><code>System.Net.WebClient webClient = new System.Net.WebClient();
string result = webClient.DownloadString("http://api.... | <pre><code>Public Function getLoginresponce(ByVal email As String, ByVal password As String) As String
Dim requestUrl As String = "your api"
Dim request As HttpWebRequest = TryCast(WebRequest.Create(requestUrl), HttpWebRequest)
Dim response As HttpWebResponse = TryCast(request.GetResponse(), HttpWebResponse... | 11,796 |
<p>Ok, I have one JavaScript that creates rows in a table like this:</p>
<pre><code> function AddRow(text,rowID) {
var tbl = document.getElementById('tblNotePanel');
var row = tbl.insertRow(tbl.rows.length);
var cell = row.insertCell();
var textNode = document.createTextNode(text);
cell.id = rowID... | <p>Try this:</p>
<pre><code>cell.onclick = function() { clickTest(rowID); };
</code></pre>
<p>The idea is that you are binding the onclick handler to the anonymous function. The anonymous function calls clickTest with rowID as the parameter.</p>
| <p>The suggested solutions work most of the time except for special scenarios.</p>
<p>In case you have a for loop adding <code>onclick</code>s calling another function with different parameters and when testing you realize all your item's behave like the last item, you may consider adding <code>onclick</code> as a text... | 39,093 |
<p>I ran into a problem while cleaning up some old code. This is the function:</p>
<pre><code>uint32_t ADT::get_connectivity_data( std::vector< std::vector<uint8_t> > &output )
{
output.resize(chunks.size());
for(chunk_vec_t::iterator it = chunks.begin(); it < chunks.end(); ++it)
{
... | <p>After a bit of work I came up with this solution:</p>
<pre><code>std::transform(chunks.begin(), chunks.end(), back_inserter(tmp), boost::bind(&ADTChunk::get_connectivity_data, _1) );
</code></pre>
<p>It required that I change get_connectivity_data to return std::vector instead of taking one by reference, and i... | <p>I don't really get what you are driving at with regards to the lambda, but I can make a couple of general suggestions for code cleanup involving STL containers.</p>
<p>Use typedefs of all STL container types:</p>
<pre><code>typedef std::vector<uint8_t> Chunks;
typedef std::vector<Chunks> Output;
uint32... | 27,771 |
<p>I can't seem to get a scrollbar to work in an inner stack/flow. Does anyone know how to?</p>
| <p>Just fix height and add ":scroll => true" parameter:</p>
<pre><code>Shoes.app(:title => "Scrolll!" ) do
flow :margin => 10 do
stack :width => "150px", :height => "200px", :scroll => true do
para "all you need is love", "all you need is love", "all you need is love", "all you need is lov... | <p>I'm not sure what exactly you mean by "an inner stack/flow", but we use iframes for our subpane windows which has a scrolling attribute you can set. Otherwise you can use a javascript framework like YUI to get subpane windows that can allow scrolling capabilities.</p>
| 34,717 |
<p>We use a number of diffrent web services in our company, wiki(moinmoin), bugtracker (internally), requestracker (customer connection), subversion. Is there a way to parse the wikipages so that if I write "... in Bug1234 you could ..." Bug1234 woud be renderd as a link to <code>http://mybugtracker/bug1234</code></p>
| <p>check out the interwiki page in moinmoin, (most wikis have them) we use trac for example and you can set up different link paths to point to your different web resources. So in our Trac you can go [[SSGWiki:Some Topic]] and it will point to another internal wiki.</p>
| <p>I finally found the solution.
"Add the site to data/intermap.txt" found at:</p>
<p><a href="http://moinmo.in/MoinMoinQuestions#MoinMoinQuestions.2BAC8-Administration.Howtoaddnewinterwikisites.3F" rel="nofollow noreferrer">http://moinmo.in/MoinMoinQuestions#MoinMoinQuestions.2BAC8-Administration.Howtoaddnewinterwik... | 44,712 |
<p>I like Vim's visual mode. <kbd>v</kbd> for highlight/select chars or lines, <kbd>Ctrl</kbd><kbd>v</kbd> for rectangle highlighting, as far as I know (I am a beginner). Is there any way to use visual mode to highlight last two chars, for example, on each line for some selected lines? The selected lines are in differe... | <p>My approach to this sort of problem is to use line selection (shift-V, cursor movement) to select the lines-of-interest, then type:</p>
<pre><code> :s/..$//
</code></pre>
<p>That's a substitution, using the regex <code>..$</code> which will match the last two characters at the end of the line. Then substitute 'not... | <p>I can't think of a way to do this in visual mode, but you could use a command like this to do it...</p>
<pre><code>:10,20 normal $xx
</code></pre>
<p>This would go to each line between line number 10 and 20, use $ to go to the end of the line, and then use x twice to delete two characters. Normal just tells vim t... | 31,256 |
<p>I made a tea bowl, but it leaked when making it in PLA...</p>
<p>What are the key points to keep in mind when designing and printing an object that is intended to hold water using an FDM printer? </p>
| <p>I've found that a double-walled base seems to give better results than trying to make the base very thick. Any imperfections in the print, or cracking caused by removing the print can lead to leaks - but if there is layer/infill/layer, the result seems to turn out better for me.</p>
<p>Vase mode can be effective (a... | <p>When designing the object, you should make sure your object is completely enclosed (obviously). When printing, try increasing the print temperature so that the layers stick to each other well. The most important thing is the print temperature, because if the layers don't adhere to each other well, you will get a lea... | 677 |
<p>Is there a way to listen for a javascript function to exit? A trigger that could be setup when a function has completed?</p>
<p>I am attempting to use a user interface obfuscation technique (BlockUI) while an AJAX object is retrieving data from the DB, but the function doesn't necessarily execute last, even if you ... | <p>However you're accomplishing your Ajax routines, what you need is a "callback" function that will run once it's complete:</p>
<pre><code>function ajaxCall(callback){
//do ajax stuff...
callback();
}
</code></pre>
<p>Then:</p>
<pre><code>function doStuff(){
blockUI();
ajaxCall(unblockUI);
}
</code>... | <p>You can do a synchronous xhr. This would cause the entire UI block for the duration of the call (no matter how long it might take).</p>
| 16,324 |
<p>I'm building a project that uses the JVCL plugin system, which relies on runtime Delphi packages, and ever since I added it to my project, debugging has become a nightmare because I'm no longer able to step-trace into the source of any VCL or RTL units. They're all marked as gray dots in the debugger, (when the rel... | <p>This is working as designed.</p>
<p>When you are building with packages, you are executing the package code, and not using any DCU's. Therefore, the DCU's are compiled in, and you don't get access to the Debug DCU's.</p>
<p>You can either turn off packages altogether, or don't compile with the specific packages y... | <p>It could be the DCU's you have are out of date, so the debugger doesn't step into the code.</p>
<p>Usually deleting all the DCU's then doing a Build All will fix this.</p>
<p>You may need to delete DCU's in the search path too, just to be sure. Make a backup first of course...</p>
| 32,160 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.