instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I found that SQL stored procedures are very interesting and useful. I have written stored procedures but i want to write well crafted, good performance tuned and concise SPs for any sort of requirement and also would love to learn about any tricks or good practices for stored procedures. How do i move from the begin... | <p>Here are my stored procedure error-handling guidelines.</p>
<ul>
<li>Call each stored procedure using its fully qualified name to improve performance: that's the server name, database name, schema (owner) name, and procedure name.</li>
<li>In the script that creates each stored procedure, explicitly specify which r... | <p>Basic stuff: </p>
<p>Have an error-handling policy, and trap errors on all SQL statements.<br>
Decide on a policy for using source code control for stored procedures.<br>
Include a commented header with user, date/time, and purpose of the sp.<br>
Explicitly return 0 (success) for successful execution, something el... | 38,983 |
<p>Been using <strong>PHP/MySQL</strong> for a little while now, and I'm wondering if there are any specific advantages (performance or otherwise) to using <code>mysql_fetch_object()</code> vs <code>mysql_fetch_assoc()</code> / <code>mysql_fetch_array()</code>.</p>
| <p>Performance-wise it doesn't matter what you use. The difference is that mysql_fetch_object returns object:</p>
<pre><code>while ($row = mysql_fetch_object($result)) {
echo $row->user_id;
echo $row->fullname;
}
</code></pre>
<p>mysql_fetch_assoc() returns associative array:</p>
<pre><code>while ($row... | <p>I vote against <code>mysql_fetch_array()</code></p>
<p>Because you get back both numerically indexed columns and column names, this creates an array that is twice as large. It's fine if you don't need to debug your code and view it's contents. But for the rest of us, it becomes harder to debug since you have to wad... | 15,112 |
<p>My dilema:</p>
<p>In .htaccess in my website's root:</p>
<pre><code>RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
</code></pre>
<p>In .htaccess in the subdirectory /foo</p>
<pre><code>RewriteEngine On
RewriteRule ^page1\.html$ /foo/page2... | <p>You are missing the following directive in <code>foo/.htaccess</code>:</p>
<pre><code>RewriteOptions inherit
</code></pre>
<p>cf. <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteoptions" rel="nofollow noreferrer">the documentation</a></p>
| <p>i'm not sure of the specifics as to why the rules in <code>/.htaccess</code> aren't applying to <code>/foo/.htaccess</code>. typically, <code>.htaccess</code> files will inherit rules up the directory structure, which can lead to all sorts of odd things. for your specific solution though, you could just place all re... | 44,014 |
<p>I once read that one way to obtain a unique filename in a shell for temp files was to use a double dollar sign (<code>$$</code>). This does produce a number that varies from time to time... but if you call it repeatedly, it returns the same number. (The solution is to just use the time.)</p>
<p>I am curious to k... | <p>In Bash <code>$$</code> is the process ID, as noted in the comments it is not safe to use as a temp filename for a variety of reasons.</p>
<p>For temporary file names, use the <code>mktemp</code> command.</p>
| <blockquote>
<p>Also, You can grab login username via this command. Eg.</p>
</blockquote>
<pre><code>echo $(</proc/$$/login id). After that, you need to use getent command.
</code></pre>
| 10,395 |
<p>Sample</p>
<pre><code>void func(void* data)
{
CResource* resource = (CResource*)data;
delete resource; // ~CResource never called.
resource = NULL;
}
</code></pre>
<p>Kindly help me to figure out this.</p>
| <p><em>Summarized possible reasons why CResource destructor may be not called, extracted from other answers:</em></p>
<h2>Incomplete type</h2>
<p>One possible cause is you have the CResource type only declared, not defined:</p>
<pre><code>class CResource;
void func(void* data)
{
CResource* resource = (CResource*)d... | <p>Destructor is called.Give us the full code.</p>
| 48,913 |
<p>I once worked with an architect who banned the use of SQL views. His main reason was that views made it too easy for a thoughtless coder to needlessly involve joined tables which, if that coder tried harder, could be avoided altogether. Implicitly he was encouraging code reuse via copy-and-paste instead of encapsul... | <p>There are some very good uses for views; I have used them a lot for tuning and for exposing less normalized sets of information, or for UNION-ing results from multiple selects into a single result set.</p>
<p>Obviously any programming tool can be used incorrectly, but I can't think of any times in my experience whe... | <p>Let's see if I can come up with a lame analogy ...</p>
<p>"I don't need a phillips screwdriver. I carry a flat head and a grinder!"</p>
<p>Dismissing views out of hand will cause pain long term. For one, it's easier to debug and modify a single view definition than it is to ship modified code.</p>
| 6,417 |
<p>I enjoyed the answers and questions about <a href="https://stackoverflow.com/questions/121243/hidden-features-of-sql-server">hidden features in sql server</a> </p>
<p>What can you tell us about Oracle?<br>
Hidden tables, inner workings of ..., secret stored procs, package that has good utils...</p>
| <p>Since Apex is now part of every Oracle database, these Apex utility functions are useful even if you aren't using Apex:</p>
<pre><code>SQL> declare
2 v_array apex_application_global.vc_arr2;
3 v_string varchar2(2000);
4 begin
5
6 -- Convert delimited string to array
7 v_array := apex_u... | <p>Q: How to call a stored with a cursor from TOAD? </p>
<p>A: Example, change to your cursor, packagename and stored proc name</p>
<pre><code>declare cursor PCK_UTILS.typ_cursor;
begin
PCK_UTILS.spc_get_encodedstring(
'U',
10000002,
null,
'none',
cursor); ... | 49,970 |
<p>Is there any downside or problem potential to change the Java compiler to automatically cast? In the example below the result of list.get(0) would automatically be casted to the type of the variable hi.</p>
<pre><code>List list = new ArrayList();
list.add("hi");
String hi = list.get(0);
</code></pre>
<p>I know tha... | <p>Casting is an explicit instruction to the Java compiler to ignore type safety so allowing automatic casts would remove one of the features purposely designed into the language.</p>
<p>I personally like compiler warnings and errors, since it's much harder to find this type of problem at run time (assuming the compil... | <p>As others have said, automatic type-casting would eliminate type safety. Generics have multiple benefits and really aren't any harder to declare. With Eclipse, you can can just declare the generic variable and then use auto-complete on the instantiation and it will automatically fill in the type you used. Plus you (... | 12,439 |
<p>I'm not sure if this is a strange thing to do or not, or if it is some how code smell...but I was wondering if there was a way (some sort of oop pattern would be nice) to "cast" a base type to a form of its derived type. I know this makes little sense as the derived type will have additional functionality that the p... | <p>Not soundly, in "managed" languages. This is <em>downcasting</em>, and there is no sane down way to handle it, for exactly the reason you described (subclasses provide more than base classes - where does this "more" come from?). If you really want a similar behaviour for a particular hierarchy, you could use constru... | <p>C++ handles it using a constructor. <a href="http://www.cplusplus.com/doc/tutorial/typecasting/" rel="nofollow">C++ Typecasting</a>. It seems like an oversight to me. Many of you have brought up the issue of what would the process do with the extra properties. I would answer, what does the compiler do when it create... | 15,132 |
<p>I've just recently setup a custom replication for my subscriber database, as described in <a href="https://stackoverflow.com/questions/161890/how-do-you-track-the-time-of-replicated-rows-for-subscribers-in-sql-server-2005">another post here</a>. Basically, when the publisher pushes a new record to the subscribers, t... | <p>I finally have an answer for this problem a few months ago, just that I never got around to update this question. We have to log a support call to Microsoft, but we got a working solution.</p>
<p>To resolve the problem, when adding a subscription, you need to run the script like below:</p>
<pre><code>sp_addsubscri... | <p>I see this is a very old question now so you've probably resolved this, but anyway...</p>
<p>The problem you describe certainly doesn't seem to make sense. The replication will be invoked further to any change to the source table via the replication trigger. The only thing that doesn't look right in your process de... | 23,579 |
<p>I am looking to write an interpreted language in C#, where should I start? I know how I would do it using fun string parsing, but what is the correct way?</p>
| <p>It can be a pretty difficult endeavour to do right.</p>
<p>If you don't have much knowledge in compiler theory you should probably first start reading about it.<br>
Just using "fun string parsing", if I understand that term correctly, isn't going to get you very far at all.</p>
<p>The first basic step is to write ... | <p>Checkout the <a href="http://connect.microsoft.com/Phoenix" rel="nofollow noreferrer">Phoenix compiler</a> from Microsoft. This will provide many of the tools you will need to build a compiler targeting native or managed environments. Among these tools us a optimizing back end.</p>
<p>I second Cycnus' suggestion... | 47,784 |
<p>Is there a standard framework (maybe part of Enterprise Library... or .NET itself) that allows you to do common parameter validation in method attributes?</p>
| <p>The Microsoft Enterprise Library has the Microsoft.Practices.EnterpriseLibrary.Validation library/namespace which allows validation using attributes.</p>
| <p><a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=Dynamic%20Data&referringTitle=Home" rel="nofollow noreferrer">Dynamic Data</a> for ASP.NET (and ASP.NET MVC) lets you do validation for model properties using attributes.</p>
| 16,716 |
<p>I need to get access to the iTunes tags in an RSS feed using PHP. I've used simplepie before for podcast feeds, but I'm not sure how to get the iTunes tags using it. Is there a way to use simplepie to do it or is there a better way?</p>
<hr>
<p>Okay I tried Simple XML.</p>
<p>All this (the code below) seems to wo... | <p>SimplePie has a <a href="http://simplepie.org/wiki/reference/simplepie_item/get_item_tags" rel="nofollow noreferrer"><code>get_item_tags()</code> function</a> that should let you access them.</p>
| <p>If you have PHP5, using Simple XML can help in parsing the info you need.</p>
| 20,645 |
<p>How can I simplify a basic arithmetic expression?</p>
<p>e.g.</p>
<pre><code>module ExprOps where
simplify :: Expr -> Expr
simplify (Plus(Var"x") (Const 0)) = Var "x"
</code></pre>
<p>What do I have to do?</p>
<hr>
<pre><code>module Expr where
-- Variables are named by strings, assumed to be identifiers.
... | <p>Well, you have the right general model. You just need more rules and to recursively apply the simplification process.</p>
<pre><code>simplify :: Expr -> Expr
simplify (Mult (Const 0) x) = Const 0
simplify (Mult x (Const 0)) = Const 0
simplify (Plus (Const 0) x) = simplify x
simplify (Plus x (Const 0)) = simpli... | <p>Are we talking rationals here, like GMP's rationals? If so, then one could simplify a division by making the second argument into its reciprocal and then multiplying.</p>
<p>Apart from that, multiplication is addition done more than once, and division is subtraction done more than once. </p>
<p>As Mitch has said i... | 41,469 |
<p>I have a Flash application that is hosted from within a Drupal page. Some parts of the Flash application should be available to all users, but some should only be available to a logged-in user. (The specific role doesn't matter, just that they are any authorized user of the site).</p>
<p>From within Flash, I can ... | <p>I was able to do this using Drupal's "system" and "user" services:</p>
<ul>
<li>install the <a href="http://drupal.org/project/services" rel="nofollow noreferrer">Services Module</a></li>
<li>enable the "system" and "user" services</li>
<li>for the code below, disable API Keys. (Or leave them enabled and supply th... | <p>I know this is a long way out from when this post was originally made, but if you are still interested in this and never took the time to research it a lot, I figured out how to successfully process a login through a flash document. (One that is embedded or external for that matter.) It does not even require AMFPHP... | 35,762 |
<p>It seems like this should be straightforward but I'm boggling. I've got my listview all setup and bound to my LINQ datasource. The source is dependent on a dropdown list which decides which branch information to show in the listview. My edit template works fine but my insert template won't work because it wants t... | <p>Use the OnSelectedIndexChanged (with AutoPostBack=True) callback for the DropDownList to manually set the values in the ListView to the defaults for that branch when the value of the DropDownList changes.</p>
<pre><code>protected void BranchDropDownList_OnSelectedIndexChanged( object sender, EventArgs e )
{
Dro... | <p>Use the OnSelectedIndexChanged (with AutoPostBack=True) callback for the DropDownList to manually set the values in the ListView to the defaults for that branch when the value of the DropDownList changes.</p>
<pre><code>protected void BranchDropDownList_OnSelectedIndexChanged( object sender, EventArgs e )
{
Dro... | 26,090 |
<p>With WinForms, I can use <code>Control.Scale</code> to scale a control larger. When I do that, all child controls are repositioned and scaled correctly, but font size remains the same.</p>
<p>Is there an easy way to force font to scale up/down, or is the only way to manually update font for all controls when contr... | <p>Do it the other way around. Change the font size, the controls will automatically scale to accommodate the larger font. For example:</p>
<pre><code> public partial class Form1 : Form {
float mDesignSize;
int mIncrement;
public Form1() {
InitializeComponent();
mDesignSize = this.Font.SizeI... | <p>Do it the other way around. Change the font size, the controls will automatically scale to accommodate the larger font. For example:</p>
<pre><code> public partial class Form1 : Form {
float mDesignSize;
int mIncrement;
public Form1() {
InitializeComponent();
mDesignSize = this.Font.SizeI... | 39,432 |
<p>Oracle has two seemingly competing technologies. CDC and DCN.</p>
<p>What are the strengths of each?</p>
<p>When would you use one and not the other?</p>
| <p>In general, you would use DCN to notify a client application that the client application needs to clear/ update the application's cache. You would use CDC for ETL processing.</p>
<p>DCN would generally be preferable when you have an OLTP application that needs to be notified immediately about data changes in the d... | <p>CDC seems to be much more complex to set up than DCN. </p>
<p>I mean to setup DCN I wrap a select in a start and end DCN block and then write a procedure to be called with a collect of changes. That's it.</p>
<p>CDC requires publishers and subscribers and anyways, seems like more work.</p>
| 25,656 |
<p>I have a pdf file.I need to find all the hyperlinks available in that file and then make change on those links. I am using C# and I'd rather not to use a third party tool!</p>
| <p>You can use <a href="http://sourceforge.net/projects/itextsharp/" rel="nofollow noreferrer">iTextSharp</a>. Its an open-source API to manipulate pdf written in c#.</p>
<p>The basic algorithm would be:</p>
<ol>
<li>Loop through every pages in the PDF file.</li>
<li>For every page, loop through every annotation in t... | <p>Personally I'd have a hack around with <a href="http://pybrary.net/pyPdf/" rel="nofollow noreferrer">PyPDF</a>..</p>
| 21,268 |
<p>I am trying to create a web application using Pylons and the resources on the web point to the <a href="http://pylonsbook.com/alpha1/authentication_and_authorization" rel="noreferrer">PylonsBook</a> page which isn't of much help. I want authentication and authorisation and is there anyway to setup Authkit to work ea... | <p>Ok, another update on the subject. It seems that the cheeseshop template is broken. I've followed the chapter you linked in the post and it seems that authkit is working fine. There are some caveats:</p>
<ol>
<li>sqlalchemy has to be in 0.5 version</li>
<li>authkit has to be the dev version from svn (easy_install a... | <p>This actually got me interested:<a href="http://groups.google.com/group/pylons-discuss/browse_thread/thread/644deb53612af362?hl=en" rel="nofollow noreferrer">Check out this mailing on the pylons list</a>. So AuthKit is being developed, and I will follow the book and get back on the results.</p>
| 7,006 |
<p>Given a linux kernel oops, how do you go about diagnosing the problem? In the output I can see a stack trace which seems to give some clues. Are there any tools that would help find the problem? What basic procedures do you follow to track it down?</p>
<pre><code>
Unable to handle kernel paging request for data ... | <p>An Oops gives a bunch of information useful in diagnosing a crash. It starts with the address of the crash, the reason ("access of bad area") and the contents of the registers. The call trace answers the question "how did we get here". The first item in the list happened most recently. Working backwards, an interrup... | <p><a href="http://oss.sgi.com/projects/kdb/" rel="nofollow noreferrer">http://oss.sgi.com/projects/kdb/</a></p>
<p>Install this into your kernel, then when it Oops's, you'll be thrown into a gdb-like interface that you can poke around with. However, it looks like the manet module is deref'ing a bad pointer.</p>
| 40,814 |
<p>I want to display a list of images (instead of text) for the user to choose from. The control is databound (the URLs come from the database) Instead of the typical vertical scroll bar in a listbox, I want this box to be horizontal. I'm looking for an ASP.NET server control similar to this: <a href="http://www.infrag... | <p>if you are experienced with ajax and/or jQuery you can have a look at the jQuery SliderGallery control.</p>
<p><a href="http://ui.jquery.com/repository/real-world/product-slider/" rel="nofollow noreferrer">http://ui.jquery.com/repository/real-world/product-slider/</a></p>
| <p>I'd just put them in a div (asp:panel?) that's styled to have a particular height and width and overflow horizontally.</p>
| 18,657 |
<p>I'm looking for a wiki that I can use to track requirements for a project, but we would like to be able to export the wiki (with formatting) to Microsoft Word. Does anyone know of a wiki that does this?</p>
| <p><a href="http://www.atlassian.com/software/confluence/" rel="nofollow noreferrer">Confluence</a> does this. Also exports to PDF.</p>
| <p>If you're looking for a free solution, MediaWiki has some <a href="http://www.mediawiki.org/wiki/Alternative_parsers" rel="nofollow noreferrer">alternative parsers</a> that might be a good place to look. You might have to go through more than one phase to get it to Microsoft Word format though.</p>
| 9,371 |
<p>Is there a way, within the .net framework, to check to see if two different shared folders are actually pointing to the same physical directory? Do directories in Windows have some sort of unique identifier? Google-fu is failing me.</p>
<p>(I mean, aside from writing a temp file to one and seeing if it appears in... | <p>I believe using WMI queries will take care of what I need to do:</p>
<pre><code>Connection options = new ConnectionOptions();
ManagementScope scpoe = new ManagementScope("\\\\Server\\root\\cimv2", options);
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Share WHERE Name = '" + name +"'")
ManagementObject... | <p>You can examine the share definition itself by using the System.Management namespace but it is not easy to use.</p>
<p>it starts something like</p>
<pre><code>ManagementClass management = new ManagementClass("\\\\.\\root\\cimv2", "Win32_Share", null)
</code></pre>
<p>And it gets much worse after that. I have use... | 32,955 |
<p>I am performing two validations on the client side on the samve event.
I have defined my validations as shown below</p>
<pre><code>btnSearch.Attributes["OnClick"] = "javascript:return prepareSave(); return prepareSearch();"
</code></pre>
<p>Pseudo code for </p>
<pre><code>prepareSave():
{
if (bPendingchanges)
... | <p><code>return</code>, as the name implies, returns control back to whatever called the code in question. Therefore, anything that's after a return statement</p>
<pre><code>return prepareSave(); return prepareSearch();
// ^^^^^^^^^^^^^^^^^^^^^^^ e.g. this part
</code></pre>
<p>never executes. Try ... | <p>That's because the return prevents the second validation from running. Try this</p>
<pre><code>btnSearch.Attributes["OnClick"] = "javascript:return prepareSave() && prepareSearch();"
</code></pre>
| 32,471 |
<p>The cube is a 2 cm x 2 cm with infill at 30 % and layer height 0.2 mm, more details can be seen below.</p>
<p>I'm printing with PETG using an Ender 3 printer.</p>
<p>There seems to be a gap between the perimeter walls, I have already referred to other forums and specifically: " <a href="https://3dprinting.stack... | <p>PETG filament is not entirely rigid and compresses slightly in the Ender 3's extruder gear and Bowden extruder setup. Tightening it will only make this effect greater. Being compressed at the point where mm of extruder advance is applied means less than the desired advance of at-nominal-diameter filament will take p... | <p>I agree with @R.. GitHub STOP HELPING ICE, looks like under extrusion you could try a flow rate test print like this <a href="https://www.thingiverse.com/thing:3397997" rel="nofollow noreferrer">link</a> to try and dial in the value.</p>
<p>But probably worth just trying a flow of 105% and see if it solves the probl... | 1,715 |
<p>Is there a cross database platform way to get the primary key of the record you have just inserted?</p>
<p>I noted that <a href="https://stackoverflow.com/questions/165156/easy-mysql-question-regarding-primary-keys-and-an-insert">this answer</a> says that you can get it by Calling <code>SELECT LAST_INSERT_ID()</cod... | <p>Copied from my code:</p>
<pre><code>pInsertOid = connection.prepareStatement(INSERT_OID_SQL, Statement.RETURN_GENERATED_KEYS);
</code></pre>
<p>where pInsertOid is a prepared statement.</p>
<p>you can then obtain the key:</p>
<pre><code>// fill in the prepared statement and
pInsertOid.executeUpdate();
ResultSet ... | <p>Just declare id column as id integer not NULL primary key <code>auto_increment</code></p>
<p>after this execute this code</p>
<pre><code>ResultSet ds=st.executeQuery("select * from user");
while(ds.next())
{
ds.last();
System.out.println("please not... | 24,666 |
<p>I have a script which logs on to a remote server and tries to rename files, using PHP.</p>
<p>The code currently looks something like this example from the php.net website:</p>
<pre><code>if (ftp_rename($conn_id, $old_file, $new_file)) {
echo "successfully renamed $old_file to $new_file\n";
} else {
echo "There ... | <p>Looking at the FTP API here:</p>
<p><a href="http://us.php.net/manual/en/function.ftp-rename.php" rel="noreferrer">http://us.php.net/manual/en/function.ftp-rename.php</a></p>
<p>There doesn't seem to be any way to get anything but true or false.</p>
<p>However, you could use ftp_raw to send a raw RENAME command, ... | <p>Based on @Sascha Schmidt answer, you could do something like this:</p>
<pre><code>if (ftp_rename($conn_id, $old_file, $new_file)) {
echo "successfully renamed $old_file to $new_file\n";
} else {
echo "There was a problem while renaming $old_file to $new_file\n";
print_r( error_get_last() ); // ADDED THIS LINE
}
... | 35,396 |
<p>In my base page I need to remove an item from the query string and redirect. I can't use<br/></p>
<pre><code>Request.QueryString.Remove("foo")
</code></pre>
<p>because the collection is read-only. Is there any way to get the query string (except for that one item) without iterating through the collection and re-bu... | <p>You'd have to reconstruct the url and then redirect. Something like this:</p>
<pre><code>string url = Request.RawUrl;
NameValueCollection params = Request.QueryString;
for (int i=0; i<params.Count; i++)
{
if (params[i].GetKey(i).ToLower() == "foo")
{
url += string.Concat((i==0 ? "?" : "&"), ... | <p>Can you clone the collection and then redirect to the page with the cloned (and modified) collection?</p>
<p>I know it's not much better than iterating...</p>
| 7,520 |
<p>Strange program hang, what does this mean in debug?</p>
<p>After attaching windbg I found the following:</p>
<pre>
(1714.258): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=015b5c74 ebx=178a13e0 ec... | <p>If you are using MSVC and the Debug build configuration, <code>0xdddddddd</code> usually means that you are attempting to access freed memory. The debug CRT memory manager fills free memory with <code>0xdd</code>.</p>
| <p>The ecx register has an invalid address (dddddddd). I would suggest this is a case of memory corruption. Consider turning gflags on for the process.</p>
| 28,022 |
<p>I need to revoke an authentication cookie if the user no longer exists (or some other condition), after the forms authentication mechanism already have received the authentication cookie from the browser and have validated it. I.e. here is the use scenario:</p>
<ol>
<li>The user have been authenticated, and granted... | <p>I don't think there is an automated way to achive this.
I think the best way would be to add a date to the auth cookie which will be the last time you checked whether the user exists.
So when a user logs-in you'll:</p>
<pre><code>FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, ... | <p>If you are rejecting the cookie for some other reason than an expired session, then I think you should redirect the user to a page that describes what they need to do in order to gain access. If logging on again is sufficient, then the logon page would suffice. It sounds, however, like there are conditions under w... | 43,071 |
<p>A similar question has been asked: <a href="https://stackoverflow.com/questions/42466/msdn-subscriptions-on-the-cheap">MSDN subscriptions on the cheap?</a>, but I am not interested in the solutions provided:</p>
<ul>
<li>I am not developing a product for sale, I am starting up a consulting company, so Empower is no... | <p>There are really only a few options available</p>
<ol>
<li>Buy it at standard price</li>
<li>Become a Microsoft Certified Partner, and get a good discount (Actually much simpler than you would think, I did it in under 2 weeks for my business)</li>
<li>Find a MVP buddy that is willing to share a free giveaway</li>
<... | <p>I used to go directly through MS, but nowadays, I always order mine through <a href="http://www.xtras.net/" rel="nofollow noreferrer">Xtras.net</a> - they have good multi-year discounts and you manage the subscription online through Microsoft's site as normal.</p>
| 21,119 |
<p>I need a way to stash some data that is global to the browser. If I open a new window with a URL from my app, e.g. via a bookmark, I need to access some data that was created in another window and never sent to the server. </p>
<p>As far as I can tell the only thing that is global to the browser and not just a wind... | <p>The HTML 5 storage API looks like exactly what you want here, but unfortunately it's only supported by a handful of browsers right now.</p>
| <p>Why not just read a field in the parent window using window.opener ? Or if you've three windows running - parent and two children which I think you might be implying then read/write to a hidden field in the parent from the children.</p>
| 45,269 |
<p>I have a variable that is built in loop. Something like:</p>
<pre><code>$str = "";
for($i = 0; $i < 10; $i++) $str .= "something";
</code></pre>
<p>If $str = "" is ommitted, I get undefined variable notice, but I thought php auto-declare a variable the first time it sees undeclared one?</p>
<p>How do I do this... | <p>You get the undefined variable because you're concatenating the value of itself with another value.</p>
<p>The equivalent of</p>
<blockquote>
<p><code>$str = $str . "something";</code></p>
</blockquote>
<p>So, it can't say what's the initial value is. It's the equivalent of this:</p>
<blockquote>
<p><code>$s... | <p>It's safer to not use the auto-declare feature - that's why it issues a notice. A notice is the lowest level of warning, and won't be displayed by default. Most older PHP apps will issue lots of notices if you were to turn them on.</p>
| 30,224 |
<p>My company is in education industry and we use XML to store course content. We also store some course related information (mostly metainfo) in relational database. Right now we are in the process of switching from our proprietary XML Schema to DocBook 5. Along with the switch we want to move course related informati... | <p>Take a look at <a href="http://exist.sourceforge.net/" rel="nofollow noreferrer">exist</a>, it is an open source xml database that supports XQuery.</p>
| <p>I have worked with Berkeley XMLDB a lot the past year and its kinda a mixed bag. </p>
<p>Pros: FAST, xquery and xupdate, oracle is maintaining well, many languages have interfaces, small imprint, embedded, file based (maybe some see that as a con?), extremely flexible for some wicked awesome queries</p>
<p>Cons: i... | 12,333 |
<p>I'm confused with how views are organized, and it is important to understand this as ASP.NET MVC uses conventions to get everything working right.</p>
<p>Under the views directory, there are subdirectories. Inside these subdirectories are views. I'm assuming that the subdirectories map to controllers, and the con... | <p>View directory naming and file naming are important, because the ASP.NET MVC framework makes certain assumptions about them. If you do not conform to these assumptions, then you must write code to let the framework know what you are doing. Generally speaking, you should conform to these assumptions unless you have ... | <p>In regard to expected names for the views, I think that it's one of those things that each project or organization will try to standardize. </p>
<p>As you hinted to in your question, it's possible that some of these Views (or more precisely, the Actions that render them) become popular across the board, like for ex... | 15,564 |
<p>Using Firebird, I want to combine the results of two queries using UNION ALL, then sort the resulting output on a given column.</p>
<pre><code>(select C1, C2, C3 from T1)
union all
(select C1, C2, C3 from T2)
order by C3
</code></pre>
<p>The parentheses came from valid syntax for other databases, and are needed to ... | <pre><code>SELECT C1, C2, C3
FROM (
select C1, C2, C3 from T1
union all
select C1, C2, C3 from T2
)
order by C3
</code></pre>
| <p>Moving <code>order by</code> into a query tail has <strong>no</strong> effect to output datagrid.</p>
<pre><code>select * from (
select first 1
C1
from T1
order by id desc
)
union all
select * from (
select first 1
C1
from T2
order by id desc
)</code></pre>
| 46,144 |
<p>Regardless of the layout being used for the tiles, is there any good way to divvy out the tiles so that you can guarantee the user that, at the beginning of the game, there exists at least one path to completing the puzzle and winning the game?</p>
<p>Obviously, depending on the user's moves, they can cut themselve... | <p>Place all the tiles in reverse (ie layout out the board starting in the middle, working out)</p>
<p>To tease the player further, you could do it visibly but at very high speed.</p>
| <p>Solitaire? Just a guess, but I would assume that your computer would need to beat the game(or close to it) to determine this.</p>
<p>Another option might be to have several preset layouts(that allow winning, mixed in with your current level.</p>
<p>To some degree you could try making sure that one of the 4 tiles i... | 19,299 |
<p>I want to embed a link to a controller action in my page so I can use it from javascript. Something like</p>
<pre><code>var pollAction = '/Mycontroller/CheckStatus'
</code></pre>
<p>Now I am happy to hardcode it, but it would be really nice if there were a method I could use to create the URL. The AjaxHelper/HtmlE... | <p>Have you tried something along these lines?</p>
<pre><code>var pollAction = '<%=Url.Action("CheckStatus", "MyController") %>';
</code></pre>
| <p>If your page or control inherits from <code>ViewPage</code> or <code>ViewUserControl</code>, use the <code>Url.Action</code> method.</p>
<p>If not, use this instead:</p>
<pre><code> String url = RouteTable.Routes.GetVirtualPath
(
((MvcHandler) HttpContext.Current.CurrentHandler).Reque... | 46,364 |
<p>I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.)</p>
<p>I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I... | <blockquote>
<p>Sharepoint: Best way to display lists
of non-Sharepoint content with
“compatible” UI?</p>
</blockquote>
<p>Take a look at the built in sharepoint web controls:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.aspx" rel="nofollow noreferrer">Microsoft.Share... | <p>Problem with SharePoint is that there are a bunch of different ways to do this. If your data is not changing too often and is not overly large it may be worth considering entering it into a list for display.
If you have the Enterprise licence it may be worth getting your data into the BDC and using it there.
you ma... | 10,139 |
<p>I'm writing a JavaSCript class that has a method that recursively calls itself.</p>
<pre><code>Scheduler.prototype.updateTimer = function () {
document.write( this._currentTime );
this._currentTime -= 1000;
// recursively calls itself
this._updateUITimerHandler = window.setTimeout( arguments.callee ... | <p>Try this:-</p>
<pre><code>Scheduler.prototype.startTimer = function() {
var self = this;
function updateTimer() {
this._currentTime -= 1000;
self.hTimer = window.setTimeout(updateTimer, 1000)
self.tick()
}
this.hTimer = window.setTimeout(updateTimer, 1000)
}
Scheduler.prototype.stopTimer = funct... | <p>You could hold a pointer towards it...</p>
<pre><code>/* ... */
var func = arguments.callee;
this._updateUITimerHandler = window.setTimeout(function() { func(); }, 1000);
/* ... */
</code></pre>
| 46,374 |
<p>I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax.</p>
<pre><code>Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
</code></pre>
<p>What the heck does the caret mean? (The <code>gcnew<... | <p>This is <a href="http://en.wikipedia.org/wiki/C%2B%2B/CLI" rel="noreferrer">C++/CLI</a> and the caret is the managed equivalent of a * (pointer) which in C++/CLI terminology is called a <a href="https://learn.microsoft.com/en-us/cpp/extensions/handle-to-object-operator-hat-cpp-component-extensions" rel="noreferrer">... | <p>It's also worth considering the following couple of sentences, that put the answer in a slightly different way:</p>
<p>"The handle declarator (^, pronounced "hat"), modifies the type specifier to mean that the declared object should be automatically deleted when the system determines that the object i... | 24,758 |
<p>Assume that we have N erlang nodes, running same application. I want
to share an mnesia table T1 with all N nodes, which I see no problem.
However, I want to share another mnesia table T2 with pairs of nodes.
I mean the contents of T2 will be identical and replicated to/with
only sharing pair. In another words, I wa... | <p>One table is always one table, no matter how many nodes you share it with. If you want pairs of nodes sharing a table, you would have to create a unique table for each pair of nodes. </p>
<p>You can use the same settings (records etc) for all those tables though, so there shouldn't be so much more work to get it do... | <p>It's possible to do this with mnesia's table fragmentation, if one makes use of the <code>mnesia_frag_hash</code> callback behaviour. This allows you to control the distribution of keys, and it would be possible to construct the keys such that the callback is able to determine which node pair (and thus, which fragme... | 14,603 |
<p>here is the input i am getting from my flash file </p>
<p>process.php?Q2=898&Aa=Grade1&Tim=0%3A0%3A12&Q1=908&Bb=lkj&Q4=jhj&Q3=08&Cc=North%20America&Q0=1</p>
<p>and in php i use this code
foreach ($_GET as $field => $label)
{
$datarray[]=$_GET[$field];</p>
<pre><code>echo "$fi... | <pre><code>ksort($_GET);
</code></pre>
<p>This should <a href="http://php.net/manual/en/function.ksort.php" rel="nofollow noreferrer">ksort</a> the <code>$_GET</code> array by it's keys. <a href="http://php.net/manual/en/function.krsort.php" rel="nofollow noreferrer">krsort</a> for reverse order.</p>
| <p>To get a natural sort by key:</p>
<pre><code>function knatsort(&$karr){
$kkeyarr = array_keys($karr);
natsort($kkeyarr);
$ksortedarr = array();
foreach($kkeyarr as $kcurrkey){
$ksortedarr[$kcurrkey] = $karr[$kcurrkey];
}
$karr = $ksortedarr;
return true;
}
</code></pre>
<p><... | 11,128 |
<p>I have written a secure TCP server in .NET. This was basically as simple as creating a TcpListener instance and wrapping the connected client's NetworkStreams with SslStreams.</p>
<p>Now I need to access this TCP server with Delphi 7 (alternatively: Delphi 2007).</p>
<p>I haven't found anything in the help, and a ... | <p>You can also use <a href="http://synapse.ararat.cz/doku.php/download" rel="nofollow noreferrer">Synapse</a>, which is also a free solution which is easy to use. It differs from Indy in that it doesn't use components, but rather simple blocking functions. For the SSL support, Synapse supports the use of <a href="ht... | <p>None of Indy / ICS / Synapse have built-in SSL. They plug third-party modules, such as OpenSSL or our <a href="http://www.eldos.com/sbbdev/delphi-ssl.php" rel="nofollow noreferrer">SecureBlackbox</a> product.</p>
| 38,637 |
<p>Does a hash shrink in Perl as you delete elements. </p>
<p>More specifically I had a perl program that I inherited that would parse a huge file ( 1 GB ) and load up a hash of hashes. it would do that same for another file and then do a comparison of different elements. The memory consumption was huge during this pr... | <p>In general, Perl cannot return memory to the operating system. It may be able to reuse memory internally, though, which could reduce the amount of memory needed by a program.</p>
<p>See perlfaq3: <a href="http://perldoc.perl.org/perlfaq3.html#How-can-I-free-an-array-or-hash-so-my-program-shrinks%3f" rel="noreferrer... | <p>If inputs in the second file are needed only once (as they are read), you could potentially cut the memory usage in half.</p>
<p>Depending on your algorithm, you might even be able to just hold both filehandles open and a small hash of not-used-yet values in memory. An example would be a merge or comparison of sor... | 15,841 |
<p>I'm trying to write a program to calculate the quadratic formula. When I run it, I get 2 error messages:</p>
<pre>error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals</pre>
<p>this is after I changed the last line of code from ... | <p><strong>[Update:]</strong> Found the concise answer to this question in TDD ByExample - Pg194.</p>
<blockquote>
<p>The simple answer, supplied by Phlip
is, "Write tests until fear is
transformed into boredom."</p>
</blockquote>
<p>[/<strong>Update</strong>]</p>
<p>I think the problem prevalent in the curren... | <p>If two test cases will run exactly the same code, then there's no need to test them separately. e.g., For your example of reading the config file, you only need to test that it is able to correctly read each type of value (and that it fails in the correct manner when asked to read a nonexistent or invalid value).</... | 45,200 |
<p>In most C or C++ environments, there is a "debug" mode and a "release" mode compilation.<br>
Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it also disables most optimizations.<br>
In "release" mode, you usually have all s... | <p>Without any optimization on, the flow through your code is linear. If you are on line 5 and single step, you step to line 6. With optimization on, you can get instruction re-ordering, loop unrolling and all sorts of optimizations.<br>
For example:</p>
<pre><code>
void foo() {
1: int i;
2: for(i = 0; i < 2; )
... | <p>If you're debugging at the instruction level rather than the source level, it's an awful lot for you easier to map unoptimized instructions back to the source. Also, compilers are occasionally buggy in their optimizers.</p>
<p>In the Windows division at Microsoft, all release binaries are built with debugging symbo... | 9,465 |
<p>My website is entirely flash based, it moves around a 3D model which was given to me as chunks of video that I've converted to FLV files. I'm using the FLVPlayback component to control the video inside of my program. While running memory checks using System.totalMemory I've noticed that whenever a video is loaded, i... | <p>You can't help the memory problems much until Flash adds destructors and explicit object deletion, unfortunately. See this thread:</p>
<p><a href="https://stackoverflow.com/questions/34/unloading-a-bytearray-in-actionscript-3">Unloading a ByteArray in Actionscript 3</a></p>
<p>There's a limit to how much memory Fl... | <p>Unfortuantely, thats just the way flash handles it. Not particularly smart, but it works for most people.</p>
| 4,340 |
<p>I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect:</p>
<blockquote>
<p>The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.</p>
</blockquote>
<hr>
<p>Note: The details of original qu... | <p>It's been my experience that Xcode occasionally gets confused about which signing certificate to use. I got into the habit of quitting and restarting Xcode after any change to the code signing settings (and doing a clean build) to work around this problem.</p>
| <p>Just had this problem today but the answers here didn't help. I finally found the problem.</p>
<p>Make sure using pull down menu: <strong>Project>Edit Active Target</strong> "<em>ProjectName</em>" to change Code Signing to Distribution - I was selecting the Project in the Groups & Files pane and using the Info ... | 7,028 |
<p>In an application I work on, any business logic error causes an exception to be thrown, and the calling code handles the exception. This pattern is used throughout the application and works well. </p>
<p>I have a situation where I will be attempting to execute a number of business tasks from inside the business l... | <p>The <a href="http://msdn.microsoft.com/magazine/cc163340.aspx" rel="noreferrer">Task Parallel Library extensions</a> for .NET (which <a href="http://blogs.msdn.com/pfxteam/archive/2008/10/10/8994927.aspx" rel="noreferrer">will become part of .NET 4.0</a>) follow the pattern suggested in other answers: collecting all... | <p>No super-elegant solution here but a few ideas:</p>
<ul>
<li>Pass an error-handler function as argument to DoTasks so the user can decide whether to continue</li>
<li>Use tracing to log errors as they occur</li>
<li>Concatenate the messages from the other exceptions in the exception bundle's message</li>
</ul>
| 35,164 |
<p>How do I dynamically reload the app.config in a .net Windows application? I need to turn logging on and off dynamically and not just based upon the value at application start.</p>
<p>ConfigurationManager.RefreshSection("appSettings") does not work and I've also tried explicitly opening the config file using OpenEx... | <p>You can refresh <strong>your own</strong> section the way you say:</p>
<pre><code>ConfigurationManager.RefreshSection("yoursection/subsection");
</code></pre>
<p>Just move a logging true/false into a section and you'll be fine.</p>
| <p>I don't think there's any way to do this, unless you write your own config file reader using XML. Why not just turn logging on or off at the start of your app based on the config file setting, and then just turn it on or off dynamically while the program is running?</p>
| 34,242 |
<p>I'm writing a small agent in java that will play a game against other agents. I want to keep a small amount of state (probably approx. 1kb at most) around between runs of the program so that I can try to tweak the performance of the agent based upon past successes. Essentially, I will be reading a small amount of da... | <p>Considering that these objects can vary per file size, and your computer's specs (bus speed, HD speed) affect this, the only way to be sure is to write your own benchmark. Just create a simple for loop, count from 1 to 1000, and read the file inside the loop over and over (but do not create and destroy the objects ... | <p>Considering that these objects can vary per file size, and your computer's specs (bus speed, HD speed) affect this, the only way to be sure is to write your own benchmark. Just create a simple for loop, count from 1 to 1000, and read the file inside the loop over and over (but do not create and destroy the objects ... | 33,946 |
<p>An MFC application that I'm trying to migrate uses <code>afxext.h</code>, which causes <code>_AFXDLL</code> to get set, which causes this error if I set <code>/MT</code>:</p>
<blockquote>
<p>Please use the /MD switch for _AFXDLL builds</p>
</blockquote>
<p>My research to date indicates that it is impossible to b... | <p>No, there are many applications built with VS2005 that have to support Windows XP, 2000, NT, the whole stack. The issue is that (by default) VS2005 wants to use libraries/exports not present on NT.</p>
<p>See <a href="http://www.mombu.com/microsoft/windows-programmer-win32/t-vs2005-and-nt4-392831.html" rel="norefer... | <p>The idea is that the exe is needed to link to the static library.</p>
<p>Please try this
"Configuration Properties", "General", "Use of MFC" to "Use MFC in a Static Library"
"Configuration Properties", "General", "Use of ATL" to "Static Link to ATL"</p>
<p>"Configuration Properties", "C\C++", "Code Generation", "R... | 2,303 |
<p>How can I get PDO to work on my mac (os x 10.5)? I'm using the built in php and php in Zend/Eclipse. Can't seem to find useful drivers for it at all.</p>
| <p>I had to install the PDO_PGSQL driver recently on Leopard, and I ran across a multitude of problems. In my search for answers, I stumbled across this question. Now I have it successfully installed, and so, even though this question is quite old, I hope that what I've found can help others (like myself) who will undo... | <p>This is what worked for me</p>
<pre><code>brew install php55-pdo-pgsql
</code></pre>
<p>This installs PHP 5.5.32 and PostgreSQL 9.5. I already had PostgreSQL 9.4 installed so I uninstalled the homebrew version with:</p>
<pre><code>brew uninstall postgres
</code></pre>
<p>You then have to update /etc/apache2/http... | 8,704 |
<p>What is the fastest way to fill ComboBox in C#?</p>
<ol>
<li>With <code>Add()</code></li>
<li>Bind the ComboBox to Dataset</li>
</ol>
<p>Or there is a faster way ?</p>
<p>Thanks.</p>
| <p>You'll probably find that the fastest way of doing this will be to read the DB from a datareader, then call .Add() in a loop, but using the DataReader's numerically indexed fields (instead of the named properties). </p>
| <p>Well, using databinding is much less code for anything other than one item:</p>
<p>myComboBox.DataSource = myDataSet;
myComboBox.DataBind();</p>
<p>Of course, this assumes your DataSet already contains data. Perhaps you could refine your question?</p>
| 45,039 |
<p>I am building an ontology-processing tool and need lots of examples of various owl ontologies, as people are building and using them in the real world. I'm not talking about foundational ontologies such as Cyc, I'm talking about smaller, domain-specific ones.</p>
| <p>There's no definitive collection afaik, but these links all have useful collections of OWL and RDFS ontologies:</p>
<ul>
<li><a href="http://www.schemaweb.info/" rel="noreferrer">schemaweb.info</a></li>
<li><a href="http://vocab.org/" rel="noreferrer">vocab.org</a></li>
<li><a href="http://www.owlseek.com/master.ht... | <p>One more concept search tool: <a href="http://iws.seu.edu.cn/services/falcons/conceptsearch/index.jsp?query=" rel="nofollow noreferrer">falcons</a></p>
| 19,905 |
<p>I'm currently in the process of testing our solution that has the whole "gamut" of layers: UI, Middle, and the omnipresent Database.</p>
<p>Before my arrival on my current team, query testing was done by the testers manually crafting queries that would theoretically return a result set that the stored procedure sho... | <p>Testing stored procs will require that each person who tests has a separate instance of the db. This is a requirement. If you share environments you won't be able to rely upon the results of your test. They'll be worthless.</p>
<p>You will also need to ensure that you roll back the db to it's previous state after e... | <p>I find it useful to test the SQL being sent down to the database rather than the result of querying the database.</p>
<p>Not that I don't do the later, but I find it much faster to test for that than having the database too much lifting.</p>
| 32,539 |
<p>I am in the middle of designing a system that will be used to feed several production sites around the country (all information is in one site) with the potential to add more. Initially I thought that I could get away with only using one database. I am now re-thinking my original design and leaning toward a more s... | <p>Without knowing more about your specific situation, it's a little difficult to help - but here's my gut feeling...</p>
<p>I'm guessing that the information that you have suggested should go in your 'Master' database is perhaps more likely to be stable (a low number of changes to the data) than the databases for eac... | <p>MySQL has <a href="http://dev.mysql.com/doc/refman/5.0/en/federated-storage-engine.html" rel="nofollow noreferrer">federated tables</a>, but it's unclear whether foreign key constraints will work across them. I kind of doubt it - but a trigger should.</p>
<p>Otherwise, you have to move your referential integrity up... | 27,643 |
<p>In the next few months I will be resurrecting a project which made extensive use of Orpheus and SysTools. The development system I used is long gone, so would like to update the libraries to my current development environment.</p>
<p>My question(s): is anyone porting, or has anyone ported the TurboPower libraries t... | <p>Some components in the process of being ported to Delphi 2009, including 5 TurboPower libraries. No Orpheus or SysTools, though.</p>
<p><a href="http://www.songbeamer.com/delphi/" rel="nofollow noreferrer">http://www.songbeamer.com/delphi/</a></p>
<p>Update:</p>
<p>As M Plaut pointed out, Orpheus has been added ... | <p>There is <a href="http://sourceforge.net/projects/tporpheus/" rel="nofollow noreferrer">Orpheus</a> project at SourceForge but last release was made in 2005 :(
<a href="http://sourceforge.net/projects/tpsystools/" rel="nofollow noreferrer">Systools</a> is also to be found there.</p>
| 14,637 |
<p>I have a web service which has a generic function that returns a dataset from results of stored procedures... Some of the stored procedures have optional parameters where the value can be null but not all the time.</p>
<p>Anyhow I am trying to pass in a parameter which has a value of DBNull.Value</p>
<p>and I get ... | <p>I beleive that's becuase a System.DBNull value is a null in database table but a null field in a procedure effectively equates to the null/nothing keyword. Not a database null value. I'm not sure of the technical differences under the hood.</p>
<p>But in your stored proc you can just default it to null and not se... | <p>You can pass a NULL value in the SqlParemeter, but you must do some type conversion to make sure the right null value gets passed. </p>
<p>In this example, there is a parameter called "Count" which is an integer, which gets passed as null:</p>
<pre><code>Using dtResult as New DataTable
Using cn as SqlConnection... | 38,345 |
<p>Is it possible to change the scrollbar color in emacs? (Note: Not XEmacs)</p>
<p>If it matters, I'm running emacs 22 on Ubuntu 8.10.</p>
| <p>In what environment? In, eg, Carbon EMACS, the scrollbar widgets come from the carbon native set; if so, you can't really change the color.</p>
| <p>Shamelessly taken from <a href="http://www.xemacs.neoscientists.org/Documentation/21.5/html/xemacs-faq_5.html" rel="nofollow noreferrer">the FAQ for XEmacs</a></p>
<p>Here's a recap of how to use resources to change your scrollbar colors: </p>
<pre><code>! Motif scrollbars
Emacs*XmScrollBar.Background: skyblu... | 45,696 |
<p>In order for my application (.Net 1.1) to use the system configured proxy server (trough a proxy.pac script) I was using an interop calls to WinHTTP function WinHttpGetProxyForUrl, passing the proxy.pac url I got from the registry.</p>
<p>Unfortunately, I hit a deployment scenario, where this does not work, as the ... | <p>Just a thought: Why not create a micro web server that can serve the local PAC file over a localhost socket. You should use a random URI for the content so that it is difficult to browse this in unexpected ways.</p>
<p>You could then pass a URL like <a href="http://localhost:1234/gfdjklskjgfsdjgklsdfklgfsjkl" rel="... | <p>Can't answer your problem unfortunately (though a few years ago I played with jscript.net and it would only be a few lines to build and run that way)</p>
<p>I hit a similar proxy.pac hiccup with a personal work-around-the-office-proxy file a while back - in the end I went with the easiest option and dropped it into... | 8,959 |
<p>Is is possible to have a local variable in an anonymous c# methods, i.e. in the following code I would like to perform the count only once.</p>
<pre><code>IQueryable<Enquiry> linq = db.Enquiries;
if(...) linq = linq.Where(...);
if(...) linq = linq.Where(e =>
(x <= (from p in db.Orders where p.Enq... | <p>Yes, why not?! After all it's a function, just anonymous!</p>
<p>Example:</p>
<pre><code> x => { int y = x + 1; return x + y; }
</code></pre>
<p>Or alternatively:</p>
<pre><code> delegate(int x) {
int y = x + 1;
return x + y;
}
</code></pre>
<p>So your code can be written as:</p>
<pre><code> ...... | <p>With a little background in Scheme you would know that 'let' is just syntax sugar for defining a lambda and invoking it.</p>
<p>So with that knowledge, lets see how it can be done.</p>
<pre><code>(count => x <= count && count <= y)
((from p in db.Orders
where p.EnquiryId == e.Id
select... | 48,236 |
<p>I've seen a few mentions of this on Stack Overflow, but staring at Wikipedia (the relevant page has since been deleted) and at an <a href="http://sourceforge.net/projects/dyndlgdemo/" rel="noreferrer">MFC dynamic dialog demo</a> did nothing to enlighten me. Can someone please explain this? Learning a fundamentally d... | <p>Gee, Brian, I wish I had seen your question sooner. Since it's pretty much my
"invention" (for better or worse), I might be able to help.</p>
<blockquote>
<p>Inserted: The shortest possible
explanation I can make is that if
normal execution is like throwing a
ball in the air and catching it, then
differen... | <p>I find this concept very similar to the state machines of classic digital electronics. Specially the ones which remember their previous output.</p>
<p>A machine whose next output depends on current input and previous output according to (YOUR CODE HERE). This current input is nothing but previous output + (USER, IN... | 48,610 |
<p>What language or method would I use to listen to the event when a removeable drive is plugged into the PC?</p>
| <p>I guess any language that can work with the Windows API should do. Basically, you listen to the windows message WM_DEVICECHANGE. This alone will let you listen to system-wide messages.</p>
<p>For more specific scenarios look at the API function RegisterDeviceNotification(). Needless to day, C/C++ would be straightf... | <p>Is your program going to be running as a windows service and waiting?
or is putting a startup script on the removable drive an option in this case?</p>
| 19,495 |
<p>I want to swap two integers, and I want to know which of these two implementations will be faster:
The obvious way with a temp variable:</p>
<pre><code>void swap(int* a, int* b)
{
int temp = *a;
*a = *b;
*b = temp;
}
</code></pre>
<p>Or the xor version that I'm sure most people have seen:</p>
<pre><co... | <p>The XOR method fails if a and b point to the same address. The first XOR will clear all of the bits at the memory address pointed to by both variables, so once the function returns (*a == *b == 0), regardless of the initial value.</p>
<p>More info on the Wiki page:
<a href="http://en.wikipedia.org/wiki/XOR_swap_al... | <p>I just placed both swaps (as macros) in hand written quicksort I've been playing with. The XOR version was much faster (0.1sec) then the one with the temporary variable (0.6sec). The XOR did however corrupt the data in the array (probably the same address thing Ant mentioned).<p>
As it was a fat pivot quicksort, the... | 5,752 |
<p>Hello all you helpful folks @ stackoverflow!</p>
<p>Best resources for Java GUI's?</p>
<p>Looking at the Java Documentation, it is pretty easy to figure out the basics of JButtons, JFrames, etc but grasping the concepts of accessing JComponents from a frame, what creating a different panel does, etc is not very ea... | <p>Hmm... Have you seen the <a href="http://java.sun.com/docs/books/tutorial/uiswing/index.html" rel="nofollow noreferrer">The Swing tutorial</a>?</p>
| <p><a href="http://www.java2s.com/" rel="nofollow noreferrer">java2s.com</a> has good coverage of the <a href="http://www.java2s.com/Tutorial/Java/0240__Swing/Catalog0240__Swing.htm" rel="nofollow noreferrer">Swing library</a>, including sample code for common tasks.</p>
| 47,827 |
<p>I have been looking at XML and HTML libraries on rubyforge for a simple way to pull data out of a web page. For example if I want to parse a user page on stackoverflow how can I get the data into a usable format?</p>
<p>Say I want to parse my own user page for my current reputation score and badge listing. I trie... | <p>Unfortunately stackoverflow is claiming to be XML but actually isn't. <a href="http://hpricot.com/" rel="nofollow noreferrer">Hpricot</a> however can parse this tag soup into a tree of elements for you.</p>
<pre><code>require 'hpricot'
require 'open-uri'
doc = Hpricot(open("http://stackoverflow.com/users/19990/ar... | <p>I always really like what Ilya Grigorik writes, and he <a href="http://www.igvita.com/2007/02/04/ruby-screen-scraper-in-60-seconds/" rel="nofollow noreferrer">wrote up a nice post</a> about using hpricot.</p>
<p>I also <a href="http://www.rubyrailways.com/data-extraction-for-web-20-screen-scraping-in-rubyrails" rel... | 16,641 |
<p>Does it make sense, having all of the C#-managed-bliss, to go back to Petzold's Programming Windows and try to produce code w/ pure WinAPI?</p>
<p>What can be learn from it? Isn't it just too outdated to be useful?</p>
| <p>This question is bordering on religious :) But I'll give my thoughts anyway.</p>
<p>I do see value in learing the Win32 API. Most, if not all, GUI libraries (managed or unmanaged) result in calls to the Win32 API. Even the most thorough libraries don't cover 100% of the API, and hence there are always gaps which ne... | <p>If you planning to develop a cross platform application, If you use win32, then your application could easily run on linux through WINE. This results in a highly maintainable application. This is one of the advantages of learning win32.</p>
| 2,740 |
<p>We've recently updated to Oracle 11g and our DBA has suggested using result caching to improve the performance of some of our queries. A quick search of Google shows there is some <a href="http://www.pythian.com/blogs/1004/oracle-11g-result-cache-in-the-real-world" rel="nofollow noreferrer">criticism</a> of the fea... | <p>I would be very wary of anything that tried to have the database cache all query results-- that is very likely going to cause lots of extra work maintaining the result cache for 90% of queries that aren't going to benefit. Oracle's cache invalidation algorithm is pretty basic and designed to ensure that stale resul... | <p>Our first (and very preliminary) test shows considerable promise. Since a cache hit on the query we are testing avoids a full table scan (~3.5 million rows), even a few hits will easily make caching worthwhile.</p>
<p>So far we are just doing one query, which seems fairly safe. I'd like to set the database to cac... | 47,535 |
<p>I would like to use <code>ON DUPLICATE KEY UPDATE</code> in Zend Framework 1.5, is this possible?</p>
<p>Example</p>
<pre><code>INSERT INTO sometable (...)
VALUES (...)
ON DUPLICATE KEY UPDATE ...
</code></pre>
| <p>I worked for Zend and specifically worked on Zend_Db quite a bit.</p>
<p>No, there is no API support for the <code>ON DUPLICATE KEY UPDATE</code> syntax. For this case, you must simply use <code>query()</code> and form the complete SQL statement yourself.</p>
<p>I do not recommend interpolating values into the SQ... | <p>you can simply do something like this:</p>
<p>set unique index on your id</p>
<p>and then</p>
<pre><code>try {
do insert here
} catch (Exception $e) {
do update here
}
</code></pre>
| 38,855 |
<p>I have a base class that represents a database test in TestNG, and I want to specify that all classes extending from this class are of a group "db-test", however I have found that this doesn't seem possible. I have tried the @Test annotation:</p>
<pre><code>@Test(groups = { "db-test" })
public class DBTestBase {
}... | <p>The answer is through a custom <strong>org.testng.IMethodSelector</strong>:</p>
<p>Its <strong>includeMethod()</strong> can exclude any method we want, like a public not-annotated method.</p>
<p>However, to register a custom <em>Java</em> MethodSelector, you must add it to the <strong>XMLTest</strong> instance man... | <p>You can specify the @Test annotation at method level that allows for maximum flexibility.</p>
<pre><code>public class DBTestBase {
@BeforeTest(groups = "db-test")
public void beforeTest() {
System.out.println("Running before test");
}
public void method1() {
Assert.fail(); // this ... | 3,053 |
<p>I'm using a regex that <a href="http://regexlib.com/REDetails.aspx?regexp_id=646" rel="nofollow noreferrer">strips the href tags out of an html doc</a> saved to a string. The following code is how I'm using it in my C# console app.</p>
<pre><code>Match m = Regex.Match(htmlSourceString, "href=[\\\"\\\'](http:\\/\\/|... | <p><strong>Match</strong> method searches for the first occurence of the string, <strong>Matches</strong> method searches for all occurences.</p>
| <p>If you use Match instead of Match<strong>es</strong> you need to use a loop to get all the matches calling m.NextMatch() at the end of each loop. For example:</p>
<pre><code> Match m = Regex.Match(htmlSourceString, "href=[\\\"\\\'](http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&... | 39,981 |
<p>I am trying to lay out a table-like page with two columns. I want the rightmost column to dock to the right of the page, and this column should have a distinct background color. The content in the right side is almost always going to be smaller than that on the left. I would like the div on the right to always be... | <p>Ahem...</p>
<blockquote>
<p>The short answer to your question is that you must set the height of 100% to the body and html tag, then set the height to 100% on each div element you want to make 100% the height of the page.</p>
</blockquote>
<p>Actually, 100% height will not work in most design situations - this m... | <p>Just trying to help out here so the code is more readable.<br>
Remember that you can insert code snippets by clicking on the button at the top with "101010". Just enter your code then highlight it and click the button.</p>
<p>Here is an example:</p>
<pre><code><html>
<body>
<style type="text... | 2,696 |
<p>I was recently working on an application that sent and received messages over Ethernet and Serial. I was then tasked to <strong>add</strong> the monitoring of DIO discretes. I throught, </p>
<blockquote>
<p>"No reason to interrupt the main
thread which is involved in message
processing, I'll just create
... | <ol>
<li>On a single processor machine and a desktop application, you use multi threads so you don't freeze the app but for nothing else really.</li>
<li>On a single processor server and a web based app, no need for multi threading because the web server handles most of it.</li>
<li>On a multi-processor machine and des... | <p>Are the processes parallel? Is performance a real concern? Are there multiple 'threads' of execution like on a web server? I don't think there is a finite answer.</p>
| 11,946 |
<p>Several questions about functional programming languages have got me thinking about whether XSLT is a functional programming language. If not, what features are missing? Has XSLT 2.0 shortened or closed the gap?</p>
| <p>XSLT is declarative as opposed to stateful. </p>
<p>Although XSLT is based on functional programming ideas, it is not a full functional programming language, it lacks the ability to treat functions as a first class data type. It has elements like lazy evaluation to reduce unneeded evaluation and also the absence o... | <p>That is not really an argument, since you can only declare variables, not change their values after declaration. In that sense it is declarative not imperative style, as stated in Mr Novatchev's article.</p>
<p>Functional programming languages like Scheme or Erlang enable you to declare variables as well, and in Ha... | 13,528 |
<p>I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in <a href="http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/" rel="noreferrer">http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/</a></p>
<p><strong>All works fi... | <p>I worked around this by having my view user control inherit from this class instead of <code>ViewUserControl<T></code> (it's kind of a patch for RenderView). It did the trick for me, hopefully it works for you too.</p>
<pre><code>public class ViewUserControlWithoutViewState<T> : ViewUserControl<T>... | <p>Are you using safari as a browser? if so then this will probably be a problem with a large float. Remove that float and things will work fine. </p>
| 28,472 |
<p>What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to setup dynamic Dynamic DNS solution.</... | <p>I'm also running Ubuntu 8.04.1, and if I type</p>
<pre><code>$ scp me@myserver.mydomain.com:.bashr<TAB>
</code></pre>
<p>I do indeed get tab completion (i.e. bash is sshing to my server and getting completion results from the filesystem there). Then</p>
<pre><code>$ scp me@myserver.mydomain.com:.bashrc .
<... | <p>I don't know.</p>
<p>I'd $ scp host:file locallocation</p>
| 18,977 |
<p>How do you split a string into tokens in C++?</p>
| <p>this works nicely for me :), it puts the results in <code>elems</code>. <code>delim</code> can be any <code>char</code>.</p>
<pre><code>std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s);
std::string item;
... | <p>It depends on how complex the token delimiter is and if there are more than one. For easy problems, just use std::istringstream and std::getline. For more complex tasks or if you want to iterate the tokens in an STL-compliant way, use Boost's Tokenizer. Another possibility (although messier than either of these t... | 34,707 |
<p>Hi sometimes i encoutner this error after restarsting sun application server 8.2 domain anyone have any idea what could be the reason?</p>
<blockquote>
<p>javax.servlet.ServletException at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:255) at
javax.servlet.http.HttpServlet.service(HttpServle... | <p><a href="http://en.wikipedia.org/wiki/Infinite_recursion#Infinite_recursion" rel="nofollow noreferrer">Infinite recursion.</a></p>
<p>This is evident by your long, repeating backtrace. The fact that you receive a <a href="http://en.wikipedia.org/wiki/Stack_buffer_overflow" rel="nofollow noreferrer">stack overflow<... | <p><a href="http://en.wikipedia.org/wiki/Infinite_recursion#Infinite_recursion" rel="nofollow noreferrer">Infinite recursion.</a></p>
<p>This is evident by your long, repeating backtrace. The fact that you receive a <a href="http://en.wikipedia.org/wiki/Stack_buffer_overflow" rel="nofollow noreferrer">stack overflow<... | 42,091 |
<p>What is your favorite Visual Studio keyboard shortcut? I'm always up for leaving my hands on the keyboard and away from the mouse! <br /></p>
<p><strong>One</strong> per answer please.</p>
| <p><kbd>Ctrl</kbd> + <kbd>-</kbd> and the opposite <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>-</kbd>.</p>
<p>Move cursor back (or forwards) to the last place it was. No more scrolling back or <kbd>PgUp</kbd>/<kbd>PgDown</kbd> to find out where you were.</p>
<p>This switches open windows in Visual Studio:</p>
<p><kbd... | <p><kbd>Ctrl</kbd>+<kbd>-</kbd> and <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>-</kbd>. But if you are a keyboard lover then go for Resharper</p>
| 12,393 |
<p>I'm trying to embed my Subversion revision number in a C++ project and am having problems setting up GNU make to do so. My makefile currently looks something like this:</p>
<pre><code>check-svnversion:
../shared/update-svnversion-h.pl
../shared/svnversion.h: check-svnversion
shared/svnversion.o: ../shared/svnv... | <p>This seems similar to what <a href="http://en.wikipedia.org/wiki/autotools" rel="nofollow noreferrer">autotools</a> does for its config.h header.</p>
<p>A quick look at automake's <code>remake-hdr.am</code> shows how it does the trick:</p>
<pre><code>%CONFIG_H%: %STAMP%
## Recover from removal of CONFIG_HEADER
... | <p>You can use Subversion's keyword substitution to put the version number into your code.</p>
<p>It's detailed [in the book], but in short you will have to set the <code>svn:keywords</code> property for the file to include <code>Rev</code> and then put <code>$Rev$</code> somewhere in your code. SVN will automatically... | 43,025 |
<p>What is the purpose of this software?</p>
<p><a href="http://www.httpwatch.com/" rel="nofollow noreferrer"><strong>http://www.httpwatch.com/</strong></a></p>
| <p>It helps you analyze/debug/monitor the HTTP comunication between server and browser. It runs on the browser and tracks all HTTP traffic.</p>
<p>A small part of this task is also done by the firefox plugin <a href="https://addons.mozilla.org/de/firefox/addon/3829" rel="nofollow noreferrer">Live HTTP Headers</a></p>
| <p>It helps you analyze/debug/monitor the HTTP comunication between server and browser. It runs on the browser and tracks all HTTP traffic.</p>
<p>A small part of this task is also done by the firefox plugin <a href="https://addons.mozilla.org/de/firefox/addon/3829" rel="nofollow noreferrer">Live HTTP Headers</a></p>
| 32,586 |
<p>I have a form which is used to <em>insert/display</em> and <em>update</em>. In the edit mode (<em>update</em>), when I pass my <code>BO</code> back to the Controller, what is the best possible way to check if any of the property values were changed, in order to execute the update to the datastore? </p>
<pre><code>t... | <p>A good way is to have an IsDirty flag on the object and have all the setable properties update that flag if they are changed. Have the flag initialized to false when the object is loaded. </p>
<p>An example property would look like this:</p>
<pre><code>public string Name {
get { return _name; }
set {
... | <p>I am no expert but I would use boolean flag property on the object to indicate it is dirty. I was beat to the answer lol.</p>
| 33,834 |
<p>We've got a scenario that requires us to parse lots of e-mail (plain text), each e-mail 'type' is the result of a script being run against various platforms. Some are tab delimited, some are space delimited, some we simply don't know yet.</p>
<p>We'll need to support more 'formats' in the future too.</p>
<p>Do we ... | <p>Regex.</p>
<p>Regex can solve almost everything except for world peace. Well maybe world peace too.</p>
| <p>With as little information you provided, i would choose Regex.</p>
<p>But what kind of information you want to parse and what you would want to do will change the decision to Lex/Yacc maybe..</p>
<p>But it looks like you've already made your mind up with String search :)</p>
| 8,025 |
<p>I've written some custom model binders (implementing IModelBinder) in our ASP.NET MVC application. I'm wondering what is a good approach to unittest them (binders)?</p>
| <p>I did it this way: </p>
<pre><code>var formElements = new NameValueCollection() { {"FirstName","Bubba"}, {"MiddleName", ""}, {"LastName", "Gump"} };
var fakeController = GetControllerContext(formElements);
var valueProvider = new Mock<IValueProvider>();
var bindingContext = new ModelBindi... | <p>dict could be refactored like this</p>
<pre><code> FormCollection form = new FormCollection
{
{ "month1", "2" },
{ "day1", "12" },
{ "year1", "1964" },
... | 31,609 |
<p>This question is similar:</p>
<p><a href="https://3dprinting.stackexchange.com/questions/156/are-there-biocompatible-materials-available-to-the-general-public">Are there biocompatible materials available to the general public?</a></p>
<p>But appears to be for non-implantation use. This question is for materials in... | <p>Perhaps more than biocompatible, which generally refers to a material that does not illicit a harmful inflammatory response inside the body, you should be looking at bioresorbable materials, which are materials that dissolve inside the body after a certain time period without needing mechanical removal. </p>
<p>As ... | <p>Yes. I have worked with people who have printed implants of PCL, loaded with antibiotics, for delivery at the infection site: <a href="https://www.google.com/search?q=pcl+medical+approval" rel="nofollow noreferrer">https://www.google.com/search?q=pcl+medical+approval</a></p>
<p>Also look at PPSU: <a href="https://w... | 842 |
<p>Here's a simple (hopefully) L10N question:</p>
<p>Do all locales want this format: </p>
<p><em>Sunday, Nov 23, 2008</em></p>
<p>with the weekday before the date, or do some locales want it after the date like this?</p>
<p><em>Nov 23, 2008, Sunday</em></p>
| <p>Don't assume that.</p>
<p>I can customize my setting in XP to :
<strong>T. MMMM JJJJ,TTTTT</strong> , which is:
<strong>24. November 2008,Montag</strong> </p>
<p>Yes. This is not per default, but I can set this in my regional settings!</p>
| <p>No. For example, the Japanese use the order year-month-day-weekday.</p>
| 40,641 |
<pre><code>System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) at
System.Drawing.Image.Save(String filename, ImageFormat format) at
System.Drawing.Image.Save(String filename) at
Content... | <p>There's no release of VB (or C#) that is hostable via the DLR hosting APIs. In general the DLR hosting APIs, and the possibility of getting more MS created languages to support them, are tenatively thought to be post-Dev10. So it won't happen anytime in the short term.</p>
| <p>Officially, there's no supported dynamic languages until VS10 is released. At that time, VBx, which apparently will be built on top of the DLR, will be released, probably alongside version 2.0 of the DLR. (Version 1.0's release is immanent.)</p>
<p>You might find some useful stuff in the VS10 CTP, but keep in mind ... | 38,090 |
<p>I have an Enum called Status defined as such:</p>
<pre><code>public enum Status {
VALID("valid"), OLD("old");
private final String val;
Status(String val) {
this.val = val;
}
public String getStatus() {
return val;
}
}
</code></pre>
<p>I would like to access the value ... | <p>A simple comparison against string works:</p>
<pre class="lang-xml prettyprint-override"><code><c:when test="${someModel.status == 'OLD'}">
</code></pre>
| <p>I generally consider it bad practice to mix java code into jsps/tag files. Using 'eq' should do the trick :</p>
<pre><code><c:if test="${dp.Status eq 'OLD'}">
...
</c:if>
</code></pre>
| 15,035 |
<p>What are the actual performance differences between Int64 and Int32 on 32 and 64 bit MS Windows?</p>
<p>It would also be great to see some actual timings of Int64 vs Int32 on each of the two operating system variants. XP or Vista would also be interesting.</p>
<ul>
<li>See also this question about <a href="https:... | <p>As far as hardware, Int64 will be more efficient on an x64 and IA64 than x86 because the 64-Bit processors have 64-Bit registers to perform the operations on them. </p>
<p>Int32 will be equally as efficient on all x86, x64, and IA64. </p>
<p>On an x64 and on an IA64 both Int32 and Int64 are equally as efficient.</... | <p>From the hardware point of view, ie if the OS takes full advantage of the architechture, the Int64 will be more efficient on a 64 bit system.</p>
<p>Int32 may be slightly more efficient on a 32 bit system, since the 64 bit system may have to emulate the 32 bit operation.</p>
| 35,637 |
<p>I need a timer tick with 1ms resolution under linux. It is used to increment a timer value that in turn is used to see if various Events should be triggered. The POSIX timerfd_create is not an option because of the glibc requirement. I tried timer_create and timer_settimer, but the best I get from them is a 10ms res... | <p>Polling in the main loop isn't an answer either - your process might not get much CPU time, so more than 10ms will elapse before your code gets to run, rendering it moot.</p>
<p>10ms is about the standard timer resolution for most non-<a href="http://en.wikipedia.org/wiki/Real-time_operating_system" rel="noreferrer... | <p>Can you at least use nanosleep in your loop to sleep for 1ms? Or is that a glibc thing?</p>
<p><strong>Update:</strong> Never mind, I see from the man page "it can take up to 10 ms longer than specified until the process becomes runnable again"</p>
| 29,714 |
<p>I've had an Ender 5 Plus for a few weeks now. It's printing great and I've got my tuning pretty good at the moment. I've noticed some horizontal inconsistencies matching feature/geometry changes. It seems to be associated with maybe layer time(?) I only have a picture from two models, but the problem will appear in ... | <p>This is varying underextrusion due to loss of material to oozing in the interior of the model.</p>
<p>When printing the infill pattern, the nozzle doesn't follow a single continuous extrusion path, but moves from the end of one path to the beginning of the next, and under Cura defaults, <em>does this without retract... | <p>If this matches the horizontal planes - like "solid floor" than I would advice to check overlap settings. My suspicion is slight overextrusion, which might be the reason of many small horizontal differences. Using 3 mm filament I often suffer of similar inconsistencies, until I find proper flowrate to avoi... | 1,834 |
<p>does anyone have a clue why the TortoiseSVN windows client (in Win32 XP and Vista)
is so incredible slow when used with Putty and PAM? It seems it connects for each request
since datatransfers (checkout) are not slow at all?</p>
<p>Any ideas how to change it?</p>
<p>Update: I had no problems with SSH before. But I... | <p>Do you have a problem with standard SSH connections to the server as well? If it's generally slow to connect to your server via SSH, this could be a problem with reverse DNS lookups.</p>
<p>Andrew</p>
| <p>What type of system are you connecting to? If you connect to OpenSUSE, for example, default DNS Reverse Lookup settings generally cause SSH connections to be very slow. If you can, put your client side IP address into the /etc/hosts table on the server. If Reverse DNS is your issue, this will resolve (remember to... | 3,551 |
<p>I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.</p>
<p>The mail created by the mailto action has the syntax:</p>
<... | <p>What we used in a projet is a popup window that opens a mailto: link, it is the only way we found to compose a mail within the default mail client that works with all mail clients (at least all our clients used).</p>
<pre><code>var addresses = "";//between the speech mark goes the receptient. Seperate addresses wit... | <p>Is there a reason you can't just send the data to a page which handles sending the mail? It is pretty easy to send an email in most languages, so unless there's a strong reason to push it to client side, I would recommend that route.</p>
| 2,914 |
<p>I have developed some classes with similar behavior, they all implement the same interface. I implemented a factory that creates the appropriate object and returns the interface. I am writing a unit test for the factory. All you get back is an interface to the object.
What is the best way to test that the factory... | <p>Since I don't know how your factory method looks like, all I can advise right now is to </p>
<ol>
<li><p>Check to see the object is the correct concrete implementation you were looking for:</p>
<pre><code>IMyInterface fromFactory = factory.create(...);
Assert.assertTrue(fromFactory instanceof MyInterfaceImpl1);
... | <pre><code>if (myNewObject instanceof CorrectClass)
{
/* pass test */
}
</code></pre>
<p><strong>update:</strong></p>
<p>Don't know why this got marked down, so I'll expand it a bit...</p>
<pre><code>public void doTest()
{
MyInterface inst = MyFactory.createAppropriateObject();
if (! inst instanceof Expe... | 5,796 |
<p>I have a Printrbot Simple Metal. The extruder is getting clogged all the time. I went through the process demonstrated <a href="https://www.youtube.com/watch?v=L_qP5AsnQNQ" rel="noreferrer">here</a> multiple times already. Heatting the extruder and pushing different tools all the way through to make sure it is compl... | <p>I'm not sure if this is particularly the issue for you right now, but I have encountered the tension on my drive gear being too high.</p>
<p>Before I upgraded my extruder to the spring loaded mechanism, my extruder used a Delrin plunger to provide tension against the filament towards the drive gear. This plunger us... | <p>I'm not sure if this is particularly the issue for you right now, but I have encountered the tension on my drive gear being too high.</p>
<p>Before I upgraded my extruder to the spring loaded mechanism, my extruder used a Delrin plunger to provide tension against the filament towards the drive gear. This plunger us... | 197 |
<p>just wondering what it is.</p>
<p>Edit: I know it's not a type of array but just a feature. So what does it mean by one-element-too-large ?</p>
| <p>Misunderstanding of language specific indexing conventions?</p>
| <p>Intent to use a "end of data" marker?</p>
| 14,896 |
<p>I wish to convert a single string with multiple delimiters into a key=>value hash structure. Is there a simple way to accomplish this? My current implementation is:</p>
<pre><code>sub readConfigFile() {
my %CONFIG;
my $index = 0;
open(CON_FILE, "config");
my @lines = <CON_FILE>;
close(CON_... | <p>What is your configuration data structure supposed to look like? So far the solutions only record the last line because they are stomping on the same hash keys every time they add a record. </p>
<p>Here's something that might get you closer, but you still need to figure out what the data structure should be.</p>
<... | <p>Here's one way. </p>
<pre>
foreach ( @lines ) {
chomp;
my %CONFIG;
# Extract the last digit first and replace it with an end of
# pair delimiter.
s/\s*([\d\.]+)\s*$/>/;
$CONFIG{ip} = $1;
while ( /([^=]*)=([^>]*)>/g ) {
$CONFIG{$1} = $2;
}
print Dumper ( \%CONFIG );
}
</pre>
| 34,659 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.