instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I want to put a spiral lid on top of a container. When the lid opens, then the spiral mechanism will rotate into the container. Is there a name for this mechanism? If not, would something like this be possible?</p>
| <p>It sounds like you're talking about an <a href="https://en.wikipedia.org/wiki/Diaphragm_(optics)" rel="nofollow noreferrer">iris diaphragm</a>. This has many parts that slide against each other, and would best be printed as separate parts, then assembled.</p>
| <p>No spiral lids that I know of. I'm not sure how they would work, anyway. There are plenty of designs with hemispherical lids -- so-called "Venus" boxes. Check Yeggi:</p>
<p><a href="https://www.yeggi.com/q/venus+box/" rel="nofollow noreferrer">Yeggi : Venus box</a></p>
| 1,599 |
<p>on Windows systems. I get the following NPE with the <code>FileChooser</code>. It is a known bug that is not fixed by sun yet. <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342301" rel="nofollow noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342301</a></p>
<p>Does somebody know a wor... | <p>In the bug report that you linked to, they also mention a workaround.
It seems to come down to calling the methods in a specific order.
Have you tried that?</p>
<blockquote>
<p>A DESCRIPTION OF THE PROBLEM :
There appears to be an undocumented bad intereaction between
explicitely setting the UI and removing a... | <p>It looks like the workaround description says you <strong>should</strong> try to set the UI before manipulating the filters. Does this not work?</p>
<p>If that doesn't work, is it possible to create an instance of your manipulated FileFilters at the same point that you are setting your UI?</p>
| 12,565 |
<p>I have a news site with articles tagged in categories.</p>
<p>My Controller is called "Category" and this URL:</p>
<blockquote>
<p><code>http://mysite.com/Category/Sport</code></p>
</blockquote>
<p>passes <code>Sport</code> to action <code>Index</code> in controller <code>Category</code>.</p>
<p>I want to allo... | <p>There's a pretty good response to my question along these lines <a href="https://stackoverflow.com/questions/19941/aspnet-mvc-catch-exception-when-non-existant-controller-is-requested">here</a>.</p>
| <p>You can do it like this:</p>
<pre><code>routes.MapRoute("Default", "{category}/{subcategory}",
new { controller = "CategoryController", action = "Display", id = "" }
);
</code></pre>
<p>and then in your controller:</p>
<pre><code>public class CategoryController : Controller
{
public ActionResult Display(s... | 26,932 |
<p>Is is better to do a joined query like this:</p>
<pre><code>var employer = (from person in db.People
join employer in db.Employers
on person.EmployerID equals employer.EmployerID
where person.PersonID == idPerson
select employer).FirstOrDefaul... | <p>I'd use this:</p>
<pre><code>var employer = (from person in db.People
where person.PersonID == idPerson
select person.Employer).FirstOrDefault();
</code></pre>
<p>It's got the simplicity of the first version but still only fetches the data for the employer (rather than the person <e... | <p>The second one could evaluate to null which would result in an error.</p>
<p>I like the first one better because if it is null then you can deal with it without an exception being thrown.</p>
| 28,952 |
<p>I'm writing a script to display the 10 most recently "active" WordPress blog posts (i.e. those with the most recent comments). Problem is, the list has a lot of duplicates. I'd like to weed out the duplicates. Is there an easy way to do this by changing the MySQL query (like IGNORE, WHERE) or some other means? Here... | <p>Look at the <a href="http://dev.mysql.com/doc/refman/5.0/en/select.html" rel="nofollow noreferrer">DISTINCT</a> option for the SELECT statement. Or alternatively the GROUP BY syntax (look at the same link). Though they work in different ways, these would be the two methods most likely to help you get exactly what yo... | <p>I thought I had figured it out using GROUP BY, but now I'm not so sure. Here is the code:</p>
<pre><code> if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
$comments = $wpdb->get_results("SELECT comment_post_ID, comment_author, comment_date FROM $wpdb->comments WHERE comment_approved = ... | 39,421 |
<p>What is the best database schema to track role-based access controls for a web application?</p>
<p>I am using Rails, but the RBAC plugin linked by Google looks unmaintained (only 300 commits to SVN; latest was almost a year ago).</p>
<p>The concept is simple enough to implement from scratch, yet complex and import... | <p>To my rather basic knowledge in that area, the basic actors of an RBAC are:</p>
<ul>
<li>Resources.</li>
<li>Permissions.</li>
<li>Users.</li>
<li>Roles (i.e. Groups).</li>
</ul>
<p><strong>Resources</strong> <- require -> (<em>one or many</em>) <strong>Permissions</strong>.</p>
<p><strong>Roles</strong> <-... | <p>For .net applications you should look at something like Visual Guard <a href="http://www.visual-guard.com/" rel="nofollow noreferrer">http://www.visual-guard.com/</a> to avoid having to handle permissions and roles from scratch. </p>
<p>Also for .net, you have the membership and role providers and authorisation han... | 23,088 |
<p>Is it better to use a stored procedure or doing it the old way with a connection string and all that good stuff? Our system has been running slow lately and our manager wants us to try to see if we can speed things up a little and we were thinking about changing some of the old database calls over to stored procedur... | <p>The first thing to do is check the database has all the necessary indexes set up. Analyse where your code is slow, and examine the relevant SQL statements and indexes relating to them. See if you can rewrite the SQL statement to be more efficient. Check that you aren't recompiling an SQL (prepared) statement for eve... | <p>You can never say in advance. You must do it and measure the difference because in 9 out of 10 cases, the bottleneck is not where you think.</p>
<p>If you use a stored procedure, you don't have to transmit the data. DBs are usually slow at executing [EDIT]complex[/EDIT] stored procedures [EDIT]with loops, higher ma... | 42,202 |
<p>I'm still trying to learn LINQ, though it's going more smoothly now that I've started to use it daily at work. I still don't feel <em>good</em> at it, though. Does anyone have any challenging practice exercises or puzzles I can use as a code-kata to improve my skills?</p>
<p>I'll leave this as community wiki, so ma... | <p>If you have not discovered <a href="http://www.linqpad.net/" rel="nofollow noreferrer">http://www.linqpad.net/</a> it lets you practice linq in a lightweight way, as well as having some inbuilt examples from C# 5.0 in a nutshell and C# in Depth books.</p>
| <p>I've been finding "foreach's" in existing code and attempting to linq'ify them. Many times things have been different enough for me to learn new concepts or at least if they're similar I get to feel more confident that my Linq skills are getting better.</p>
| 23,202 |
<p>I have a WPF ListView which repeats the data vertically. I cannot figure out how to make it repeat horizontally, like the slideshow view in Windows Explorer. My current ListView definition is:</p>
<pre><code><ListView ItemsSource="{StaticResource MyDataList}" ItemTemplate="{StaticResource ListViewTemplate}">
... | <p>Set the ItemsPanel of the ListView to a horizontal StackPanel. Like this:</p>
<pre><code><ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</code></pre>
| <p>I found it easier to go this way</p>
<pre><code><ItemsControl ItemsSource="{Binding Path=Steps}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding PageName}" Padding="10" />
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.Item... | 46,848 |
<p>What is the single most important performance tuning area for a WCF Web service? </p>
<ul>
<li>ASP.net Thread settings?</li>
<li>WCF throttling?</li>
</ul>
| <p>Please take a look at the articles and whitepapers below. I think they should give you MUCH more concrete performance considerations to explore, and likely some very practical settings to tweak, optimize, or change. I posted this answer in another question as well, but I think it'll be useful for anybody who comes a... | <p>There's so much that depends upon your application design, hardware and load.</p>
<p>If I had to pick one technique, it would probably be using single call objects.</p>
<p>Throttling is helpful once you have a feel for the peak load your system can handle.</p>
| 33,110 |
<p>I've introduced visitors as one of core architecture ideas in one of my apps. I have several visitors that operate on a same stuff. Now, how should I test it? Some tests I'm thinking of are a bit larger then a unit test should be (integration test? whatever) but I still wanna do it. How would you test code like the... | <p>make a test visitor object and make it visit things.... test that it visited the right things.</p>
| <p>You can create <a href="http://en.wikipedia.org/wiki/Mock_Object" rel="nofollow noreferrer">mock objects</a> and have your visitors visit them, and then create mock visitors, and test that the right actions were performed.</p>
| 30,365 |
<p>What is the current state of the art in rails for preventing spam accounts? Captcha? Any good plugins, tutorials or suggestions?</p>
| <p><strong>Use a library</strong>: You're (almost) always better off appropriating code from people who are better at the subdomain than you are. The Wordpress guys behind Akismet have forgotten more about blog spam than I know, and I was an email anti-spam researcher for a while. You might be interested in a <a href... | <p>Spam is fair. It doesn't care what you're running behind the scenes.</p>
<p>So by extension, the things that work well on Rails are the same things that work for PHP, ASPNET, etc. Take a look at <a href="http://github.com/jfrench/rakismet/tree/master" rel="nofollow noreferrer">Akismet</a> and the various "karma" an... | 12,753 |
<p>Looking for one that is fast enough and still graceful with memory. The image is a 24bpp System.Drawing.Bitmap.</p>
| <p>If you need an exact number, then you are going to have to loop over all of the pixels. Probably storing the color and a count in a hash is the best way to go because of the sparseness of the colors. </p>
<p>Using the Color.ToArgb() in the hash instead of the color object would probably be a good idea too.</p>
<... | <p>The modern popular implementation of <a href="http://en.wikipedia.org/wiki/Color_quantization" rel="nofollow noreferrer">color quantization</a> uses the <a href="http://en.wikipedia.org/wiki/Octree" rel="nofollow noreferrer">octree</a> data structure. Note the wikipedia pages, the content is pretty good. The octre... | 15,410 |
<p>Is there an easy way to test whether your named pipe is working correctly? I want to make sure that the data I'm sending from my app is actually being sent. Is there a quick and easy way to get a list of all the named pipes?</p>
| <p>You can view these with <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="noreferrer">Process Explorer</a> from sysinternals. Use the "Find -> Find Handle or DLL..." option and enter the pattern "\Device\NamedPipe\". It will show you which processes have which pipes open.</p>
| <p>The second pipe was interpreted by this web site when submitted... You need two backslashes at the beginning. So make sure to use <code>System.IO.Directory.GetFiles(@"\\.\pipe\")</code>.</p>
<p>Note that I have seen this function call throw an 'illegal characters in path.' exception when one of the pipes o... | 32,294 |
<p>I have a DateTime object that I need to print in a custom gridlike control.
The type of the data I want to print is a date in the format dd-mm-yyyy.
This value can be either filled or blank.
If it's filled it will be parsed into a <code>DateTime</code> and then printed as the default <code>ToString</code>.</p>
<p>F... | <pre><code>Container.Value.Length > 0 ? Convert.ToDateTime(Container.Value).ToShortTimeString() : ""
</code></pre>
<p>You should also be able to pass <code>Container.Value</code> to any method in scope that you've defined.</p>
| <p>You can have a protected method in your code behind which does the checking for you</p>
<pre><code>protected static string ConvertDate(object date) {
if (date == null)
return string.Empty;
return Convert.ToDateTime(date).ToShortTimeString();
}
</code></pre>
| 40,531 |
<p>I am developing a Joomla component and one of the views needs to render itself as PDF. In the view, I have tried setting the content-type with the following line, but when I see the response, it is text/html anyways.</p>
<pre><code>header('Content-type: application/pdf');
</code></pre>
<p>If I do this in a regular... | <p>Since version 1.5 Joomla has the JDocument object. Use <a href="http://api.joomla.org/Joomla-Framework/Document/JDocument.html#setMimeEncoding" rel="noreferrer">JDocument::setMimeEncoding()</a> to set the content type.</p>
<pre><code>$doc =& JFactory::getDocument();
$doc->setMimeEncoding('application/pdf');
... | <p>I had the same problem in joomla 2.5. After 8 hours of clicking around in the joomla admin panel I found a solution.</p>
<ol>
<li>Log into your joomla admin panel and click on media manager </li>
<li>Click the options button in the top right hand corner. This opens a configuration tab with various options</li>
<li>... | 16,150 |
<p>Alright, long story but I want to provide as much detail as possible:</p>
<p>I have a heavily modded Ender 3 Pro. Mods include:</p>
<ul>
<li>Metal Extruder</li>
<li>Capricorn PTFE tube</li>
<li>Glass bed with improved leveling nuts</li>
<li>BLTouch</li>
<li>LED strip</li>
<li>Dual Z-axis motors with the recent addi... | <p><img src="https://i.stack.imgur.com/WpqHy.jpg" alt="enter image description here" />
It was a worn extruder gear. I didn’t think it was THAT worn, and when I loosened it a bit and slid it a few mm so that the gear hit the filament in a fresh spot it didn’t improve. But new stainless steel gears showed up today and... | <p>I see positional errors in X and Y, but Z looks okay.</p>
<p>That suggests one or both of your belts is stretched, perhaps damaged, or maybe just loose.</p>
<p>Try engaging the stepper motors in the device's panel and push the head left/right or pull the bed toward/away from you. They should both resist handforce, ... | 2,053 |
<p>Is there a specific reason why I should be using the <code>Html.CheckBox</code>, <code>Html.TextBox</code>, etc methods instead of just manually writing the HTML?</p>
<pre><code><%= Html.TextBox("uri") %>
</code></pre>
<p>renders the following HTML</p>
<pre><code><input type="text" value="" name="uri" id... | <p>There are huge benefits:</p>
<p>It has overloaded methods to pre-populate the values (formatted, and safe for HTML) just like the ViewState.</p>
<p>It allows built in support for the Validation features of MVC.</p>
<p>It allows you to override the rendering by providing your own DLL for changing the rendering (a ... | <p>I haven't been doing MVC too long, but I've already written some extension methods to generate menu tabs based on Html.ActionLink. It allows me to be consistent with my usage and, if I decide to change how my CSS menus work, only modify a single method to output the new tab format.</p>
<p>The other use that I have... | 34,539 |
<p>I have a simple event handler with a ItemAdding event that changes a column value that I need in the ItemUpdated method. After uploading a word 2007 document (*.docx, *.pptx or xlsx) the value of the column is changed, but when I protect the document the value of the column disappears in the ItemUpdated method. Thi... | <p>We have the same issue. It appears that the properties from the list are added to the office 2007 doc, but only with the default values for the field on upload/creation. Once the item is edited we are experiencing that the office documents values are overriding the values set in our event handler.</p>
<p>We do not ... | <p>When you upload an Office document into SharePoint, it tries to extract column from the document and promote them to the list.</p>
<p>Do, check if your doc has any attribute set. If this is the case, it can explain what you see.</p>
<p>Note: open advance document properties and delete all custom properties to be s... | 25,228 |
<p>Background</p>
<p>I have a massive db for a SharePoint site collection. It is 130GB and growing at 10gb per month. 100GB of the 130GB is in one site collection. 30GB is the version table. There is only one site collection - this is by design.</p>
<p>Question</p>
<p>Am I able to partition a database (SharePoint... | <p>You would have to create a partition set and rebuild the table on that partition set. SQL2005 can only partition on a single column, so you would have to have a column in the DB that </p>
<ul>
<li>Behaves fairly predictably so you don't get a large skew in the amount of data in each partition</li>
<li>IIRC the col... | <p>Mauro,</p>
<p>Is there no way you can segment the data on a Sharepoint level?</p>
<p>ie you may have multiple "sites" using a single (SQL) content database.
You could migrate site data to a new content database, which will allow you to reduce the data in that large content site and then shrink the datafiles.</p>
... | 19,058 |
<p>I'm trying to come up with a design for a thread pool with a lot of design requirements for my job. This is a real problem for working software, and it's a difficult task. I have a working implementation but I'd like to throw this out to SO and see what interesting ideas people can come up with, so that I can compa... | <p>So what are we going to pick as the basic building block for this. Windows has two building blocks that look promising :- I/O Completion Ports (IOCPs) and Asynchronous Procedure Calls (APCs). Both of these give us FIFO queuing without having to perform explicit locking, and with a certain amount of built-in OS sup... | <p>@DrPizza - this is a very good question, and one that strikes right to the heart of the problem. There are a few reasons why QueueUserWorkItem and the Windows NT thread pool was ruled out (although the Vista one does look interesting, maybe in a few years).</p>
<p>Firstly, we wanted to have greater control over whe... | 5,939 |
<p>I've got a big big code base that includes two main namespaces: the engine and the application. </p>
<p>The engine defines a vector3 class as a typedef of another vector3 class, with equality operators that sit in the engine namespace, not in the vector3 class. I added a class to the application that also had equ... | <p>C++ Standard, 3.4.4.2 declares:</p>
<blockquote>
<p>For each argument type T in the function call, there is a set of zero or more associated namespaces and a set of zero
or more associated classes to be considered. The sets of namespaces and classes is determined entirely by the types of
the function argument... | <pre><code>bool operator==(Vector3 const &lhs, Vector3 const &rhs) { ... }
</code></pre>
<p>The canonical definition of an equality operator defined on a class should only have one argument, namely the rhs. The lhs is this.
Don't know if this would be a solution to your problem though.</p>
<p>This is what I w... | 25,972 |
<p>Is it possible to using "paging" functionality in Linq queries? Let's say I have some XML like this:</p>
<pre><code><Root>
<BetaSection>
<Choices>
<SetA>
<Choice id="choice1">Choice One</Choice>
<Choice id="choice2">... | <pre><code>var q = from X in Choices.Skip((page-1)*pageSize).Take(pageSize)
select X;
</code></pre>
<p>Now, if you need a where clause in it, it gets a bit trickier:</p>
<pre><code>var q = (from X in Choices
where x.SomeField == SomeValue
select X).Skip((page-1)*pageSize).Take(pageSize);
</c... | <p>The "Take" and "Skip" extension methods provide for this.</p>
<pre><code>myQueryable = myQueryable.Skip(10).Take(10);
</code></pre>
| 45,666 |
<p>I'm using <code>git-svn</code> to work against my company's central Subversion repository. We've recently created a new feature branch in the central repo. </p>
<p>How do I tell Git about it? When I run <code>git branch -r</code> I can only see the branches that existed when I ran <code>fetch</code> against the Sub... | <p>You can manually add the remote branch,</p>
<pre><code>git config --add svn-remote.newbranch.url https://svn/path_to_newbranch/
git config --add svn-remote.newbranch.fetch :refs/remotes/newbranch
git svn fetch newbranch [-r<rev>]
git checkout -b local-newbranch -t newbranch
git svn rebase newbranch
</code></p... | <p>If you don't check out with a valid layout, you won't be able to checkout a remote branch. </p>
<p>This is what I do:</p>
<pre><code>git svn init -s <svn path with no trunk> local_repo
cd local_repo
git svn fetch
## wait
</code></pre>
<p>After that, you can switch to a remote branch:</p>
<pre><code>git ch... | 37,983 |
<p>There seem to be two bash idioms for redirecting STDOUT and STDERR to a file:</p>
<pre><code>fooscript &> foo
</code></pre>
<p>... and ...</p>
<pre><code>fooscript > foo 2>&1
</code></pre>
<p>What's the difference? It seems to me that the first one is just a shortcut for the second one, but my ... | <p>From the <a href="http://www.gnu.org/software/bash/manual/bashref.html#Redirections" rel="noreferrer">bash manual</a>:</p>
<blockquote>
<p>There are two formats for redirecting standard output and standard error:</p>
<pre><code>&>word
</code></pre>
<p>and</p>
<pre><code>>&word
</code></p... | <p><code>2>&1</code> might be useful for cases where you aren't redirecting stdout to somewhere else, but rather you just want stderr to be sent to the same place (such as the console) as stdout (perhaps if the command you are running is already sending stderr somewhere else other than the console).</p>
| 22,811 |
<p>I'm looking for a SharePoint (MOSS) shared hosting provider that supports deployment of custom solutions (.WSPs) - it'd be okay if it was medium trust. I'm building a public Internet site on SP and the client doesn't want to host it or pay for the license all up front. Any suggestions?</p>
| <p>I'm not aware of any shared hosting plans that support the deployment of custom solutions. From what I've seen, you'd need at least a semi-dedicated hosting plan. I'm a developer at Fpweb.net and I know that you can do this using any of their <a href="http://www.fpweb.net/moss-hosting/moss-corporate.asp" rel="nofo... | <p>if you are looking to develop a custom Sharepoint Page, you may consider the sharepoint plan at <a href="http://www.asphostportal.com" rel="nofollow noreferrer">ASPHostPortal.com</a>. They allow not only medium trust, but full trust mode and this certainly allow you to create a custom page via any Sharepoint Designe... | 25,193 |
<p>Specifically, I have a model that has a field like this</p>
<pre><code>pub_date = models.DateField("date published")
</code></pre>
<p>I want to be able to easily grab the object with the most recent <code>pub_date</code>. What is the easiest/best way to do this?</p>
<p>Would something like the following do what I... | <pre><code>obj = Edition.objects.latest('pub_date')
</code></pre>
<p>You can also simplify things by putting <a href="http://docs.djangoproject.com/en/dev/ref/models/options/#get-latest-by" rel="noreferrer"><code>get_latest_by</code></a> in the model's Meta, then you'll be able to do</p>
<pre><code>obj = Edition.obje... | <p>This has already been answered, but for more reference, this is what <a href="http://www.djangobook.com/en/2.0/chapter05.html" rel="nofollow">Django Book</a> has to say about Slicing Data on QuerySets:</p>
<blockquote>
<p>Note that negative slicing is not supported:</p>
<pre><code>>>> Publisher.objects.... | 31,428 |
<p>I've been working through a recent Computer Science homework involving recursion and big-O notation. I believe I understand this pretty well (certainly not perfectly, though!) But there is one question in particular that is giving me the most problems. The odd thing is that by looking it, it looks to be the most sim... | <p>There's a couple of different ways to solve recurrences: substitution, recurrence tree and master theorem. Master theorem won't work in the case, because it doesn't fit the master theorem form.</p>
<p>You could use the other two methods, but the easiest way for this problem is to solve it iteratively.</p>
<p>T(n)... | <blockquote>
<p>I think this will be exponential. Each increment to n brings twice as much calculation.</p>
</blockquote>
<p>No, it doesn't. Quite on the contrary:</p>
<p>Consider that for <em>n</em> iterations, we get running time <em>R</em>. Then for <em>n</em> + 1 iterations we'll get exactly <em>R</em> + 1.</p>... | 25,247 |
<p>When should I put ... at the end of a menu item? I seem to remember reading some rules but can't for the life of me find them.</p>
<p>For context - I'm adding a properties option to a right click menu and am wondering if it is appropriate to add them.</p>
| <p>One exception to the first two answers: if the whole <strong>point</strong> of the menu command is to open a window or dialog, then you don't need an ellipsis. For example, a "Get Info" or "Properties" command shouldn't have it, even though it's opening a window which lets you edit things.</p>
<p>It's only when the... | <p>You should add ellipses to the end of text only if you're truncating the text (this applies anywhere). You should truncate the text if it's too long to reasonably fit where you're putting it.</p>
<p>Edit: interesting, I never noticed that <strong>menus in Windows use the ellipses to indicate truncated text, but al... | 35,187 |
<p>I am making a mp3 id3tag editor, and a regex is not matching.
Could anyone help me please?
my code:</p>
<pre><code>arquivo = "[coletanea] album [CD #] [faixa] [artista] musica.mp3"
r = New Regex("^\[(?<1>[^\]]+?)\]\s*(?<2>[\w\s]+)\s*\[CD\s*(?<3>\d+)\]\s*\[(?<4>\d+)\]\s*\[(?<5>[^\]]+)\... | <p>That's because your string will never match the regexp you are using.</p>
<p>The regexp expects a number instead of # and a number instead of 'faixa'</p>
<p>Try this, for example:</p>
<pre><code>"[coletanea] album [CD 20] [89] [artista] musica.mp3"
</code></pre>
<p>If you wish to allow for any character instead ... | <p>Well, your string dosen't match the regexp (since '#' and 'faixa' is not digits) try with this string witch I'm guessing is the string you will get from the system:</p>
<pre><code>"[coletanea] album [CD 1] [1] [artista] musica.mp3"
</code></pre>
<p>Its also a little weird to name the capture groups to numbers like... | 38,908 |
<p>In a program I work on, I have a lot of code as follows:</p>
<pre><code>pthread_mutex_lock( &frame->mutex );
frame->variable = variable;
pthread_mutex_unlock( &frame->mutex );
</code></pre>
<p>This is clearly a waste of CPU cycles if the middle instruction can just be replaced with an atomic store... | <p>You could check the gcc documentation. For the current gcc version (4.3.2) it would be chapter 5.47 <a href="http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html" rel="noreferrer">Built-in functions for atomic memory access</a> - for other gcc versions please check your docs. It should be in chapter 5- E... | <p>As i can see, you're using gnu platform for development, so it's safe to say that glic provides a datatype int ranged with atomic capabilities, <code>'sig_atomic_t'</code> . So this approach can assure you atomic operations at kernel levels. not gcc levels.</p>
| 20,037 |
<p>I have a string encrypted in PHP that I would like to decrypt in C#. I used the tutorial below to do the encryption, but am having problems decrypting. Can anyone post an example on how to do this? </p>
<p><a href="http://www.sanity-free.org/131/triple_des_between_php_and_csharp.html" rel="noreferrer">http://www... | <p>Hope this helps:</p>
<pre><code>class Program
{
static void Main(string[] args)
{
Console.WriteLine(Decrypt("47794945c0230c3d"));
}
static string Decrypt(string input)
{
TripleDES tripleDes = TripleDES.Create();
tripleDes.IV = Encoding.ASCII.GetBytes("password");
... | <p>If you are not tied to tripleDES, but just need to pass encrypted data between php and .net, this will work for you. It's in VB and C# below.</p>
<h3>BEGIN PHP CODE</h3>
<pre><code><?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
// I blantantly stole, tweaked and happily used this code from:
// L... | 27,726 |
<p>I develop industrial client/server application (C++) with strong real time requirements.
I feel it is time to change the look of the client interface - which is developed in MFC - but I am wondering which would be the right choice.
If I go for a web client is there any way to exchange data between C++ and javascrip... | <p>My team had to make that same decision a few months ago...</p>
<p>The cool thing about making it a web application would be that it would be <em>very</em> easy to modify later on. Even the user of the interface (with a little know-how) could modify it to suit his/her needs. Custom software becomes just that much ea... | <p>You may want to consider where your data lives. If your application feeds a back-end database, you could write a web app leaving your c++ code in tact -- the web application would be independent and offer up pages to web users and talk directly to the database -- In this case you have as many options, and more, as ... | 38,464 |
<p>When you double click on a class (in 'solution explorer')... if that class happens to be an .asmx.cs webservice... then you get this...</p>
<blockquote>
<p>To add components to your class, drag
them from the Toolbox and use
the Properties window to set their
properties. To create methods and
events for yo... | <p>You can set the default editor for any given file type (.cs, .xml, .xsd, etc). To change the default editor for a given type:</p>
<ol>
<li>Right-click a file of that type in
your project, and select "Open
With..."</li>
<li>Select your preferred editor. You
may want "CSharp Editor".</li>
<li>Click "Set as Default".... | <p>Add the following attribute to your class:</p>
<pre><code><System.ComponentModel.DesignerCategory("")>
</code></pre>
| 18,847 |
<p>Is there any way to check whether a file is locked without using a try/catch block? </p>
<p>Right now, the only way I know of is to just open the file and catch any <code>System.IO.IOException</code>.</p>
| <p>No, unfortunately, and if you think about it, that information would be worthless anyway since the file could become locked the very next second (read: short timespan).</p>
<p>Why specifically do you need to know if the file is locked anyway? Knowing that might give us some other way of giving you good advice.</p>
... | <p>What I ended up doing is:</p>
<pre><code>internal void LoadExternalData() {
FileStream file;
if (TryOpenRead("filepath/filename", 5, out file)) {
using (file)
using (StreamReader reader = new StreamReader(file)) {
// do something
}
}
}
internal bool TryOpenRead(strin... | 2,370 |
<p>Does anyone know a good .NET dictionary API? I'm not interested in meanings, rather I need to be able to query words in a number of different ways - return words of x length, return partial matches and so on...</p>
| <p>Grab the flat text file from an open source spellchecker like ASpell (<a href="http://aspell.net/" rel="noreferrer">http://aspell.net/</a>) and load it into a List or whatever structure you like.</p>
<p>for example, </p>
<pre><code>List<string> words = System.IO.File.ReadAllText("MyWords.txt").Split(new stri... | <p>You might want to look for a <a href="http://en.wikipedia.org/wiki/Trie" rel="nofollow noreferrer">Trie</a> implementation. That will certainly help with "words starting with XYZ" as well as exact matches. You may well want to have all of your data in multiple data structures, each one tuned for the particular task ... | 43,518 |
<p>Generally, I like to keep an application completely ignorant of the IoC container. However I have ran into problems where I needed to access it. To abstract away the pain I use a basic Singleton. Before you run for the hills or pull out the shotgun, let me go over my solution. Basically, the IoC singleton does a... | <p>I've seen that even Ayende implements this pattern in the Rhino Commons code, but I'd advise against using it wherever possible. There's a reason Castle Windsor doesn't have this code by default. StructureMap does, but Jeremy Miller has been moving away from it. Ideally, you should regard the container itself wit... | <p>It all depends on the usage. Using the container like that is called the Service Locator Pattern. There are cases where it's not a good fit and cases where it do apply.</p>
<p>If you google "service locator pattern" you'll see a lot of blog posts saying that it's an anti-pattern, which it's not. The pattern has sim... | 35,009 |
<p>If a large module is loaded by some submodule of your code, is there any benefit to referencing the module from that namespace instead of importing it again?</p>
<p>For example:
I have a module MyLib, which makes extensive use of ReallyBigLib. If I have code that imports MyLib, should I dig the module out like so</... | <p>Python modules could be considered as singletons... no matter how many times you import them they get initialized only once, so it's better to do:</p>
<pre><code>import MyLib
import ReallyBigLib
</code></pre>
<p>Relevant documentation on the import statement:</p>
<p><a href="https://docs.python.org/2/reference/si... | <p>It is the same performancewise. There is no JIT compiler in Python yet.</p>
| 37,860 |
<p>When you data bind in C#, the thread that changes the data causes the control to change too. But if this thread is not the one on which the control was created, you'll get an Illegal Cross Thread Operation exception.</p>
<p>Is there anyway to prevent this?</p>
| <p>You should be able to do something like:</p>
<pre><code>if (control.InvokeRequired)
{
control.Invoke(delegateWithMyCode);
}
else
{
delegateWithMyCode();
}
</code></pre>
<p>InvokeRequired is a property on Controls to see if you are on the correct thread, then Invoke will invoke the delegate on the correct t... | <p>If the thread call is "illegal" (i.e. the DataBind call affects controls that were not created in the thread it is being called from) then you need to create a delegate so that even if the decision / preparation for the DataBind is not done in the control-creating thread, any resultant modification of them (i.e. Dat... | 2,421 |
<p>I want to connect and execute one (or sometimes several) SQL statements, and NOT have those replicated to the slaves.</p>
<p>I have no replicate-do or replicate-ignore configs, so I can't <code>use</code> some non-replicated database to send the commands from. And I know about:</p>
<pre><code>set global sql_slave... | <p><code>SET sql_log_bin=0</code> is what you're looking for. Requires SUPER priv., and will turn off logging of commands from your session until you set it back to 1. See <a href="http://dev.mysql.com/doc/refman/5.0/en/server-session-variables.html#sysvar_sql_log_bin" rel="noreferrer">http://dev.mysql.com/doc/refman/5... | <p>BE CAREFUL.....! </p>
<p><code>SET sql_log_bin=0;</code></p>
<p>Master MySQL server automatically set this 0 value to 1 after a while(after about one minute). It does not wait until we explicitly set it to 1. So according to my experience this not a safe way to turn off binary logging at all.....!</p>
| 46,295 |
<p>I was just watching a video on MSDN Channel 9 which can be found <a href="http://channel9.msdn.com/posts/Dan/Lucian-Wischik-and-Lisa-Feigenbaum-Whats-new-in-Visual-Basic-10/" rel="noreferrer">here</a>, about some of the new features in Visual Basic 10. Now I like most of the new features, some of which have been lo... | <p>Personally, I think that VB's syntax for delegates and lambdas is completely bogus. I mean, come on, <code>AddressOf</code>! This was fine in VB6. It is definitely <em>not</em> fine in a language such as VB.NET where functions <em>should</em> be treated as first-class citizens (although they really aren't, of course... | <p>Full anonymous method support in VB means you can start taking a more functional style with things. If the Sub() End Sub need to go on separate lines... that hurts. I'd hope they'd allow single-line anonymous methods, so long there was only one statement.</p>
| 30,991 |
<p>My HTML is as follows:</p>
<pre><code><ul id="nav">
<li><a href="./">Home</a></li>
<li><a href="/About">About</a></li>
<li><a href="/Contact">Contact</a></li>
</ul>
</code></pre>
<p>And my css:</p>
<pre><code>#nav {
... | <p>Several options here, first I'll give you my normal practice when creating inline lists:</p>
<pre><code><ul id="navigation">
<li><a href="#" title="">Home</a></li>
<li><a href="#" title="">Home</a></li>
<li><a href="#" title="">Home</a>&l... | <pre><code><html>
<head>
<style>
ul li, ul li:before,ul li:after{display:inline; content:' '; }
</style>
</head>
<body>
<ul><li>one</li><li>two</li><li>three</li></ul>
<ul>
<li>one</li>
<li>two</li>... | 29,893 |
<p>I need ideas on how to go about table layout problem.
I want to set different width of the columns dependent on the picked language.</p>
| <p>A variable switch, such as:</p>
<pre><code><%
dim columnWidth
if session("lang") = "eng" then
columnWidth = 50
else
columnWidth = 100
end if
%>
<table>
<tr>
<td width="<%= columnWidth %>px">[content]</td>
</tr>
</table>
</code></pre>
<p>For c... | <p>Use if-else inside scriplet based on the currently selected language and place appropriate "td" tags.</p>
<p>Hope this is what you are looking for !</p>
| 24,914 |
<p>Consider the following code:</p>
<pre><code><a href="#label2">GoTo Label2</a>
... [content here] ...
<a name="label0"></a>More content
<a name="label1"></a>More content
<a name="label2"></a>More content
<a name="label3"></a>More content
<a name="label4"... | <p>This JS has generally worked well for me if you also put an ID on the element:</p>
<pre><code>document.getElementById('MyID').scrollIntoView(true);
</code></pre>
<p>This is good as it will also position scrollable divs etc so that the content is visible.</p>
| <p>you can just open the new URL with the name appended, for instance <code>http://www.example.com/mypage.htm#label2</code></p>
<p>In JavaScript,</p>
<pre><code>location.href = location.href + '#label2';
</code></pre>
| 33,327 |
<p>If someone creates a 3D model of a character for 3D printing can I import that model into Unreal engine or Unity 3D for use in a video game? Also is the inverse true? Can I get 3D model of Mario and send that to a 3D printer?</p>
<p>Specifically, it’s more important to know if I can pull a 3D printer model into an u... | <p>The only time I've seen lifting, away from the edges of the part like this, is when the bed is contaminated with something which will stop the print sticking, like fingerprints and such.</p>
<p>A thorough wipe-down with IPA on the heated bed is usually enough to stop it.</p>
| <p>I haven't seen lifts that aren't on the edge of the print, such as warping, or the entire printed surface lifts. When I get something like in your photograph, it's because the print surface isn't flat and the first layer matches the surface topology. If the second image shows the print surface, it looks like blobs... | 1,875 |
<p>I'm using <code>org.w3c</code> <code>XML API</code> to open an existing <code>XML</code> file. I'm removing some nodes , and I'm adding others instead.</p>
<p>The problem is that the new nodes that are added are written one after the other, with no newline and no indentation what so ever. While it's true that the <... | <p>I'm assuming that you're using a <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/Transformer.html" rel="noreferrer"><code>Transformer</code></a> to do the actual writing (to a <a href="http://java.sun.com/javase/6/docs/api/javax/xml/transform/stream/StreamResult.html" rel="noreferrer"><code>Stream... | <p>There are a few good examples of "pretty printing" in the following thread</p>
<p><a href="https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java">how to pretty print xml from Java</a></p>
<p><a href="https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java#260314">Link to... | 19,513 |
<p>Is there a way to define the timezone for an application in ASP.NET such that all times read from/compared to current server time are implicitly converted, or do I need to put in conversion statements as each and every DateTime.Now call?</p>
| <p>I am not sure about the latest evolutions of ASP, but this <a href="http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/772971a4-9f1b-4004-a873-c1e0e2098852/" rel="nofollow noreferrer">article from 2006</a> provides an interesting answer:</p>
<blockquote>
<p>The problem is that timezone information is n... | <p>Internally use <a href="http://msdn.microsoft.com/en-us/library/system.datetime.utcnow.aspx" rel="nofollow noreferrer">DateTime.UtcNow</a>. For .NET 3.5, check out
<a href="http://msdn.microsoft.com/en-us/library/system.timezoneinfo.converttime.aspx" rel="nofollow noreferrer">TimeZoneInfo.ConvertTime</a>.</p>
| 38,623 |
<p>There has been a lot of press about IPv6 and the impending switch over to IPv6 from IPv4. I have some understanding of IPv6, but I've often wondered how much impact IPv6 has on application development & design (specifically)?</p>
<p>Are there some tangible/well known benefits IPv6 provides which we don't alrea... | <p>It will impact the UI design for any software where you input an IP address, as you will need to let them select between IPv4 and IPv6 input. Pretty obvious though.</p>
<p>My understanding is that not much else will change. Most programs are using networking facilities provided by the operating system, so by the ... | <p>All the modern web browsers (Chrome, IE, Safari, and Firefox come to mind) are all IPv6 aware. Also IPv6 aware is µTorrent.</p>
| 25,477 |
<p>I'm trying to automate a gdb session using the <code>--command</code> flag. I'm trying to set a breakpoint on a function in a shared library (the Unix equivalent of a DLL) . My cmds.gdb looks like this:</p>
<pre><code>set args /home/shlomi/conf/bugs/kde/font-break.txt
b IA__FcFontMatch
r
</code></pre>
<p>However, ... | <p>Replying to myself, I'd like to give the answer that someone gave me on IRC:</p>
<pre>
(gdb) apropos pending
actions -- Specify the actions to be taken at a tracepoint
set breakpoint -- Breakpoint specific settings
set breakpoint pending -- Set debugger's behavior regarding pending breakpoints
show breakpoint -- Br... | <p>With no symbols.</p>
<pre><code>objdump -t /lib/libacl.so
SYMBOL TABLE:
no symbols
objdump -T /lib/libacl.so
...
00002bd0 g DF .text 000000d0 ACL_1.0 acl_delete_entry
...
(gdb) break 0x0002bd0
(gdb) x/20i acl_delete_entry
0x2bd0 <acl_delete_entry>: stwu r1,-32(r1)
0x2bd4 <acl_delete_en... | 12,574 |
<p>I have a command line tool, written in Delphi, which job is to insert a node in a XML file and then immediately exit. I need to make it possible several instances of the tool to be executed simultaneously and insert nodes to one and the same XML. </p>
<p>To achieve this purpose I have introduced a simple file "mute... | <p>A named semaphore or mutex can do this for you on a single machine. Use e.g. TMutex from SyncObjs, and use one of the constructors which takes a name argument. If you use the same name in all the applications, they will be synchronizing over the same kernel mutex. Use TMutex.Acquire to access, and TMutex.Release whe... | <p>From <a href="https://stackoverflow.com/a/4406823/80901">this answer</a>:</p>
<blockquote>
<p>On Windows, this is possible if you can control both programs.
LockFileEx. For reads, open a shared lock on the lockfile. For writes,
open an exclusive lock on the lockfile. Locking is weird in Windows,
so I recomm... | 12,676 |
<p>In C# you can make a block inside of a method that is not attached to any other statement.</p>
<pre><code> public void TestMethod()
{
{
string x = "test";
string y = x;
{
int z = 42;
int zz = z;
}
}
}
</code>... | <p>Scope and garbage collection: When you leave the unattached block, any variables declared in it go out of scope. That lets the garbage collector clean up those objects.</p>
<p><a href="https://stackoverflow.com/users/7093/ray-hayes">Ray Hayes</a> points out that the .NET garbage collector will not immediately colle... | <p>One reason for doing this is that the variables 'z' and 'zz' would not be available to code below the end of that inner block. When you do this in Java, the JVM pushes a stack frame for the inner code, and those values can live on the stack. When the code exits the block, the stack frame is popped and those values g... | 11,086 |
<p>With an ABS or PLA extrusion 3D printer, are there any potentially negative quality differences that could occur if I try to print at a higher resolution?</p>
<p>I am not concerned about print time as the equipment is not under high demand. I am, however, worried the device may be more prone to fracture, likely to... | <p>The biggest effect I've see on resolution is due to plastic stress due to thermal gradients.</p>
<p>The higher resolution prints build up more layers of material, and each layer has a cumulative effect on thermal stress. The upper layers pulling up more as they cool, and the lower layers curling up more strongly a... | <p>In my experience building with smaller layers also makes bridging and overhangs more pronounced and less likely to fail. </p>
<p>The smaller layers allow gradual changes for overhangs that are more abrupt with thicker layer. </p>
| 90 |
<p>As the title says, I have a Windows app written in C++ from which I need to make calls to remote Thrift services, and I'm a bit lost on the subject, to be honest. <a href="http://wiki.apache.org/thrift/ThriftInstallationWin32" rel="nofollow noreferrer">http://wiki.apache.org/thrift/ThriftInstallationWin32</a> states... | <p>I ported Thrift to Windows/C++ for my own app. Its open-source, so other people are free to make use of it: <a href="http://peoplesnote.codeplex.com/SourceControl/list/changesets" rel="noreferrer">http://peoplesnote.codeplex.com/SourceControl/list/changesets</a></p>
| <p>That page seems fairly straightforward. They tell you how to make the Thrift compiler but state, in no uncertain terms, that the metacode from it won't compile under Windows.</p>
<p>So, short of getting someone to figure out how to compile it under Windows, you <strong>are</strong> out of luck.</p>
<p>To be honest... | 31,095 |
<p>I understand that BigDecimal is recommended best practice for representing monetary values in Java. What do you use? Is there a better library that you prefer to use instead?</p>
| <p><code>BigDecimal</code> all the way. I've heard of some folks creating their own <code>Cash</code> or <code>Money</code> classes which encapsulate a cash value with the currency, but under the skin it's still a <code>BigDecimal</code>, probably with <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecim... | <p>You can use the DecimalFormat class when ultimately displaying a currency value. It provides localization support and is pretty extensible.</p>
| 36,281 |
<p>Hey All, I have been working on this problem for a while and the usual google searches are not helping :(</p>
<p>I have a production database in SQL 2000. I want to copy it over the top of a training database to refresh it. I want this to be something that is scheduled to happen once a week to keep the training dat... | <p>I feel stupid, but am posting the answer I just found for posterity (and so all you helpful fellows can stop stressing on my behalf.</p>
<p>Even though I had selected all the user tables, views, stored procedures and user defined functions to copy, I hadn't selected "Include all dependant objects". I had assumed th... | <p>Somehow the dbo.vwEstAssetStationAddress table is not being found by your DTS package. Unfortunately, the message doesn't say if it was on the source or destination that it couldn't find it.</p>
<p>What are the exact steps, in the order that you have them in your DTS package? I'm assuming that the list of the task ... | 24,890 |
<p>I'd like to create a spring bean that holds the value of a double. Something like:</p>
<pre><code><bean id="doubleValue" value="3.7"/>
</code></pre>
| <p>Declare it like this:</p>
<pre><code><bean id="doubleValue" class="java.lang.Double">
<constructor-arg index="0" value="3.7"/>
</bean>
</code></pre>
<p>And use like this:</p>
<pre><code><bean id="someOtherBean" ...>
<property name="value" ref="doubleValue"/>
</bean>
</cod... | <p>Why don't you just use a <strong>Double</strong>? any reason?</p>
| 8,461 |
<p>In Java, there is no such thing as an unsigned byte.</p>
<p>Working with some low level code, occasionally you need to work with bytes that have unsigned values greater than 128, which causes Java to interpret them as a negative number due to the MSB being used for sign.</p>
<p>What's a good way to work around thi... | <p>It is actually possible to get rid of the if statement and the addition if you do it like this.</p>
<pre><code>byte[] foobar = ..;
int value = (foobar[10] & 0xff);
</code></pre>
<p>This way Java doesn't interpret the byte as a negative number and flip the sign bit on the integer also.</p>
| <p>I guess you could just use a short to store them. Not very efficient, but really the only option besides some herculean effort that I have seen.</p>
| 3,227 |
<p>I am wondering if it is possible to validate parameters to (custom) .net attributes. eg: If I had an attribute that takes a positive integer, could I force a compile time error when a negative value was supplied?</p>
<p>[DonkeyAttribute(1)] //OK</p>
<p>[DonkeyAttribute(-828)] //error</p>
<p>In this example I cou... | <p>I don't think it is normally, however <a href="http://karlagius.wordpress.com/2008/01/29/validating-attribute-usage-with-postsharp-aspects/" rel="nofollow noreferrer">this</a> article details a solution using <a href="http://www.postsharp.org/" rel="nofollow noreferrer">PostSharp</a>. Not sure if it's fit for your p... | <p>Directly? No. Not without rewriting csc or vbc. Most people would perform said validation at runtime.</p>
<p>However, a bit of Googling came up with this <a href="http://karlagius.wordpress.com/2008/01/29/validating-attribute-usage-with-postsharp-aspects/" rel="nofollow noreferrer">blog entry on PostSharp Aspects</... | 48,512 |
<p>I am trying to create a two-piece snap-fit or joint using a 3D printer (Resin). After that, I plan to coat the joint with a conductive spray and create an electrical connection when the two pieces are joined together.</p>
<p><strong>Has this been done before? Are certain types of joint mechanism recommended?</strong... | <p><a href="https://www.instructables.com/Copper-Electroforming-on-3d-Printed-PLAABS-Objects/" rel="nofollow noreferrer">Electroforming</a> is the process of applying a conductive paint to a non-conductive surface. Once dry, the object is subjected to a process similar to electroplating, in that molecules of a conducti... | <p>For your task you basically have several options:</p>
<ol>
<li><strong>Electroforming</strong> (see @fred_dot_u answer). Pros: high electrical conductivity due to actual metal layer; very low friction between polished metal layers. Cons: the process is quite dirty and requires additional materials and processing, pl... | 2,167 |
<p>There are a few things that I almost always do when I put a class together in C++.</p>
<p>1) Virtual Destructor
2) Copy constructor and assignment operator (I either implement them in terms of a private function called Copy(), or declare them private and thus explicitly disallow the compiler to auto generate them).... | <p>I find turning on the gcc flags <code>-Wall</code>, <code>-Werror</code>, and (this is the fun one) <code>-Weffc++</code> help catch a lot of potential problems. From the gcc man page:</p>
<blockquote>
<pre><code> -Weffc++ (C++ only)
Warn about violations of the following style guidelines from Scott
Me... | <p>In header files, do</p>
<pre><code>#ifndef __SOMEDEFINE__
#define __SOMEDEFINE__
#endif
</code></pre>
<p>In VS, I add</p>
<pre><code>#pragma warning(disable: 4786)
</code></pre>
<p>Oh, I also use </p>
<pre><code>#include <inttypes.h>
</code></pre>
<p>cuz I <3 C99 types.</p>
| 40,800 |
<p>Is there any easy way to add a using statement to every class I create in a project without having to write</p>
<pre><code>using SomeNamespace;
</code></pre>
<p>in every file?</p>
<p>[edit]
I could add a template I realise but I'm talking about doing it for every file in an existing project.</p>
| <p>Go to "My Project" > "References" tab > "Imported Namespaces" section. Check any namespaces that you want available on every page.</p>
| <p>I believe you can do something like:</p>
<pre><code><system.web>
<pages>
<namespaces>
<add namespace="System.IO" />
<add namespace="System.Text"/>
<add namespace="Westwind.Tools"/>
<... | 39,613 |
<p>I want an <strong>simple IDE/editor for C</strong> in <strong>Linux</strong> to which I <strong>can add features easily</strong>. For example: I want to add a right click menu item and a related action for the editor. It should be easy to extent and add any desirable functionality. I tried eclipse CDT but its to muc... | <p>I personally use Code::Blocks, which according to their website also has a Linux ditribution. <a href="http://www.codeblocks.org/" rel="nofollow noreferrer">http://www.codeblocks.org/</a>
I don't know whether it's very extendable, but it has all the features you'd expect from an IDE.</p>
<p>QuantumPete</p>
| <p>Look into <a href="http://anjuta.sourceforge.net/" rel="nofollow noreferrer">Anjuta</a>. It's an IDE for GNOME/Glib type applications and to my knowledge is written in C, and has a plugin framework that should be useful.</p>
| 24,427 |
<p>Exception: Failed to compare two elements in the array.</p>
<pre><code>private void assignNames(DropDownList ddl, Hashtable names)
{
List<ListItem> nameList = new List<ListItem>();
if (ddl != null)
{
ddl.ClearSelection();
ddl.Items.Add(new ListItem("Select Author"));
... | <p>Provide a <a href="http://msdn.microsoft.com/en-us/library/tfakywbh.aspx" rel="noreferrer"><code>Comparison<T></code></a> to instruct the <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="noreferrer"><code>List</code></a> on how to sort the items.</p>
<pre><code>nameList.Sort(delegate(ListI... | <p>Use ArrayList.Sort(IComparer) instead of ArrayList.Sort().</p>
| 30,809 |
<p>I'm teaching a kid programming, and am introducing some basic artificial intelligence concepts at the moment. To begin with we're going to implement a tic-tac-toe game that searches the entire game tree and as such plays perfectly. Once we finish that I want to apply the same concepts to a game that has too many pos... | <p>Another game choice could be <a href="http://en.wikipedia.org/wiki/Reversi" rel="noreferrer">Reversi</a> aka Othello.</p>
<p>A naive heuristic would be to simply count the number of tiles gained by each valid move and choose the greatest. From there you can factor in board position and minimizing vulnerably to the ... | <p>How about starting your Dots and Boxes game with random lines already added. This can get you into the action quickly. Just need to make sure you don't start the game with any boxes.</p>
| 10,184 |
<p>I've been studying OOP for quite a while now and I have a good grasp of the theory. I read the <a href="https://rads.stackoverflow.com/amzn/click/com/0596008678" rel="noreferrer" rel="nofollow noreferrer">Head First</a> book on OOP and, while it reinforced a lot of the theory, I found the case studies to be somewha... | <p>Read <a href="https://rads.stackoverflow.com/amzn/click/com/0201485672" rel="noreferrer" rel="nofollow noreferrer">Refactoring</a> by Martin Fowler, and apply it to your own work.</p>
<p>It will take you through a litany of malodorous characteristics of software code that describe how to detect improperly construct... | <p><a href="http://bitbucket.org/tortoisehg/stable/src/tip/tortoisehg/hgtk/" rel="nofollow noreferrer">Tortoise HG</a> is extrodanarily well designed piece of OO open source software (written in Python).</p>
<p>If you already understand the basics, building something from scratch in a fully object oriented language wi... | 34,884 |
<p>Does anyone know how to tell VS(2008) where to save the obj folder when building the solution? We have it save the bin folder to another path in order to keep the source file folders small (ie. emailable), but can't find any way to tell it to do the same with obj...</p>
| <p>Use the <code>BaseIntermediateOutputPath</code> property in the project file (<code>.csproj</code>, <code>.vbproj</code>, etc.), as explained at <a href="http://msdn.microsoft.com/en-us/library/bb629394.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/bb629394.aspx</a>. You'll have to manually edit the... | <p>In Visual Studio 2013, this is specified in project "Configuration Properties/General/Intermediate Directory".</p>
<p><a href="https://i.stack.imgur.com/Tb2F5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tb2F5.png" alt="enter image description here" /></a></p>
| 32,685 |
<p>So I am really fed up with inductive probes. The one I am using keeps getting shifted slightly every time I switch nozzles or run an oozy print. That means I have to autolevel again, then manually set a Z-offset (as I would have anyway if I didn't have an inductive probe).</p>
<p>On my Lulzbot Mini there is a diffe... | <p>Aluminium is conductive, but aluminium oxide is not, which is just so what there (unavoidably, since aluminium rapidly oxidises in air) happens to be a thin layer of on top of your bed. The coating is very thin, but it might foul your plans. It would work better with a sharp probe (that can puncture the layer) than ... | <p>This will not work reliably.</p>
<p>I know, I have tried it, for a couple of years, with poor consistency.</p>
<p>Now, I will tell you that it worked better than the parallax IR sensors. It worked better than trying to slam the head into the bed and listen for the click.</p>
<p>I used the brass nozzle and the al... | 1,409 |
<p>I have created a brand new project in XCode and have the following in my AppDelegate.py file:</p>
<pre><code>from Foundation import *
from AppKit import *
class MyApplicationAppDelegate(NSObject):
def applicationDidFinishLaunching_(self, sender):
NSLog("Application did finish launching.")
stat... | <p>I had to do this to make it work:</p>
<ol>
<li><p>Open MainMenu.xib. Make sure the class of the app delegate is <code>MyApplicationAppDelegate</code>. I'm not sure if you will have to do this, but I did. It was wrong and so the app delegate never got called in the first place.</p></li>
<li><p>Add <code>statusItem.r... | <p>The above usage of .retain() is required because the statusItem is being destroyed upon return from the applicationDidFinishLaunching() method. Bind that variable as a field in instances of MyApplicationAppDelegate using self.statusItem instead.</p>
<p>Here is a modified example that does not require a .xib / etc..... | 17,089 |
<p>Is it possible to <code>typedef</code> long types that use templates? For example:</p>
<pre><code>template <typename myfloat_t>
class LongClassName
{
// ...
};
template <typename myfloat_t>
typedef std::vector< boost::shared_ptr< LongClassName<myfloat_t> > > LongCollection;
Long... | <p>No, that isn't possible currently. It will be made possible in C++0X AFAIK.</p>
<p>The best I can think of is </p>
<pre><code>template<typename T> struct LongCollection {
typedef std::vector< boost::shared_ptr< LongClassName<T> > > type;
};
LongCollection<float>::type m_foo;
</co... | <p>Its not exactly what you're asking for, but this might achieve the desired effect depending on your actual situation:</p>
<pre><code>template <typename myfloat_t>
class LongClassName
{
// ...
};
template <typename myfloat_t>
class LongCollection : public std::vector< boost::shared_ptr< LongCl... | 31,312 |
<p>I want a small (< 30MB) standalone Windows executable (a single file) that creates a window which asks the user for the location of a directory and then launches a different program in that directory. </p>
<p>This executable has to run on XP, Vista, Server 2003, and Server 2008 versions of Windows in 32-bits an... | <p>What about a WSH script? It won't be an exe, right, but to ask for a folder I don't see the need for an exe file, much less a 30Mb one...</p>
<p>A 1Kb script, save it as whatever name you like with vbs extension and run it. This, in case it's not clear, asks you for a folder name and then runs calc.exe from the sys... | <p>Similar to what Vinko Vrsalovic said, you can use a HTA application. It is as easy as building a webpage with windows scripting host functionality. I have built a few utilities with jscript and it is really easy and quick
<a href="http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx" rel="nofollow noreferrer... | 34,343 |
<p>I've inherited a database that has a structure with a table of products, a table consisting of some product attributes and another table to build the relationship between these attributes and a given product.</p>
<p>A user can filter the products by a combination of these attributes, meaning that if more than one a... | <p>The query seems fine, except that you possibly could remove the DISTINCT modifier, since you're already grouping by id. Regarding the new requirement, can't you solve it in your code, before it reaches the SQL query?</p>
<p>Edit: An alternative would be to construct the query with one inner join for each required a... | <p>With proper (and obvious) indexes, this will be very efficient in MySQL. </p>
<p>SELECT ... </p>
<p>FROM products AS p </p>
<p>INNER JOIN attributes a1 ON p.product_id=a1.property_id AND a1.attribute_id=1<br>
LEFT JOIN attributes a2 ON p.product_id=a2.property_id AND a2.attribute_id=3<br>
LEFT JOIN attributes ... | 45,079 |
<p>In SQL Server 2017, you can use this syntax, but not in earlier versions:</p>
<pre><code>SELECT Name = TRIM(Name) FROM dbo.Customer;
</code></pre>
| <pre><code>SELECT LTRIM(RTRIM(Names)) AS Names FROM Customer
</code></pre>
| <p>To trim any set of characters from the beginning and end of a string, you can do the following code where @TrimPattern defines the characters to be trimmed. In this example, Space, tab, LF and CR characters are being trimmed:</p>
<p>Declare @Test nvarchar(50) = Concat (' ', char(9), char(13), char(10), ' ', 'TEST', ... | 21,667 |
<p>I'm in the process of designing a small website and was curious when an XML file can/should be substituted for a database table. There are some cases where I think using a database table may be overkill and was just wondering if anyone else has come across making this decision.</p>
<p>Thanks!</p>
| <p>If you think you'll end up needing more than a tiny amount of CRUD, or your site will grow beyond a handful users, <strong>use a database</strong>.</p>
<p>Searching or updating XML files can kill performance and future scalability.</p>
| <p>I'm working with an application that works with 100% XML for data storage right now. The reason for this is allowing text searching in many different other applications. Sometimes XML is better when you need to share data in other applications. </p>
| 27,339 |
<p>I took the plunge and bought a resin printer. I was wondering if I could use full strength home-brew vodka at 90 % instead of using isopropyl alcohol before anything is added to clean prints with?</p>
<p>I cannot seem to find anywhere or anyone that has tried this.</p>
| <p>Isopropyl-Alcohol - Propan-2-ol - and Ethyl alcohol - Ethan-1-ol - are different chemically. As a secondary alcohol, Propan-2-ol has quite different solubility of different materials than ethyl-alcohol.</p>
<p>Now, let's look at home made alcoholic destillate. That stuff is, if done in one refraction and without tos... | <p>Some manufacturers do recommend ethanol and not isopropanol. The problem would be getting relatively pure ethanol through distillation. When distilling you will get different fractions which may be full of methanol or water. You will probably need to do multiple runs. You could just buy some 95% ethanol and distill ... | 1,746 |
<p>So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. </p>
<p>The details:
Interestingly enough this code runs fine when called in the context of our regular winforms application -- but I am tasked with writing a web-... | <p>I thought I'd post back here with the resolution to this in case someone else runs into it. The replies above were all helpful, and pointed out why i might be overflowing the stack -- but the thing that I still couldn't come to grips with was why the exact same code ran fine in our winforms app. </p>
<p>What I ev... | <p>According to stack object dump "ASI.ParadigmPlus.GrilleApp.GA1000" is 96872 bytes. You might want to figure out what that object is all about. That's a pretty big chunk of your stack space right there.</p>
| 11,882 |
<p>This is a subjective question as I want to gauge if it's worth me moaning at my co-workers for doing something which I find utterly detestable.</p>
<p>The issue is that a bunch of my co-workers will truncate method calls to fit a width. We all use widescreen laptops that can handle large resolutions (mine is 1920x1... | <p>Maybe you should have as part of your standard build process some sort of checkstyle plugin which checks for exactly that kind of thing? If you've agreed the standard with your co-workers it seems reasonable to ask them to keep to it.</p>
<p>I personally find the second of the two options the more readable, but tha... | <p>I prefer option #2, as well. The issue isn't just how it looks on screen (and if I had 1920 horizontal pixels, I'd have a lot more docked windows), it's how it looks if I need to print it and read it. Long lines will print terribly out of most IDEs, whereas lines broken by an author with the intent to improve legibi... | 19,542 |
<p>I've a friend who is expecting. There are several adorable weapon themed rattles on thingiverse. I am, however, concerned about safety associated with such a product in the hands of a baby who will gnaw on it. To me the safety concerns here are much larger than for most food handling applications.</p>
<p>What st... | <p>You're on the right track. Since you asked for "steps" here you go:</p>
<p><strong>Step 1. Choose a safe material:</strong> </p>
<p>Consider chemical safety and physical safety. Food grade PLA should be chemically safe, but could be too brittle depending on the design you choose. PETG, T-Glase, or similar filame... | <p>Also consider the nozzle on your printer. Most nozzles are made of brass, which is not considered food safe due to the presence of small amounts of lead. Stainless steel nozzles are available which will not perform quite as well as brass but are food safe.</p>
| 394 |
<p>If you put up an <code>NSAlert</code> while your app is in the background your dock icon starts bouncing and keeps on bouncing until you switch back. </p>
<p>I find this annoying. </p>
<p>Does anyone know how disable that for a single app? </p>
| <p>Create your own subclass of NSApplication, and implement something like this:</p>
<pre><code>- (int)requestUserAttention:(NSRequestUserAttentionType)requestType
{
if (dontDoThatBouncyThing) {
return 0;
}
return [super requestUserAttention:requestType];
}
</code></pre>
<p... | <p>Not that I'd recommend it, but there is a Haxie that may help: <a href="http://unsanity.com/haxies/dockdetox" rel="nofollow noreferrer">Dock Detox</a>.</p>
<p>They allow you to intercept the bouncing and do other stuff, I think.</p>
<p>A quick google showed up:</p>
<pre><code>- (void)cancelUserAttentionRequest:(i... | 37,739 |
<p>I have an have an ASP.Net page which contains a button. This Page contains a ServerSide Paypal button.</p>
<p>When pushed my server does various clever things on the back end and then rewrites the response as a form and some javascript which posts this form to paypal..</p>
<p>This all works great.</p>
<p>However,... | <p>I'm not sure if that can be done. But here is an idea how you could prevent that resubmit of the form.</p>
<p>You could insert a <strong>hidden input</strong> in your form which at the beginning would be empty. On submit you'll write a value in that field and make sure you check on every submit attempt if this fiel... | <p>You could simply programme your page not to submit, or to do something / navigate somewhere else, if window.referer is the Paypal page you are trying to avoid invoking a second time. </p>
| 36,963 |
<p>I've often had to load multiple items to a particular record in the database. For example: a web page displays items to include for a single report, all of which are records in the database (Report is a record in the Report table, Items are records in Item table). A user is selecting items to include in a single rep... | <p>If going to SQL Server 2008 is an option for you, there's a new feature called "Table-valued parameters" to solve this exact problem.</p>
<p>Check out more details on TVP <a href="http://blog.benhall.me.uk/2007/07/sql-server-2008-table-value-parameters.html" rel="noreferrer">here</a> and <a href="http://www.mssqlti... | <p><strong>Query a Single Field for Multiple Values in a Stored Procedure</strong> <br>
<a href="http://www.norimek.com/blog/post/2008/04/Query-a-Single-Field-for-Multiple-Values-in-a-Stored-Procedure.aspx" rel="nofollow noreferrer">http://www.norimek.com/blog/post/2008/04/Query-a-Single-Field-for-Multiple-Values-in-a-... | 25,729 |
<p>Consider the following table:</p>
<pre><code>mysql> select * from phone_numbers;
+-------------+------+-----------+
| number | type | person_id |
+-------------+------+-----------+
| 17182225465 | home | 1 |
| 19172225465 | cell | 1 |
| 12129876543 | home | 2 |
| 13049876543 | cell |... | <p>In the second SQL, the condition h.type = 'home' is part of the outer join conditions, and is not a filter on the results. For all records where h.type='cell', the condition h.type = 'home' is FALSE and so no "matching" c row is found - so c.number is null, which is your only filtering (WHERE) condition.</p>
<p>In... | <p>I don't know if this will fix things or not, but...</p>
<p>The statements starting with "and" should be part of the WHERE clause, not part of the ON clause. The ON clause should <strong>only</strong> have statements involving which columns are used to join the tables.</p>
| 44,758 |
<p>Java was initially slow before the JIT but today performance is pretty close to C++. I want to know if someone has done measurable performance comparisons between the two languages? <b>Where does Java fall short when compared to C++?</b> Java provides many productivity gains to developers so they can write applic... | <p>JIT compilers can be faster for many individual code constructs because they can take advantage of runtime profiling of code.</p>
<p>For example, VonC in his answer to this question mentions heap allocation for all objects. This is not actually true: the JIT can allocate objects on the stack if it can prove by <a h... | <p>Some things are better built with Java, C# or any Managed programming languages. Other things will <em>always</em> be better built with an un-managed programming language (like C or C++)</p>
<p>The former category normally includes "applications" in general while the second category normally includes "platforms" in... | 40,411 |
<p>It doesn't look like basic javascript but nor can I use JQuery commands like <code>$('myId')</code>. Is this or similar functions documented anywhere?</p>
<p>For reason I don't want to go into, I am not able to use 3rd party libraries like JQuery but if some powerful javascript extensions come with asp then I would... | <p>$get is a function from the (now depreciated) ms ajax core javascript library. In the future they will be using jquery therefore $get will just be $('#myid') so I dont understand your feelings about not using jQuery, MS have decided to embrace OpenSource and bundle it with visual studio, check out Scott Gu and Hansl... | <p>check out this one.
<a href="http://msdn.microsoft.com/en-us/library/cc165447%28v=vs.100%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/cc165447(v=vs.100).aspx</a>
There are altogether 7 shortcuts methods
they are $addHandler, $addHandlers, $clearHandlers, $create, $find, $get and $removeHandler</p>... | 25,466 |
<p>I have a series of forms that I need a user to complete in sequence, which is perfect for the formwizard app. However, I've some need of the admin application also and would like to set the whole thing up to trigger several forms within the admin app. </p>
<p>Is it possible/easy to integrate a 'formwizard' into the... | <p>There's a <em>lot</em> that you can do, but you'd need to be more specific about what you mean by "integrate a formwizard into the admin app" and "trigger several forms within the admin app."</p>
<p>The admin app at its core is basically just a wrapper around a bunch of stock ModelForms, so if you just build a form... | <p>You <em>do</em> have the source, and it <em>is</em> Python, so... you can read the admin application source to see what options it has.</p>
<p>Look at
<a href="http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/cont... | 43,682 |
<p>I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.</p>
| <p>Just put this in the first line of your script :</p>
<pre><code>#!/usr/bin/env python
</code></pre>
<p>Make the file executable with</p>
<pre><code>chmod +x myfile.py
</code></pre>
<p>Execute with</p>
<pre><code>./myfile.py
</code></pre>
| <p>Another way to do it could be by creating an alias.
For example in terminal write:</p>
<pre><code>alias printhello='python /home/hello_world.py'
</code></pre>
<p>Writing <code>printhello</code> will run hello_world.py, but this is only temporary.
To make aliases permanent, you have to add them to bashrc, you can e... | 39,200 |
<p>How do you create a "dockable" form, similar to the windows in Visual Studio?</p>
| <p>I've used Weifen Luo's "DockPanel Suite" to good effect. It's an open source library that mimics Visual Studio's docking system very well, including nested docking, floating windows, tabbed windows, etc. You can download his source and see his approach there, if you'd prefer your own, simpler solution.</p>
<p>Sourc... | <p>Any custom control (composite, not inherited) in winforms can be docked, because it's really just a panel underneath. Combine this with a tablelayout panel for the high-level layout of your form and you have all the pieces. But you still have to implement all the glue and supporting UI yourself.</p>
| 11,029 |
<p>I'm about to inherit a set of large and complex set of stored procedures that do monthly processing on very large sets of data.</p>
<p>We are in the process of debugging them so they match the original process which was written in VB6. The reason they decided to re write them in t-sql is because the vb process take... | <p>First, create a directory full of .sql files and maintain them there. Add this set of .sql files to a revision control system. SVN works well. Have a tool that loads these into your database, overwriting any existing ones.</p>
<p>Have a testing database, and baseline reports showing what the output of the monthly p... | <p>One thing that you can do is have an automated script to store all changes to source control so that you can review changes to the procedures (using a diff on the previous and current versions)</p>
| 11,040 |
<p>I use nested database stuctures with TClientDataSets. I'm new to programming so my lingo is ten-to-one wrong. </p>
<p>My problem is as follows: I defined my database stucture and all the fields of the nested stuctures and then I called the CreatDataSet method of the master clientDataSet and it worked. I then wanted... | <p>It is a Delphi bug.</p>
<p>Call YourDataset.FieldDefs.Clear before calling CreateDataSet and it should work.</p>
<p>For more infomation please look at this QC Report:</p>
<p><a href="http://qc.codegear.com/wc/qcmain.aspx?d=38984" rel="nofollow noreferrer">http://qc.codegear.com/wc/qcmain.aspx?d=38984</a></p>
<p>... | <p>It has been a long time since you asked this question, but I believe the problem has specifically to do with the nested dataset fields. I've seen this error before, and I believe that it has to do with the order in which the particular fields are created. If I remember correctly, if you try to create the master data... | 45,045 |
<p>I am making a C# app for a class project. I want to ensure a string has one of three values. Normally, in a web app, I would do validation with javascript on the client side. However, this is currently a console app. I know that I should do the validation early, but what are some good rules of thumb for validati... | <p>Each module should do its own validation and never trust what the calling code gives it. This typically means that validation should happen at each layer of your application. You especially do not want to trust any validation to occurs on the client side, because that can lead to security holes. Code that runs on th... | <p>Depending on how the application progresses you can validate either before you leave that page/step (if its like a wizard where you step through multiple pages/steps), or you can have it validate immediately once the user leaves that textbox/value. Another option is validation while it is modified.</p>
| 42,620 |
<p>Inside a .NET 3.5 web app running impersonation I am trying to execute a process via:</p>
<pre><code>var process = new Process
{ StartInfo =
{ CreateNoWindow = true,
FileName = "someFileName",
Domain = "someDomain",
... | <p>You can use ProcessStartInfo which allows you to specify credentials. The trick is that the password is a secure string, so you have to pass it as a byte array.</p>
<p>The code might look something like:</p>
<pre><code>Dim startInfo As New ProcessStartInfo(programName)
With startInfo
.Domain =... | <p>I ran into the same problem that you did on a project. There <em>should</em> be a way to spawn a process out of your web app with given credentials, but in practice, it's a kludge at best. What I wound up finally doing was just having the app push information to an MSMQ and having a windows service that popped ite... | 14,793 |
<p>I have a framework written in Perl that sets a bunch of environment variables to support interprocess (typically it is sub process) communication. We keep a sets of key/value pairs in XML-ish files. We tried to make the key names camel-case <code>somethingLikeThis</code>. This all works well.</p>
<p>Recently we... | <p>As far as I remember, using ALL_CAPS for environment variables is the recommended practice in both Windows and *NIX worlds. My guess is Perl is just using some kind of legacy API to access the environment, and thus only retrieves the upper-case-only name for the variable.</p>
<p>In any case, you should never rely o... | <p>Jack M.: Agreed, it is not a problem on Windows. If I create an environment variable Foo I can reference it in Perl as $ENV{FOO} or $ENV{fOO} or $ENV{foo}. The problem is: I create it as Foo and dump the entire %ENV to a file and then read in the file from *NX to recreate the Environment hash and use the same scr... | 6,220 |
<p>I'm coding a simple code editor for a very simple scripting language we use at work. My syntax highlighting code works fine if I do it on the entire <code>RichTextBox</code> (<code>rtbMain</code>) but when I try to get it to work on just that line, so I can run the function with <code>rtbMain</code> changes, it gets... | <p>Ok I figured it out. I was calling the even on rtbMain.TextChange thinking that this would only trigger if the text actually changed. Nay Nay, it will also trigger if formatting is changed. so each time it changed something while it was doing its first pass and highlighting everything, it would then trigger to highl... | <pre><code>Private Sub HighLight(ByVal All As Boolean)
Dim RegExp As System.Text.RegularExpressions.MatchCollection
Dim RegExpMatch As System.Text.RegularExpressions.Match
Dim FirstCharIndex As Integer = rtbMain.GetFirstCharIndexOfCurrentLine
Dim CurrentLine As Integer = rtbMain.GetLineFromCharIndex(Fir... | 39,813 |
<p>The Visual Basic 6.0 IDE checks for syntax errors on-the-fly. Every time it finds a syntax error, it pops up an alert dialog. This feature is driving me crazy, as every time I try to cut and paste in the middle of typing a statement, I have to deal with this pop-up.</p>
<p>Is there any way to disable this on-the-fl... | <p>Goto Tools-> Options and turn off "Auto-Syntax" check. </p>
<p>While you're there Turn On "Require Variable Declaration"</p>
| <p>Yes. In the Tools->Options menu, there is a checkbox called "Auto Syntax Check." Disable this option:</p>
<p><a href="http://img513.imageshack.us/img513/9809/vbsyntaxcheckdh9.png">alt text http://img513.imageshack.us/img513/9809/vbsyntaxcheckdh9.png</a></p>
| 38,603 |
<p>I am using a class library which represents some of its configuration in .xml. The configuration is read in using the <code>XmlSerializer</code>. Fortunately, the classes which represent the .xml use the <code>XmlAnyElement</code> attribute at which allows me to extend the configuration data for my own purposes with... | <p>So you need to have your class contain custom configuration information, then serialize that class to XML, then make that serialized XML into an XML node: is that right?</p>
<p>Could you just take the string created by the XMLSerializer and wrap that in it's own XML tags?</p>
<pre><code>XmlSerializer xs = new XmlS... | <p>One solution is to serialize the inner object to a string and then load the string into a XmlDocument where you can find the XmlNode representing your data and attach it to the outer object. </p>
<pre><code>XmlSerializer xser1 = new XmlSerializer(typeof(Config));
XmlSerializer xser2 = new XmlSerializer(typeof(MyCon... | 6,835 |
<p>In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields. </p>
<p>It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. </p>
<p>However, in Mac OSX, tab skips dropdown menus. Is there anyway to change this behavior, or access the ... | <p>Go to System Preferences > Keyboard and Mouse, then choose Keyboard Shortcuts. At the bottom, ensure Full Keyboard Access is set to "All controls". It's a long time since I turned it on but I think that's all you need to do</p>
| <p>It's in the System Preferences - <a href="http://www.howtogeek.com/howto/apple/why-doesnt-tab-work-for-drop-down-controls-in-firefox-on-os-x/" rel="nofollow noreferrer">this blog post</a> shows where the setting is.</p>
| 2,451 |
<p>I'm curious about everyones practices when it comes to using or distributing libraries for an application that you write.</p>
<p>First of all, when developing your application do you link the debug or release version of the libraries? (For when you run your application in debug mode)</p>
<p>Then when you run your ... | <p>I would first determine what requirements are needed from the library:</p>
<ol>
<li>Debug/Release</li>
<li>Unicode support</li>
<li>And so on..</li>
</ol>
<p>With that determined you can then create configurations for each combination required by yourself or other library users.</p>
<p>When compiling and linking ... | <p>I use VS. The way that I do it is that the libraries I need through the references of the project. Which basically just says in what folder to look for a specific library at project load time. I develop my libraries to be as project independent or reusable as possible. Therefore they are all projects of their own. S... | 6,776 |
<p>I've organized my code hierarchically and I find myself crawling up the tree using code like the following.</p>
<pre><code>File clientFolder = task.getActionPlan().getClientFile().getClient().getDocumentsFolder();
</code></pre>
<p>I'm not drilling down into the <code>task</code> object; I'm drilling up to its pare... | <p>the flag is red, and it says two things in <strong>bold</strong>:</p>
<ul>
<li>to follow the chain it is necessary for the calling code to know the entire tree structure, which is not good encapsulation, and</li>
<li>if the hierarchy ever changes you will have a lot of code to edit</li>
</ul>
<p>and one thing in p... | <p><strong>The biggest flag in the world.</strong> </p>
<p>You cannot check easily if any of those invokations returns a null object thus making tracking any sort of error next to impossible!</p>
<p>getClientFile() may return null and then getClient() will fail and when you are catching this, assuming you are try-cat... | 19,306 |
<p>I've a WEB application (with pure Java servlet) that have some heavy computational work, with database access, that can be done in asynchronous mode.
I'm planning to use a dedicated server to execute such batch jobs and I'm wondering which tools/techniques/protocols to use for communication between servlets in the W... | <p>Messaging is one of the best options.</p>
<p>Make the messaging framework very generic so that it can handle any type of batch jobs. </p>
<p>One approach is to have an event/task manager where you put an event on the queue and the queue consumer processes the event and converts it into a set of tasks. The tasks ca... | <p>We use JMS with web services:</p>
<ol>
<li>Client requests computation via web service</li>
<li>Server writes JMS message, and creates an ID value which is stored in a database along with a status (initially "Pending"). Server returns the id to the client.</li>
<li>Server (can be separate server) reads JMS message... | 28,360 |
<p>My application needs up to 3 simultaneous download connections. I am currently using a (slightly altered) CWebClient class provided in the Carbide UI framework, however using multiple instances of this for each connection prompts me multiple types to "select access point"</p>
<p>An <code>RSocketServ</code> and an <... | <p>RConnection should be the class that triggers the access point selection dialog.</p>
<p>If you write your own code, get one instance of RSocketServ and 3 instances of RSocket. That should be enough. The access point selection dialog will only occur when the connection is established, which will happen only once unt... | <p>The other way is to suppress "Select Access Point" dialog. You can do it by using CIntConnectionInitiator to establish a connection. Although this class isn't documented there is a bunch of examples on <a href="http://forum.nokia.com" rel="nofollow noreferrer">forum.nokia.com</a>.</p>
| 43,215 |
<p>I am dabbling in the world of web services and I've been making a simple web service which mimics mathematical operations. Firstly it was simple, passing in two integers and then a binary operator would be applied to these (plus, minus etc) depending on the method called.</p>
<p>Then I decided to make things a litt... | <p>Partial classes are really a tool to separate auto-generated code from developer code.</p>
<p>A good example is the windows forms designer in VS, or the new DBML Linq DataContext generated code.</p>
<p>There's also an argument for using them with VSS style source control providers where only one user can edit a fi... | <p>Not with partial classes. A partial class is a syntax construct that gives you the ability to have different parts of the class in different source files. However, all parts of the partial class are ultimately compiled into the same binary.</p>
<p>You could use extension methods to add functionality to your class ... | 28,017 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.