instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is there any performance comparison of System.IO.File.ReadAllxxx / WriteAllxxx methods vs StreamReader / StremWriter classes available on web. What you think is the best way(from a performance perspective) to read/write text files in .net 3.0?</p>
<p>When I checked the <strong><a href="http://msdn.microsoft.com/en-... | <p>You probably don't want to use File.ReadAllxxx / WriteAllxxx if you have any intention to support loading / saving of really large files.</p>
<p>In other words, for an editor which you intend to remain usable when editing <strong>gigabyte</strong> size files, you want some design with StreamReader/StreamWriter and ... | <p>@Fredrik Kalseth is right. File.ReadXXX methods are just convenient wrappers around StreamReader class.</p>
<p>For example here is an implementation of <a href="http://msdn.microsoft.com/en-us/library/system.io.file.readalltext.aspx" rel="nofollow noreferrer">File.ReadAllText</a></p>
<pre><code>public static strin... | 20,105 |
<p>I have a GridView that has columns such as:</p>
<pre><code>| A | B C | D E / F |
</code></pre>
<p>I want these to be wrapped in a particular way - that is, I do not want to leave it up to the browser to work out whether to wrap or not depending on the column width. So in the above example I may wa... | <p>You can do it without templates. Just set HtmlEncode="False" on the headers with <code><br /></code> tags in them.</p>
<p>Example:</p>
<pre><code><asp:GridView ID="GridView1" runat="server" DataSourceID="Data">
<Columns>
<asp:BoundField HeaderText="First Line<br />Second Line" DataF... | <p>If you use a template field, you can have fine grain control the header content in the header template:</p>
<pre><code><asp:templatefield>
<headertemplate>
D<br />
E / F
</headertemplate>
<itemtemplate>
<%#Eval("MyField")%>
</itemtemplate>... | 45,822 |
<p>What's your experience with <a href="http://www.doctrine-project.org/" rel="noreferrer">doctrine</a>?
I've never been much of an ORM kind of guy, I mostlymanaged with just some basic db abstraction layer like adodb. </p>
<p>But I understood all the concepts and benifits of it. So when a project came along that need... | <p>I have mixed feelings. I am a master at SQL only because it is so easy to verify. You can test SELECT statements quickly until you get the results right. And to refactor is a snap.</p>
<p>In Doctorine, or any ORM, there are so many layers of abstraction it almost seems OCD (obsessive/compulsive). In my latest p... | <p>For now I'm using Symfony framework with Doctrine ORM,
how about using Doctrine together with plain queries?
For e.g. from knpuniversity, I can create custom repository method like:</p>
<pre><code> public function countNumberPrintedForCategory(Category $category)
{
$conn = $this->getEntityManage... | 33,567 |
<p>Python's access to environment variables does not accurately reflect the operating system's view of the processes environment.</p>
<p>os.getenv and os.environ do not function as expected in particular cases.</p>
<p>Is there a way to properly get the running process' environment?</p>
<hr>
<p>To demonstrate what I... | <p>That's a very good question.</p>
<p>It turns out that the <code>os</code> module initializes <code>os.environ</code> to the value of <a href="http://docs.python.org/library/posix.html" rel="noreferrer"><code>posix</code></a><code>.environ</code>, which is set on interpreter start up. In other words, the standard li... | <p>Looking at the Python source code (2.4.5):</p>
<ul>
<li><p>Modules/posixmodule.c gets the environ in convertenviron() which gets run at startup (see INITFUNC) and stores the environment in a platform-specific module (nt, os2, or posix)</p></li>
<li><p>Lib/os.py looks at sys.builtin_module_names, and imports all sym... | 29,146 |
<p>Using Maven 2, is there a way I can list out the jar dependencies as just the file names?</p>
<pre><code>mvn dependency:build-classpath
</code></pre>
<p>can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (o... | <p>This command will generate the dependencies tree of your maven project: </p>
<pre><code>$ mvn dependency:tree
</code></pre>
<p>I am sure that you will like the result :-)</p>
| <p>To add a notch to the existing answers, the current maven-dependency-plugin allows saving the classpath to a property with the <a href="http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html#outputProperty" rel="nofollow"><code>outputProperty</code></a> parameter.</p>
| 35,180 |
<p>While cruising through my white book the other day, I noticed in the list of C keywords.
<strong>entry</strong> is one of the keywords on that list.</p>
<p>It is reserved for future use. Thinking back to my Fortran days, there was a function of some sort that used an <strong>entry</strong> statement to make a seco... | <p>I had no idea, so I googled to find something about this. This is what I found.</p>
<p>First, it was included as a reserved keyword.</p>
<blockquote>
<p><strong>Q</strong>: What was the entry keyword mentioned in K&R1?<br>
<strong>A</strong>: It was reserved to allow functions with multiple, differently-na... | <p>To complement the accepted answer 'entry' is mentioned in K&R1:</p>
<blockquote>
<p><strong>2.3 Keywords</strong></p>
<p>The following identifiers are reserved for use as keywords, and may not be used otherwise</p>
<p>int extern else</p>
<p>char register for</p>
<p>float typedef do</p>
... | 31,735 |
<p>I haven't found an answer to this particular question; perhaps there isn't one. But I've been wondering for a while about it.</p>
<p>What exactly causes a binary file to display as "gibberish" when you look at it in a text editor? It's the same thing with encrypted files. Are the binary values of the file trying to... | <ul>
<li><strong><em>Are the binary values of the file trying to be converted into ASCII?</em></strong></li>
</ul>
<p>Yes, that's exactly what's happening. Typically, the binary values of the file also include ASCII control characters that aren't printable, resulting in even more bizarre display in a typical text edit... | <p>Yes, Wordpad and Notepad and many other text editors assume that any file you open with it is a text file and will try to display the ASCII characters represented by the bytes in the file.</p>
<p><a href="http://en.wikipedia.org/wiki/Hex_editor" rel="nofollow noreferrer">Hex Editors</a> are made to view and edit bi... | 26,560 |
<p>I am developing a java web app using servlet, in order to prevent user from hitting the back button to see previous users' info, I have the following code :</p>
<pre><code> protected void processRequest(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
{ ... | <p>How will hitting the back button cause the user to see <em>another</em> user's data? What is your use case? Is it designed for a public terminal, where each user submits data and then leaves? In this case, associate each input with a unique session id. Keep track of valid session ids in your server. Once the input i... | <p>I had a similar problem in .Net. I added the following javascript to my logout page:</p>
<p>document.execCommand("ClearAuthenticationCache","false");</p>
<p>now if you press the back button you need to authenticate again.</p>
| 31,587 |
<p>There are plenty of "heavyweight" tools such as XmlSpy, which are good for prodding around in xml docs - but often (very often in some cases!) you just want to quickly open and browse an xml doc, and have it pretty printed. Possibly with some basic search functionality (textual is probably fine).</p>
<p>I usually u... | <p>firstobject's 605k download lightweight native Windows <a href="http://www.firstobject.com/dn_editor.htm" rel="noreferrer">free XML editor</a> opens a 50MB file in 1.3 seconds and provides text editing, search, syntax-colored printing, plus tree view and additional XML features including formatting and full-blown CM... | <p>I like <a href="http://www.microsoft.com/downloads/details.aspx?familyid=72d6aa49-787d-4118-ba5f-4f30fe913628&displaylang=en" rel="nofollow noreferrer">Microsoft's XML Notepad 2007</a>, but I don't know how it handles very large files, sorry.</p>
| 39,768 |
<p>Problem: Z-Axis doesn't work during a print. It attempts to work, maybe climbs on the Z-Axis, but screws back down. It whines, too. But, Z-Axis DOES work while not printing. It doesn't matter if the bed and nozzle heating or not, if it's not printing, it works as it should. I don't know what else I can do to t... | <p>I would check the gcode you're generating to make sure it's not full of "bad" z-commands.</p>
<p>Further, I'd take any gcode file you have and manually edit it, leaving in all the initializations, heatings, zeroing, etc., and then delete everything except some z-motion commands. Run that as a test case t... | <p>I had the same issue with an Ender 3.
The threaded rod was not lubricated enough. Adding some lithium grease, applying it evenly, and moving the Z-axis from top to bottom multiple times fixed the issue.
I had to recalibrate the Z-offset after that.</p>
| 967 |
<p>On Windows Mobile, I am displaying my output in HTML. This includes lots of user-generated strings. Occasionally there are situations where a really large string is part of the output that has no whitespaces or punctuation. </p>
<p>Unfortunately the Windows Mobile's HTML view (htmlview.dll, based on Pocket Internet... | <p>I would use a List if you need a dynamically sized array:</p>
<pre><code>List<string> ls = new List<string>();
ls.Add("Hello");
</code></pre>
| <pre><code>private static string[] GetMergedArray(string[] originalArray, string[] newArray)
{
int startIndexForNewArray = originalArray.Length;
Array.Resize<string>(ref originalArray, originalArray.Length + newArray.Length);
newArray.CopyTo(originalArray, startIndexForNewArray);
... | 31,014 |
<p>In C# when I am done entering the fields of a snippet, I can hit Enter to get to the next line. What is the equivalent Key in VB?</p>
<p>Edit: I prefer not to use the mouse.</p>
| <p>Wow... I sure hope they improve this soon.</p>
<p>Meanwhile, in case anyone cares, I created an additional replacement field ($Enter$) at the end of my custom snippet. This allows me to [tab] through the fields and then type [DownArrow] [Enter] when I reach the end of the list.</p>
<p>Something like....</p>
<pre>... | <p>At any point while you're editing a snippet, you can use the up/down arrow keys to get out of it. Or have I misunderstood what you're trying to do?</p>
| 14,992 |
<p>I have the following SQL-statement:</p>
<pre><code>SELECT DISTINCT name FROM log WHERE NOT name = '' AND name LIKE '%.EDIT%';
</code></pre>
<p>It works fine on Postgres (returns all different names from log, which aren't empty and contain the string '.EDIT'). But on Oracle this statement doesn't work. Any idea why... | <pre><code>SELECT DISTINCT name FROM log WHERE NOT name = '' AND name LIKE '%.EDIT%';
</code></pre>
<p>1) Oracle treats '' as NULL, which means the comparison "NOT name = ''" is never true or false; use "IS NOT NULL" instead. But...</p>
<p>2) The second condition "name LIKE '%.EDIT%' will not match an empty string a... | <p>The empty string in Oracle is equivalent to NULL, causing the comparison to fail.
Change that part of the query to NAME IS NOT NULL</p>
| 29,758 |
<p>I have read the very good blog post of Rob Conery <a href="http://blog.wekeroad.com/blog/crazy-talk-reducing-orm-friction/" rel="nofollow noreferrer">Crazy Talk: Reducing ORM Friction</a><br>
How can I generalize this interface so I can implement it with NHibernate?</p>
<pre><code>using System;
using System.Colle... | <p>Look at LINQ to NHibernate. Kyle Baley has a great <a href="http://codebetter.com/blogs/kyle.baley/archive/2008/04/07/trying-out-linq-for-nhibernate.aspx" rel="nofollow noreferrer">overview of it</a></p>
| <p>You'll need to walk the expression tree and build your Criteria.</p>
| 34,455 |
<p>I can do this:</p>
<pre><code>$ find .
.
./b
./b/foo
./c
./c/foo
</code></pre>
<p>And this:</p>
<pre><code>$ find . -type f -exec cat {} \;
This is in b.
This is in c.
</code></pre>
<p>But not this:</p>
<pre><code>$ find . -type f -exec cat > out.txt {} \;
</code></pre>
<p>Why not?</p>
| <p>find's -exec argument runs the command you specify once for each file it finds. Try:</p>
<pre><code>$ find . -type f -exec cat {} \; > out.txt
</code></pre>
<p>or:</p>
<pre><code>$ find . -type f | xargs cat > out.txt
</code></pre>
<p>xargs converts its standard input into command-line arguments for the co... | <p>Or just leave out the find which is useless if you use the really great Z shell (<code>zsh</code>), and you can do this:</p>
<pre><code>setopt extendedglob
</code></pre>
<p>(this should be in your <code>.zshrc</code>)
Then:</p>
<pre><code>cat **/*(.) > outfile
</code></pre>
<p>just works :-)</p>
| 20,352 |
<p>I want this page to return 200 whilst still sending the redirect...</p>
<pre><code><script>
sub page_load
'Get the parameters
dim content As String
content = request.querystring("text")
response.redirect ("http://100.200.100.10/test1/Default.aspx?CommandParm=" + content)... | <p>@eyelidlessness@</p>
<p>I agree it seems like a poor usability choice, but I'm hoping it's a workaround for a problem that can't be fixed directly.</p>
<p>Given that, try a <a href="http://en.wikipedia.org/wiki/Meta_refresh" rel="nofollow noreferrer">META refresh</a>, e.g.,</p>
<pre><code><meta http-equiv="ref... | <p>No way with <code>Response.Redirect()</code>. I... think. Maybe setting <code>Response.Status = "200 OK"</code> after calling <code>Redirect()</code> works, I've never tried.</p>
<p>You could fake it by setting the "Location" header manually in an otherwise empty response. Not sure what that is good for, though. ;-... | 29,997 |
<p>I can't tell if this is a result of the jQuery I'm using, but this is what I'm trying to do:</p>
<pre><code><div class="info" style="display: inline;"
onMouseOut="$(this).children('div').hide('normal');"
onMouseOver="$(this).children('div').show('normal');"
>
<... | <p><strong>edit</strong>: actually this is a much better solution (<a href="https://stackoverflow.com/questions/308411/#308720">credit</a>):</p>
<pre><code>$('.info').bind('mouseenter', function() {
$('div', this).show('normal');
});
$('.info').bind('mouseleave', function() {
$('div', this).hide('normal');
})... | <p>Did you follow this <strong><a href="http://www.kriesi.at/archives/create-simple-tooltips-with-css-and-jquery" rel="nofollow noreferrer">tutorial</a></strong> ?</p>
<p>Especially the mousemove part, where he constantly sets the positioning values left and top to align the tooltip next to the cursor. the X and Y coo... | 39,686 |
<p>I am trying to deserialize a stream but I always get this error "End of Stream encountered before parsing was completed"?</p>
<p>Here is the code:</p>
<pre><code> //Some code here
BinaryFormatter b = new BinaryFormatter();
return (myObject)b.Deserialize(s);//s---> is a Stream object that ... | <p>Try to set the position to 0 of your stream and do not use your object but the object type.</p>
<pre><code> BinaryFormatter b = new BinaryFormatter();
s.Position = 0;
return (YourObjectType)b.Deserialize(s);
</code></pre>
| <p>In my case I used:</p>
<pre><code>stream.Seek(0, SeekOrigin.Begin);
</code></pre>
<p>after i serialized the stream, and before i deserialized the stream works charm. hope this helps!</p>
| 39,442 |
<p>I have an XML document looking similar to this:</p>
<pre><code><items>
<item cat="1" owner="14">bla</item>
<item cat="1" owner="9">bla</item>
<item cat="1" owner="14">bla</item>
<item cat="2" owner="12">bla</item>
<item cat="2" owner="12">bla</item... | <p>Presuming the fragment is in itemsElement:</p>
<pre><code>var distinctOwners = (from item in itemsElement.Element("item")
where itemElements.Attribute("cat") == 1
select item.Attribute("owner")).Distinct();
</code></pre>
<p>Apologies for formatting and indentation!</p>
| <pre><code> XElement ele = XElement.Parse(@"<items><item cat=""1"" owner=""14"">bla</item><item cat=""1"" owner=""9"">bla</item>" +
@"<item cat=""1"" owner=""14"">bla</item><item cat=""2"" owner=""12"">bla</item>" +
... | 44,890 |
<p>In PHP, function parameters can be passed by reference by prepending an ampersand to the parameter in the function declaration, like so:</p>
<pre><code>function foo(&$bar)
{
// ...
}
</code></pre>
<p>Now, I am aware that this is <i>not</i> designed to improve performance, but to allow functions to change v... | <p>In a test with 100 000 iterations of calling a function with a string of 20 kB, the results are:</p>
<h3>Function that just reads / uses the parameter</h3>
<pre><code>pass by value: 0.12065005 seconds
pass by reference: 1.52171397 seconds
</code></pre>
<h3>Function to write / change the parameter</h3>
<pre... | <p>There is no need for adding & operator when passing objects. In PHP 5+ objects are passed by reference anyway.</p>
| 21,494 |
<p>My code is in c# asp.net 3.5</p>
<p>In the following code the "Msg" has many words with spaces and characters (eg:Failed to prepare Sync Favorites : Directory does not exist: \STL-FNP-02\ryounes$\Sync\Favorites). This "Msg" is pulled from database to a gridview. I am not able to create hyperlink for this "Msg" in g... | <p>The easiest way to get around it is to use something like </p>
<pre><code><asp:TemplateField HeaderText="Msg">
<asp:HyperLink runat="server" Text='<%# HttpUtility.UrlEncode(Eval("Msg")) %>' NavigateUrl='<%#Eval("Msg")%>' />
</asp:TemplateField>
</code></pre>
<p>Not 100% certain t... | <p>It doesn't create the link as it is not a valid URL, rather than using a hyperlink column most likely you are going to need to migrate to a template and manage it yourself, or at minimum do some formatting on it.</p>
<p>I would be cautious regardless of making that a hyperlink, where is it going to go anway?</p>
<... | 27,519 |
<p>I have an M3D Micro 3D printer that printed fine for a couple of weeks and then was plagued with issues afterward. I've done the fixes from the forum to get proper heating and cooling of the nozzle (I've added aluminum foil around the nozzle to make sure the hotend is fit snug against the nozzle and I've added an ex... | <p>I'm not sure how similar the two systems are, but I use a Stratasys uPrint SE Plus and I've run into a similar problem. </p>
<p>There are two rollers in the head that pull the filament through to the extruder nozzle, and in one instance they appeared to have heated up, melted the filament enough to create two "inde... | <p>Placing this suggestion as an answer, because all information appears to point to the slicer software and/or the operating system. Consider to use alternative methods of slicing and sending the model, such as the previously mentioned <a href="https://craftunique.com/craftware" rel="nofollow noreferrer">Craftware</a>... | 383 |
<p>I <em>sometimes</em> get the following exception for a custom control of mine:</p>
<p><code>XamlParseException occurred</code> <code>Unknown attribute Points in element SectionClickableArea [Line: 10 Position 16]</code></p>
<p>The stack trace:</p>
<pre><code>{System.Windows.Markup.XamlParseException: Unknown attr... | <p>I've also came across this issue. I do not have a good explanation for that (seems to be XAML parse bug), but I've fixed it by adding following code to XAML:</p>
<pre><code><UserControl.Resources>
<customNamespace:InheritedControl x:Name="dummyInstance"/>
</UserControl.Resources>
</code></pre>
| <p>I'm no XAML expert but are you missing a namespace on Points (e.g. l:Points)?</p>
| 28,359 |
<p>I need to make chocolate busts.</p>
<p>Is it better to make silicon reverse of the bust and cast the bust or directly print it using chocolate printer (I prefer cost and process speed over quality)? I don't have chocolate printer so if this method will be better I will need to use some 3D printing service.</p>
<p>I ... | <p>For your application, you should 3d print a positive model, then make a silicone mould negative of that model. Then use the silicone mould to make the final chocolate. Clean the silicone thoroughly before initial use. Fill gaps in the 3d printed model with a light epoxy resin. Use mould release and ensure you wash a... | <blockquote>
<p>I prefer ... process speed</p>
</blockquote>
<p>Printing is unlikely to win that battle. You might print a plastic mold once you can use for casts, but if you do make sure you use a liner of some kind. 3d-printed plastics are not considered food-safe.</p>
| 1,720 |
<p>I'm trying to learn CSS. I've taken great pains to get everything right. My pages all validate and they look correct on Firefox and mostly correct on Chrome. However IE is all over the place. In relation to Firefox, the following is wrong in IE (in order of importance):</p>
<ol>
<li>the main body box is pushed belo... | <p>You need to Reset your CSS (Dean, above recommends Eric Meyer's Reset CSS). I prefer <a href="http://developer.yahoo.com/yui/reset/" rel="nofollow noreferrer">Yui Reset CSS</a> (I actually like their own Reset / Fonts / Grids CSS). As part of doing this you also need to use Standards Mode. </p>
<p>Finally, you need... | <p>What version of IE are you running? Sounds like most of your issues may be caused by the <a href="http://www.google.com/search?q=IE+Box+Model" rel="nofollow noreferrer">IE Box Model</a> Bug. </p>
| 38,109 |
<p>Hey having some trouble trying to maintain transparency on a png when i create a thumbnail from it, anyone any experience with this? any help would be great, here's what i am currently doing:</p>
<pre><code>$fileName= "../js/ajaxupload/tees/".$fileName;
list($width, $height) = getimagesize($fileName);
$newwidth =... | <p>I have had success doing it like this in the past:</p>
<pre><code>$thumb = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($thumb, false);
imagesavealpha($thumb, true);
$source = imagecreatefrompng($fileName);
imagealphablending($source, true);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $ne... | <p>See <a href="https://stackoverflow.com/questions/279236/how-do-i-resize-pngs-with-transparency-in-php#279310">dycey's answer to "How do I resize..."</a>. Essentially, you need to fill the entire background with transparency before you do any other operations.</p>
| 40,354 |
<p>I currently capture MiniDumps of unhandled exceptions using <Code>SetUnhandledExceptionFilter</Code> however at times I am getting "R6025: pure virtual function".</p>
<p>I understand how a pure virtual function call happens I am just wondering if it is possible to capture them so I can create a MiniDump at that poi... | <p>If you want to catch all crashes you have to do more than just: SetUnhandledExceptionFilter</p>
<p>I would also set the abort handler, the purecall handler, unexpected, terminate, and invalid parameter handler.</p>
<pre><code>#include <signal.h>
inline void signal_handler(int)
{
terminator();
}
inline ... | <p>Try defining the offending pure virtual. There is nothing in the C++ rules that prohibit you from defining a pure virtual, and you can use this for a number of reasons, the least of which is getting a backtrace on the call. The only caviat is the definition must be outside the declaration (<code>virtual void bla() =... | 27,691 |
<p>Using SQL Server, how do I split a string so I can access item x?</p>
<p>Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"?</p>
| <p>You may find the solution in <em><a href="http://www.codeproject.com/KB/database/SQL_UDF_to_Parse_a_String.aspx" rel="noreferrer">SQL User Defined Function to Parse a Delimited String</a></em> helpful (from <a href="http://en.wikipedia.org/wiki/The_Code_Project" rel="noreferrer">The Code Project</a>).</p>
<p>You ca... | <p>Well, mine isn't all that simpler, but here is the code I use to split a comma-delimited input variable into individual values, and put it into a table variable. I'm sure you could modify this slightly to split based on a space and then to do a basic SELECT query against that table variable to get your results.</p>
... | 2,475 |
<p>As the title states, is there a way to prevent extra elements from showing up in VBA dynamic arrays when they are non-zero based? </p>
<p>For example, when using code similar to the following:</p>
<pre><code>While Cells(ndx, 1).Value <> vbNullString
ReDim Preserve data(1 To (UBound(data) + 1))
ndx = ... | <p><code>ReDim Preserve</code> is a relative expensive operation and probably not something to do on every iteration. Better to <code>ReDim</code> the array to an upper bounds larger than you need (perhaps in chunks) then reducing the array to the required upper bounds when you are done.</p>
<p>Also, you may want to i... | <p>Granted, its been a while since I've done classic VB6, and my VBA experience is even rustier... if memeory serves, the array syntax is different for VB in more than just the base being 1 instead of 0. The syntax also says that the "size" that you specify doesn't denote the total number of elements in the array, but... | 26,110 |
<p>Say I have an interface IFoo which I am mocking. There are 3 methods on this interface. I need to test that the system under test calls at least one of the three methods. I don't care how many times, or with what arguments it does call, but the case where it ignores all the methods and does not touch the IFoo mock i... | <p>You can give rhino mocks a lambda to run when a function get's called. This lambda can then increment a counter. Assert the counter > 1 and you're done.</p>
<p>Commented by Don Kirkby:
I believe Mendelt is referring to the Do method.</p>
| <p>Not sure this answers your question but I've found that if I need to do anything like that with Rhino (or any similiar framework/library), anything that I didn't know how to do upfront, then I'm better just creating a manual mock. </p>
<p>Creating a class that implements the interface and sets a public boolean fiel... | 7,721 |
<p>I've been researching PHP frameworks as of late for some personal projects, and it looks like most of them use a front controller to mimic a response. The controller gets the params from the request, and re-routes by sending the appropriate headers depending on the logic. This is the "response". Is this the best way... | <p>a front controller lends itself quite well to a web environment, allowing you to funnel all requests to your application. since HTTP is stateless, and a user can, in a sense, inadvertently stumble upon parts of your app by accident (ie, hitting random URL's), a front controller allows you to determine the entry poin... | <p>I think you are confusing an Http response with a response object in the frameworks you looked at. A front controller is the gateway for your application - all (http) requests go through it, and it routes to the appropriate controller/action. Processing a request does not necessary results in a returned response (of... | 23,693 |
<p>I am building a Prusa i3 MK2S (<a href="https://toms3d.org/2017/02/23/building-cheapest-possible-prusa-i3-mk2/" rel="nofollow noreferrer">Dolly</a>). I find it very difficult to find M5 rods for the Z axis, I have an M8 lead screw with 8 mm lead, So I thought since M8 is widely available online I could just use... | <p>as long as you match the parts that is ok.
The m8 rod will give you more stiffness and will be harder to bend.
As the result, you will have to calibrate the steps/mm settings in the firmware.</p>
| <p>You can use the screws and rods you can find easily, of course some dimensions will change and is needed to adjust parameters. </p>
<p>I used in my first 3D printer and standard screw of 9.5mm (3/8) the main problem was the coupling available in Mexico that werer none on that time.</p>
<p>You can buy the bearings ... | 839 |
<p>A path in Perforce contains files a.txt and b.txt. I'll refer to the main path as mainline.</p>
<p>I've create a branch (called initialbranch) from there which contains just a.txt. I make lots of changes to a.txt, and am very happy with it. However, it's not yet ready for submitting back to mainline. I can easily i... | <p>I'm not convinced I understand your question, but I'll try to help. </p>
<p>If you're saying that you don't really want b.txt in initialbranch, you can define a branch specification like this:</p>
<pre><code>initialbranch/a.txt secondbranch/a.txt
mainline/b.txt secondbranch/b.txt
</code></pre>
<p>That way, when y... | <p>Perhaps a diagram might help?</p>
<pre><code> a,b------------------------------------------------------> mainline
\ branched / integrated back in
\-a----------------------------------/------------> initialbranch
copied from mainline /
... | 30,740 |
<p>I need to call an external dll from c#. This is the header definition:</p>
<pre><code>enum WatchMode {
WATCH_MODE_SYSTEM = 0,
WATCH_MODE_APPLICATION = 1 };
LONG ADS_API WDT_GetMode ( LONG i_hHandle, WatchMode * o_pWatchMode );
</code></pre>
<p>I've added the enum and the call in C#:</p>
<pre>... | <p>You're running into a parameter size problem difference between C# and C++. In the C++/windows world LONG is a 4 byte signed integer. In the C# world long is a 8 byte signed integer. You should change your C# signature to take an int.</p>
<p>ffpf is wrong in saying that you should use an IntPtr here. It will fi... | <p>The Managed, Native, and COM Interop Team released the PInvoke Interop Assistant on codeplex. Maybe it can create the proper signature.
<a href="http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?ReleaseId=14120" rel="nofollow noreferrer">http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?R... | 17,935 |
<p>When I use the PrintOut method to print a Worksheet object to a printer, the "Printing" dialog (showing filename, destination printer, pages printed and a Cancel button) is displayed even though I have set DisplayAlerts = False. The code below works in an Excel macro but the same thing happens if I use this code in... | <p>When you say the "Printing" Dialog, I assume you mean the "Now printing xxx on " dialog rather than standard print dialog (select printer, number of copies, etc). Taking your example above & trying it out, that is the behaviour I saw - "Now printing..." was displayed briefly & then auto-closed.</p>
<p>What ... | <p>The API calls in the article linked by Kevin Haines hide the Printing dialog like so:</p>
<ol>
<li>Get the handle of the Printing dialog window.</li>
<li>Send a message to the window to tell it not to redraw</li>
<li>Invalidate the window, which forces a redraw that never happens</li>
<li>Tell Windows to repaint th... | 9,281 |
<p>basically, I've got my Huffman table as </p>
<pre><code>std::map<std::string, char> ciMap;
</code></pre>
<p>Where string is the bit pattern and char is the value represented by said pattern.
The problem is how do I store that as a header of my compressed file so I can build again the same map when I want to ... | <p>You can do it yourself, or you can do it with boost: <a href="http://www.boost.org/doc/libs/1_37_0/libs/serialization/doc/index.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_37_0/libs/serialization/doc/index.html</a>. What you currently try is just view the map as a plain old datatype, which essent... | <p>Great question. Problem here is that the default containers don't support serialization - you have to write it yourself, it's a pain, but it's possible.</p>
<p>Here's how you could serialize a <code>std::map</code> to a textual format. You can adapt it to write to whatever binary format you need. Just replace the <... | 45,773 |
<p>I am currently trying to create a menu system for a game and cannot arrive at any really sound way to do it. There are several menu screens, each of them non-trivial, so that I would like to keep these as separate classes. The main problem I am having is passing control between these menu screens.</p>
<p>I tried bu... | <p>One of the tricks I learned to decent design is always separate your data from your code. This will do WONDERS for your specific problem.</p>
<p>By this I mean that the menu items (strings) and relationships between the menus should be stored somewhere either in an array or a separate file (and read into an array)... | <p>Putting all the contents of the menus into a dictionary, dumping to a plist and reading each as necessary by the menu screens is likely the simplest route but in all honesty, you should consider taking a more MVC-centric approach to solving the problem. The screens should be for presentation of data not the storage... | 36,612 |
<p>Is there a way to make <strong>awk</strong> (gawk) ignore or skip missing files? That is, files passed on the command line that no longer exist in the file system (e.g. rapidly appearing/disappearing files under /proc/[1-9]*).</p>
<p>By default, a missing file is a fatal error :-(</p>
<p>I would like to be able to... | <p>GAWK 4 has <code>BEGINFILE</code> in which you can test for <code>ERRNO</code> and do a <code>nextfile</code> if <code>ERRNO</code> is not empty (indicating that the file couldn't be opened).</p>
| <p>In the finest of traditions, I will answer your awk question with a Perl program.</p>
<pre><code>#!/usr/bin/perl -w
for my $file (@ARGV) {
open my $fh, $file or next;
while(<$fh>) {
...do your thing here...
}
}
</code></pre>
<p>(It's not awk, but it is the only solution without a race co... | 26,696 |
<p>I am setting up a few Wordpress blog sites. I have created a user in mysql that wordpress will use to access its database. The docs say to give this user all privileges on the database.</p>
<p>Does it really need full privileges? I expect not, so does anyone know the min set of privileges that it really needs?</p>
| <p>I grant:</p>
<ul>
<li>ALTER</li>
<li>CREATE</li>
<li>CREATE TEMPORARY TABLES</li>
<li>DELETE</li>
<li>DROP</li>
<li>INDEX</li>
<li>INSERT</li>
<li>LOCK TABLES</li>
<li>SELECT</li>
<li>UPDATE</li>
</ul>
<p>Hope that helps anyone else that looks into this.</p>
| <p>grant select, insert, delete, update, create, drop, alter on myblog</p>
| 11,724 |
<p>Saving data to Postscript in my app results in a Postscript file which I can view without issues in GhostView, but when I try to print it, the printer isn't able to print it because it seems to be invalid.</p>
<p>Is there a way to validate / find errors in Postscript files without actually sending it to a printer? ... | <p>If you can see it on ghostview, it means ghostscript can parse it.</p>
<p>So, one trick you could try using to print (but not to actually validate) your file would be to use ghostscript's postscript output mode (there is a wrapper called <code>ps2ps</code> for it, which mainly adds <code>-sDEVICE=pswrite</code>; th... | <p>Do you know why it's invalid?</p>
<p>My suggestion would have been to feed it to Ghostscript/Ghostvoiew, but given Ghostview can view it, it would seem that at least some interpreters think it is valid Postscript.</p>
<p>So it may be something specific to your printer - either it's picky about something in the PS ... | 32,215 |
<p>I basically need to show a wait window to the user. For this i have put two seperate window forms in the application. the first form is the main form with a button. The second one is a empty one with just a label text. On click of the button in Form1 i do the below </p>
<pre><code>Form2 f = new Form2();
f.Show();
T... | <p>That's because you probably do some lengthy operation in the same thread (UI thread). You should execute your code in a new thread (see Thread class) or at least call Application.DoEvents periodically from inside your lengthy operation to update the UI.</p>
| <p>You can (an always should for UI threads) use <a href="http://msdn.microsoft.com/en-us/library/6b1kkss0.aspx" rel="nofollow noreferrer">Thread.Current.Join(2000)</a> instead of Thread.Sleep(2000).</p>
| 21,931 |
<p>I am very new to 3D printing. I am looking to purchase the Ender 3 V2 but before I do I would appreciate some advice on what I should purchase as the upgrades/addons for it. I'm not sure as to what I would need for the V2 since most websites are for the original Ender 3 so I don't know if the V2 already has that upg... | <p>IMHO, it's probably better to get the printer as-is first. This way you can get familiar with the printer and 3D printing in general before you get overwhelmed with all the extra introduced variables from your upgrades.</p>
<p>The new model already has loads of features that were considered upgrades on the older mod... | <p>I have an Ender 3 v2 and I haven't upgraded anything except updating the firmware. The first thing I suggest is updating the firmware and changing the hotend to an all-metal one. This will allow you to print in higher temperatures and adding a BLTouch for automatic bed leveling will make your life a bit easier.</p>
| 1,736 |
<p>How can I connect a system to a network and sniff for virus/spyware related traffic? I'd like to plug in a network cable, fire up an appropriate tool sand have it scan the data for any signs of problems. I don't expect this to find everything, and this is not to prevent initial infection but to help determine if t... | <p>I highly recommend running <a href="http://www.snort.org/" rel="noreferrer">Snort</a> on a machine somewhere near the core of your network, and span (mirror) one (or more) ports from somewhere along your core network path to the machine in question.</p>
<p>Snort has the ability to scan network traffic it sees, and ... | <p>As a followup to <a href="https://stackoverflow.com/questions/124745/sniffing-network-traffic-for-signs-of-virusesspyware#124768">Ferruccio's</a> comment you will need to find some method of getting around your switches.</p>
<p>A number of network switches have the option of setting up port mirrors, so that all tra... | 15,170 |
<p>In Excel I can use an expression like "=C16+C17" for a cell to display values from other cells. </p>
<p>In my application I need something similar. The user needs to be able to select a range of cells from a databound grind and display the sum in another cell (not in a footer!). So what I need is the ability to ass... | <p>There's nothing built into the DataGridView that can help you do that. Your option is obviously Custom Controls. I'm sure Infragistics UltraGrid has something like that, but in case you don't want to spend the money, you could roll your own. It might actually not be that hard. Here's the simple way to do it.</p>
<p... | <p>There's nothing built into the DataGridView that can help you do that. Your option is obviously Custom Controls. I'm sure Infragistics UltraGrid has something like that, but in case you don't want to spend the money, you could roll your own. It might actually not be that hard. Here's the simple way to do it.</p>
<p... | 48,606 |
<p>I would like to know how much disk space a directory is going to consume before I bring it over from the Perforce server. I don't see any way to do this other than getting the files and looking at the size of the directory in a file manager. This, of course, defeats the purpose. </p>
<p>Is there a way to get fil... | <p>I don't know how I missed this command, but here's how you do it:</p>
<p><strong>p4 sizes -s //depot/directory/...</strong></p>
| <p><a href="http://www.perforce.com/perforce/doc.current/manuals/cmdref/fstat.html" rel="nofollow noreferrer"><code>p4 fstat</code></a></p>
| 21,004 |
<p>My Java UI unexpectly terminated and dumped an <code>hs_err_pid</code> file. The file says "The crash happened outside the Java Virtual Machine in native code." JNA is the only native code we use. Does anyone know of any know issues or bugs with any JNA version that might cause this. I've included some of the con... | <p>I just hit that very same bug, it's apppearantly a bug in the new Direct3d accelerated Java2d functionality with 1.6.0_11 that happens with machines with low video ram.
If you start your app with -Dsun.java2d.d3d=false it should work again.
The sun bug tracking this is the following: <a href="http://bugs.sun.com/vie... | <p>You've hit an access violation, meaning that some code tried to access an address it's not allowed to, often because there isn't any memory at the given address. The stacktrace points to the location that tripped over the problem, which may <em>or may not</em> be the source of the problem. People sometimes forget ... | 49,732 |
<p>Using Terminal.app on OS X 10.5, often you see the commands get garbled when you do a reverse-search with Bash. Is there some kind of termcap or perhaps a bash shopt command that can fix this? It is very annoying. </p>
<p>Steps to reproduce: Open Terminal.app, reverse-search to a longish command. Hit <ctrl&... | <p>I was able to set my TERM to xterm instead of xterm-color and it solves the problem. (export TERM=xterm).</p>
| <p>In worst case, you could launch the X server (somewhere under utilities) and launch a real xterm. </p>
| 5,612 |
<p>How can I make this work?</p>
<pre><code>switch(property.PropertyType){
case typeof(Boolean):
//doStuff
break;
case typeof(String):
//doOtherStuff
break;
default: break;
}
</code></pre>
<p>I don't want to use the name since string comparing for types is just awfull and... | <pre><code> System.Type propertyType = typeof(Boolean);
System.TypeCode typeCode = Type.GetTypeCode(propertyType);
switch (typeCode)
{
case TypeCode.Boolean:
//doStuff
break;
case TypeCode.String:
//doOtherStuff
... | <p>Just use the normal if/else if/else pattern:</p>
<pre><code>if (property.PropertyType == typeof(Boolean))
{
}
else if (property.PropertyType == typeof(String))
{
}
else if (...)
{
}
</code></pre>
| 11,697 |
<p>I was coding with 2 CStringList objects. Each has its own data, for eg one has name and other the phoneno, and both are in sync, i.e, if there is a phoneno there is a name and viceversa.</p>
<p>Now, i have 2 combobox in which i show the names and the respective phonenos. The name combobox is sorted, hence the sync... | <p>I Hope U are using CStringArray and not CStringList.
You need to use FindIndex rather than Find since Find will return OBJECT Pos rather than the Index count....
and to get the element with array use simply [] the operator.
If You still want to use CStringList then through Iterator Find the Index Count of the firs... | <p>Why do you have 2 separate lists? Why not one CTypedPtrArray of structures holding both the name and the phone nb?</p>
| 49,345 |
<p>I'm trying to troubleshoot an issue with my 3D printer (Robo 3D R1+). It cannot print vertical walls well any more. Here is a picture of what it looks like:</p>
<p><a href="https://i.stack.imgur.com/4Y4PE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Y4PE.jpg" alt="enter image description here... | <p>Mmm... you've tried lots of obvious things. I don't have a printer the same as yours, so my help is generic. </p>
<p>How about a thorough check of extruder and filament path, since it may be just inconsistent filament feed? I've seen something similar happen when the filament reel was not rolling freely. Less likel... | <p>Despite the picture being a bit small and blurry, it is quite obvious that something is off. A better picture might help closing in on the problem with more precision.</p>
<p>From what I can see it could be wrong extrusion settings. I'm making a wild guess based on personal experience that the printer is over extru... | 1,576 |
<p>I'm in the process of writing a piece of code that connects to a server spawns a bunch of threads using that connection and does a bunch of "stuff".</p>
<p>There are certain instances where the connection fails and I need to stop everything and start from scratch with a new object.</p>
<p>I wanted to clean up afte... | <p>Assuming your threads are reasonably under your control - i.e. they're not calling anything which is going to potentially wait forever without your code executing - I would shut it down with a simple (but thread-safe - use volatile!) flag.</p>
<p>See <a href="http://pobox.com/~skeet/csharp/threads/shutdown.shtml" r... | <p>Use your_thread.interrupt and check in your thread if Thread.interrupted() return true. If so, close your thread properly.</p>
| 30,737 |
<p>Uphill about 5 years ago my career was going fairly well, but separation, family deaths and a bit of illness caused me to make a couple of BAD career decisions, and I ended up in a dead end job doing mainly vb 6, though it was the end as mid to late 30, but was recently handed a break, working with a forward thinkin... | <p>Taking a introductory .NET course will be a good investment. It gives you a chance to focus on .NET for four or five days and build a good foundation.</p>
<p>The other choice is to use online resources and do self study. One suggestion (out of the ton that are out there) is to follow one of the webcast series avail... | <p>It's not like C/Machine code programmers aren't in demand... They're growing increasingly rare as developers are breast-fed with Java or .NET nowadays :)</p>
| 30,612 |
<p>The simple demo below captures what I am trying to do. In the real program, I have to use the object initialiser block since it is reading a list in a LINQ to SQL select expression, and there is a value that that I want to read off the database and store on the object, but the object doesn't have a simple property t... | <p>Object Initializers are just syntactic sugar that requires a clever compiler, and as of the current implementation you can't call methods in the initializer.</p>
<pre><code>var x = new BaseDataObject { SomeValue = 3, SomeOtherValue = 4 };
</code></pre>
<p>Will get compiler to something like this:</p>
<pre><code>B... | <p>Is extending the class a possibility? Then you could easily add the property you need.</p>
<p>Failing that, you can create a new class that has similar properties that simply call back to a private instance of the class you are interested in.</p>
| 16,034 |
<p>I'd like to know if anyone has any first-hand experience with this dichotomy. A few blogs say the mysql extension is faster than mysqli. Is this true?</p>
<p>And I'm only asking about speed. I know mysqli has features that are not present in the older extension.</p>
| <p>The MySQL extension is very slightly faster than MySQLi in most benchmarks I've seen reported. The difference is so slight, however, that this should probably not be your criterion for deciding between the two.</p>
<p>Other factors dwarf the difference in performance between mysql and mysqli. Using mod_php or Fas... | <p><strong>MySQLi</strong> has two basic advantages over <strong>MySQL</strong>; prepared statements are a great way to avoid SQL injection attacks. Secondly MySQL (or mariaDB) will do their best to optimize prepared statements and thus you have the potential for speed optimizations there. Speed increases from making t... | 20,665 |
<p>Okay, this is just a crazy idea I have. Stack Overflow looks very structured and integrable into development applications. So would it be possible, even useful, to have a Stack Overflow plugin for, say, Eclipse? </p>
<p>Which features of Stack Overflow would you like to have directly integrated into your IDE so you... | <p>Following up on Josh's answer. This VS Macro will search StackOverflow for highlighted text in the Visual Studio IDE. Just highlight and press Alt+F1</p>
<pre><code>Public Sub SearchStackOverflowForSelectedText()
Dim s As String = ActiveWindowSelection().Trim()
If s.Length > 0 Then
DTE.ItemOperat... | <p>You could just set it as your Start Page in Visual Studio.</p>
<p>Not sure what benefit this would provide... but to each his own.</p>
| 16,285 |
<p>A question about different methods of outputting html from PHP; what are the performance differences between these:</p>
<p>Method 1 - variable concatenation</p>
<pre><code>$html = '';
$html .= '<ul>';
for ($k = 1; $k < = 1000; $k++){
$html .= '<li> This is list item #'.$k.'</li>';
}
$html ... | <p>The idea of string concatenation itself aside, you're really asking (I think) how you should be building up web pages, and it strikes me that any form of explicit concatentation is probably the wrong thing to do.</p>
<p>Try using the <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="noreferrer">Mode... | <p>Something I haven't seen mentioned is that, usually, the PHP guy has to work with design people that need to class the HTML or add styles some other way, so the solution must bear that in mind.</p>
| 21,252 |
<p>I have always been able to read and write basic text files in C++, but so far no one has discussed much more than that. </p>
<p>My question is this:</p>
<p>If developing a file type by myself for use by an application I also create, how would I go about writing the data to a file and preserve the layout, formattin... | <p>There are a number of standards of course. The likely one to use is some flavor of xml since there are libraries and tools that already exist to help you work with it, but nothing is stopping you from inventing your own.</p>
| <p>If you create a binary file , you can write any file to it . The only drawback is that you have to know exactly where it starts and where it ends .</p>
| 9,982 |
<p>I was wondering if anyone could give me tips for designing a 3d printable structure that can "pinch" down onto a hockey puck shaped piece and hold it tightly. </p>
<p>I'd like for the structure to normally want to "pinch" two edges together, but I can pry/force them open when I shove the hockey puck into it. Once I... | <p>Here are first 3 the most simplified and generalized options you have:</p>
<p><a href="https://i.stack.imgur.com/XmHnf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XmHnf.png" alt="enter image description here"></a></p>
<p>All you need now is to give use more details about your needs. If you r... | <p>If you are looking for a solid piece, the red one darth pixel showed is the best. An important consideration for something like this is making sure that it is able to flex outwards around the puck without fracturing. In order to keep the stress low in the arms, you can reduce the stiffness by either:</p>
<ul>
<li>I... | 376 |
<p>Is there a way to take a backup file from SQL Server Express Edition and restore it into a standard SQL Server database? I tried to do it from Management Studio but it didn't recognize the file format.</p>
| <p>If you have a databse .bak file you can move from SQL Server 2005 Express to SQL Server.</p>
<p>Just make sure that you check the option to overwrite the existing DB.</p>
| <p>Yes. It should work using the standard tools. What versions of the databases are you working with?</p>
| 19,767 |
<p><strong>The cause was probably that I ran out of disk space, causing everything to work strangely. I will leave this question up anyways in case anyone else has a similar issue.</strong></p>
<p>I have a few PHP scripts that have hung for a long time, but apparently they are not really using much CPU time as they do... | <p>All of the other examples would work...also if you're looking to redirect based on a referral from an external site, you may want to check CGI.HTTP_REFERER. Check out the CGI scope for several other options.</p>
<pre><code><cfif reFindNoCase('[myRegex]',cgi.http_referer)>
<cflocation url="my_new_url"&g... | <p>A dynamic version. </p>
<pre><code><cfif isdefined("somecondition")>
<cfset urlDestination = "someurl">
<cfelseif isdefined("somecondition")>
<cfset urlDestination = "someurl">
.
.
.
<cfelse>
<cfset urlDestination = "someurl">
</cfif>
<cflocation url = ur... | 49,039 |
<p>i need a C# library about strict HTML validation and filtering </p>
| <p>Assuming it is properly escaped, it doesn't make you vulnerable. The thing is that escaping properly is harder than it looks at first sight, and you condemn yourself to escape properly every time you do a query like that. If possible, avoid all that trouble and use prepared statements (or binded parameters or parame... | <p>That statement as such isn't really a problem, its "safe", however I don't know how you are doing this (one level up on the API stack). If $user_id is getting inserted into the statement using string operations (like as if you are letting Php automatically fill out the statement) then its dangerous.</p>
<p>If its g... | 40,848 |
<p>What's the best way to authenticate and track user authentication state from page to page? Some say session state, some say cookies? </p>
<p>Could I just use a session variable that has the ID of the user and upon authentication, instatiate a custom User class that has the User's information. Then, on every page, v... | <p>There's no <em>perfect</em> way to do it. If you store it in a cookie you'll take flak that cookies can be stolen. If you store it in the session you'll take flak because sessions can be hijacked. </p>
<p>Personally, I tend to think a session is a little more reliable because the only thing stored on the client ... | <p>Sessions are Cookies...</p>
| 46,490 |
<p>How hard would it be to use GCC instead of VC++ from within Visual Studio 2008? Obviously, some of the keywords won't match, and some may not get syntax highlighting (unless you made a new language service).</p>
<p>Is this what a 'makefile project' is for, pretty much?</p>
| <p>There is no GCC plugin for Visual Studio as the one for example for Intel C++, which allows Intel's compiler to be used as a drop-in replacement for Visual C++.</p>
<p>You can use Makefile projects which allows you to use any external tool you like (make, SCons, jam, whatever) to do your build. If you don't like Ma... | <p>You can use <a href="http://visualgdb.com/" rel="noreferrer">Visual GDB</a> add-in for Visual Studio that simplify work with GCC</p>
| 26,555 |
<p>As an example:</p>
<pre><code>def get_booking(f=None):
print "Calling get_booking Decorator"
def wrapper(request, **kwargs):
booking = _get_booking_from_session(request)
if booking == None:
# we don't have a booking in our session.
return HttpRedirect('/')
... | <p>I believe python decorators are just syntactic sugar.</p>
<pre><code>@foo
def bar ():
pass
</code></pre>
<p>is the same thing as</p>
<pre><code>def bar ():
pass
bar = foo(bar)
</code></pre>
<p>As you can see, <em>foo</em> is being called even though <em>bar</em> has not been called. This is why you see t... | <p>A decorator is called as soon as the decorated function is defined. It is equivalent to writing something like this:</p>
<pre><code>def __do_stuff(...):
...
do_stuff = get_booking(__do_stuff)
</code></pre>
| 44,371 |
<p>I'd like to implement a way of recording the version of a project within code, so that it can be used when testing and to help track bugs.
It seems the best version number to use would just be the current revision number from Subversion. Is there an easy way to hook this number into a (C++ in my case) header file o... | <p>Two ways:</p>
<p>Embed <em>$Id$</em> or <em>$Revision$</em> within the code. Then set <em>svn:keywords="Id Revision"</em> property on the file. This will give you the last modified revision of that source file. Good for smaller projects and scripts.</p>
<p>Alternatively, use a Makefile driven process and the comma... | <p>A good up-to-date solution:</p>
<p>Create a <code>Makefile</code> containing the following line (in the same folder as <code>YourFile.dox</code>):</p>
<pre><code>sed "s~RevNumber~$(shell svnversion ../)~g" YourFile.dox > YourFileDummy.dox; doxygen YourFileDummy.dox
</code></pre>
<p>And <code>YourFile.dox</code... | 3,697 |
<p>We're using Microsoft.Practices.CompositeUI.EventBroker to handle event subscription and publication in our application. The way that works is that you add an attribute to your event, specifying a topic name, like this:</p>
<pre><code>[EventPublication("example", PublicationScope.Global)]
public event EventHandler... | <p>What you are trying to achieve is quite complicated, so I will try to provide something just to get you started. This is what I think you would need to combine in order to achieve something:</p>
<ol>
<li>Define an abstract class <code>AbstractEventDebugger</code>, with a method <code>Search</code> that searches all... | <p>You need to delve into the world of the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx" rel="nofollow noreferrer"><code>DynamicMethod</code></a>. However, as you need then to know MSIL, I really suggest you think hard about your architecture.</p>
| 33,685 |
<p>Let's assume that I have some packets with a 16-bit checksum at the end. I would like to guess which checksum algorithm is used.</p>
<p>For a start, from dump data I can see that one byte change in the packet's payload totally changes the checksum, so I can assume that it isn't some kind of simple XOR or sum.</p>
... | <p>There are a number of variables to consider for a CRC:</p>
<pre><code>Polynomial
No of bits (16 or 32)
Normal (LSB first) or Reverse (MSB first)
Initial value
How the final value is manipulated (e.g. subtracted from 0xffff), or is a constant value
</code></pre>
<p>Typical CRCs:</p>
<pre><code>LRC: Polynomial=0... | <p>You would have to try every possible checksum algorithm and see which one generates the same result. However, there is no guarantee to what content was included in the checksum. For example, some algorithms skip white spaces, which lead to different results.</p>
<p>I really don't see why would somebody want to kn... | 18,031 |
<p>I have a mysql database which as one of the fields contains a html description. This description is not in my control, and is obtained and inserted automatically. An example of one of these descriptions is here:</p>
<p><a href="http://www.nomorepasting.com/getpaste.php?pasteid=22492" rel="nofollow noreferrer">http:... | <p>Reminds me a little of <a href="https://stackoverflow.com/questions/340478/phpcode-generating-broken-javascript-and-html-code">this question</a>.</p>
<p>You see here in PHP code</p>
<pre><code>child1.document.write(' . json_encode($row2["ARTICLE_DESC"]) . ');
</code></pre>
<p>and here in HTML code</p>
<pre><code... | <p>Reminds me a little of <a href="https://stackoverflow.com/questions/340478/phpcode-generating-broken-javascript-and-html-code">this question</a>.</p>
<p>You see here in PHP code</p>
<pre><code>child1.document.write(' . json_encode($row2["ARTICLE_DESC"]) . ');
</code></pre>
<p>and here in HTML code</p>
<pre><code... | 44,709 |
<p>I'm developing an application using Java, Tomcat, Spring Framework and Spring LDAP 1.2.1 for LDAP access.</p>
<p>According to our LDAP administrator, it is not possible to find out programmatically, if a specific user is locked out in the directory - the user is just not returned. This makes life difficult for me, ... | <p>I'll answer myself: turns out there is an attribute nsaccountlock, which can be used for this purpose. Binding with the locked out user is not possible, but searching is.</p>
| <p>I'll answer myself: turns out there is an attribute nsaccountlock, which can be used for this purpose. Binding with the locked out user is not possible, but searching is.</p>
| 35,536 |
<p><code>System.IO.Directory.GetFiles()</code> returns a <code>string[]</code>. What is the default sort order for the returned values? I'm assuming by name, but if so how much does the current culture effect it? Can you change it to something like creation date? </p>
<p><strong>Update:</strong> MSDN points out tha... | <p>If you're interested in properties of the files such as CreationTime, then it would make more sense to use System.IO.DirectoryInfo.GetFileSystemInfos().
You can then sort these using one of the extension methods in System.Linq, e.g.:</p>
<pre><code>DirectoryInfo di = new DirectoryInfo("C:\\");
FileSystemInfo[] fil... | <p>Just an idea. I like to find an easy way out and try re use already available resources. if I were to sort files I would've just create a process and make syscal to "DIR [x:\Folders\SubFolders*.*] /s /b /on" and capture the output. </p>
<p>With system's DIR command you can sort by :</p>
<pre><code>/O List... | 7,618 |
<p>We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in the database so this should not make the conversion problemati... | <p>Generate a full script for your database in SQL2005, and change the "Script for Server Version" option to SQL Server 2000. You can now recreate your database on the SQL 2000 server. After this is complete, use the export data feature to export from SQL 2005 to SQL 2000.</p>
| <ol>
<li>Script out the entire database</li>
<li>Create a new SQL2000 database</li>
<li>Run the script on the new database</li>
<li>Import the data from the SQL2005 to the SQL2000 database (lots of ways to do this)</li>
</ol>
<p>There probably is a tool somewhere that does all this for you, although I don't know how c... | 21,891 |
<p>How do I create an index on the date part of DATETIME field?</p>
<pre><code>mysql> SHOW COLUMNS FROM transactionlist;
+-------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+------------... | <p>If I remember correctly, that will run a whole table scan because you're passing the column through a function. MySQL will obediently run the function for each and every column, bypassing the index since the query optimizer can't really know the results of the function.</p>
<p>What I would do is something like:</p>... | <p>Create a new fields with just the dates <code>convert(datetime, left(date_field,10))</code> and then index that.</p>
| 12,080 |
<p>Every now and then I'll have a problem with layer shift. Solving this is a separate issue, but it occurred to me: most of the time when this happens I notice right away because of the noise. What if there were an easy to to pause the print, re-home the X/Y axis (not Z), and then resume. I'd only have one layer that ... | <p>Have you tried this? It should just work, at least if you're using software like Octoprint to control the printer over serial interface rather than print-from-SD-card on the printer itself. In such a setup you're free to submit whatever commands (in particular, <code>G28 X Y</code>) you like while the print is pause... | <p>Repetier software has a Pause button and works very well. I use it to change filament color in mid-print. When pause is invoked manual moves and homing of all three axes are available.
In my case, after pausing I quickly home X and Y so the nozzle is not over the in-progress print in case of oozing during the filame... | 1,929 |
<p>Does anyone know how I could go about doing something like :</p>
<p>Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } ))</p>
<p>This should output a link with the url of "/Controller/SomeAction/1", pointing at an ActionMethod along the lines of:</p>
<pre><code>public Controller : Controller
{
publi... | <p>In the end I ended up wrapping the following code in an HtmlHelper extension method. This would allow me to use something like
Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } ))</p>
<p>and have all the properties of the MessageObject created as RouteValues.</p>
<pre><code> public static RouteValue... | <p>I'm not sure exactly what you are trying to do since your example URL doesn't match that required for the signature of your method. Typically if you use a method that requires a complex object, you pass the values to construct that object in the query string or as form parameters and the ModelBinder constructs the ... | 48,200 |
<p>I am consistently getting these strings in the overhangs on models that folks say they are printing without supports. Can anyone tell me what is causing them and what I can do to fix them?</p>
<p>I've attached a picture mid-way during a <a href="https://www.thingiverse.com/thing:3232347" rel="nofollow noreferrer">... | <p>While this looks a lot like stringing, it's not what I would call stringing. I usually reserve that term for material that should never have left the nozzle to begin with, due to insufficient or missing retraction or excessive compression of the filament between the extruder and the nozzle. The "strings" you've show... | <p>You did print overhangs without supports. I have printed a Thermal Detonator for StarWars day (May the 4th be with you!), which is pretty much an empty pair of domes. To ensure that the upper layers stay up, I have activated support starting at 40°, and it came out perfectly fine. Without support, the lines would ha... | 1,300 |
<p>We are trying to come up with our client and server standard and there is a big debate. One school of thought is C# client and java servers using some type of proprietary messsage library to share data objects (think XML like structure . .)</p>
<p>The issue with this model is that there is lots of code that needs ... | <p>There are frameworks for this. ICE (ZeroC), "protocol buffers", etc.</p>
<p>For example, my protocol buffers implementation (protobuf-net) works on mono, MS .NET, CF, Silverlight etc - and the binary format is compatible with a <em>range</em> of languages (java, etc). If you start from a .proto (a bespoke definitio... | <p>I would try to keep the client and the server the same runtime (Java or CLR). We have had plenty of success using a mix of Mono and .Net client/Server.</p>
| 47,841 |
<p>Our QA team wants to focus their testing based on what EXEs and DLLs have actually changed between builds. We have a nice svn change report, but the relationship between source and changed binaries isn't always obvious. The builds we're comparing are always full clean builds, so we can't use file system timestamp... | <p>Have you had a look at <a href="http://technet.microsoft.com/en-us/library/cc784415.aspx" rel="nofollow noreferrer">Bindiff</a>?</p>
| <p>When I was working on the "home grown" tool for installation verification at my company, we used <strong><a href="http://www.scootersoftware.com/" rel="nofollow noreferrer">Beyond Compare</a></strong> as a backend for comparison. </p>
<p>It has great file/folder comparison (binary as well) and scripting capabilitie... | 44,994 |
<p>I was shocked to find out today that C# does not support dynamic sized arrays. How then does a <a href="http://en.wikipedia.org/wiki/Visual_Basic_.NET" rel="noreferrer">VB.NET</a> developer used to using <a href="http://msdn.microsoft.com/en-us/library/w8k3cys2.aspx" rel="noreferrer">ReDim Preserve</a> deal with thi... | <p>VB.NET doesn't have the idea of dynamically sized arrays, either - the CLR doesn't support it.</p>
<p>The equivalent of "Redim Preserve" is <a href="http://msdn.microsoft.com/en-us/library/bb348051.aspx" rel="noreferrer"><code>Array.Resize<T></code></a> - but you <em>must</em> be aware that if there are other... | <p>Even though it's a long time ago it might help someone looking for a simple solution - I found something great in another forum:</p>
<pre><code>//from Applied Microsoft.NET framework Programming - Jeffrey Richter
public static Array RedimPreserve(Array origArray, Int32 desiredSize)
{
System.Type... | 42,512 |
<p>i want to write code for unit test to test my application code. I have different methods and now want to test these methods one by one in python script.
but i do not how to i write. can any one give me example of small code for unit testing in python.
i am thankful </p>
| <p>Read the <a href="http://www.python.org/doc/2.5.2/lib/module-unittest.html" rel="nofollow noreferrer">unit testing framework section</a> of the <a href="http://www.python.org/doc/2.5.2/lib/lib.html" rel="nofollow noreferrer">Python Library Reference</a>.</p>
<p>A <a href="http://www.python.org/doc/2.5.2/lib/minimal... | <p>Here's an <a href="http://www.python.org/doc/2.5.2/lib/minimal-example.html" rel="nofollow noreferrer">example</a> and you might want to read a little more on <a href="http://www.python.org/doc/2.5.2/lib/module-unittest.html" rel="nofollow noreferrer">pythons unit testing</a>.</p>
| 26,787 |
<p>I want to do some benchmarking of a C# process, but I don't want to use time as my vector - I want to count the number of IL instructions that get executed in a particular method call. Is this possible?</p>
<p><strong>Edit</strong> I don't mean static analysis of a method body - I'm referring to the actual number o... | <p>I don't think it's possible to do what you want. This is because the IL is only used during JIT (Just-In-Time) compilation. By the time the method is running the IL has been translated into native machine code. So, while it might be possible to count the number of IL instructions in a given method/type/assembly s... | <p>I use the <a href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=CodeMetrics&referringTitle=Home" rel="nofollow noreferrer">Code Metrics</a> add in to Reflector</p>
<blockquote>
<p>The CodeMetrics add-in analyses and
computes several code quality metrics
on your assemblies. This add-in uses... | 20,027 |
<p>We have a traditional UV account. Data files in one directory, application programs & subroutines in another directory. Our latest projects is implementing JDBC and in order to fully access the subroutines from java, I belive I need to create a schema on the existing uv account.</p>
<p>How can I do this? I trie... | <p>They're both admin, per the docs, but a UniVerse Admin is simply someone who has r/w perms on the underlying files used in creation (uvadm and/or root).</p>
<blockquote>
<p>Who Is a UniVerse Administrator?</p>
<p>To
perform most administration tasks, you
must be logged on as a UniVerse
Administrator. On UNIX systems... | <p>When you installed UniVerse, who did you say the owner of uvsql is - uvadm or root? The only way I know to resolve this problem is to go through a reinstallation to allow answer uvadm so all the files within SQL will be setup and cataloged properly.</p>
| 42,038 |
<p>I'm working on a Win32 control. There could be hundreds of "items" on this control. Those are not windows, but internal objects (eg: rectangles). Depending on the mouse position I want to change the mouse cursor. That is fine, I can use WM_SETCURSOR.</p>
<p>At the same time based on mouse move I want to display a s... | <p>While they might currently always come as a matched pair, you probably can't rely on this behaviour.</p>
<p>You can set the cursor during WM_MOUSEMOVE (using SetCursor), and it won't flicker, as long as (IIRC), you return TRUE from WM_SETCURSOR without doing anything (i.e. you eat the message), and your window does... | <p>Is there any way to cache the last item that was found, and shortcut the lookup if the cursor is in the same place? That would be the most robust solution.</p>
| 23,587 |
<p>I have two tables with the same columns, and I need to copy one table's rows to the other table's rows to create one big table with all the values from both tables. Right now I am doing this query to return the same thing:</p>
<pre><code>SELECT col1, col2, col3 from Table1
union
SELECT col1, col2, col3 from Table2... | <p>May it work to just do:</p>
<pre><code>SELECT col1, col2, col3
INTO Table1
FROM Table2
</code></pre>
| <pre><code>select * into new table(your new table name)
from table1.col1,table1.col2,table2.col1;
</code></pre>
<p>here columns can be your required columns .</p>
| 42,419 |
<p>When developing (works fine live) the pages for our website don't pick up the correct CSS until the user has authenticated (logged on).</p>
<p>So the Logon and Logoff forms look bad, but once inside the site, the CSS works again.</p>
<p>I'm guessing it's some kind of authentication issue? Haven't really looked int... | <p>Check and make sure that the CSS file itself is not in an area that you are securing. You can manually exclude the file via the web.config if needed.</p>
| <p>Can you try using a tool like <a href="http://fiddler2.com/fiddler2/" rel="nofollow noreferrer">Fiddler</a> or <a href="http://httpwatch.com/" rel="nofollow noreferrer">HttpWatch</a> and check if a request actually goes for the .css file from the login page. Verify the return codes are 200. Could be because of relat... | 7,940 |
<p>What I would like to achive is: </p>
<ul>
<li>I go to admin site, apply some filters to the list of objects</li>
<li>I click and object edit, edit, edit, hit 'Save'</li>
<li>Site takes me to the list of objects... unfiltered. I'd like to have the filter from step 1 remembered and applied.</li>
</ul>
<p>Is there an... | <p>Unfortunately there's no easy way to do this. The filtering does not seem to be saved in any session variable.</p>
<p>Clicking back twice is the normal method, but it can be unweildy and annoying if you've just changed an object so that it should no longer be shown using your filter.</p>
<p>If it's just a one-off... | <p>Another way to do this is to embed the filter in the queryset.</p>
<p>You can dynamically create a proxy model with a manager that filters the way you want, then call admin.site.register() to create a new model admin. All the links would then be relative to this view.</p>
| 21,381 |
<p>I can't figure out how to get the SCOPE_IDENTITY() back to my variables from an SQL2005 Store Procedure.</p>
<p>My sSQL String:</p>
<pre><code>sSQL = "EXEC [sp_NewClaim] " & Chr(34) & ClaimNumber & Chr(34) & ", " & Request.Cookies("UserID") & ", " & Request.Cookies("MasterID") & ", ... | <p>For your stored procedure, do this:</p>
<pre><code>CREATE PROCEDURE sp_NewClaim
(
@ClaimNumber nvarchar(50),
@blah............
.................
)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO Accidente (ClaimNumber,........., RecordNumber)
VALUES (@ClaimNumber,....., @RecordNumber)
SELECT... | <p>You might try testing to make sure the <code>SCOPE_IDENTITY()</code> function is working as expected- add <code>SELECT @RecordNumber</code> to the end of the sproc and run it manually in Management Studio to confirm that the variable is getting set the way you expect. If that doesn't work try <code>SELECT SCOPE_IDE... | 39,095 |
<p>I have written an Excel VBA macro which imports data from a HTML file (stored locally) before performing calculations on the data.</p>
<p>At the moment the HTML file is referred to with an absolute path:</p>
<pre><code>Workbooks.Open FileName:="C:\Documents and Settings\Senior Caterer\My Documents\Endurance Calcul... | <p>Just to clarify what yalestar said, this will give you the relative path:</p>
<pre><code>Workbooks.Open FileName:= ThisWorkbook.Path & "\TRICATEndurance Summary.html"
</code></pre>
| <p>i think this may help. Below Macro checks if folder exists, if does not then create the folder and save in both xls and pdf formats in such folder. It happens that the folder is shared with the involved people so everybody is updated.</p>
<pre><code>Sub PDF_laudo_e_Prod_SP_Sem_Ajuste_Preco()
'
' PDF_laudo_e_Prod_SP... | 26,256 |
<p>I need to run an equipment audit and to do that I need to obtain the Windows PC, monitor etc. serial numbers.</p>
<p>So I faced with going to each PC and manually writing down the numbers.</p>
<p>Is there a way I can get this programmatically so each user can run a small program and email me the results?</p>
| <p>If this information is anywhere, it'd be in WMI (<a href="http://en.wikipedia.org/wiki/Windows_Management_Instrumentation" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Windows_Management_Instrumentation</a>) - you could write a VBscript script to query this information and save it to a remote share on a se... | <p>I am not quite sure if this is exactly what you want, but there is pay software made by <a href="http://www.dameware.com/" rel="nofollow noreferrer">DameWare</a> that allows you to easily remote connect to other machines and get lots of information. I haven't used it much yet, but I think there is a way to make bat... | 12,389 |
<p>I've just coded a 700 line class. Awful. I hang my head in shame. It's as opposite to <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself" rel="nofollow noreferrer">DRY</a> as a British summer.</p>
<p>It's full of cut and paste with minor tweaks here and there. This makes it's a prime candidate for re... | <p>#region</p>
<p>I made a 1,000 line class only one line with it!</p>
<p>In all seriousness, the best way to avoid repetition is the things covered in your list, as well as fully utilizing polymorphism, examine your class and discover what would best be done in a base class, and how different components of it can be... | <p>First of all, I would recommend refactoring much sooner than when you are done with the first version of the class. Anytime you see duplication, eliminate it ASAP. This may take a little longer initially, but I think the results end up being a lot cleaner, and it helps you rethink your code as you go to ensure you... | 8,491 |
<p>Whenever it start printing the extruder starts clicking, I tried adjusting the voltage with no luck, it's still clicking. And it doesn't extrude a lot of plastic sometimes it even stops extruding but the extruder is still turning. Can someone help?</p>
| <p>The clicking you are hearing is either the stepper motor skipping steps or the hobbed gear losing grip on the filament.</p>
<p>Either way, it means that the filament opposes an unusually high resistence to be pushed forward.</p>
<p>A key information to be able to diagnose your problem is whether the clicking is on... | <p>I have an X5S and quite frankly, I never got it print properly because of these persistent issues. Thank you for the most excellent comments and suggestions. Lots to investigate.</p>
<p>I added an anycubic glass table but that takes longer to heat up. But i am unable to get adhesion on the first layers and the clic... | 857 |
<p>I have a <code>JSP</code> page which contains an <code>HTML</code> <code><select></code> populated with all countries loaded from a database. Say for example, on "create user" all the country values are loaded in the select menu and I select 5 countries. Those 5 values are loaded into database for that particu... | <p>I am not sure if I understand the question correctly, but here is a multiple selection list:</p>
<pre><code><select multiple="multiple">
<option value ="UK">UK</option>
<option value ="France" selected="selected">France</option>
<option value ="Germany">Germany</option&g... | <p><code>javascript</code> may not be the best answer, although it is certainly doable that way.</p>
<p>In the <code>JSP</code> page, I'm assuming you have a loop that populates the <code>HTML</code> <code><select></code> options. In that loop, place a test to see if the current value was selected for the user.... | 44,231 |
<p>I'm finding the WPF command parameters to be a limitation. Perhaps that's a sign that I'm using them for the wrong purpose, but I'm still giving it a try before I scrap and take a different tack.</p>
<p>I put together a system for <a href="https://stackoverflow.com/questions/151686/asynchrnonous-wpf-commands">exec... | <p>Let me point you to my open source project Caliburn. You can find it at <a href="http://caliburn.codeplex.com/" rel="nofollow noreferrer">here</a>. The feature that would most help solve your problem is documented briefly <a href="http://caliburn.codeplex.com/Wiki/View.aspx?title=Action%20Basics&referringTitle... | <p>You need something that will allow you to request the proper object. Perhaps you need an object just for storing these parameters that your parent object can expose as a property. </p>
<p>Really what you should do is leave the commands synchronous and execute them asynchronously by throwing off a new thread or pass... | 18,280 |
<p>I've got a Method that gets a IDictionary as a parameter.
Now I want to provide a method that retrieves the value from this dictionary, but it should be case-invariant.</p>
<p>So my solution to this right now was to have a static function that loops through the keys and converts them toLower() like this:</p>
<pre>... | <p>Yes - pass the Dictionary constructor <code>StringComparer.OrdinalIgnoreCase</code> (or another case-ignoring comparer, depending on your culture-sensitivity needs).</p>
| <p>LINQ version using the <code>IEnumerable<T></code> extension methods:</p>
<pre><code>
private static IDictionary<ILanguage, IDictionary<string, string>> ConvertKeysToLowerCase(
IDictionary<ILanguage, IDictionary<string, string>> dictionaries)
{
r... | 19,534 |
<p>I have a unicode string like "Tanım" which is encoded as "Tan%u0131m" somehow. How can i convert this encoded string back to original unicode.
Apparently urllib.unquote does not support unicode.</p>
| <p>%uXXXX is a <a href="http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementations" rel="noreferrer">non-standard encoding scheme</a> that has been rejected by the w3c, despite the fact that an implementation continues to live on in JavaScript land.</p>
<p>The more common technique seems to be to UTF-8... | <p>there is a bug in the above version where it freaks out sometimes when there are both ascii encoded and unicode encoded characters in the string. I think its specifically when there are characters from the upper 128 range like '\xab' in addition to unicode.</p>
<p>eg. "%5B%AB%u03E1%BB%5D" causes this error.</p>
<p... | 38,511 |
<p>I'm using two commercial libraries that are produced by the same vendor, called VendorLibA and VendorLibB. The libraries are distributed as many DLLs that depend on the compiler version (e.g. VC7, VC8). Both libraries depend on a another library, produced by this vendor, called VendorLibUtils and contained in one DL... | <p>As you are not using VendorLibUtils directly, I assume you can't use <a href="http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx" rel="nofollow noreferrer">LoadLibrary</a> etc.</p>
<p>If the VendorLibUtils DLLs only have exports by ordinal, you could probably rename one of the the libraries and patch the ... | <p>It is actually possible to implicitly load different versions of a dll into a single process.</p>
<p>Doing this entails:</p>
<ol>
<li><p>Creating two assemblies, each containing a version of the dll that must be loaded multiple times. Sounds complicated but practically it entails little more than creating (2) name... | 40,702 |
<p>I need to create and add custom headers to an ASP.NET 2.0 application.
The case is simulation of an SSO-login in our dev/test environment.</p>
<p>When I try to add headers I run into the "Not supported on this platform."
error. BigJim has a nice post on the subject here:
<a href="http://bigjimindc.blogspot.com/20... | <p>One method i have used before, though a long winded approach, is <a href="http://nunitasp.sourceforge.net/" rel="nofollow noreferrer">NUnitASP</a>.</p>
<p>This is based on the NUnit framework but intended for ASP.NET UI Testing.</p>
<p>It basically starts a browser in memory, and is able to manipulate the content ... | <p><p>I could be wrong, but doesn't the <code>Response.AddHeader()</code> method still work? <p>Although, I agree with <a href="https://stackoverflow.com/questions/114772/adding-custom-headers#114913">Oscar</a> that a formal testing solution like <a href="http://nunitasp.sourceforge.net/" rel="nofollow noreferrer">NUni... | 14,006 |
<p>I have been sold on mod_wsgi and apache rather than mod_python.
I have all the parts installed (django, apache, mod_wsgi) but have run into a problem deploying.</p>
<p>I am on osx 10.5 with apache 2.2 and django 1.0b2, mod_wsgi-2.3</p>
<p>My application is called tred.</p>
<p>Here are the relevant files:
httpd-vh... | <p>What happens if you remove the <code>Alias /</code> directive?</p>
| <p>try following this tutorial - <a href="http://singlas.in/5-step-tutorial-for-using-django-with-apache-and-mod_wsgi/" rel="nofollow">http://singlas.in/5-step-tutorial-for-using-django-with-apache-and-mod_wsgi/</a></p>
<p>you are trying to host apache /var/www/ folder and the Django app both at root (/). Since Alias ... | 5,739 |
<p>Is there a way to vertically stack selected td elments? I would like to have the same table, though display it differently using only css. Would this be possible, or do I have to have separate html markups? I would like to try to have the same html markup, though use different css for different sites/looks.</p>
<pr... | <p>You need to create the table stacked</p>
<pre><code><table>
<tr>
<td class="vertical">i'm</td>
<td class="horizontal" rowspan="3">i'm horizontal</td>
</tr>
<tr>
<td class="vertical">above</td>
</tr>
<tr>
<td cla... | <p>You need to create the table stacked</p>
<pre><code><table>
<tr>
<td class="vertical">i'm</td>
<td class="horizontal" rowspan="3">i'm horizontal</td>
</tr>
<tr>
<td class="vertical">above</td>
</tr>
<tr>
<td cla... | 47,068 |
<p>I got a bunch of servlet context listeners in my Java webapp, each of them gathering some information about the environment.</p>
<p>Some of them depend on information which is gathered by another listener. But I can't determine the order in which the listeners are registered and called, so I have to duplicate code.... | <p>All servlet containers and Java EE containers implement this part of the spec strictly. You can rely on the fact that the listeners are called in the order you specified in web.xml.</p>
<p>You can have a Application LEVEL Data structure(HashMap) that will be updated by each Filter/Listener as it encounters the data... | <p>It would seem you can create a ListenerManager which you place as your one and only listener, and have it contain the other Listeners. When the event comes in, simply call each of the other Listeners in the order you require (probably the order you created them in the ListenerManager's constructor).</p>
<p>Unfortu... | 21,522 |
<p>I have a menu of report links in my master page. I need to append an ID to the end of each whenever the user changes a value on the child page. What's a good way to accomplish this?</p>
<p>UPDATE: I should have mentioned that the child update is happening inside an UpdatePanel, meaning the master page is not reload... | <p>A MasterPage is really a child control of the page which it controls. You can control a MasterPage like any other control on your page (almost). All you need to do is get a reference to it.</p>
<p>You add a property to the code of your MasterPage, so its code may look something like this:</p>
<pre><code>public p... | <p>In response to your UPDATE:</p>
<p>The updated panel could write the ID to a hidden field and the menu events could look for that hidden fields in <code>Request.Form["fieldName"]</code>.</p>
<p>Note that you shouldn't <code>fieldName.Text</code> because ASP.NET does a bad job of returning the right value for field... | 47,105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.