instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've got a couple django models that look like this:</p>
<pre><code>from django.contrib.sites.models import Site
class Photo(models.Model):
title = models.CharField(max_length=100)
site = models.ForeignKey(Site)
file = models.ImageField(upload_to=get_site_profile_path)
def __unicode__(self):
... | <p>I would delete <code>site</code> field on my <code>Photo</code> model and add a <code>ForeignKey</code> to <code>Gallery</code>. I would remove <code>limit_choices_to</code> from <code>photos</code> fields on <code>Gallery</code> model.</p>
<p>Because you are using <code>ForeignKey</code>s to <code>Site</code>s, th... | <p>According to the <a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#manytomanyfield" rel="nofollow noreferrer">docs</a>, "limit_choices_to has no effect when used on a ManyToManyField with an intermediate table". By my reading, that means it has no effect at all, because ManyToManyFields use intermedi... | 44,940 |
<p>All,</p>
<p>this is my code</p>
<pre><code>//declare string pointer
BSTR markup;
//initialize markup to some well formed XML <-
//declare and initialize XML Document
MSXML2::IXMLDOMDocument2Ptr pXMLDoc;
HRESULT hr;
hr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
pXMLDoc->async = VARIANT_FALSE... | <p>Try replacing</p>
<pre><code> BSTR Markup;
</code></pre>
<p>with </p>
<pre><code> bstr_t Markup;
</code></pre>
<p>BSTR is pretty much a dumb pointer, and I think that the return result of GetXML() is being converted to a temporary which is then destroyed by the time you get to see it. bstr_t wraps that with some... | <p>Ok, I think Patrick is right. I took your code and made a quick ATL EXE project named getxmltest.
I added this line after #include directives</p>
<pre><code>#import "MSXML3.DLL"
</code></pre>
<p>removed the post-build event which registers the component because I dont want to expose any component from the exe but ... | 41,976 |
<p>I've created a custom list, and made some changes to the way the CQWP renders it on a page by modifying ItemStyle.xsl. However, I'd like to use some custom css classes and therefore I'd like to link to my own custom .css file from the head tag of the pages containing this CQWP.</p>
<p>So my question is, where to do... | <p>The microsoft official way is just to copy them into the relevant folders (as seen by downloading their template packs). However, you could also create your own site definition and add the items to the correct libraries and lists in the same way that the master pages are added.</p>
<p>If you are going to deploy CS... | <p>Consider uploading them to "Style Library" in the root of the site collection.
<p>If you don't have a "Style Library" at the root, consider making one -- it's just a document library.
<p>Make sure the permissions are set correctly so everyone who needs to read it can.
<p>You can reference them using "/Style%20Librar... | 7,712 |
<p>When working with Silverlight, I've noticed that Firefox will cache the XAP file, so if I do an update, a user may be stuck using an outdated version. Is there a way to force the browser to either re-download the XAP file every time, or maybe only force it to after an update has been published? Or is there a setti... | <p>The query string works perfectly, but I wouldn't use <em>DateTime.Now</em>, because it forces the user to re-download the app every time. Instead, we use the following:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
var versionNumber = Assembly.GetExecutingAssembly().GetName().Version.ToS... | <p>The query string idea doesn't work for me in Silverlight 4. The server seems to cache the darned xap (though not the aspx file). The solution that does work in SL4 is to go to properties on your Silverlight project, go to Assembly info and put in a version.</p>
| 39,614 |
<p>I'm designing an application which deals with two sets of data - Users and Areas. The data is read from files produced by a third party. I have a User class and an Area class, and the data is read into a Users array and an Areas array (or other appropriate memory structure, depending on the technology we go with).... | <p>this is really a many-to-many relationship,</p>
<pre><code>User <<--->> Area
</code></pre>
<p>break it up into 3 objects, User, Area, and UserArea:</p>
<pre><code>User: Id, name, etc.
Area: Id, name, etc.
UserArea: UserId, AreaId
</code></pre>
| <p>Why not use DataTables with relations, if .NET is involved? You may want to look into Generics as well, again, if .NET is involved.</p>
| 18,557 |
<p>I would like to reload an <code><iframe></code> using JavaScript. The best way I found until now was set the iframe’s <code>src</code> attribute to itself, but this isn’t very clean. Any ideas?</p>
| <pre><code>document.getElementById('some_frame_id').contentWindow.location.reload();
</code></pre>
<p>be careful, in Firefox, <code>window.frames[]</code> cannot be indexed by id, but by name or index</p>
| <p>If you tried all of the other suggestions, and couldn't get any of them to work (like I couldn't), here's something you can try that may be useful.</p>
<p><strong>HTML</strong></p>
<pre><code><a class="refresh-this-frame" rel="#iframe-id-0">Refresh</a>
<iframe src="" id="iframe-id-0"></iframe&... | 11,193 |
<p>Heres the issue.</p>
<p>I have a table(mySQL) that contains dates and some of them are null.
I know that I can use DateTime? or Nullable to allow nulls, but I'm not sure where to set it. </p>
<p>What I've tried:</p>
<p>I built the class in the dblm. The date propery has the following attributes set:</p>
<pre><co... | <p>I remember a <a href="http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic47934.aspx" rel="nofollow noreferrer">problem</a> with mysql's ADO.NET driver, where it was not playing nice with nulled date/time fields at all.</p>
<p>Even IsDBNull was throwing exception on a field with null da... | <p>Fixed -
It turned out to be an issue with the connection string to connect to the mySQL DB. </p>
<p>Also I didn't know that it was possible to drop a table into the DBML using the Server Explorer. All I needed to do was connect to the database then drop the table onto the DBML.</p>
| 45,723 |
<p>My workplace filters our internet traffic by forcing us to go through a proxy, and unfortunately sites such as IT Conversations and Libsyn are blocked. However, mp3 files in general are not filtered, if they come from sites not on the proxy's blacklist.</p>
<p>So is there a website somewhere that will let me give ... | <p>Can you SSH out? SSH Tunnels are your friend!</p>
| <p>There are many other Development/Dotnet/Technology podcasts, try one of <a href="https://stackoverflow.com/questions/1644/what-good-technology-podcasts-are-out-there">those</a>. for the blocked sites try an anonymous proxy site, there are plenty out there.</p>
| 15,770 |
<p>Let's say you work someplace where every change to source code must be associated with a bug-report or feature-request, and there is no way to get that policy reformed. In such an environment, what is the best way to deal with code refactorings (that is, changes that improve the code but do not fix a bug or add a f... | <p>I vote for the "sneak in refactorings" approach, which is, I believe, the way refactoring is meant to be done in the first place. It's probably a bad idea to refactor just for the sake of "cleaning up the code." This means that you're making changes for no real reason. Refactoring is, by definition, modifying the... | <p>Lets have a look at each option:</p>
<ul>
<li>Write up a bug-report and associate the refactoring with it.</li>
</ul>
<p>If you feel that, in your opinion, the original code poses a security risk or potential for crashing or instability. Write a small bug report outlining the danger, and then fix it.</p>
<ul>
<li... | 7,790 |
<p>Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity.</p>
<p>1: <a href="http://example... | <p>Oh, whatever, I found the answer myself: </p>
<pre><code>/// <summary>
/// Replaces each occurrence of sPattern in sInput with sReplace. This is done
/// with the CLR:
/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace).
/// The result of the replacement is the return value.
/// </... | <p>See also <a href="https://stackoverflow.com/questions/4213788/how-to-create-clr-stored-procedure-with-nvarcharmax-parameter">How to create CLR stored procedure with Nvarchar(max) parameter</a> where you'll discover how/why you really should use the SqlChars data type. See <a href="https://learn.microsoft.com/en-us/... | 46,465 |
<p>What are good ways of dealing with the issues surrounding plugin code that interacts with outside system?</p>
<p>To give a concrete and representative example, suppose I would like to use Subversion and Eclipse to develop plugins for WordPress. The main code body of WordPress is installed on the webserver, and the ... | <p>There are a few ways to do what you need in PostgreSQL.</p>
<ul>
<li><p>If you can install modules, look at the tablefunc contrib. It has a connectby() function that handles traversing trees. <a href="http://www.postgresql.org/docs/8.3/interactive/tablefunc.html" rel="noreferrer">http://www.postgresql.org/docs/8.3/... | <p>If you need to store arbitrary graphs, not just hierarchies, you could push Postgres to the side and try a graph database such as <a href="http://agraph.franz.com/support/learning/" rel="nofollow noreferrer">AllegroGraph</a>:</p>
<p>Everything in the graph database is stored as a triple (source node, edge, target n... | 7,654 |
<p>I have a Java bean like this:</p>
<pre><code>class Person {
int age;
String name;
}
</code></pre>
<p>I'd like to iterate over a collection of these beans in a JSP, showing each person in a HTML table row, and in the last row of the table I'd like to show the total of all the ages.</p>
<p>The code to generate ... | <p><strong><em>Note:</strong> I tried combining answers to make a comprehensive list. I mentioned names where appropriate to give credit where it is due.</em></p>
<p>There are many ways to solve this problem, with pros/cons associated with each:</p>
<p><strong>Pure JSP Solution</strong></p>
<p>As ScArcher2 mentione... | <p>It's a bit hacky, but in your controller code you could just create a dummy Person object with the total in it!</p>
<p>How are you retrieving your objects? HTML lets you set a <a href="http://www.w3schools.com/tags/tag_tfoot.asp" rel="nofollow noreferrer"><TFOOT></a> element which will sit at the bottom of an... | 12,856 |
<p>I was going to ask a question here about whether or not my design for some users/roles database tables was acceptable, but after some research I came across this question:</p>
<p><a href="/questions/1451/what-is-the-best-way-to-handle-multiple-permission-types">What is the best way to handle multiple permission typ... | <p>You use bitwise operations. The pseudo-code would be something like:</p>
<pre><code>bool HasPermission(User user, Permission permission) {
return (user.Permission & permission) != 0;
}
void SetPermission(User user, Permission permission) {
user.Permission |= permission;
}
void ClearPermission(User us... | <p>Actually, this is how we determine authority within a fairly large web application that I'm the DBA for. </p>
<p>If you are going to do something like this, you'll really benefit from having a <a href="http://snippets.dzone.com/posts/show/1184" rel="nofollow noreferrer">numbers table</a>. It will make your calcula... | 8,503 |
<p>I have this Perl script with many defined constants of configuration files. For example:</p>
<pre><code>use constant {
LOG_DIR => "/var/log/",
LOG_FILENAME => "/var/log/file1.log",
LOG4PERL_CONF_FILE => "/etc/app1/log4perl.conf",
CONF_FIL... | <p>I'd probably write it like this:</p>
<pre><code>use Readonly;
Readonly my $LOG_DIR => "/var/log";
Readonly my $LOG_FILENAME => "$LOG_DIR/file1.log";
Readonly my $ETC => '/etc/app1';
Readonly my $LOG4PERL_CONF_FILE => "$ETC/log4perl.con";
# hash because we don't have an ... | <p>Depending on what you are doing, you might not want constants at all. Mostly, I write stuff that other people use to get their stuff done, so I solve this problem in a way that gives other programmers flexibility. I make these things into methods:</p>
<pre><code> sub base_log_dir { '...' }
sub get_log_file
... | 28,337 |
<p>One of my favourite tools for linux is <a href="http://en.wikipedia.org/wiki/Lsof" rel="noreferrer" title="Wikipedia">lsof</a> - a real swiss army knife!</p>
<p>Today I found myself wondering which programs on a WinXP system had a specific file open. Is there any equivalent utility to lsof? Additionally, the file i... | <p>Use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer" title="Process Explorer">Process Explorer</a> from the Sysinternals Suite, the Find Handle or DLL function will let you search for the process with that file open.</p>
| <p>If you right-click on your "Computer" (or "My Computer") icon and select "Manage" from the pop-up menu, that'll take you to the Computer Management console.</p>
<p>In there, under System Tools\Shared Folders, you'll find "Open Files". This is probably close to what you want, but if the file is on a network share th... | 3,651 |
<p>Ok as programmers we all follow programming standards (as in W3 standards, or C++ standard, etc...), and many of us consider these standards "sacred" and also many seasoned programmers can recite their choice of standards by heart when asked about a question in their field of expertise. You can see this last case a ... | <p>As a former prominent member of standards committees (C#, CLI), I personally appreciated public input on the standard. We, in fact, released interim draft standards a couple of times and got some public eyes on them before they were officially ratified.</p>
<p>It's all about getting a fresh pair of eyes -- the folk... | <p>Perl has neither a standard nor a committee, but I've participated from time to time in the mailing list (known as <a href="http://lists.cpan.org/showlist.cgi?name=perl5-porters" rel="nofollow noreferrer">p5p</a>) where its many authors and maintainers communicate among themselves, and I've written an article (<a hr... | 39,612 |
<p>On Linux, feenableexcept and fedisableexcept can be used to control the generation of SIGFPE interrupts on floating point exceptions. How can I do this on Mac OS X Intel?</p>
<p>Inline assembly for enabling floating point interrupts is provided in <a href="http://developer.apple.com/documentation/Performance/Conce... | <p>Exceptions for sse can be enabled using <code>_MM_SET_EXCEPTION_MASK</code> from <code>xmmintrin.h</code>. For example, to enable invalid (nan) exceptions, do</p>
<pre><code>#include <xmmintrin.h>
...
_MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID);
</code></pre>
| <p>On Mac OS X this is moderately complicated. OS X uses the SSE unit for all FP math by default, not the x87 FP unit. The SSE unit does not honor the interrupt options, so that means that in addition to enabling interrupts, you need to make sure to compile all your code not to use SSE math.</p>
<p>You can disable the... | 30,678 |
<p>I've been asked by my team leader to investigate MSMQ as an option for the new version of our product. We use SQL Service Broker in our current version. I've done my fair share of experimentation and Googling to find which product is better for my needs, but I thought I'd ask the best site I know for programming ans... | <p>Having just migrated my application from Service Broker to MSMQ, I would have to vote for using MSMQ. There are several factors to take into account, but most of which have to do with how you are using your data and where the processing lives.</p>
<ul>
<li>If processing is done in the database? <strong>Service Brok... | <blockquote>
<p>Do you need to be able to send messages while the destination is down? MSMQ</p>
</blockquote>
<p>I don't understand why? SSB can send messages to disconnected destination without any problem. All this messages going to transmission queue and would be delivered when destination stay reachable.</p>
| 29,771 |
<p>Is there any type of software in which you can animate the way the .stl object will be printed? </p>
<p>I'm not talking about what the end result looks like. I'm talking about a tool which acts like it's printing the given object as an animation.</p>
<p>I know it somehow depends on your printer but is there anythi... | <p>You may wish to consider <a href="https://craftunique.com/craftware" rel="nofollow">Craftware</a> for your purposes. It's a free program in beta form that does provide a tool-path animation for printing the layers. It is not so much specific to a printer as it is configurable for your own requirements. <a href="http... | <p>I'm using <a href="http://www.mattercontrol.com" rel="nofollow">MatterControl</a> and it has such visualization. User can see synchronized animation which shows how the object is actually printed and user is able to see each path of filament put onto the layer.</p>
<p>It's possible to control starting and ending po... | 269 |
<p>I'm working on a project where I need to analyze a page of text and collections of pages of text to determine dominant words. I'd like to know if there is a library (prefer c# or java) that will handle the heavy lifting for me. If not, is there an algorithm or multiple that would achieve my goals below. </p>
<p... | <p>One option for what you're doing is term frequency to inverse document frequency, or tf-idf. The strongest terms will have the highest weighting under this calculation. Check if out here: <a href="http://en.wikipedia.org/wiki/Tf-idf" rel="noreferrer">http://en.wikipedia.org/wiki/Tf-idf</a></p>
<p>Another option is... | <p>Check MapReduce model to get the word count and then derive the frequency as described in tf-idf</p>
<p>Hadoop is a apache MapReduce framework that can be used for the heavy lifting task of word count on many documents.
<a href="http://hadoop.apache.org/common/docs/current/mapred_tutorial.html" rel="nofollow norefe... | 27,110 |
<p>Right now, I have two Eclipse projects - they both use Maven 2 for all their jar-dependency goodness.</p>
<p>Inside Eclipse, I have project Foo included in project Bar's build path, so that I can use Foo's classes from project Bar. This works really well in Eclipse land, but when I try:</p>
<pre><code>mvn compile... | <p>Maybe you are referencing the other project via Eclipse configure-> build path only. This works as long as you use Eclipse to build your project.</p>
<p>Try running first <code>mvn install</code> in project Bar (in order to put Bar in your Maven repository), and then add the dependency to Foo's pom.xml.</p>
<p>Tha... | <p>If you reference a local project, but its version has been updated (usually increased), it could maybe only be found in your local repo and you have to update the (likely fixed) version of it in your POM(s).</p>
<hr>
<p>We have a "common project" (used everywhere) which does not necessarily need to be versioned si... | 16,502 |
<p>I was very impressed with the OpenCalais system. It's (is/has) a web service where you send your text, they analyze it, then you are provided with a series of categorized (RDF enabled) tags that your document belongs to.</p>
<p>But - at the moment - English is the only supported language.</p>
<p>Do you know of sim... | <p><a href="http://stanbol.apache.org/" rel="nofollow">Apache Stanbol</a> can analyze texts in many different languages. So far the following languages are supported (precision and recall values may vary according to the language):</p>
<ul>
<li>English,</li>
<li>中文 (Chinese),</li>
<li>Español (Spanish),</li>
<li>Русск... | <p>OpenCalais supports both French and Spanish metadata tagging for entities. The set of entities will be extended in future releases. See our online documentation at <a href="http://www.opencalais.com/documentation/calais-web-service-api" rel="nofollow noreferrer">http://www.opencalais.com/documentation/calais-web-ser... | 41,400 |
<p>How do you decide if something goes in the view or the controller?</p>
<p>Here are some specific examples: </p>
<ul>
<li>Zend_Captcha: Does the controller generate the captcha and pass it to the view or does the view generate it?</li>
<li>Zend_Alc: Does the view decide if a segment of the view should be displayed ... | <p>Generally speaking, this question can apply to any MVC framework. Here are the guidelines I use: </p>
<ol>
<li><p>Skinny controllers. If possible, have your controllers do little more than invoke business logic on your models and pass results to your views. </p></li>
<li><p>Views do nothing but View Logic. Do anyth... | <p>For Capcha you can generate in the view. For Acl use the view. Zend_Session is accessible by both - the controller and the view</p>
| 22,140 |
<p>On Mac OS X, I am running Flex Builder (which is basically a customized Eclipse). When I do a Find it beeps if it cannot find the selected text and when it wraps the search to the top.</p>
<p>Is it possible to turn off that beep? I've searched the internet and the preferences pane to no avail.</p>
| <p>You can get rid of it by turning down the alert volume system-wide in the Mac OS sound preferences (Sound -> Sound Effects -> Alert volume).</p>
| <p>I found a better solution, compared to the one that changes the 'beep' sound to a silent .wav file.</p>
<p><strong>Settings -> System -> Sound -> App volume and device preferences (Scroll all the way down) -> System Sounds -> Slide it to 0</strong></p>
<p>I am on Windows 10, and it worked for me. I ha... | 42,984 |
<p>I know that most people recommend using HttpRuntime.Cache because it has more flexibility... etc. But what if you want the object to persist in the cache for the life of the application? Is there any big downside to using the Application[] object to cache things?</p>
| <p>As long as you don't abuse the application state, then I don't see a problem in using it for items that you don't want to expire.
Alternatively I would probably use a static variable near the code that uses it. That way you avoid to go through <code>HttpApplicationState</code> and then be forced to have a reference ... | <p>Use cache when you want items to automatically expire or get reclaimed when memory is scarse. Otherwise use static variables if you can, because they will yield better performance then digging through the ApplicationState collection. I'm not exactly sure what would be the case when to use ApplicationState, but there... | 42,322 |
<p>If you're creating a temporary table within a stored procedure and want to add an index or two on it, to improve the performance of any additional statements made against it, what is the best approach? Sybase says <a href="http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc20020_1251/html/databases/data... | <p>A few thoughts: </p>
<ul>
<li>If your temporary table is so big that you have to index it, then is there a better way to solve the problem? </li>
<li><p>You can force it to use the index (if you are sure that the index is the correct way to access the table) by giving an optimiser hint, of the form: </p>
<pre><co... | <p>In Sybase if you create a temp table and then use it in one proc the plan for the select is built using an estimate of 100 rows in the table. (The plan is built when the procedure starts before the tables are populated.) This can result in the temp table being table scanned since it is only "100 rows". Calling a ano... | 7,728 |
<p>This issue came up when I got different records counts for what I thought were identical queries one using a <code>not in</code> <code>where</code> constraint and the other a <code>left join</code>. The table in the <code>not in</code> constraint had one null value (bad data) which caused that query to return a coun... | <p>Query A is the same as:</p>
<pre><code>select 'true' where 3 = 1 or 3 = 2 or 3 = 3 or 3 = null
</code></pre>
<p>Since <code>3 = 3</code> is true, you get a result.</p>
<p>Query B is the same as:</p>
<pre><code>select 'true' where 3 <> 1 and 3 <> 2 and 3 <> null
</code></pre>
<p>When <code>ansi... | <p>also this might be of use to know the logical difference between join, exists and in
<a href="http://weblogs.sqlteam.com/mladenp/archive/2007/05/18/60210.aspx" rel="nofollow noreferrer">http://weblogs.sqlteam.com/mladenp/archive/2007/05/18/60210.aspx</a></p>
| 15,697 |
<p>This should be straight forward for a guru. I don't have any code really written out, just a couple of controllers and a custom UIView. All connected through nibs. The app loads without crashing, yet I can't see my NSLog() hit from my custom UIView.</p>
<p>My application delegate has default template code which cal... | <p>First of all, when a view is dehydrated from nib file, instead of <code>initWithFrame</code>, <code>initWithCoder</code> is invoked. So you need to implement your initialization in <code>initWithCoder</code> as well. (It may be a good idea to keep the <code>initWithFrame</code> initialization as well, if you anticip... | <p>The simplest way to get this up and running is simply to use the "View based Application" template when you create a new project. It sets up everything you need to start with.</p>
<p>But, in short, you're looking at the wrong methods. First, you shouldn't override <em>loadView</em> unless you're creating your view ... | 47,966 |
<p>Is there a way where I can add a connection string to the ConnectionStringCollection returned by the ConfigurationManager at runtime in an Asp.Net application?</p>
<p>I have tried the following but am told that the configuration file is readonly.</p>
<pre><code>ConfigurationManager.ConnectionStrings.Add(new Connec... | <pre><code>var cfg = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(@"/");
cfg.ConnectionStrings.ConnectionStrings.Add(new ConnectionStringSettings(params));
cfg.Save();
</code></pre>
<p>Be Advised this will cause your website to recycle since it modifies the config file. Check out <a href="htt... | <p>No, you can't modify the config file at runtime, it isn't intended for that.
Maybe you could use the Enterprise Libraries Configuration to do that.</p>
| 46,611 |
<p>Has anybody got any kind of experience with dynamic programming using WCF. By dynamic programming I mean runtime consumption of WSDL's.
I have found one blog entry/tool:
<a href="http://blogs.msdn.com/vipulmodi/archive/2006/11/16/dynamic-programming-with-wcf.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/vipu... | <p>This is one of the weirder aspects of WCF. You can dynamically create a channelfactory, but only with a known type.</p>
<p>I came up with a solution that is not perfect, but does work:</p>
<p>Create an interface, "IFoo" which contains a single method, say <code>Execute()</code>. In your ESB, dynamically create a... | <p>I am actually considering making a small ESB, where a user can add a webservice to route to at run time.
So I can not add WSDLs statically </p>
| 6,264 |
<p>I know FireBug with YSlow has to be by far my personal favourite. I also use IE developer toolbar when forced to test pages in IE. Is there any other jewels out there hiding??</p>
| <p>I use the <a href="https://chrispederick.com/work/web-developer/" rel="nofollow noreferrer">Web Developer Extension</a> for Firefox, has tons of useful options.</p>
<p><a href="https://i.stack.imgur.com/RnMOY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RnMOY.png" alt="https://addons.mozilla.or... | <p>For Internet Explorer, the <a href="http://en.wikipedia.org/wiki/Internet_Explorer_Developer_Toolbar" rel="nofollow noreferrer">IE Developer Toolbar</a>, as you mentioned, is very very useful. It allows you to navigate through rendered HTML, and it will display the section on the screen (highlighted block). I cons... | 40,374 |
<p>I have a request that returns a JSON object with a single property which is an array. How can I test if the array is empty?</p>
<p>With jQuery code like:</p>
<pre><code> $.getJSON(
jsonUrl,
function(data) {
if (data.RoleOwners == [ ]) {
$('<tr><... | <pre><code>(data.RoleOwners.length === 0)
</code></pre>
| <p>An array (being an object too) can have non numeric properties which are not picked up by testing for zero length. You need to iterate through the properties just like testing for an empty object. If there are no properites then the array is empty.</p>
<pre><code>function isEmptyObject(obj) {
// This works for a... | 43,420 |
<p>The MySQL manual at <a href="http://web.archive.org/web/20160504181056/https://dev.mysql.com/doc/refman/5.1/en/rename-database.html" rel="noreferrer">MySQL</a> covers this.</p>
<p>Usually I just dump the database and reimport it with a new name. This is not an option for very big databases. Apparently <code>RENAME {... | <p>For <strong>InnoDB</strong>, the following seems to work: create the new empty database, then rename each table in turn into the new database:</p>
<pre><code>RENAME TABLE old_db.table TO new_db.table;
</code></pre>
<p>You will need to adjust the permissions after that.</p>
<p>For scripting in a shell, you can use... | <p>Really, the simplest answer is to export your old database then import it into the new one that you've created to replace the old one. Of course, you should use <a href="http://en.wikipedia.org/wiki/PhpMyAdmin" rel="nofollow noreferrer">phpMyAdmin</a> or command line to do this.</p>
<p><strong>Renaming and Jerry-ri... | 9,267 |
<p>I have created a minidump using win32 api
[DllImport("DbgHelp.dll", SetLastError = true)]
private static extern bool MiniDumpWriteDump(</p>
<p>dmp file is successfully created.</p>
<p>i am trying to open this *.dmp file in another visual studio instance to locate the place of the crash,</p>
<p>in visual s... | <p>I'm not 100% sure. But, I think even if you get it open in VisualStudio, VS doesn't support half the commands that WinDbg does for analysing a dmp. So, I'd just stick to WinDbg. WinDbg is a free download... so that's available to you too. It's not the easiest to use, I always have to open the help to find the comman... | <p>It sounds like you are opening the dump correctly.</p>
<p>Here is what is says in the Visual Studio Help files:</p>
<blockquote>
<p>"To open a dump file
On the File menu, click Open, and then click Project.</p>
<p>In the Open Project dialog box, locate and select the dump file. </p>
<p>It will usuall... | 47,866 |
<p>I have an application web.xml with the following entry:</p>
<pre><code><error-page>
<error-code>404</error-code>
<location>/system_files/error/p_notfound.jsp</location>
</error-page>
</code></pre>
<p>However, when this page is displayed, Japanese characters are garbled. ... | <p>Haiving just launched a project which .NET 3.5 and workflow I'd say that the current release of WF is <strong>good enough</strong> to use and run with. It has helped us to get a product out quickly (we have the usual feature creep and requirements changing weekly). However, I have a list of complaints with it:</p>
... | <p>I don't know why people have such negative impressions about WF. Sure it has it drawbacks, but I thought it was pretty useful. The one major issue I have about it is the lack of support for upgrading existing workflow (bullent #2 in gbanfill's list).</p>
| 44,114 |
<p>I use UML Sequence Diagrams all the time, and am familiar with the UML2 notation.</p>
<p>But I only ever use them to capture the essence of what I intend to do. In other words the diagram always exists at a level of abstraction above the actual code. Every time I use them to try and describe <strong>exactly</strong... | <p>I have the same problem but when I realize that I am going low-level I re-read this: </p>
<blockquote>
<p>You should use <strong>sequence diagrams</strong>
when you want to look at the behavior
of several objects within a single use
case. Sequence diagrams are good at
showing collaborations among the
ob... | <p><strong>U.M.L. diagrams are guidelines, not strictly rules.</strong></p>
<p>You <strong>don't have to make them exactly & detailed as the source code</strong>, but, you may try it, if you want it.</p>
<p>Sometimes, its possible to do it, sometimes, its not possible, because of the detail or complexity of syste... | 18,130 |
<p>So I have been using Leopard for a year now, and the lastest update broke the keyboard mapping for eclipse. I use the dvorak layout, and now in eclipse if I press the ⌘ and the b key it does a build, instead of a cut(b = x).</p>
<p>Does anyone else have this issue, and are there any workarounds? </p>
<p><strong>E... | <p>Woo-hoo! It's fixed as of 10.5.7!</p>
| <p>Eclipse 3.4.1, standard (US) qwerty layout. I haven't found any shortcut problems, I temporarily set B to do cut (by fiddling with the key assignments in the eclipse preferences), and that worked OK.</p>
| 48,354 |
<p>Reusing values in CSS (particularly colors) has always been a problem for me when it comes to maintaining that CSS. What are the best tools for creating variables, or generally improving maintainability with CSS?</p>
| <p>See the answers to the following questions </p>
<ul>
<li><a href="https://stackoverflow.com/questions/47487/create-a-variable-in-css-file-for-use-within-that-css-file">Create a variable in .CSS file for use within that .CSS file</a></li>
<li><a href="https://stackoverflow.com/questions/30170/avoiding-repeated-const... | <p>I haven't had the chance to use it on a project yet, but if you happen to be using PHP for your backend, <a href="http://turbine.peterkroener.de/" rel="nofollow">Turbine</a> looks promising.</p>
| 7,364 |
<p>I'm working on a project where I'm coding in C in a UNIX environment. I've been using the lint tool to check my source code. Lint has been around a long time (since 1979), can anyone suggest a more recent code analysis tool I could use ? Preferably a tool that is free.</p>
| <p>Don't overlook the compiler itself. Read the compiler's documentation and find all the warnings and errors it can provide, and then enable as many as make sense for you.</p>
<p>Also make sure to tell your compiler to treat warnings like errors so you're forced to fix them right away (<code>-Werror</code> on gcc).
By... | <p>There is a "-Weffc++" option for gcc which according to the Mac OS X man page will:</p>
<blockquote>
<p>Warn about violations of the following style guidelines from Scott Meyers' Effective C++ book:</p>
</blockquote>
<p><strong><em>[snip]</em></strong></p>
<p>I know you asked about C, but this is the closest I ... | 2,502 |
<p>Since Graduating from a very small school in 2006 with a badly shaped & outdated program (I'm a foreigner & didn't know any better school at the time) I've come to realize that I missed a lot of basic concepts from a mathematical & software perspective that are mostly the foundations of other higher conc... | <p><a href="http://steve-yegge.blogspot.com/2006/03/math-for-programmers.html" rel="nofollow noreferrer">Math for Programmers</a>. A good read.</p>
| <p>My math background is really poor (Geologist by training), but I took a <a href="http://en.wikipedia.org/wiki/Discrete_mathematics" rel="nofollow noreferrer">discrete math</a> class in high school and I use the concepts every day as a programmer. It is probably the most valuable class I took in all of my education ... | 7,544 |
<p>Often times when mixing jQuery with asp.net I need to use asp .net angle bracket percent, <% %>, syntax within a jQuery selector.</p>
<p>If I would like to separate the JavaScript from markup into different files is there still a way to evaluate my JavaScript file so the angle bracket percents are interpolated ... | <p>If you want to evaluate <code><% code blocks %></code> as ASP.NET code in a JavaScript file, you can just put the JavaScript in an ASPX file and reference it from a SCRIPT element.</p>
<p><code>script.js.aspx</code>:</p>
<pre><code>function hideElements()
{ <% foreach(var elementId in Request.QueryString... | <p>You could also handle .js files as .aspx files; this way you won't lose intellisense and code formatting while you're editing them. Just add this to web.config:</p>
<pre><code><system.webServer>
<handlers>
<add name="Dynamic JS" path="*.js" verb="*" type="System.Web.UI.PageHandlerFactory" ... | 19,328 |
<p>Is there a way to query the current DATEFORMAT SQLServer 2005 is currently using with T-SQL?</p>
<p>I have an application that reads pregenerated INSERT-statements and executes them against a database. To make the data to be inserted culture independent I store datetime-values represented in the invariant culture (... | <p>Set Language and Set DateFormat only affect the current session. If you Disconnect from the database and connect again, the language and Dateformat are set back to their default values.</p>
<p>There is a 'trick' you could use to determine if the DateFormat is m/d/y, or d/m/y.</p>
<pre><code>Select DatePart(Month,... | <p>If it's not too late submit your dates as YYYYMMDD to SQL Server and they will always be inserted correctly regardless of DMY or MDY dateformat settings</p>
<p>SET DATEFORMAT is also not permanent. In my experience it affects that particular connection. Some people say session only but I found if the connection is... | 39,288 |
<p>I'm creating a cms and have not yet settled on the matter of where to store the complete url for a given page in the structure.</p>
<p>Every page have a slug (url friendly name of the page) and every page has a nullable (for top-level pages) parent and children.</p>
<p>Where do I store the complete url (/first-pag... | <p>Lazy loading is exactly what you want - and it's not a hack either, it's a well tested and baked in part of NHIbernate and an important tool when performance tuning any substantial NHibernate app.</p>
<p>If you were to mark your "parent" EntityA as lazy loaded, referring to EntityB.Parent.Id would not load EntityA ... | <p>Just this:</p>
<pre><code>[Property] public int ParentId { get; set; }
</code></pre>
<p>...assuming <code>ParentId</code> is the actual column name.</p>
<p>A couple of other comments. </p>
<p>First, you should consider lazy loading many-to-one properties anyway. If you eagerly load them, you must be aware of ... | 30,634 |
<p>According to <a href="http://msdn.microsoft.com/en-us/library/bb386454.aspx" rel="noreferrer">Microsoft</a> the FileUpload control is not compatible with an AJAX UpdatePanel. </p>
<p>I am aware that a PostBackTrigger can be added to the submit button of the form like this:</p>
<pre><code><Triggers>
<asp... | <p>I know of a third party component that can do that. It's called <a href="http://swfupload.org/" rel="noreferrer">"<em>swfupload</em>"</a> and is free to use and open source, and uses javascript and flash to do the magic.</p>
<p>here is a list of the features they offer:
(from their site)</p>
<blockquote>
<ul>
... | <p>The button that is triggering the upload event needs to have <code>UseSubmitBehavior</code> property set to false:</p>
<pre><code>clsUploadButton.UseSubmitBehavior = False;
</code></pre>
| 5,629 |
<p>What is the proper way to inject a data access dependency when I do lazy loading?</p>
<p>For example I have the following class structure</p>
<pre><code>class CustomerDao : ICustomerDao
public Customer GetById(int id) {...}
class Transaction {
int customer_id; //Transaction always knows this value
Customer ... | <p>I suggest something different...
Use a lazy load class :</p>
<pre><code>public class Lazy<T>
{
T value;
Func<T> loader;
public Lazy(T value) { this.value = value; }
public Lazy(Func<T> loader { this.loader = loader; }
T Value
{
get
{
if (loader != null)
... | <p>I typically do the dependency injection in the constructor like you have above, but take the lazy loading a step further by acting only when the "get" is called like I have below. Not sure if this is the pure approach you are looking for, but it does eliminate the "dirty" constructor DI/Lazy Loading in 1 step ;)</p... | 15,822 |
<p>How should I tell SDL to maximize the application window?</p>
<p>I'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE.</p>
| <p>This functionality is controlled by the window manager when you use the SDL_RESIZABLE flag. To simulate the maximizing a window with SDL you would need to first determine the size the window would occupy when maximized. Then you would call <a href="http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode" rel="nofollow no... | <p>SDL_FULLSCREEN is the option you're looking for:</p>
<pre><code>flags |= SDL_FULLSCREEN;
screen = SDL_SetVideoMode(..., flags);
</code></pre>
| 40,185 |
<p>Consider the following 2 queries:</p>
<pre><code>select tblA.a,tblA.b,tblA.c,tblA.d
from tblA
where tblA.a not in (select tblB.a from tblB)
select tblA.a,tblA.b,tblA.c,tblA.d
from tblA left outer join tblB
on tblA.a = tblB.a where tblB.a is null
</code></pre>
<p>Which will perform better? My assumption is that i... | <p>RDBMSs "rewrite" queries to optimize them, so it depends on system you're using, and I would guess they end up giving the same performance on most "good" databases.</p>
<p>I suggest picking the one that is clearer and easier to maintain, for my money, that's the first one. It's much easier to debug the subquery as... | <p>From my observations, MSSQL server produces same query plan for these queries.</p>
| 6,968 |
<p>This is a pretty straight forward attempt. I haven't been using python for too long. Seems to work but I am sure I have much to learn. Someone let me know if I am way off here. Needs to find patterns, write the first line which matches, and then add a summary message for remaining consecutive lines which match patte... | <p>The rematcher function seems to do what you want:</p>
<pre><code>def rematcher(re_str, iterable):
matcher= re.compile(re_str)
in_match= 0
for item in iterable:
if matcher.match(item):
if in_match == 0:
yield item
in_match+= 1
else:
if ... | <p>First, your regular expression will match more slowly than if you had left off the greedy match.</p>
<pre><code>.*Dog.*
</code></pre>
<p>is equivalent to</p>
<pre><code>Dog
</code></pre>
<p>but the latter matches more quickly because no backtracking is involved. The longer the strings, the more likely "Dog" app... | 20,283 |
<p>What is the easiest way to set the contents of an <code><asp:ContentPlaceHolder></code> programmatically? I imagine ill have to do a <code>Master.FindControl</code> call?</p>
| <p>If your page inherits from a MasterPage, then you should have an asp:Content control on your page with some id, like so:</p>
<pre><code><asp:Content runat="server" ID="myContent" ContentPlaceHolderID="masterContent">
</asp:Content>
</code></pre>
<p>You should be able to reference this in your codebehin... | <p>If you are adding controls to a blank page then you do Page.Controls.Add()....no?</p>
| 37,118 |
<p>I have a menu div that I want to slide down so it's always visible, but I want it to be positioned under my title div. I don't want it to move until the top of the menu hits the top of the screen and then stay in place. Basically I want a sliding menu with a maximum height it can slide to.</p>
| <p>I think I understand what you're talking about—we used a similar technique on <a href="http://www.kingtray.com" rel="nofollow noreferrer">The King</a> with jQuery. Here's how:</p>
<pre><code>///// CONFIGURATION VARIABLES:
var name = "#rightsidebar";
var menu_top_limit = 241;
var menu_top_margin... | <p>Slashdot does this. Check it out at, for example, <a href="http://tech.slashdot.org/tech/08/10/22/1246200.shtml" rel="nofollow noreferrer">http://tech.slashdot.org/tech/08/10/22/1246200.shtml</a></p>
<p>You may be able to lift the technique from their site.</p>
| 27,921 |
<p>We use Microsoft Smart client, Enterprise Library, Composite Application Block and Infragistics and some more third party libraries.</p>
<p>In the project, we added references to the libraries in the Visual Studio 'Add Reference' and selecting from .NET component lists. </p>
<p>How to make sure all the DLLs shall ... | <p>I assume you have set the "Copy Local" property on the reference to True.</p>
<p>To automatically copy files after a build, modify the "Post-build event command line" found in the project properties. Insert the appropriate command to copy your files.</p>
| <p>If they are all references, just select them and set 'Copy Local' to true in the PropertyGrid.</p>
<p>Check <a href="https://stackoverflow.com/questions/304909/best-practices-for-referencing-3rd-party-assemblies">this</a> question too.</p>
| 39,676 |
<p>I'm handling the <code>onSelectIndexChanged</code> event. An event is raised when the DropDownList selection changes. the problem is that the DropDownList still returns the old values for <code>SelectedValue</code> and <code>SelectedIndex</code>. What am I doing wrong?</p>
<p>Here is the DropDownList definition fro... | <p>Do you have any code in page load that is by chance re-defaulting the value to the first value?</p>
<p>When the page reloads do you see the new value?</p>
| <p>Is it possible that you have items copied throughout your datasource for the drop down list? </p>
| 10,094 |
<p><strong>Is there an easy way of cloning entire installed debian/ubuntu system?</strong></p>
<p>I want to have identical installation in terms of installed packages and as much as possible of settings.</p>
<p>I've looked into options of aptitude, apt-get, synaptic but have found nothing. </p>
| <p><a href="http://www.debianadmin.com/clone-your-ubuntu-installation.html" rel="noreferrer"> This guide should answer your direct question </a></p>
<p>But I would recomend <a href="http://samba.anu.edu.au/rsync/" rel="noreferrer">Rsync</a> and simply clone entire /root. Its only expensive the first time.</p>
<p>You ca... | <p>There is RSYNC which let's you synchornise files between installations. So you could just rsync your entire distro, or at least the directories that contain the programs and the configuration files.</p>
<p>Also, I don't know if this is what you are asking, but you could turn your existing install into an ISO image... | 21,077 |
<p>All the PHP files in my workspace are encoded in <strong>Unicode (UTF-8, no BOM)</strong>. I often duplicate an existing source file to use as a base for a new script. Invariably (with Path Finder or the original Finder), OS X will convert the encoding of the duplicate file to <strong>Western (Mac OS Roman)</strong>... | <p>I highly doubt that the "conversion" you're seeing is an actual difference in the two copies of the file. OS X doesn't store any sort of encoding value for a file's content, so it's much more likely that it's whatever tool you're using to view/edit your files that's interpreting the content differently, whether it ... | <p>Are you using the Finder to copy your files, or some other tool (an IDE)?</p>
<p>It's possible your original file has some extended Finder metadata in its Resource Fork that's being lost in the copying, if you don't use Finder to copy it.</p>
<p>-W</p>
| 28,916 |
<p>I have a RHEL 5 system with a fresh new hard drive I just dedicated to the MySQL server. To get things started, I used "mysqldump --host otherhost -A | mysql", even though I noticed the manpage never explicitly recommends trying this (mysqldump into a file is a no-go. We're talking 500G of database). </p>
<p>This ... | <p>mysqldump by default performs a per-table lock of all involved tables. If you have many tables that can exceed the amount of file descriptors of the mysql server process.
Try --skip-lock-tables or if locking is imperative --lock-all-tables.<br />
<a href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html" rel="n... | <p>If your database is that large you've got a few issues. </p>
<ol>
<li><p>You have to lock the tables to dump the data.</p></li>
<li><p>mysqldump will take a very very long time and your tables will need to locked during this time.</p></li>
<li><p>importing the data on the new server will also take a long time. </p>... | 10,893 |
<p>I have a <a href="http://en.wikipedia.org/wiki/Git_%28software%29" rel="noreferrer">Git</a> repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.</p>
<p>How can I do this while keeping the hist... | <p><strong>Update</strong>: This process is so common, that the git team made it much simpler with a new tool, <code>git subtree</code>. See here: <a href="https://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository/17864475#17864475">Detach (move) subdirectory into separate Git reposito... | <p>I've found quite straight forward solution,
The idea is to copy repository and then just remove unnecessary part.
This is how it works:</p>
<p>1) Clone a repository you'd like to split</p>
<pre><code>git clone git@git.thehost.io:testrepo/test.git
</code></pre>
<p>2) Move to git folder</p>
<pre><code>cd test/
</... | 46,883 |
<p>I've been using a lot of new .NET 3.5 features in the work that I've been doing, lately. The application that I'm building is intended for distribution among consumers who will probably not have the latest version (or perhaps <em>any version</em>) of the .NET framework on their machines.</p>
<p>I went to go <a href... | <p>That's one of the sad reasons i'm still targeting .net 2.0 whenever possible :/</p>
<p>But people don't neccessarily need the full 200 MB Package. There is a 3 MB Bootstrapper which will only download the required components:</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-41... | <p>Also, it is worth including (in some fashion) the Service Pack downloads as well. In fact, depending on how your executables are built, you might be forced to install the Framework and the Service Packs.</p>
| 2,818 |
<p>Is it possible to create a user with permissions of both a local administrator and NETWORK SERVICE?</p>
<p>I've got a Sharepoint timer job which runs stsadm for which it needs local administrator permissions. On the other hand temer jobs are also used by other services which need NETWORK SERVICE permissions and tho... | <p>I recommend always using domain accounts - SharePoint works best on servers connected to an Active Directory server. For production environments a best practice is using a least privilege account. I always create the following domain account dedicated to SharePoint services:</p>
<p>DOM\spservice</p>
<p>You do not ... | <p>I can't help you with the user permissions (Lars hit the important points), but I wanted to share some information that may be of use.</p>
<p>You mentioned that you're trying to move site collections between content databases and haven't found an API the can be leveraged. Have you looked into SharePoint's Content ... | 32,775 |
<p>We have implemented a popup window as a modal dialog using the IE method:</p>
<pre><code>window.showModalDialog('...aspx')
</code></pre>
<p>The target of the popup window is itself an ASP.Net web page.</p>
<p>Assume for the following steps that the popup has never been launched:</p>
<ol>
<li>Launch popup.</li>
<... | <p>Add a timestamp querystring variable to the URL of the dialog content - number of ticks since 1/1/08 or something - IE will treat it as a new page and ignore the cache.</p>
| <p>One of the strange quirks of IE is that setting no-cache at the beginning of the file doesn't seem to work, but moving that section to after the original HTML often does. Still best to send it as an HTTP header, but the following will work in most cases:</p>
<pre><code><html>
<head><title>Blah... | 42,833 |
<p>I'm starting a project using a Restful architecture implemented in Java (using the new JAX-RS standard)</p>
<p>We are planning to develop the GUI with a Flex application. I have already found some problems with this implementation using the HTTPService component (the response error codes, headers access...).</p>
<... | <p>The problem here is that a lot of the web discussions around this issue are a year or more old. I'm working through this same research right now, and this is what I've learned today.</p>
<p>This <a href="http://www.ibm.com/developerworks/websphere/library/techarticles/0808_rasillo/0808_rasillo.html" rel="noreferrer... | <p>Actually were are already using Flex with a Rest-Style Framework. As mbrevort already mentioned PUT and DELETE methods cannot be directly used. Instead we are doing PUT via a POST and for DELETE we are using a GET on a resource with an URL parameter like ?action=delete.</p>
<p>This is not 100% Rest style, so I am n... | 18,519 |
<p>I want to register a specific instance of an object for a type in structuremap, how can I do that?</p>
<p>For example,</p>
<p>When I do:</p>
<pre><code>var myObj = ObjectFactory.GetInstance(typeof(MyAbstractClass));
</code></pre>
<p>i would like it to return a previously constructed concrete class, which i creat... | <p>I believe you would do this in you initialization</p>
<pre><code> ObjectFactory.Initialize(x =>
{
x.ForRequestedType<MyAbstractClass>().TheDefault.IsThis(myClass);
});
</code></pre>
<p>Where myClass is the instance of the object you want to return. </p>
| <p>In StructureMap 3 methods have changed and this code now works:</p>
<pre><code>var emailService = new EmailService(ConfigurationManager.AppSettings[mykey]);
ObjectFactory.Initialize(x =>
{
x.For<IEmailService>().Use(emailService);
});
</code></pre>
| 48,629 |
<p>How would you model booked hotel room to guests relationship (in PostgreSQL, if it matters)? A room can have several guests, but at least one.</p>
<p>Sure, one can relate guests to bookings with a foreign key <code>booking_id</code>. But how do you enforce on the DBMS level that a room must have at least one guest?... | <p>Actually, if you read the question, it states booked hotel rooms. This is quite easy to do as follows:</p>
<pre><code>Rooms:
room_id primary key not null
blah
blah
Guests:
guest_id primary key not null
yada
yada
BookedRooms:
room_id primary key foreign key (Rooms:room_id)
primary_... | <p>What about a room which has not been rented out? What you're looking for are reservations and a reservation presumably needs at least one guest on it.</p>
<p>I think what you're asking is whether you can guarantee that a reservation record is not added unless you have at least one guest for and you can't add a gue... | 29,651 |
<p>I was wondering if it is possible to tweak the way garbage collector works on JavaMe in order to improve performance somehow(may reducing the number of passages)? I´ve seen some articles about it, but mostly directed Java SE and most of them says GC is highly dependant on the maker. How much would that be.</p>
| <p>When the garbage collector is triggered is largely a mistery unless you have first hand knowledge of how the particular VM your application is running on was implemented and exactly how it was configured and customized for the specific phone you are using.</p>
<p>Calling java.lang.System.gc() is no guarantee that t... | <p>I don't see any possible way to tweak the garbage collection behavior in J2ME.</p>
<p>If you have problems with pauses induced by garbage collections, you have to do two things:</p>
<ul>
<li>Reduce the garbage that your program produces, by re-using objects, and avoid costly things like string concatenations (use ... | 42,010 |
<p>For reasons I won't go into, I wish to ban an entire company from accessing my web site. Checking the remote hostname in php using gethostbyaddr() works, but this slows down the page load too much. Large organizations (eg. hp.com or microsoft.com) often have blocks of IP addresses. Is there anyway I get the full lis... | <p>How about an .htaccess:</p>
<pre><code>Deny from x.x.x.x
</code></pre>
<p>if you need to deny a range say: 192.168.0.x then you would use</p>
<pre><code>Deny from 192.168.0
</code></pre>
<p>and the same applies for hostnames:</p>
<pre><code>Deny from sub.domain.tld
</code></pre>
<p>or if you want a PHP solutio... | <p>Do you have access to the actual server config? If so depending on the server you could do it in the configuration.</p>
<p>See <a href="http://www.webmasterworld.com/forum92/3546.htm" rel="nofollow noreferrer">this</a> thread for some information that may be helpful.</p>
| 11,498 |
<p>Currently reading quite a heavy WCF book. I have used it myself in production just the once, using tcp, worked a charm.
Anyway what are your opinions on this technology, is it here to stay, is it worth the time invested learning all the complex features etc etc?</p>
| <p>I think it is here to stay. It is easily configurable for moving endpoints, it seems robust and allows you to do (pretty much) everything you could do in web services and remoting without the overhead of separate implementations.</p>
<p>I can see where you are coming from, with MS's recent leaks about ongoing supp... | <p>I second what ZombieSheep says. Although complex, it greatly simplifies distributing applications across physical and logical boundaries, facilitates interoperability, and mostly decouples implementation details like ports/protocols for communication.</p>
<p>It's definitely worth the time to learn, although depend... | 38,312 |
<p>Anyone else seeing this issue? Anyone know a solution?</p>
<p>While editing a part on TinkerCad.com (<a href="https://www.tinkercad.com/things/hrsKxOk1Xc7" rel="nofollow noreferrer">this part</a>, to be specific), I click the "Send To" button in the top-right --> click Thingiverse --> I see this scre... | <h2>the 3D Benchy isn't a specific calibration test</h2>
<p>With the Benchy you don't see if your printer is calibrated in any axis, but it is a general use-case test for a model that can show you many of the issues you might face in a normal print. For all intents and purposes, it is more a general Benchmark item than... | <p>Benchy is cute. That goes a long way in attracting attention.</p>
<p>The benchy is one of the earlier STLs that was freely available to download, dating from April 2015, and was released under the Creative Commons Sharealike licence, which clearly states the requirements and limitations/requirements.</p>
<p>Curious... | 2,079 |
<p>Does someone have a link where I can read on how to access my remote server's sql server '08 installation?</p>
<p><b>update</b></p>
<p>I want to access sql server 2008 from management studio on a remote server.</p>
<p>Remote access is disabled by default!</p>
| <p>badbadboy's link would be a good start</p>
<ol>
<li>Enable remote connection in SSMS</li>
<li>Check for TCP/IP, Named Pipe enabled in Configuration Manager</li>
<li>Check the Firewall</li>
</ol>
<p>And double check you're connecting to the correct server\instance name, and PORT</p>
| <p>Could you please expand your question?
How do you want to access it? With SQL management studio? Doesn't specifying the computer name work? Are you able to access it locally? Is there anything specific about that it is 2008 SQL?</p>
| 37,963 |
<p>I'm trying to do the following in python:</p>
<p>In a file called foo.py:</p>
<pre><code># simple function that does something:
def myFunction(a,b,c):
print "call to myFunction:",a,b,c
# class used to store some data:
class data:
fn = None
# assign function to the class for storage.
data.fn = myFunction
</co... | <pre><code>data.fn = staticmethod(myFunction)
</code></pre>
<p>should do the trick.</p>
| <p>Thanks to Andre for the answer - so simple!</p>
<p>For those of you who care, perhaps I should have included the entire context of the problem. Here it is anyway:</p>
<p>In my application, users are able to write plugins in python. They must define a function with a well-defined parameter list, but I didn't want t... | 42,435 |
<p>Recently I've been doing a lot of modal window pop-ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelmingly been along the lines of: </p>
<pre><code>$("<div></div>");
</code></pre>
<p>However, I'm getting the feeling that this isn't the... | <p>I use <code>$(document.createElement('div'));</code> <a href="http://jsperf.com/jquery-vs-createelement" rel="noreferrer">Benchmarking shows</a> this technique is the fastest. I speculate this is because jQuery doesn't have to identify it as an element and create the element itself.</p>
<p>You should really run b... | <p>I am using jquery.min v2.0.3 .
It's for me better to use following:</p>
<pre><code>var select = jQuery("#selecter");
jQuery("`<option/>`",{value: someValue, text: someText}).appendTo(select);
</code></pre>
<p>as following:<br/></p>
<pre><code>var select = jQuery("#selecter");
jQuery(document.createElement(... | 42,372 |
<p>I need a "result server" that can store my raw test data (server cpu, memory usage, etc), create report template (e.g. user number vs response time), generate live-reports base on templates, and perform complicated analysis (such as 70/80/90 percentile charts, data distribution comparison between test, etc.)</p>
| <p>If you are on Microsoft platform, try using Visual Studio load testing functionality. It uses SQL Server for storing test results and will do all the kinds of analysis for you.</p>
| <p>If money's no object, HP as a tool called <a href="https://h10078.www1.hp.com/cda/hpms/display/main/hpms_content.jsp?zn=bto&cp=1-11-126-17%5E1582_4000_100__" rel="nofollow noreferrer">Performance Center</a>, which is a webified version of Mercury LoadRunner (HP bough Mercury a while back; Performance Center was ... | 37,686 |
<p>I have a <code>VARCHAR</code> column in a <code>SQL Server 2000</code> database that can contain either letters or numbers. It depends on how the application is configured on the front-end for the customer. </p>
<p>When it does contain numbers, I want it to be sorted numerically, e.g. as "1", "2", "10" instead of "... | <p>One possible solution is to pad the numeric values with a character in front so that all are of the same string length.</p>
<p>Here is an example using that approach:</p>
<pre class="lang-sql prettyprint-override"><code>select MyColumn
from MyTable
order by
case IsNumeric(MyColumn)
when 1 then Replic... | <pre><code>SELECT FIELD FROM TABLE
ORDER BY
isnumeric(FIELD) desc,
CASE ISNUMERIC(test)
WHEN 1 THEN CAST(CAST(test AS MONEY) AS INT)
ELSE NULL
END,
FIELD
</code></pre>
<p>As per <a href="http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_23258510.html" rel="nofollow noreferrer">t... | 14,558 |
<p>I'm just getting started with learning about Unit testing (and TDD in general). My question is does the latest version of NUnit support working in VS2008 with .NET 3.5? I've looked at the documentation pages at NUnit and they don't mention it. </p>
<p>If anyone has worked with it in 3.5 are there any limitations ... | <p>I've been using nUnit with 3.5. As long as you have a version that works with 2.0 you should be fine - same CLR and all that. :)</p>
| <p>Check the steps to follow at <a href="http://social.msdn.microsoft.com/forums/en-US/vsdebug/thread/365fd6ef-0fa5-4eeb-b2d5-7c2f795b1f8c?prof=required" rel="nofollow noreferrer">http://social.msdn.microsoft.com/forums/en-US/vsdebug/thread/365fd6ef-0fa5-4eeb-b2d5-7c2f795b1f8c?prof=required</a></p>
| 11,801 |
<p>I want to convert a string into a series of Keycodes, so that I can then send them via PostMessage to a control. I need to simulate actual keyboard input, and I'm wondering if a massive switch statement is the only way to convert a character into the correct keycode, or if there's a simpler method.</p>
<p>====</p>... | <p>Raymond says this is a bad idea.</p>
<p><a href="http://blogs.msdn.com/oldnewthing/archive/2005/05/30/423202.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2005/05/30/423202.aspx</a></p>
| <p>For A-z 1-9 you could try build the char into a keycode string <code>string.Format("KEY_KEY_{0}", char.ToString())</code> then use Enum.Parse to extract the Enum value, but it's a bit of a cludge</p>
<p>Or look at <a href="http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_23092844.html" rel="nofollow ... | 41,750 |
<p>As my first project, I'm trying to design a holder for glass vials, for a scientific application. The photo below shows the latest design iteration, and also shows the problem with it:</p>
<p><a href="https://i.stack.imgur.com/7vqSam.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/7vqSam.jpg" alt="vial ho... | <p>It looks like those clips are thin and need to bend pretty far to let the vial out. Try to make the clips thicker, but with a smaller clip to retain the vial so that it doesn't have to bend as much. </p>
<p>This is what I'm thinking, in beautiful MS-PAINT form:<br>
<a href="https://i.stack.imgur.com/evTyz.png" rel=... | <p>If you don't want your clip to break, you'll have to engineer in some form of flexibility in a strong part of your design. For example, right now it looks like the bases of the clips are sitting rather solidly on the underlying surface such that it can't move. I'd suggest that instead it might be better to have tw... | 225 |
<p>I've worked with folks who are chatting online with their peers, constantly batting around ideas. I've also worked with folks who adamantly refuse and think it's a waste of time.</p>
<p>Are online live chatting forums of particular use to you? Why or why not?
Internal to your company, or external and world-wide?
D... | <p>If you have telecommuters, not chatting online will be the death of you. </p>
<p>Without chat, there is no interaction. </p>
<p>Without interaction, there is no problem solving. </p>
<p>Without problem solving, the code will suck. </p>
<p>The chatting part does waste a lot of time and I often wish I could just p... | <p>When I need to collaborate with someone in another office, it's great ... when I'm deep in thought, I have to turn it off (just like e-mail).</p>
| 11,943 |
<p>I have a sqlite (v3) table with this column definition:</p>
<pre><code>"timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP
</code></pre>
<p>The server that this database lives on is in the CST time zone. When I insert into my table without including the timestamp column, sqlite automatically populates that field with ... | <p>I found on the sqlite documentation (<a href="https://www.sqlite.org/lang_datefunc.html" rel="noreferrer">https://www.sqlite.org/lang_datefunc.html</a>) this text:</p>
<blockquote>
<p>Compute the date and time given a unix
timestamp 1092941466, and compensate
for your local timezone.</p>
</blockquote>
<pre><... | <p>I think this might help. </p>
<pre><code>SELECT datetime(strftime('%s','now'), 'unixepoch', 'localtime');
</code></pre>
| 49,989 |
<p>What end-user clients (not libraries) expose <a href="http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol" rel="noreferrer">XMPP</a> <a href="http://en.wikipedia.org/wiki/Publish/subscribe#See_also" rel="noreferrer">XEP-0060</a> to users right now?</p>
| <p>I am not very good at web programming, but i believe, from the example you described, that there should be one model, one view and one controller for the entire page. Now the view itself should contain the views for every widget in the page (and the same goes for the page controller) to which it dispatches the messa... | <p>There are a lot of variations on the MVC theme and a lot to consider before coming to a conclusion as to the design of your particular system. Most of the latest, popular web based systems look to <a href="http://martinfowler.com/articles/injection.html" rel="nofollow noreferrer">IoC</a> as the guiding principal. Us... | 32,402 |
<p>I'm doing some maintenance on a private svn server. Authentication is handled through Apache basic HTTP+mod_authz_svn. I need to have it so every user has read/write access, except for a single read-only user. The read-only user still needs to be authenticated, though. I setup my authz config file like this:</p>
<p... | <p>In this case, the read-only user has still write access as it also matches the * group.</p>
<p>A safe way to achieve what you want is to create a group of all users except read-only, e.g.</p>
<pre><code>[groups]
all-but-ro = harry, sally, ...
[/]
@all-but-ro = rw
read-only = r
</code></pre>
<p>(alternatively, yo... | <p>Hmmm, the previous posts may be correct on the ACL order, but...</p>
<p>My configuration includes</p>
<pre><code>AuthzSVNAccessFile "<path-to-svn-acl-file>"
</code></pre>
<p>Might this also be a problem?</p>
| 35,702 |
<p>I'm converting some Actionscript code from AS2 tp AS3, and I've eventually managed to get most of it to work again (it's allmost a totally different language, sharing just a little syntax similarity). One of the last things that still doesn't work, is the code for loading an external image.</p>
<p>Perhaps this has ... | <p>I think you're making things a little too complicated - here's what you need to load a single image:</p>
<pre><code>import flash.display.Loader;
import flash.event.Event;
import flash.net.URLRequest;
var imageLoader:Loader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Ev... | <p>I discovered a soulution, myself.</p>
<p>Initializing or unloading a list of images (actually instances of MovieClip):</p>
<pre><code>for (i = 0; i<imgHolders.length; i++) {
var loader:Loader = imgHolders[i].getChildByName("imgloader"+i);
if (loader) {
loader.unload();
} else {
loade... | 40,079 |
<p>I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How?</p>
<p>I am using zsh, but a bash solution is also welcome.</p>
| <p>ZSH:</p>
<pre><code>$ unsetopt CASE_GLOB
</code></pre>
<p>Or, if you don't want to enable case-insensitive globbing in general, you can activate it for only the varying part:</p>
<pre><code>$ print -l (#i)(somelongstring)*
</code></pre>
<p>This will match any file that starts with "somelongstring" (in any combin... | <p>For completeness (and frankly surprised it's not mentioned yet, even though all the other answers are better and/or "more correct"), obviously one can also use (especially for <code>grep</code> aficionados):</p>
<pre><code>$ ls | egrep -i '^SomeLongString'
</code></pre>
<p>One might also stick in a redundant <code... | 18,991 |
<p>I am trying to adapt a simple WPF application to use the Model-View-ViewModel pattern. On my page I have a couple of animations:</p>
<pre><code><Page.Resources>
<Storyboard x:Name="storyboardRight"
x:Key="storyboardRight">
<DoubleAnimation x:Name="da3"
... | <p>I had the opportunity to put this question to Microsoft's Josh Twist, who kindly took the time to provide an answer to this problem. The solution is to use a <code>DataTrigger</code> in combination with an enum in the ViewModel to launch the Storyboard, and this in turn requires putting the page into a <code>Content... | <p>You need to use an <code>EventTrigger</code>. This <a href="http://www.microsoft.com/emea/msdn/thepanel/en/articles/animations_wpf.aspx" rel="nofollow noreferrer">article about Animations in WPF</a> might help. See also the <a href="http://msdn.microsoft.com/en-us/library/ms742806.aspx" rel="nofollow noreferrer">Rou... | 36,488 |
<p>did anyone try to view a Silverlight site on a Linux machine? afaik, there is something called mono on Linux which is a try to port .NET on Linux machines, but did one really try to use it? did it work?</p>
| <p>Moonlight is the mono implementation of SilverLight. <a href="http://www.mono-project.com/Moonlight" rel="nofollow noreferrer">http://www.mono-project.com/Moonlight</a> </p>
<p>In an interview, they said Microsoft gave them the same test suite they use on Silverlight, so the implementation is pretty good I would ... | <p>Currently Moonlight, the implementation of Silverlight on Linux, is in Beta. According to their roadmap, the final version of Moonlight 1.0 should be out on January 20, 2009. As stated by MrChrister, they're a "release behind", because we already have Silverlight 2. However, according to the same roadmap, they plan ... | 47,828 |
<p>I have a .net application and i published in the local location. while installing from the published location the application need to install in "c:\temp" how can i do this in clickonce method?</p>
| <p>ClickOnce installers <strong>do not install</strong> to the "Program Files" or to any specific directory (C:\temp). For security purposes, your WinForms app is in the <strong>ClickOnce cache</strong>, an obfuscated directory that differs for each ClickOnce app.</p>
<p>It's documented in this MSDN Library topic: <a ... | <p>ClickOnce installation always installs in the predefined user folders, the ClickOnce cache.</p>
<p>There is no way to install a ClickOnce program somewhere else. Neither can you decide on a different location on creation of the ClickOnce package, nor can the person installing the program decide on a different locat... | 23,992 |
<p>Are there any tricks for preventing SQL Server from entitizing chars like &, <, and >? I'm trying to output a URL in my XML file but SQL wants to replace any '&' with '<code>&amp;</code>'</p>
<p>Take the following query:</p>
<pre><code>SELECT 'http://foosite.com/' + RTRIM(li.imageStore)
+ '... | <p>There are situations where a person may not want well formed XML - the one I (and perhaps the original poster) encountered was using the For XML Path technique to return a single field list of 'child' items via a recursive query. More information on this technique is here (specifically in the 'The blackbox XML meth... | <p>Try this....</p>
<pre><code>select
stuff(
(select ', <' + name + '>'
from sys.databases
where database_id > 4
order by name
for xml path(''), root('MyString'), type
).value('/MyString[1]','varchar(max)')
, 1, 2, '') as namelist;
</code></pre>
| 34,068 |
<p>Should it be on the development servers or a Subversion server?</p>
<p>I suppose this could be expanded to any client-server version control system.</p>
| <p>The physical repository should be on a stable system that gets regular backups. </p>
<p>Generally, a development server does not fit this description... it may be acceptable to put the apache server on the dev server and host the files remotely on a stable, backed-up file server (though there are a number of pitfal... | <p>It is always better to keep your repositories on a stable server where you can reliably take backups whenever needed.</p>
| 16,950 |
<p>How can one detect being in a chroot jail without root privileges? Assume a standard BSD or Linux system. The best I came up with was to look at the inode value for "/" and to consider whether it is reasonably low, but I would like a more accurate method for detection.</p>
<p><code>[edit 20080916 142430 EST]</cod... | <p>The inode for / will always be 2 if it's the root directory of an ext2/ext3/ext4 filesystem, but you may be chrooted inside a complete filesystem. If it's just chroot (and not some other virtualization), you could run mount and compare the mounted filesystems against what you see. Verify that every mount point has... | <p>If you entered the chroot with schroot, then you can check the value of $debian_chroot.</p>
| 10,081 |
<p>Let's say I have a table:</p>
<pre>
i j
---
a 1
a 2
a 3
a 4
b 5
b 6
b 7
b 8
b 9
</pre>
<p>Obvoiusly <code>SELECT a, GROUP_CONCAT(b SEPARATOR ',') GROUP BY a</code> would give me</p>
<pre>
a 1,2,3,4
b 5,6,7,8,9
</pre>
<p>But what if I want to get only a LIMITED number of results, like 2, for example:</p>
<pre>... | <p>Best way is to use <code>SUBSTRING_INDEX()</code> and <code>GROUP_CONCAT()</code>.</p>
<pre><code>SELECT i, SUBSTRING_INDEX( GROUP_CONCAT(j), ',', 2)
FROM mytable
GROUP BY i;
</code></pre>
<p>You don't have to know the length of <code>j</code> field here.</p>
| <p>One solution would be to limit the rows in the group to the top two, before computing the aggregate.</p>
<pre><code>SELECT t.i, GROUP_CONCAT(t.j)
FROM
(SELECT t1.i, t1.j
FROM mytable AS t1
LEFT JOIN mytable AS t2
ON (t1.i = t2.i AND t1.j >= t2.j)
GROUP BY t1.i, t1.j
HAVING COUNT(*) <= ... | 37,085 |
<p>I have a Winforms application created in Visual Studio 2005 Pro, it connects to an SQL Server 2005 database using the SqlConnection / SqlCommand / SqlDataAdapter classes to extract data. I have stored procedures in my database to return the data to me.</p>
<p>What is the best way to handle queries that take a "long... | <p>Making sure that the queries are optimized is the first step, but afterwards, you have to use threading, and .NET has the <a href="http://msdn.microsoft.com/en-us/library/8xs8549b.aspx" rel="nofollow noreferrer">BackgroundWorker component</a> for these cases. </p>
<p>Here's a <a href="http://msdn.microsoft.com/en-u... | <p>To implement your warning, you could first issue a COUNT() query, which would not only return the number of rows the user's about to get, but may start to cache the data.</p>
| 31,659 |
<p>I have a PrusaI3(Chinese kit that I assembled myself). my strange problem is that: when I try to leveling the bed, upper-left and bottom-right corners of the bed, are more far than the nozzle, respect to upper-right and bottom-left.</p>
<p>I don't know why, but I can't level them with the screws(because upper-left ... | <p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that th... | <p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that th... | 737 |
<p>In Java (And in general) is there a way to make a class so public that it's methods etc... are accessible from little classes all around that don't even instantiate it? Ha, what I mean is... If I have a daddy class that has a method <code>draw()</code> and it instantiates a baby class called Hand and one called Deck... | <p>When the Daddy class instantiates the Baby classes, it (Daddy) could pass a reference to itself to the Baby constructor, giving Baby access to all of its public methods.</p>
<pre><code>class Daddy {
public foo(){...}
public createBaby(){
Baby baby = new Baby(this);
// baby now has a referenc... | <p>From an OO perspective I would say to use inheritance. One way is to create an abstract class that does not implement methods that will not behave the same by sub-classes; and implements methods that will behave the same for all sub-classes.</p>
| 44,252 |
<p>Is there an editor that is:</p>
<ol>
<li>Available for at least windows and linux</li>
<li>Highlights multiple syntaxes in the same document. (Ala Dreamweaver)</li>
<li>Tabbed interface</li>
</ol>
<p>All the editors I tried highlighted by file extension only which isn't fine grained enough.
At the very least it ne... | <p>The answer is emacs. You can do pretty much anything you want with that editor. There is a 'nxhtml-mode' which you can use to edit javascript, php, html,ruby, jsp,css, whatever on the same file. If you're still at university, the best advice I can give you is to start learning how to use emacs. It will change your l... | <p>Netbeans.</p>
<p>I've only tried it with HTML av Javascript for two languages in the same file though.</p>
| 34,860 |
<p>Is there a way to do this in one line?</p>
<pre><code>$x =~ s/^\s+//;
$x =~ s/\s+$//;
</code></pre>
<p>In other words, remove all leading and trailing whitespace from a string.</p>
| <pre><code>$x =~ s/^\s+|\s+$//g;
</code></pre>
<p>or</p>
<pre><code>s/^\s+//, s/\s+$// for $x;
</code></pre>
| <pre><code>$x =~ s/^\s*(.*?)\s*$/$1/;
</code></pre>
| 22,319 |
<p>I want to print a model of an animal cell.</p>
<p>What I have so far: I managed to use different colors to print out the different parts of the cell.<br>
My question is: what is the best way to connect plastic 3d printed parts?<br>
Glue? Melted plastic? I need it to have a strong connection and not very visible whe... | <p>For ABS print, I recommend <a href="https://en.wikipedia.org/wiki/Acetone" rel="nofollow">acetone</a>. It is not a glue, but it will dissolve the plastic a bit and if you apply it to both connecting parts and push them together, they will stay connected after the acetone dries. However, it does not dry very fast and... | <p>After doing the processes that hroncok described, the edges of the print can be finished with a 3D printing pen. The pen extrudes filament as a regular print head does, but is hand held. The filament can be extruded on the previous gap between the two prints. It will melt between the two sides and can be finished... | 100 |
<p>I've recently taken up learning some C# and wrote a Yahtzee clone. My next step (now that the game logic is in place and functioning correctly) is to integrate some method of keeping stats across all the games played.</p>
<p>My question is this, how should I go about storing this information? My first thought wou... | <p>Here is one idea: use Xml Serialization. Design your GameStats data structure and optionally use Xml attributes to influence the schema as you like. I like to use this method for small data sets because its quick and easy and all I need to do is design and manipulate the data structure.</p>
<pre><code>
using (Fil... | <p>You can either use the <code>System::Xml</code> namespace or the <code>System::Data</code> namespace. The first gives you raw XML, the latter gives you a handy wrapper to the XML.</p>
| 4,041 |
<p>The <em>VS2008 SP1</em> documentation talks about <strong><code>std::tr1::mem_fun</code></strong>.</p>
<p>So why, when I try and use <strong><code>std::tr1::mem_fun</code></strong>, why do I get this compile error?:</p>
<pre><code>'mem_fun' : is not a member of 'std::tr1'
</code></pre>
<p>At the same time, I can ... | <p>Change it to this:</p>
<pre><code>std::tr1::function<void (int)> f =
std::tr1::bind(std::tr1::mem_fn(&Test::TakesInt), t, std::tr1::placeholders::_1);
f(2);
</code></pre>
<p>The binder requires the int argument. So you have to give it a placeholder which stands for the integer argument that the gener... | <p>To use mem_fun like that you need to fully specify all the template arguments (as mem_fun is a class and automatic template parameter deduction is not done on classes). Also mem_fun only has a default constructor that takes 0 arguments. </p>
<p>Not having the full class definition it is hard to get correct.<br>
But... | 37,503 |
<p>I have some code that modifies a value that several controls in other update panels are bound to. When this event handler fires, I'd like it to force the other update panels to refresh as well, so they can rebind.</p>
<p>Is this possible?</p>
<p>Edit: </p>
<p>To clarify, I have an update panel in one user control... | <p>You can set triggers on the events in the update panel you want updated or you can explicitly say updatepanel.update() in the code behind.</p>
| <p>This is a good technique if you want to refresh updatepanel from <a href="http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/" rel="nofollow noreferrer">client side Javascript</a>.</p>
| 7,898 |
<p>What is the best way to create a webservice for accepting an image.
The image might be quite big and I do not want to change the default receive size for the web application.
I have written one that accepts a binary image but that I feel that there has to be a better alternative.</p>
| <p>Where does this image "live?" Is it accessible in the local file system or on the web? If so, I would suggest having your WebService accepting a URI (can be a URL or a local file) and opening it as a Stream, then using a StreamReader to read the contents of it.</p>
<p>Example (but wrap the exceptions in FaultExcept... | <p>Can't you upload the image to the server using FTP, then when that's done the server (and thus WCF service) van easily access it? That way you don't need to thinker with the receive size settings etc.</p>
<p>At least, that's how I did it.</p>
| 13,036 |
<p>If I switch on the generating of debug info with Javac then the class files are 20-25% larger. Has this any performance effects on running the Java program? If yes on which conditions and how many. I expect a little impact on loading the classes because the files are larger but this should be minimal.</p>
| <p>In any language, debugging information is meta information. It by its nature increases the size of the object files, thus increasing load time. During execution outside a debugger, this information is actually completely ignored. As outlined (although not clearly) in the <a href="http://java.sun.com/docs/books/jvms/... | <p>Please be aware that since JDK1.3 javac ignores any optimization flags, "compile-time optimization is unnecessary"</p>
| 26,814 |
<p>Hey all. We're sending quite a few emails (around 23k) using IIS6 SMTP service and receive about 7-8 error messages each time. The stack trace is:</p>
<pre><code>System.Net.Mail.SmtpException: Exceeded storage allocation. The server response was: 4.3.1 Session size exceeds fixed maximum session size
at System.... | <p>Jim, this seems like it's running out of disk space storing all the temp queue files to be sent out. Which is why you only see the error a couple times. As it sends the messages, I'm sure it cleans up the temp files, making room for more. Keep in mind that you can send emails MANY, MANY times faster than the SMTP... | <p>I've got the exact same error message on a Windows Server machine and changing the "Limit message size" to a bigger size resolved the error.</p>
<p>On a Windows Server 2012 machine you can find the IIS SMTP server settings using the search charm and search for IIS. On the tap messages you can change the message siz... | 39,344 |
<p>I'm trying to run SQuirreL SQL.<br>
I've downloaded it and installed it, but when I try to run it I get this error message: </p>
<blockquote>
<p>Java Virtual Machine Launcher.<br>
Could not find the main class.<br>
Program will exit. </p>
</blockquote>
<p>I get the gist of this, but I have not idea how to f... | <p>Is Java installed on your computer? Is the path to its bin directory set properly (in other words if you type 'java' from the command line do you get back a list of instructions or do you get something like "java is not recognized as a .....")?</p>
<p>You could try try running <code>squirrel-sql.jar</code> from th... | <p>I had the same issue with a different application (BI Publisher) because I installed a 32 bit version of this application on a 64 bit version of Windows.</p>
<pre><code>Java Virtual Machine Launcher - could not find the main class
</code></pre>
<p><a href="https://i.stack.imgur.com/UOQJv.png" rel="nofollow norefer... | 14,675 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.