instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Is there anything I can add to <code>pom.xml</code> that will copy the generated <code>.war</code> file from the <code>target</code> directory to my Tomcat's <code>webapps</code> directory?</p>
| <pre><code><build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<outputDirectory><!-- Tomcat webapp... | <p>You can also do this with the <a href="http://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html" rel="nofollow noreferrer">dependency plugin</a></p>
| 48,281 |
<p>I don't know how to save object with where clause. I need it to prevent saving object with range of dates overlapping on others.</p>
<pre><code>public class TaskEvent
{
public DateTime StartDate {get;set;}
public DateTime EndDate {get;set;}
}
</code></pre>
<p>I want to check overlaping in criteria within s... | <p>You need to figure out in code which objects need saving, then save those. This is business logic and should not be pushed into persistence operations. IMO, even if NH could support that. </p>
| <p>One approach would be to retermine which TaskEvent objects you do not want to save in code and evict them from the ISession so that they won't be persisted. </p>
| 45,197 |
<p>This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my understanding, unit tests should be:</p>
<ul>
<li>stateless</li>
<li>independent from each other</li>
<li>repeatable with th... | <p>There's no real way to unit test a database other than asserting that the tables exist, contain the expected columns, and have the appropriate constraints. But that's usually not really worth doing.</p>
<p>You don't typically <strong>unit</strong> test the database. You usually involve the database in <strong>integ... | <p>If you're using LINQ to SQL as the ORM then you can generate the database on-the-fly (provided that you have enough access from the account used for the unit testing). See <a href="http://www.aaron-powell.com/blog.aspx?id=1125" rel="nofollow noreferrer">http://www.aaron-powell.com/blog.aspx?id=1125</a></p>
| 4,172 |
<p>I'm trying to get the following code working: </p>
<pre><code> string url = String.Format(@"SOMEURL");
string user = "SOMEUSER";
string password = "SOMEPASSWORD";
FtpWebRequest ftpclientRequest = (FtpWebRequest)WebRequest.Create(new Uri(url));
ftpclientRequest.Method = WebRequestMethods.Ftp.ListDirectory;... | <p>I just tested this on one of our dev servers and indeed there is a CWD issued by the .NET FtpWebRequest:</p>
<pre>
new connection from 172.16.3.210 on 172.16.3.210:21 (Explicit SSL)
hostname resolved : devpc
sending welcome message.
220 Gene6 FTP Server v3.10.0 (Build 2) ready...
USER testuser
testuser, 331 Passwor... | <p>I think we had a similar issue a while back, I don't remember the exact details though.</p>
<p>To prevent .net from issuing the cd command, see if setting the default directory for the user you're login in as is set to the directory you want to work in. You can just use a command line ftp client to check this out.<... | 24,595 |
<p>I'm experiencing an <a href="https://stackoverflow.com/questions/248182/my-c-activemq-client-can-send-messages-but-not-receive-messages">issue</a> with ActiveMQ and would like to trace/view all ActiveMQ activity. The only log file I can find is one associated with persistent data (if this is turned on). Are there ... | <p>activemq has a jmx interface that you can connect to.</p>
<p>this gives us access to consumer counts messages queued dequeue and all sorts of data on memory usage etc.</p>
<p><a href="http://activemq.apache.org/jmx.html" rel="noreferrer">http://activemq.apache.org/jmx.html</a></p>
<p>Has all the details to get yo... | <p>Try <a href="http://hawt.io/" rel="nofollow">HawtIO</a>. Assuming you are not using Active MQ 5.9 you can add this feature to your broker. It is a much better web console and a good JMX monitoring utility as well.</p>
<p><a href="http://www.christianposta.com/blog/?p=315" rel="nofollow">http://www.christianposta.co... | 30,902 |
<p>How can I prevent the image tag that calls the associated image from displaying if no image is associated with the record?</p>
<pre><code><%= image_tag @agent.avatar.url %>
</code></pre>
<p>...gives me the text "Missing" if there is no image associated with that agent. I want to test to see there is an imag... | <p>I use the following to find wether a model has an associated attachment:</p>
<pre><code><% if @agent.avatar.file? %>
<%= image_tag @agent.avatar.url(:normal) %>
<% else %>
No attachment available!
<% end %>
</code></pre>
| <p>You can use this </p>
<pre><code>user.photo.exists?(:medium).
</code></pre>
| 37,978 |
<p>Recently thanks to rails' popularity, many people start using activerecord as model. however, before I heard of rails (my peer group was not a fan of open source stuff, we were taught in a .NET school...) and while I was doing my final year project, i found this definition for a model</p>
<blockquote>
<p>The mode... | <p>Martin Fowler described this pattern in Patterns of Enterprise Application Architecture together with two other patterns or architectures. These patterns are good for different situations and different amounts of complexity.</p>
<p>If you want to so only simple stuff you can use Transaction Script. This is an archi... | <p>The great thing about using the Rails ActiveRecord as a model in MVC is that it gives you an automatic ORM (Object Relational Mapper) and easy way to create associations between models. As you have pointed out, MVC can sometimes be lacking.</p>
<p>Therefore, for some complex transaction involving many models, I'd s... | 8,048 |
<p>I need to be able to periodically send email alerts to subscribed users. PHP seems to struggle with sending <em>one</em> message, so I'm looking for good alternatives.</p>
<p>Any language will do, if the implementation is fast enough. The amount of mails sent will eventually be in the thousands.</p>
<p>If purchasi... | <p>smtplib in python is a doddle to set up and a very clean API.</p>
| <p>There is a dos based command line tool called blat that you can download and send emails very easily</p>
| 19,485 |
<p>Im in the process of learning asp.net 3.5, currently on webparts and co.</p>
<p>Ive started a new project for webparts, not using a database with it, but when i go to view the website (dev server), i get an sql timeout??</p>
<blockquote>
<p>A network-related or instance-specific
error occurred while establishi... | <p>The webparts infrastructure talks to a database.</p>
| <p>Ok fixed, needed to enable/start sql server 2008 express</p>
| 41,194 |
<p>I am attempting to set up an nmake makefile to export our balsamiq mockup files to png files automatically, but I'm afraid I can't make heads nor tails of how to make a generic rule for doing so, without explicitly listing all the files I want exported.</p>
<p><a href="http://www.balsamiq.com/blog/?p=231" rel="nofol... | <p>NMAKE pattern rules are a lot like GNU make old-school suffix rules. In your case, you had it almost right to begin with, but you were missing the .SUFFIXES declaration. For example:</p>
<pre><code>.SUFFIXES: .bmml .png
.bmml.png:
@echo Building $@ from $<
</code></pre>
<p>I think this is only part of you... | <p>Will this work for you? Put this in MAKEFILE.:</p>
<pre><code>export : *.bmml
"C:\Program Files\Balsamiq Mockups\Balsamiq Mockups.exe" export $** $(**B).png
</code></pre>
<p>Then run:</p>
<pre><code>nmake /A
</code></pre>
<p>I don't have Balsamiq so I can't test this but in my case if I have the following MA... | 20,165 |
<p>I have to use both IDEs and I would like to use the Eclipse style of syntax highlighting in Netbeans. Does any one know how to import it (or change any configuration file)? I've already set Netbeans to use the Eclipse key bindings.</p>
<p>Is there any better way than manually changing the colors of every keyword fo... | <p>You can change the style of syntax highlighting in NetBeans by going to <strong>Tools > Options</strong> and selecting the <strong>Fonts & Colors</strong> tab.</p>
<p>In order to import a syntax highlighting profile use the <strong>Import</strong> button from the above mentioned Options window.</p>
<p>A ready-... | <p>As far as I know this is not possible yet. Both IDEs have different systems to store settings on global or project level. I know that there is a plugin that lets you import Ecplise projects into NetBeans.</p>
| 38,774 |
<p>What is the fastest way you know to convert a floating-point number to an int on an x86 CPU. Preferrably in C or assembly (that can be in-lined in C) for any combination of the following:</p>
<ul>
<li>32/64/80-bit float -> 32/64-bit integer</li>
</ul>
<p>I'm looking for some technique that is faster than to just ... | <p>It depends on if you want a truncating conversion or a rounding one and at what precision. By default, C will perform a truncating conversion when you go from float to int. There are FPU instructions that do it but it's not an ANSI C conversion and there are significant caveats to using it (such as knowing the FPU r... | <p>Generally, you can trust the compiler to be efficient and correct. There is usually nothing to be gained by rolling your own functions for something that already exists in the compiler.</p>
| 10,406 |
<p>I have somewhat of a staging server on the public internet running copies of the production code for a few websites. I'd really not like it if the staging sites get indexed. </p>
<p>Is there a way I can modify my httpd.conf on the staging server to block search engine crawlers? </p>
<p>Changing the robots.txt wo... | <p>Create a robots.txt file with the following contents:</p>
<pre><code>User-agent: *
Disallow: /
</code></pre>
<p>Put that file somewhere on your staging server; your directory root is a great place for it (e.g. <code>/var/www/html/robots.txt</code>).</p>
<p>Add the following to your httpd.conf file:</p>
<pre><cod... | <p>Try <a href="http://www.evolt.org/article/Using_Apache_to_stop_bad_robots/18/15126/" rel="nofollow noreferrer">Using Apache to stop bad robots</a>. You can get the <a href="http://www.user-agents.org/" rel="nofollow noreferrer">user agents</a> online or just allow browsers, rather than trying to block all bots.</p>... | 28,099 |
<p>What is an effective algorithm for nesting 1 dimensional lengths into predefined stock lengths?</p>
<p>For example, If you required steel bars in the following quantities and lengths,</p>
<ul>
<li>5 x 2 metres </li>
<li>5 x 3 metres</li>
<li>5 x 4 metres</li>
</ul>
<p>and these can be cut from 10 metre bars.
How ... | <p>Actually, there's an even more specific problem that applies: The <a href="http://en.wikipedia.org/wiki/Cutting_stock_problem" rel="noreferrer">cutting stock problem</a>:</p>
<blockquote>
<p>The cutting stock problem is an
optimization problem, or more
specifically, an integer linear
programming problem. It... | <p>Solved a problem similar to this years ago. I ended up using a genetic algorithm. That would be overkill for small problems. This program was somewhat fun to write, but not fun at the same time, being back in the 16-bit days.</p>
<p>First, it made a list of all the ways a 10' piece of raw material could be cut, ... | 21,008 |
<p>How do I access specific sections of man pages?</p>
| <p>Put the section number in front of the item you want to reference. For example, to access the sysctl function from the library section, you can write:</p>
<pre><code>man 3 sysctl
</code></pre>
<p>and to access the sysctl tool from the system administrator's section, you would write:</p>
<pre><code>man 8 sysctl
</... | <p>use the -s flag, for example:</p>
<pre><code>man -s 2 read
</code></pre>
<p>you might like to look at</p>
<pre><code>man intro
</code></pre>
<p>to get an idea of what's where.</p>
<p>HTH.</p>
<p>cheers,</p>
<p>Rob</p>
| 34,031 |
<p>Say I'm extending a TextBox called CustomTextBox in .net. In certain situations I would like to force a tab to the next TabIndex on the form. Is there a way to do this beyond getting all the controls contained in CustomTextBox's parent, sorting them by their TabIndex, and then focusing the next ordinal one?</p>
| <p>I think you are looking for something like the following method:</p>
<pre><code>form1.SelectNextControl(textBox1, true, true, true, true);
</code></pre>
<p>(All the trues are just different options, read the intellisense!)</p>
<p>You did say it is WinForms and not WebForms right?</p>
| <p>If you're extending a normal Winforms Textbox, you can set the <strong>AcceptsTab</strong> property to True or False, depending on your needs. If it's true, then a tab character will be inserted into your textbox. If it's false, then hitting the Tab key will move focus to the next control in the Tab Order</p>
| 41,643 |
<p>I would like to create a WLST script to create my Weblogic domain. However I'm having problems adding the LDAP config.</p>
<pre><code>cd("/SecurityConfiguration/myDomain")
cmo.createRealm("myrealm")
cd("/SecurityConfiguration/myDomain/Realms/myrealm")
cmo.createAuthenticationProvider("myLDAP", "weblogic.security.p... | <p>From what I've found, this configuration has to be done using WLST Online.</p>
<p>The script I have created looks something like this</p>
<pre><code>connect("username", "password", "t3://ip:port");
edit()
startEdit()
create_AuthenticationProvider_54("/SecurityConfiguration/myDomain/Realms/myrealm", "value")
cd("... | <p>I always use online, but WLST offline will work with security providers that come with WebLogic, but not with custom providers. Of course, the NovelAuthenticator comes with WebLogic, so it should work.</p>
<p>Try</p>
<pre><code>realm = cmo.getSecurityConfiguration().getDefaultRealm()
myProvider = realm.createAuthe... | 41,439 |
<p>I'm trying to create a function in C# which will allow me to, when called, return a reference to a given class type. The only types of functions like this that I have seen are in UnrealScript and even then the functionality is hard coded into its compiler. I'm wondering if I can do this in C#. Here's what I mean ... | <p>Rather than use a generic <em>class</em>, use a generic <em>method</em>:</p>
<pre><code>public T Spawn<T>() where T : new()
{
return new T();
}
</code></pre>
<p>Having said that, I assume you want to do more than just blindly create an instance, otherwise you could just call <code>new MyClass()</code> yo... | <p>You can use the class System.Type to represent classes. To get references to type objects, you either use typeof (in a scope where the class is actually defined)</p>
<pre><code>System.Type t = typeof(ActorChild);
</code></pre>
<p>or the Type.GetType function (if you only know the name of the type)</p>
<pre><code>... | 32,018 |
<p>I'm working on a small project in VB.Net where I get a input from a textbox, and need to verify that this is an e-email address.</p>
<p>I found this expression "^[_a-z0-9-]+(.[_a-z0-9-]+)<em>@[a-z0-9-]+(.[a-z0-9-]+)</em>(.[a-z]{2,4})$", but i cant find any way to test if it passes.</p>
<p>I want some code like: <... | <p>Use the <code>System.Text.RegularExpressions.Regex</code> class:</p>
<pre><code>Function IsEmail(Byval email as string) as boolean
Static emailExpression As New Regex("^[_a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$")
return emailExpression.IsMatch(email)
End Function
</code></pre>
<p>The... | <p>Email address: RFC 2822 (simplified)
Matches a normal email address. Does not check the top-level domain.
Requires the "case insensitive" option to be ON.</p>
<pre><code>Dim FoundMatch As Boolean
Try
FoundMatch = Regex.IsMatch(txtEmail.text, "\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{... | 48,267 |
<p>I am interested in learning MVC, and have experimented with a couple of the sample apps. As a project, I'd like to move part or all of my own office app to MVC. An important part of this app, and of ALL of my apps for customers, is the printing of invoices, purchase orders, inventory lists and so forth. In fact, o... | <p>Assume controls <strong>don't</strong> work until you can prove otherwise.</p>
<p>In MVC, there is no server-side form, no post back, no view state. If the control relies on any of these things -- and most do -- then it won't work properly in MVC.</p>
| <p>I don't see any reason why is won't work. ASP.Net work the same way is it you were using Web Forms. The only thing you don't get is the Postback, which I don't think is necessary if you are just rendering a report in your page.</p>
| 47,945 |
<p>In an Adobe flex applicaiton using BlazeDS AMF remoting, what is the best stategy for keeping the local data fresh and in synch with the backend database? </p>
<p>In a typical web application, web pages refresh the view each time they are loaded, so the data in the view is never too old. </p>
<p>In a Flex applica... | <p>a. Consider optimizing back-end changes through a proxy that does its own notification or poling: it knows if any of the data is dirty, and will quick-return (a la a 304) if not.</p>
<p>b. Often, users look more than they touch. Consider one level of refresh for looking and another when they start and continue to e... | <p>In the past I have gone with choice "a". If you were using Remote Objects you could setup some cache-style logic to keep them in sync on the remote end.</p>
<p>Sam</p>
| 13,349 |
<p>How do I get whole and fractional parts from double in JSP/Java ? If the value is 3.25 then I want to get <code>fractional =.25</code>, <code>whole = 3</code></p>
<p>How can we do this in Java?</p>
| <p><a href="http://www.java2s.com/Code/Java/Data-Type/Obtainingtheintegerandfractionalparts.htm" rel="noreferrer">http://www.java2s.com/Code/Java/Data-Type/Obtainingtheintegerandfractionalparts.htm</a></p>
<pre><code>double num;
long iPart;
double fPart;
// Get user input
num = 2.3d;
iPart = (long) num;
fPart = num -... | <pre><code>public class MyMain2 {
public static void main(String[] args) {
double myDub;
myDub=1234.5678;
long myLong;
myLong=(int)myDub;
myDub=(myDub%1)*10000;
int myInt=(int)myDub;
System.out.println(myLong + "\n" + myInt);
}
}
</code></pre>
| 44,684 |
<p>I'm building a 3D printer and I've been looking around for materials suitable to make the frame.</p>
<p>I have occasional access to a laser cutter which I could use to manufacture a ply box-type (UltiMaker) enclosure, but I like the ease of adjustment provided by the T-slot beam kits.</p>
<p>I don't have any metal... | <p>Aluminum of almost every grade is very easy to cut with a hacksaw. I would suggest to mark clearly the cut line and to wrap masking tape at the edge of the cut. Consider to allow for about 2-3 millimeters (1/16") extra material for final finishing. Cut across the line, rotate the part ninety degrees and cut again. O... | <p>As an alternative solution, Misumi sells extrusions precision-cut to length for a very reasonable price. You'll get better quality ends and a more precisely square frame from Misumi than if you try to cut them yourself. The HFS-5 series of 2020 is perfect for 3D printers. </p>
| 222 |
<p>I am interested in using Xaml with expression blend for creating user interfaces in an application. However, because of the limitations of the target architecture, I cannot use WPF or C#.</p>
<p>So, what I am interested in is in any examples / existing projects or advice from anyone who has experiance of this techn... | <p>Have you checked out the XAML spec.
<a href="http://download.microsoft.com/download/0/A/6/0A6F7755-9AF5-448B-907D-13985ACCF53E/[MS-XAML].pdf" rel="nofollow noreferrer">http://download.microsoft.com/download/0/A/6/0A6F7755-9AF5-448B-907D-13985ACCF53E/[MS-XAML].pdf</a></p>
<p>XAML 2009 and the system.xaml.dll in clr... | <p>If your not using WPF then Xaml as its core is no better than XML really. Xaml has a few flavours but they are essentially addition functionality in the form of libraries. You could use Vanilla Xaml as a base but then you would essentially have to build a parser that reads it and then a framework of code that it ess... | 26,832 |
<p>I would like to log the name of all the files I access from a particular network share (and the process accessing the the file).</p>
<p>What are the solutions in C++ / Win32 preferably ?</p>
| <p>You need <a href="http://msdn.microsoft.com/en-us/library/aa365465(VS.85).aspx" rel="nofollow noreferrer">ReadDirectoryChangesW</a> and the FILE_NOTIFY_CHANGE_LAST_ACCESS notification flag.</p>
<p>I don't think the old FindFirstChangeNotification will work for you as it only notifies on changes, not access, but I'v... | <p>If it's for after-the-fact, you could use the <a href="http://technet.microsoft.com/en-us/library/dd772690%28WS.10%29.aspx" rel="nofollow">Windows' security auditing</a>.</p>
<p>If you need to do it in real-time, then you might need to interface with the <a href="http://msdn.microsoft.com/en-us/library/windows/desk... | 36,503 |
<p>I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm going to use Cygwin for my Unix commands on Windows, but I'm not sure how well that's ... | <p>These work very well for me: <a href="http://unxutils.sourceforge.net/" rel="nofollow noreferrer">http://unxutils.sourceforge.net/</a>.</p>
<p>Cygwin is not so good on Vista or 64 bit, so I stopped using it a while back.</p>
| <p><a href="https://stackoverflow.com/questions/32777/what-is-the-best-and-most-complete-implementation-of-unix-system-commands#32792">Why vote down this question</a>? It's obviously meant to be tongue in cheek is it worth the voter and the receiver losing rep over? Can't you people leave anything at zero and mark up... | 5,278 |
<p>Can someone explain what this means?</p>
<pre><code>int (*data[2])[2];
</code></pre>
| <p><strong>What are the parentheses for?</strong></p>
<p>In C brackets [] have a higher precedence than the asterisk *</p>
<p><strong>Good explanation from Wikipedia:</strong></p>
<blockquote>
<p>To declare a variable as being a
pointer to an array, we must make use
of parentheses. This is because in C
brack... | <p>data[2] - an array of two integers</p>
<p>*data[2] - a pointer to an array of two integers</p>
<p>(*data[2]) - "</p>
<p>(*data[2])[2] - an array of 2 pointers to arrays of two integers.</p>
| 30,344 |
<p>I like the XMLReader class for it's simplicity and speed. But I like the xml_parse associated functions as it better allows for error recovery. It would be nice if the XMLReader class would throw exceptions for things like invalid entity refs instead of just issuinng a warning.</p>
| <p>I'd avoid SimpleXML if you can. Though it looks very tempting by getting to avoid a lot of "ugly" code, it's just what the name suggests: simple. For example, it can't handle this:</p>
<pre><code><p>
Here is <strong>a very simple</strong> XML document.
</p>
</code></pre>
<p>Bite the bul... | <p>I mostly stick to SimpleXML, at least whenever PHP5 is available for me.</p>
<p><a href="http://www.php.net/simplexml" rel="nofollow noreferrer">http://www.php.net/simplexml</a></p>
| 9,406 |
<p>We have two tags: <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged 'support'" rel="tag">support</a> & <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged '... | <p>The tags <a href="https://3dprinting.stackexchange.com/questions/tagged/support" class="post-tag" title="show questions tagged 'support'" rel="tag">support</a> & <a href="https://3dprinting.stackexchange.com/questions/tagged/support-structures" class="post-tag" title="show questions tagged 'support-s... | <p>I've made a synonym - <strike>apparently it needs <a href="https://3dprinting.stackexchange.com/tags/support-structures/synonyms">some votes</a></strike>.</p>
| 57 |
<p>When I try to use an <strong>ssh</strong> command in a shell script, the command just sits there. Do you have an example of how to use <strong>ssh</strong> in a shell script?</p>
| <p>Depends on what you want to do, and how you use it. If you just want to execute a command remotely and safely on another machine, just use</p>
<pre><code>ssh user@host command
</code></pre>
<p>for example</p>
<pre><code>ssh user@host ls
</code></pre>
<p>In order to do this safely you need to either ask the user ... | <p>The easiest way is using a certificate for the user that runs the script.</p>
<p>A more complex one implies adding to stdin the password when the shell command asks for it. Expect, perl libraries, show to the user the prompt asking the password (if is interactive, at least), there are a lot of choices.</p>
| 4,873 |
<p>I love the way I can profile a Java/.Net app to find performance bottlenecks or memory problems. For example, it's very easy to find a performance bottleneck looking at <a href="http://www.yourkit.com/dotnet/features/cpu-tree-threads-together.gif" rel="nofollow noreferrer">the call tree with execution times and invo... | <p>Check out <a href="http://www.codeplex.com/sqlnexus/Wiki/View.aspx?title=SqlNexusReports&referringTitle=Home" rel="nofollow noreferrer">SQL Nexus Tool</a>. This has some good reports on identifying bottlenecks.
SQL Nexus is a tool that helps you identify the root cause of SQL Server performance issues. It loads ... | <p>You could use S<a href="http://msdn.microsoft.com/en-us/library/ms181091.aspx" rel="nofollow noreferrer">ql Profiler</a> - which covers the profiling aspect, but I tend to think of it more as a logging tool.
For diagnosing performance, you should probably just be looking at the <a href="http://www.sql-server-perfor... | 18,529 |
<p>There are multiple values I have been storing in ASP.NET configSections sections for each "module". I have been wondering if they even belong in these files at all.</p>
<p>The background stands at: These are multiple instances of the web application deployed. All use the same database but have their own settings.</... | <p>Mmm these sounds like things that you might want be able to change at runtime for your application without having to modify the app.config. One rule of thumb I like to follow is that anything in the config should be for the deployment or server configuration. In this case your settings appear to be modifying the app... | <p>A few questions: Why do you use the same DB for multiple instances of the application, and how will that effect maintanence?
In the future will it be an option to split the db in order to improve performance? Does the config model support that change better then the DB based one?</p>
<p>In other words, you will ha... | 27,599 |
<p>I can see some options available:</p>
<p>1) Use PEAR's POP3 class --> tried it, having some weird weird issues like FF choking to death on their sample code!!!</p>
<p>2) Use PHPClasses (<a href="http://www.phpclasses.org/" rel="nofollow noreferrer">here</a>) --> seems to be the viable option at the time, still wor... | <p>The native PHP IMAP functions support POP3 mailboxes, and will probably be faster than anything written purely in PHP. There are generally some useful comments and examples in the PHP manual, for example on the <a href="http://uk3.php.net/imap_open" rel="noreferrer">imap_open</a> page.</p>
| <p>I've just discovered <a href="http://ezcomponents.org" rel="nofollow noreferrer">ezcomponents</a>. Real nice to work with.</p>
| 42,168 |
<p>I am using a third-party DLL. For some particular cases, a function in the DLL is throwing an exception. Is it possible to debug the DLL in the Visual Studio?</p>
<p>After <a href="https://stackoverflow.com/questions/349918/debugging-a-third-party-dll-in-visual-studio/349925#349925">the answer from Andrew Rollings<... | <p>If the DLL is in a <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> language, you can decompile it using a tool like <a href="http://en.wikipedia.org/wiki/.NET_Reflector" rel="noreferrer">.NET Reflector</a> and then debug against the source code.</p>
<p>Or you could ask the vendor if ... | <p>I thought .NET Reflector got some debugging plugins. That'd be a so much better idea because decompiling and recompiling code generally fails, and you need to do so many changes in the code to fix it.</p>
<p>Give .NET Reflector debugger a try. It might help you a lot.</p>
| 45,536 |
<p>I have a page using <code><ul></code> lists for navigation (Javascript changes the styling to display or not on mouseover).</p>
<p>This is working fine for me <em>except</em> in IE6 and IE7 when I have a Google Map on the page.</p>
<p>In this case the drop-down simply does not work. However, the page continu... | <p>I don't know if this will fix your problem but you may want to try <a href="http://www.cssplay.co.uk/menus/pro_drop8.html" rel="nofollow noreferrer">this solution at ccsplay.co.uk</a> which fixes the problem of menus appearing underneath drop-down lists. I don't know if it will work for sure, but it's worth a shot.<... | <p>I don't have an immediate answer for you, but the tools mentioned in <a href="https://stackoverflow.com/questions/17561/recommendations-for-browser-add-on-tools-to-help-with-development#17621">this answer</a> (particularly the IE DOM Inspector) may help.</p>
| 3,961 |
<p>I wrote a PHP web-application using <code>SQLite</code> and sessions stored on <code>filesystem</code>.</p>
<p>This is functionally fine and attractively low maintenance. But, now it needs to run on a shared host.</p>
<p>All web-applications on the shared host run as the same user, so my users' session data is vu... | <p>As long as your code is running as the shared web user, anything stored on the server is going to be vulnerable. Any other user could write a PHP script to examine any readable file on the server, including your data and PHP code.</p>
<p>If your hosting provider will allow it, running as PHP as a CGI under a diffe... | <p>A shared host is no way to run a web site if you are conscious about privacy and security of your data from the sites that you share the server with. Anything accessible to your web application is fair game for the others; it'll only be a matter of time before they can access it (assuming they do have incentive to d... | 15,908 |
<p>I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML:</p>
<pre><code>Node Tidy.parse(Reader, Writer)
</code></pre>
<p>And to get the <body /> of that Node, I assume, I should use</p>
<pre><code>Node Node.findBody(TagTab... | <p>I found there's <em>much</em> simpler method to extract the body:</p>
<pre>
tidy = new Tidy();
tidy.setXHTML(true);
<b>tidy.setPrintBodyOnly(true);</b>
</pre>
<p>And then use tidy on the Reader-Writer pair.</p>
<p>Simple as it should be.</p>
| <p>You could use the <code>parseDOM</code> method instead, which would give you a <code>org.w3c.dom.Document</code> back:</p>
<pre><code>Document document = Tidy.parseDOM(reader, writer);
Node body = document.getElementsByTagName("body").item(0);
</code></pre>
| 27,261 |
<p>It looks like the run-time compiler doesn't support the same language as the command-line compiler so if you want to use lambda expressions, extensions methods or LINQ, well, you're stuck.</p>
<p>There's more detail here:</p>
<p><a href="http://metadatalabs.com/blog/" rel="nofollow noreferrer">http://metadatalabs.... | <p>This guy's blog seems to have the answer</p>
<p><a href="http://andersnoras.com/blogs/anoras/archive/2008/04/13/codedomproviders-and-compiler-magic.aspx" rel="nofollow noreferrer">CodeDomProviders</a></p>
<p>Looks like the factory defaults the instance it returns to 2.0.</p>
<p>This seems like a pretty crazy tech... | <p>I haven´t tried that, but it sounds crazy..</p>
<p>In the future that wont be a problem, since the .NET team are going to have the C# compiler available as a service, which means you can work with the real C# compiler in your code. Take a look at this video:</p>
<p><a href="http://channel9.msdn.com/pdc2008/TL16/" ... | 36,404 |
<p>Is it possible to do a cast within a LINQ query (for the compiler's sake)?</p>
<p>The following code isn't terrible, but it would be nice to make it into one query:</p>
<pre><code>Content content = dataStore.RootControl as Controls.Content;
List<TabSection> tabList = (from t in content.ChildControls
... | <p>Try this:</p>
<pre><code>from TabSection t in content.ChildControls
</code></pre>
<p>Also, even if this were not available (or for a different, future scenario you may encounter), you wouldn't be restricted to converting everything to Lists. Converting to a List causes query evaluation on the spot. But if you re... | <p>yes you can do the following:</p>
<pre><code>List<TabSection> tabList = (from t in content.ChildControls
where t as TabSection != null
select t as TabSection).ToList();
</code></pre>
| 19,189 |
<p>Is it possible to import a python file more than once in a python script because i run a loop back to my driver file in a function by using the import command but it only works once? thanks</p>
<p><strong>edit:</strong> Resolved myself thanks</p>
| <p>You most probably should not use import for what you are trying to do.</p>
<p>Without further information I can only guess, but you should move the code in the module you import from the top level into a function, do the import once and than simply call the function from you loop.</p>
| <p>The import statement -- by definition -- only imports once. </p>
<p>You can, if you want, try to use <code>execfile()</code> (or <code>eval()</code>) to execute a separate file more than once. </p>
| 34,895 |
<p>Suppose I have the following CSS rule in my page:</p>
<pre class="lang-css prettyprint-override"><code>body {
font-family: Calibri, Trebuchet MS, Helvetica, sans-serif;
}
</code></pre>
<p>How could I detect which one of the defined fonts were used in the user's browser?</p>
<p>For people wondering why I want to ... | <p>I've seen it done in a kind of iffy, but pretty reliable way. Basically, an element is set to use a specific font and a string is set to that element. If the font set for the element does not exist, it takes the font of the parent element. So, what they do is measure the width of the rendered string. If it matche... | <p>You can use this website :</p>
<p><a href="http://website-font-analyzer.com/" rel="nofollow noreferrer">http://website-font-analyzer.com/</a></p>
<p>It does exactly what you want...</p>
| 2,328 |
<p>In my applications, I often have to use relative paths. For example, when I reference JQuery, I usually do so like this:</p>
<pre><code><script type="text/javascript" src="../Scripts/jquery-1.2.6.js"></script>
</code></pre>
<p>Now that I'm making the transition to MVC, I need to account for the differe... | <p>Try this:</p>
<pre><code><script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-1.2.6.js")%>"></script>
</code></pre>
<p>Or use <a href="http://www.codeplex.com/MVCContrib" rel="noreferrer">MvcContrib</a> and do this:</p>
<pre><code><%=Html.ScriptInclude("~/Content/Script/jquery... | <p>Like Chris, I really can't stand having to put bloated server-side tags inside my clean markup just purely to tell the stupid thing to look from the root upwards. That should be a very simple, reasonable thing to ask for. But I also hate the idea of having to go to the effort of writing any custom C# classes to do s... | 40,986 |
<p>Can anyone explain to me how to get the visual state manager to work with a WPF application? It's just been added to the new wpftoolkit. I installed it as told, but even the sample doesn't show the VSM. In silverlight it work, but not in WPF. If installed the latest Blend 2 and updated with the SP1. </p>
| <p>This might also help: <a href="http://blogs.msdn.com/expression/archive/2008/10/30/blend-2-sp1-wpf-toolkit-visual-state-manager-for-wpf.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/expression/archive/2008/10/30/blend-2-sp1-wpf-toolkit-visual-state-manager-for-wpf.aspx</a></p>
| <p>Read these 2 articles on VSM in WPF:</p>
<ul>
<li><a href="http://dotnet.org.za/rudi/archive/2008/10/29/silverlight-love-for-wpf.aspx" rel="nofollow noreferrer">http://dotnet.org.za/rudi/archive/2008/10/29/silverlight-love-for-wpf.aspx</a></li>
<li><a href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-visua... | 31,038 |
<p>I'm wondering if there is some trick to power my OctoPi with the power supply of my 3D printer. I'm using an Geeetech I3 Pro W.</p>
<p>The power supply itself should be able, but the output is as far as I'm aware of 3.3 volts. Not my desired 5 V for USB, it would be a shame if I really would need to buy a new ... | <p>What you are looking for is called a "buck converter" or a "step down module". These literally cost about half a buck/Euro a piece. These converters convert a high voltage into a low voltage, the better ones are able to draw 2 to 3 Amps, which is required for stable operation of the Raspberry Pi.</p>
<p>If you have... | <p>Thank you guys for your help. I ended up with a suggested <a href="https://www.amazon.de/dp/B0768D2NYH?tag=t--21" rel="nofollow noreferrer">"Step Down Power Module"</a> which works fine for me. I connected that module directly with the power supply of the printer with a blade connector. The first startup showed me a... | 1,299 |
<p>I have an application where I would like to have mixed Java and Scala source (actually its migrating a java app to scala - but a bit at a time). </p>
<p>I can make this work in IDEs just fine, very nice. But I am not sure how to do this with maven - scalac can compile java and scala intertwined, but how to I set up... | <p>Using the maven scala plugin, a config like the one below will work for a project that mixes java and scala source (scala source of course goes in the /scala directory, as mentioned by someone else). </p>
<p>You can run run mvn compile, test etc... and it will all work as normal. Very nice (it will run scalac first... | <p>You need to combine several approaches in order to mix scala and java classes freely. This solution worked for me: </p>
<pre><code> <properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<!-- <... | 43,609 |
<p>How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following?</p>
<pre><code>if (!isObjectLoaded(someVar)) {
someVar= loadObject();
}
</code></pre>
| <p>If it is an object then you should just be able to check to see if it is <a href="http://javascript.about.com/od/reference/g/rnull.htm" rel="nofollow noreferrer">null</a> or <a href="http://javascript.about.com/od/reference/g/sundefined.htm" rel="nofollow noreferrer">undefined</a> and then load it if it is.</p>
<pr... | <p><code>typeof(obj)</code> would return "object" for an object of a class among other possible values.</p>
| 12,143 |
<p>I've been writing PHP for about six years now and have got to a point where I feel I should be doing more to write better code. I know that Object Oriented code is the way to go but I can't get my head around the concept.</p>
<p>Can anyone explain in terms that any idiot can understand, OO and how it works in PHP o... | <p>Think of a thingy. Any thingy, a thingy you want to do stuff to. Say, a breakfast.</p>
<p>(All code is pseudocode, any resemblance to any language living, dead, or being clinically abused in the banking industry is entirely coincidental and nothing to do with your post being tagged PHP)</p>
<p>So you define a temp... | <p>The best advice was from: xtofl.myopenid.com ^^^^</p>
<p>If you don't understand the purposes of patterns, your really not going to use objects to their fullest. You need to know why inheritence, polymorphism, interfaces, factories, decorators, etc. really make design easier by addressing particular issues.</p>
| 10,963 |
<p>I'm running a console app (myApp.exe) which outputs a pseudo localized (unicode) string to the standard output.
If I run this in a regular command prompt(cmd.exe), the unicode data gets lost.
If I run this in a unicode command prompt(cmd.exe /u) or set the properties of the console to "Lucida Console" then the unico... | <p>It looks like you need to change the encoding on the StandardOutput stream from your console app, using the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.standardoutputencoding.aspx" rel="nofollow noreferrer">StandardOutputEncoding</a> property on ProcessStartInfo. Try adding t... | <p>First set <code>process.StartInfo.StandardOutputEncoding = Encoding.Default</code>.</p>
<p>Then goto <code>Control Panel</code> > <code>Region</code> > <code>Administrative</code> > <code>Change system locale...</code> and set encoding of your pseudo localized string there.</p>
| 25,348 |
<p>I have binary data in an unsigned char variable.
I need to convert them to PEM base64 in c.
I looked in openssl library but i could not find any function.
Does any body have any idea?</p>
| <p>Here's the one I'm using:</p>
<pre><code>#include <stdint.h>
#include <stdlib.h>
static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
... | <p>Here is an optimized version of encoder for the accepted answer, that also supports line-breaking for MIME and other protocols (simlar optimization can be applied to the decoder):</p>
<pre><code> char *base64_encode(const unsigned char *data,
size_t input_length,
size_t *outp... | 44,514 |
<p>When I started using SoundEngine (from CrashLanding and TouchFighter), I had read about a few people recommending not to use it, for it was, according to them, not stable enough. Still it was the only solution I knew of to play sounds with pitch and position control without learning C++ and OpenAL, so I ignored the ... | <p>Look at <a href="https://sourceforge.net/projects/clunk" rel="nofollow noreferrer">this</a> library, but i don't know is this what you need.</p>
| <p>Why not just use AVFoundation? It's pretty simple to handle and nicely flexible - apart from if you need exact timing (says the Apple documentation - but I've been testing it fairly extensively and yet to find any significant practical issues) I don't see any reason for not leveraging it.</p>
| 45,304 |
<p>Is there a way to search the latest version of every file in TFS for a specific string or regex? This is probably the only thing I miss from Visual Source Safe... </p>
<p>Currently I perform a Get Latest on the entire codebase and use Windows Search, but this gets quite painful with over 1GB of code in 75,000 file... | <p>Team Foundation Server 2015 (on-premises) and Visual Studio Team Services (cloud version) include built-in support for searching across all your code and work items.</p>
<p>You can do simple string searches like <code>foo</code>, boolean operations like <code>foo OR bar</code> or more complex language-specific thin... | <p>This add-in claims to have the functionality that I believe you seek:</p>
<p><a href="http://www.attrice.info/cm/tfs/index.htm" rel="nofollow noreferrer">Team Foundation Sidekicks</a></p>
| 6,232 |
<p>I have a ComponentResourceKey defined in my resource dictionary like this:</p>
<pre><code><Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:Resources}, ResourceId=BaseControlStyle}" TargetType="{x:Type FrameworkElement}">
<Setter Property="Margin" Value="4,4,0,0" />
</Style&g... | <p>I figured it out. </p>
<pre><code>myTextBox.Style =
Application.Current.TryFindResource(Resources.BaseControlStyleKey)
as Style;
</code></pre>
| <p>After you have created a separate ComponentResourceKey holder (Resources class) you can simplify your key declaration.</p>
<p><strong>Instead of:</strong></p>
<pre><code><Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:Resources}, ResourceId=BaseControlStyle}" TargetType="{x:Type Framework... | 43,843 |
<p>I am creating a form in HTML that will be printed, with fields that need to be written in by the recipient. Basically what I want is a single line that stretches from the end of the field label to the side of the page. Here's how I'm doing it right now:</p>
<pre><code><table width="100%">
<tr>
... | <p>Here's my CSS:</p>
<pre><code>span.print_underline
{
display: inline-block;
height: 1em;
border-bottom: 1px solid #000;
}
</code></pre>
<p>So your HTML will look like:</p>
<pre><code><span class="print_underline" style="width: 200px">&nbsp;</span>
</code></pre>
<p>I left the width out... | <p>How about using the span tag?</p>
<pre><code><span style="border-bottom....">Text</span>
</code></pre>
| 36,623 |
<p>I would like to compare a screenshot of one application (could be a Web page) with a previously taken screenshot to determine whether the application is displaying itself correctly. I don't want an exact match comparison, because the aspect could be slightly different (in the case of a Web app, depending on the brow... | <p>This depends entirely on how smart you want the algorithm to be.</p>
<p>For instance, here are some issues:</p>
<ul>
<li>cropped images vs. an uncropped image</li>
<li>images with a text added vs. another without</li>
<li>mirrored images</li>
</ul>
<p>The easiest and simplest <em>algorithm</em> I've seen for this... | <p>Well a really base-level method to use could go through every pixel colour and compare it with the corresponding pixel colour on the second image - but that's a probably a very <strong>very</strong> slow solution.</p>
| 4,555 |
<p>How do I get timestamp from e.g. <code>22-09-2008</code>?</p>
| <p><br/></p>
<p><em>This method works on <strong>both</strong> Windows and Unix <strong>and</strong> is <strong>time-zone</strong> aware, which is probably what you want if you work with <a href="https://unix4lyfe.org/time/" rel="noreferrer">dates</a>.</em></p>
<p>If you don't care about timezone, or want to use the ... | <p>If you're looking to convert a UTC datetime (<code>2016-02-14T12:24:48.321Z</code>) to timestamp, here's how you'd do it:</p>
<pre><code>function UTCToTimestamp($utc_datetime_str)
{
preg_match_all('/(.+?)T(.+?)\.(.*?)Z/i', $utc_datetime_str, $matches_arr);
$datetime_str = $matches_arr[1][0]." ".$matches_arr... | 13,897 |
<p>I'm having trouble dynamically adding controls inside an update panel with partial postbacks. I've read many articles on dynamic controls and I understand how to add and maintain them with postbacks but most of that information doesn't apply and won't work for partial postbacks. I can't find any useful information a... | <p>This is, I think, one of the common pitfalls for asp.net programmers but isn't actually that hard to get it right when you know what is going on (always remember your viewstate!).</p>
<p>the following piece of code explains how things can be done. It's a simple page where a user can click on a menu which will trigge... | <p>I encountered the problem that using the method mentioned above, LoadUserControl() is called twice when handling an event. I've read through some other articles and would like to show you my modification:</p>
<p>1) Use LoadViewstate instead of Page_Load to load the user control:</p>
<pre><code>protected override v... | 26,235 |
<p>Can jQuery be extended so that I can use the above syntax?</p>
<p>I can't figure out how to prototype whatever it is $() returns, so that I can call $().$()</p>
<p>Thanks.</p>
| <p>you can use <a href="http://docs.jquery.com/Traversing/find" rel="nofollow noreferrer"><code>find()</code></a></p>
<p>eg: <code>$('.superset').find('.within');</code></p>
<p>or much simpler, <code>$('.superset .within');</code></p>
| <blockquote>
<p>Can jQuery be extended so that I can use the above syntax?</p>
</blockquote>
<p>Yes!</p>
<pre><code>$.fn.$ = $.fn.find;
</code></pre>
<p>Now you can use <code>.$()</code></p>
| 46,715 |
<p>I wish to migrate the database of a legacy web app from SQL Server to MySQL. What are the limitations of MySQL that I must look out for ? And what all items would be part of a comprehensive checklist before jumping into actually modifying the code ? </p>
| <p>First thing I would check is the data types - the exact definition of datatypes varies from database to database. I would create a mapping list that tellme what to map each of the datatypes to. That will help in building the new tables. I would also check for data tables or columns that are not being used now. No po... | <p>One thing I forgot, make sure the dev database you are running the migration from (the sql server database) is updated from production immediately before each test run. Hate to have something fail on prod because you were testing against outdated records.</p>
| 25,157 |
<p>I've got a System.Generic.Collections.List(Of MyCustomClass) type object.</p>
<p>Given integer varaibles pagesize and pagenumber, how can I query only any single page of MyCustomClass objects?</p>
| <p>If you have your linq-query that contains all the rows you want to display, this code can be used:</p>
<pre><code>var pageNum = 3;
var pageSize = 20;
query = query.Skip((pageNum - 1) * pageSize).Take(pageSize);
</code></pre>
<p>You can also make an extension method on the object to be able to write</p>
<pre><code... | <p>Hi There is a wicked thing called PagedList which i got when watching a Rob Conery Screen Cast. </p>
<p><a href="http://blog.wekeroad.com/2007/12/10/aspnet-mvc-pagedlistt/" rel="noreferrer">http://blog.wekeroad.com/2007/12/10/aspnet-mvc-pagedlistt/</a></p>
<p>It has all the Skip and Take stuff built in.</p>
<p>Al... | 4,144 |
<p>Does anyone have a good algorithm for taking an ordered list of integers, i.e.:<br>
[1, 3, 6, 7, 8, 10, 11, 13, 14, 17, 19, 23, 25, 27, 28]</p>
<p>into a given number of evenly sized ordered sublists, i.e. for 4 it will be:<br>
[1, 3, 6] [7, 8, 10, 11] [13, 14, 17, 19] [23, 25, 27, 28]</p>
<p>The requirement being... | <p>Splitting the lists evenly means you will have two sizes of lists - size S and S+1.</p>
<p>With N sublists, and X elements in the original, you would get:</p>
<p>floor(X/N) number of elements in the smaller sublists (S), and X % N is the number of larger sublists (S+1).</p>
<p>Then iterate over the original array... | <p><a href="https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python">Here's</a> a solution for Python. You can translate it to Java, you need a way to get a piece of of a list and then to return it. You cannot use the generator approach though, but you can append each subli... | 41,410 |
<p>A reliable coder friend told me that Python's current multi-threading implementation is seriously buggy - enough to avoid using altogether. What can said about this rumor?</p>
| <p>Python threads are good for <strong>concurrent I/O programming</strong>. Threads are swapped out of the CPU as soon as they block waiting for input from file, network, etc. This allows other Python threads to use the CPU while others wait. This would allow you to write a multi-threaded web server or web crawler, for... | <p>I've used it in several applications and have never had nor heard of threading being anything other than 100% reliable, as long as you know its limits. You can't spawn 1000 threads at the same time and expect your program to run properly on Windows, however you can easily write a worker pool and just feed it 1000 o... | 5,419 |
<p>I often need to implement some sort of rule system that is user-editable -- the requirements are generally different enough that the same system isn't directly applicable, so I frequently run into the same problem--how do I design a rule system that</p>
<ol>
<li>is maintainable</li>
<li>properly balances expressive... | <p>We had an in-house demo of this tool by it's vendor:
<a href="http://www.rulearts.com/rulexpress.php" rel="nofollow noreferrer">http://www.rulearts.com/rulexpress.php</a></p>
<p>As a company, we have a lot of experience with rule engines (e.g. Cleverpath Aion), but mostly developer-oriented tools. This tool (rulexp... | <p>A Ruby implementation to consider is Ruleby (<a href="http://ruleby.org/wiki/Ruleby" rel="nofollow noreferrer">http://ruleby.org/wiki/Ruleby</a>)</p>
| 9,301 |
<p>I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regenerating the data layer? </p>
| <p>I've run into this same problem and using <a href="http://msdn.microsoft.com/en-us/library/bb386987.aspx" rel="nofollow noreferrer">sqlmetal</a> is definitely a good way to solve it. One approach is to create a batch file that executes your sqlmetal command and that way you can just run the batch anytime you need u... | <p>In the past where I've worked, we created a wrapper class to the DataContext that sqlmetal generated. Then we created a thin data layer that kept private the DataContext and all the classes generated by sqlmetal.</p>
<p>If any operations in the software needed information from the database, they had to go through t... | 21,875 |
<p>I've recently read the Yahoo manifesto <a href="http://developer.yahoo.com/performance/rules.html#postload" rel="noreferrer">Best Practices for Speeding Up Your Web Site</a>. They recommend to put the JavaScript inclusion at the bottom of the HTML code when we can.</p>
<p>But where exactly and when?</p>
<p>Should ... | <p>There are two possibilities for truly unobtrusive scripts:</p>
<ul>
<li>including an external script file via a script tag in the head section</li>
<li>including an external script file via a script tag at the bottom of the body (before <code></body></html></code>)</li>
</ul>
<p>The second one can be f... | <p>If you put it at the bottom, it loads last, hence speeding up the speed that the user can see the page. It does need to be before the final <code></html></code> though otherwise it won't be part of the DOM.</p>
<p>If the code is needed instantly though, then put it in the head.</p>
<p>It's best to put things... | 17,323 |
<p>I need to perform a SNMP Set operation in a printer in the network which as an Access Control List configured (ACL) and my host's IP Address is not in the ACL table.
I'm getting a strange behavior: When I have a SNMPv1 Set community name configured, I am ONLY able to perform a SNMP Set if my host ip is in the ACL ta... | <p>The ACL is on the printer itself. We are connected through a network and the printer is in another subnet. The ACL contains only one entry and there is not a blocking rule.
The issue itself is regarding the behavior related with the SNMP Set Community itself that I'd like to understand if there is any relationship ... | <p>So the ACL is on a local router or the printer itself?
What model of printer is it and how are you connected to it, are you on the same network or do you pass through the router to get to the printer which is on a seperate network range?</p>
<p>I would check the full ACL list as perhaps there is a block all rule th... | 18,047 |
<p>Question is pretty self explanitory. I want to do a simple find and replace, like you would in a text editor on the data in a column of my database (which is MsSQL on MS Windows server 2003)</p>
| <p>The following query replace each and every <code>a</code> character with a <code>b</code> character.</p>
<pre><code>UPDATE
YourTable
SET
Column1 = REPLACE(Column1,'a','b')
WHERE
Column1 LIKE '%a%'
</code></pre>
<p>This will not work on SQL server 2003.</p>
| <p>If you are working with SQL Server 2005 or later there is also a CLR library available at <a href="http://www.sqlsharp.com/" rel="nofollow noreferrer">http://www.sqlsharp.com/</a> that provides .NET implementations of string and RegEx functions which, depending on your volume and type of data may be easier to use an... | 8,350 |
<p>Required is the true language version of the OS, not the user interface language or the current locale settings.</p>
<p>Use case: software installation which has to apply security settings and user account creation. The scripts have to know certain system properties like user group names in the original language of... | <p>To detect the operating system language use <a href="http://msdn.microsoft.com/en-us/library/ms776263.aspx" rel="nofollow noreferrer">GetSystemDefaultUILanguage</a>.</p>
<p>However, there are more straightforward ways to find things such as a known group name in Windows. For example, to get the name for the <em>Use... | <p>My best solution so far: enumerate the local user accounts and groups and compare with a list of known names in different languages. </p>
| 24,687 |
<p>The coding is done using VS2008
There are two divs in my page namely "dvLeftContent" and "dvRightContent".
I cannot statically set the height of the pages since "dvRightContent" have variable heights on various pages (Master Pages are used here)
Is there a client side function(javascript or jquery) that takes the he... | <p>Depending on how you're working with it, you can adjust the input to order the data ascending.</p>
<blockquote>
<pre><code>SELECT customer, sum(amountdue) AS total FROM invoices
GROUP BY customer
ORDER BY total ASC
</code></pre>
</blockquote>
<p>If you're doing in a way that you can't change that information, cou... | <p>Note that other Business Objects products order on the total of a summary field when sorting a cross tab by it's values. I forget how CR does it exactly.</p>
| 28,308 |
<p>My application is using struts 1.1.
I'm trying to group URL forwards, using wildcards. </p>
<p>For example, if the action is like this:
<br /> <br />
action path="/edit/product" type="classname" <br />
forward <br />
name="success" <br />
path=".myapp.main" <br />
action <br /></p>
<p>Replacing the firs... | <p>To the best of my knowledge Struts does not support this type of wildcard configuration.</p>
| <p>laz, it does support.
I'm not sure if version 1.1 supports though.</p>
<p><a href="http://www.oreillynet.com/onjava/blog/2004/12/struts_12_offers_cool_new_feat.html" rel="nofollow noreferrer">http://www.oreillynet.com/onjava/blog/2004/12/struts_12_offers_cool_new_feat.html</a></p>
| 27,966 |
<p>As a two-monitor user at work, I've noticed that applications behave differently with regards to what monitor they open on (primary or secondary monitor, the last monitor the application opened on, and so on). To be honest, some applications annoy me because I want them to open on my primary monitor and I'll move th... | <p>As a windows programmer I control the starting monitor of windows created by my apps by
a. storing my apps last position in the registry and restoring that, and
b. lacking stored info, setting the starting position to magic flag values that windows uses to position the app using its default logic. The default logic ... | <p>Had a similar problem. Found the following:</p>
<p><strong>Right Klick on the window titlebar and select "More Actions"->"Window Manager Settings". There choose "Focus" in the column to the left. Toggle option "Active screen follows mouse".</strong></p>
<p>If no other defaults are specified, windows appear on the ... | 25,548 |
<p>Many of our customers have access to InstallShield, WISE or AdminStudio. These aren't a problem. I'm hoping there is some way I can provide our smaller customers <strong>without access to commercial repackaging tools</strong> a freely available set of tools and steps to do the file replacement themselves.</p>
<p>On... | <p>Okay, revisiting this question with my own answer providing nice little VB script that will do all heavy lifting. As mentioned in the original question, the aim was provide a simple solution for sysadmin users to make the updates/changes themselves. </p>
<p>Below is a simplified version of the code I'm currently pr... | <p>You need to add an entry to the <a href="http://msdn.microsoft.com/en-us/library/aa369801.aspx" rel="nofollow noreferrer">Media</a> table, adding another medium with no cabinet file, and a LastSequence one more than the CAB file's last sequence. You then need to replace in the <a href="http://msdn.microsoft.com/en-u... | 41,368 |
<p>I'm trying to implement an IErrorHandler in my WCF service in order to log every exception that hits the service boundary before it's passed to the client. I already use IErrorHandlers for translating Exceptions to typed FaultExceptions, which has been very useful. According to the MSDN for IErrorHandler.HandleErr... | <p>I ended up putting the logging in IErrorHandler.ProvideFault() instead of IErrorHandler.HandlerError(). The ProvideFault call is made in the operation thread, so I can use OperationContext.Current to get some information to log.</p>
| <p>Have you used the <a href="http://msdn.microsoft.com/en-us/library/ms732023.aspx" rel="nofollow noreferrer">Service Trace Viewer</a>?</p>
| 27,517 |
<p>How can I add an input form in an Excel sheet. I want to insert values into an Excel cell using the form.</p>
| <p>ALT+F11 starts the VBA editor in Excel. In there you can create UserForms (Insert | UserForm) which you can bind into their own modules or attach to worksheets. </p>
<p>I suggest you look at the Excel help or MSDN for details of what you can do with UserForms. There are also a lot of VBA tutorials on the web for... | <p>You have to activate the form toolbar.<br>
Of course, IIRC, the form must be handled by VBA code.</p>
| 42,417 |
<p>I want to load some images into my application from the file system. There's 2 easy ways to do this:</p>
<pre><code>[UIImage imageNamed:fullFileName]
</code></pre>
<p>or:</p>
<pre><code>NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];
NSData *imageData = [NSData dataWith... | <p>It depends on what you're doing with the image. The <code>imageNamed:</code> method does cache the image, but in many cases that's going to help with memory use. For example, if you load an image 10 times to display along with some text in a table view, UIImage will only keep a single representation of that image in... | <p>I don't believe that the image gets cached at all, and I don't know why you are all saying that. UIImage is a subclass of NSObject which uses reference counters to keep track of the things that it is related to. So when you load an image it does that same thing. If you load the same image multiple times it will(or s... | 40,832 |
<p>What sort of database schema would you use to store email messages, with as much header information as practical/possible, into a database?</p>
<p>Assume that they have been fed into a script from the MTA and parsed into the relevant headers/body/attachments.</p>
<p>Would you store the message body whole in the da... | <p>You may want to check the <a href="http://www.archiveopteryx.org/architecture" rel="noreferrer">architecture</a> and the <a href="http://www.archiveopteryx.org/schema" rel="noreferrer">DB schema</a> of "Archiveopteryx".</p>
| <p>If it is already split up, and you can be sure that the routine to split the data is sound, then I would split up the table as granular as possible. You can always parse it back together in your middle tier. If space is not an issue, you could always store it twice. One, split up into the relevant fields, and ano... | 9,068 |
<p>I have this RewriteRule that works too well :-)</p>
<pre><code>RewriteRule ^([^/]*)/$ /script.html?id=$1 [L]
</code></pre>
<p>The bad thing about this rule is that it also matches physical directories which I don't want.</p>
<p>How can I tell the <code>mod_rewrite</code> to ignore physical directories and apply t... | <p>Take a look at <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond" rel="nofollow noreferrer">RewriteCond</a>. Put the following before your rule to exempt out directories and files</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
</code></pre>
| <pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/$ /script.html?id=$1 [L]
</code></pre>
| 15,305 |
<p>How often do we see stuff like "Send this page to a friend" on a webpages? Well, I see them quite often.</p>
<p>My question is, how do you guys see it's effectiveness? If I hit a webpage that's interesting, and I think my friend would enjoy it, I can just copy the URL from my browser bar, paste it into the email an... | <p>The tell-a-friend button has a number of uses that are not so obvious.</p>
<p><strong>From the users perspective:</strong>
A tell a friend button will remind a user to tell a friend when they may not have thought of it themselves, which increases referrals. As part of the page, it's much more noticeable.</p>
<p>I... | <p>I've used those buttons for when I'm not sure which bits of a long URL are part of the bare minimum needed for my friend to get to the page and which bits are data related to my session on the site.</p>
<p>Having said that, when I've used them I've sent them to myself, and copied and pasted the URL from the email I... | 24,229 |
<p>I'm sure this has already been asked and answered so I apologize in advance for that but I'm not figuring out the correct keywords to search for. Searching for "Pattern" hits way too many Q & A's to be useful.</p>
<p>I'm working on a regression testing app. I'm displaying a form on the screen and according to... | <p>Table driven designs can be effective.
Steve Maguire had few nice examples in <em>Writing</em> <em>Solid</em> <em>Code</em> .</p>
<p>They are also a great way to capture tests, see <a href="http://fit.c2.com/" rel="nofollow noreferrer">fit</a> .</p>
<p>In your case something like:</p>
<pre><code>Field1ReadonlyRu... | <p>At first blush it sounds more like you have two different types of users and they have different access levels. This could be solved by inheritance (PowerUser, User) or by containing a security object or token that sets the level for the user. </p>
<p>If you don't like inheritance as a rule, you could use a State... | 7,566 |
<p>I'm trying to find out the last time a computer came out of standby/hibernate. I know I could get this by watching Win32_PowerManagementEvent, but that doesn't work in this instance as I need something I can poll - any ideas? It doesn't have to be WMI, I'm just assuming that's the place it would be.</p>
<p>Thanks!<... | <p>Actually, as it usually happens, I figured this out as soon as I posted it.</p>
<p>So, to watch for when a computer comes out of standby, which is EventType 7 in Win32_PowerManagementEvent I used Powershell. </p>
<pre><code>Register-WmiEvent -query "Select * From Win32_PowerManagementEvent where EventType=7" -mess... | <p>Awesome, thank you for this solution! I managed to get my script working using yours as a template. I can just run this using Task Scheduler.</p>
<pre><code>Register-WMIEvent -query "Select * From Win32_PowerManagementEvent where EventType=4" `
-sourceIdentifier "Action Before Sleep" `
-action ... | 46,973 |
<p>Here's the information <a href="http://www.php.net/manual/en/language.basic-syntax.php" rel="noreferrer">according to the official documentation</a>:</p>
<blockquote>
<p>There are four different pairs of
opening and closing tags which can be
used in PHP. Two of those, <code><?php ?></code>
and <code>&... | <p>There must be a clear distinction between the PHP short tag (<code><?</code>) and shorthand echo tag (<code><?=</code>)</p>
<p>The former is prohibited by the <a href="https://www.php-fig.org/psr/psr-1/" rel="nofollow noreferrer">PHP Coding standard</a>, mostly out of common sense because it's a PITA if you ev... | <p>No, and they're <a href="http://www.slideshare.net/thinkphp/php-53-and-php-6-a-look-ahead/" rel="nofollow noreferrer">being phased out by PHP 6</a> so if you appreciate code longevity, simply don't use them or the <code><% ... %></code> tags.</p>
| 24,483 |
<p>My coworkers and I were having a discussion about this yesterday. It seems that no matter how well we prepare and no matter how much we test and no matter what the client says immediately before the site becomes public, initial site launches almost always seem to be somewhat rocky. Some clients are better than other... | <p>Don't worry. This is completely and entirely normal and happens with every piece of software. Everything that can go wrong will go wrong, and the most volatile entity in the development process, the client, will be the cause of these things.</p>
<p>You could do all the Requirements Gathering in the world, write a 1... | <p>Web site launches are usually fairly smooth for us. Of course, we do extensive validation including code inspections, deployments to proto-servers (identical to our production servers), and mountains of documentation.</p>
<p>After every launch, we have a meeting to discuss what went well and what didn't so that we... | 28,177 |
<p>I was reading a research paper about Haskell and how HList is implemented and wondering when the techniques described are and are not decidable for the type checker. Also, because you can do similar things with GADTs, I was wondering if GADT type checking is always decidable.</p>
<p>I would prefer citations if you... | <p>I believe GADT type checking is always decidable; it's inference which is undecidable, as it requires higher order unification. But a GADT type checker is a restricted form of the proof checkers you see in eg. Coq, where the constructors build up the proof term. For example, the classic example of embedding lambda... | <p>You've probably already seen this but there are a collection of papers on this issue at Microsoft research: <a href="http://research.microsoft.com/~simonpj/papers/assoc-types/" rel="nofollow noreferrer">Type Checking papers</a>. The first one describes the decidable algorithm actually used in the Glasgow Haskell com... | 7,131 |
<p>I'm developing and application that runs as a Windows service. There are other components which include a few WCF services, a client GUI and so on - but it is the Windows service that access the database.</p>
<p>So, the application is a long-running server, and I'd like to improve its performance and scalability, I... | <blockquote>
<p>There seems to be a great lack of documentation / discussion for non-web app designs.</p>
</blockquote>
<p>This has also been my experience. However, the model you are following seems correct to me. You should always open a session, commit changes, then close it again.</p>
| <p>I agree, there aren't many examples for stateful apps.
I'm thinking of doing the following:</p>
<p>Like you I have a windows service hosting a number of WCF services. So the WCF services are the entry points.
Ultimately all my WCF services inherit from AbstractService - which handles a lot of logging and basic DB i... | 20,701 |
<p>I'm new to development on the iPhone. Just about every sample project (as well as the default project templates) have one or more delegates and controllers. Can someone give me a breakdown of what the delegates are responsible for vs. what the controllers are supposed to do?</p>
| <p>The simplest way I can think to differentiate the two are:</p>
<ul>
<li>A delegate is a protocol (interface) that defines methods that an object implements in order to receive specific messages from other objects. Delegates objects are most often used to receive asynchronous callbacks such as user input, I/O.</li>... | <p>A delegate is some object that implements a set of methods which either your application or the framework you link against depends on for functioning. It is a means of implementing a delegation based design pattern wherein the responsibility for performing an action is transferred from some root source to an intere... | 39,891 |
<p>I've got a series of GIFs that I need to crop on the fly, I'm using a HTTP Handler in C# so I can better encapsulate the code - provide caching for the result etc.</p>
<p>Currently, when I draw the existing image to a new <code>Image</code> via the <code>Graphics</code> object all the transparency is lost.</p>
<p>... | <p>This seems to have been answered already <a href="https://stackoverflow.com/questions/189392/how-do-you-draw-transparent-image-using-systemdrawing">How do you Draw Transparent Image using System.Drawing?</a></p>
| <p>When I have used transparency I've always used <code>Bitmap</code>. I.e.</p>
<pre><code>System.Drawing.Image SourceImage = System.Drawing.Image.FromFile("the.gif");
System.Drawing.Bitmap NewImage = new System.Drawing.Bitmap(SourceImage);
// Do Processing
NewImage.MakeTransparent();
// Store changes
NewImage.Save(..... | 29,802 |
<p>I bought an Ender 3 v2 in January 2021 for my second printer. I have had an Ender 3 for two years and love the quality it prints. This new printer has been plagued with issues since day one. Creality sent me a new mainboard and fan due to issues. Even since then my printer will still not print consistently. I checke... | <p>First, check that your belts are tight, on the X-axis and the bed. If not, tighten them.</p>
<p>Second, grab the hot end and wiggle the gantry, and make sure it is not loose. If there is any play at all, tighten the eccentric nuts.</p>
<p>If this doesn't fix your problems, check out this playlist I put together for ... | <p>If you have a 4.2.2 board, it may be a stepper driver problem. If this is the case, the only solution is to replace the board.</p>
| 1,916 |
<p>I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like <code>play()</code>, <code>stop()</code>, <code>pause()</code>, <code>record()</code> etc... Then I have workhorse classes which do the video decoding and video... | <p>I would be a bit reluctant to use nested classes here. What if you created an abstract base class for a "multimedia driver" to handle the back-end stuff (workhorse), and a separate class for the front-end work? The front-end class could take a pointer/reference to an implemented driver class (for the appropriate m... | <p>One reason to avoid nested classes is if you ever intend to wrap the code with swig (<a href="http://www.swig.org" rel="nofollow noreferrer">http://www.swig.org</a>) for use with other languages. Swig currently has problems with nested classes, so interfacing with libraries that expose any nested classes becomes a r... | 2,282 |
<p>We have a few operations where we are doing a large number of large string concatenations, and have recently encountered an out of memory exception. Unfortunately, debugging the code is not an option, as this is occurring at a customer site. </p>
<p>So, before looking into a overhaul of our code, I would like to ... | <p>Here is a nice study about <a href="http://blog.cumps.be/string-concatenation-vs-memory-allocation/" rel="nofollow noreferrer">String Concatenation vs Memory Allocation</a>.</p>
<blockquote>
<p><strong>If you can avoid concatenating, do it!</strong></p>
<p>This is a no brainer, if you don't
have to concate... | <p>I don't know about the exactly memory pattern of string builder but the common string is not an option.</p>
<p>When you use the common string every concatenation creates another couple of string objects, and the memory consumption skyrocket, making the garbage collector being called too often.</p>
<pre><code>strin... | 18,019 |
<p>I know that primary keys based on Guids do not have the best performance (due to the fragmentation), but they are globally unique and allow replication scenarios.</p>
<p>Integral identifiers, on the other side, have greater performance at the cost of scalability.</p>
<p>But in what scenarios would someone want to ... | <p>What is commonly known as a sequential guids in SQL Server 2005 (generated by NEWSEQUENTIALID()) are an attempt to overcome the issues with normal guids.</p>
<p>They <strong>are</strong> still universally unique but also are always ascending. This means that they can be used for replication <strong>and</strong> ha... | <p>Using sequential guids ensures that you are always using a value larger than the last value. For an indexed field this is important. Instead of inserting randomly all over the spectrum, you are always inserting at the end of the last "page" of data, resulting in drastically reduced page splits, especially in the c... | 22,293 |
<p>I have a swing application deployed in HTTP Server. Users use the browser to point an URL and install the client using java webstart. Now I need to enable https access to my application deployed on HTTP server. I am using JDK 1.5 as default jdk supported in the jnlp file. For time being I use a self signed certifica... | <p>As far as I understand your question you don't need to change anything to your code of the client. If you only want to give access to the JNLP via HTTPS you would only need to reconfigure the application server distributing the JNLP or if you have a webserver in front of the application server (as we do here: user -... | <p>What is the feature of https that you are hoping to leverage? </p>
<ul>
<li>The signing/server authentication is done by code signing, though you are undermining this using a self-signed certificate. </li>
<li>Does your application code contain secrets that must be hidden from eavesdroppers?</li>
</ul>
<p>As you s... | 33,583 |
<p>How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language? </p>
<p>I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solvin... | <p>I like slim's answer. I do spend a crazy amount of time in Java and C++ crafting custom data structures that are just free in Python/Ruby. And crafting specialized functions to process these custom data structures. Yes, in C++, STL is really nice. Yes, Generics in Java are nice. They help create custom data structur... | <p>Dynamic languages are capable of executing code which was created at run-time. This is very dangerous if malicious code is injected. But very powerful if you can sanitize the environment.</p>
<p>I think Javascript people do this by executing JSON files.</p>
| 49,663 |
<p>How do I create a ListBox in ASP.NET MVC with single selection mode?</p>
| <p>I am assuming you are looking for a select box visually like the ListBox, meaning with multiple rows displayed, but functionally like the DropDownList (allowing for only one selection). </p>
<p>It looks like there is not a particularly easy way to pull this off using ListBox. I'd suggest using Html.DropdownList, si... | <p>the below should do it: The object is translated in a list of attributes for the select element.</p>
<p>Html.DropDownList("list1", new Object {@rows = 5, @multiple = false} )</p>
| 45,761 |
<p>I'm trying to do something like the following:</p>
<pre><code>enum E;
void Foo(E e);
enum E {A, B, C};
</code></pre>
<p>which the compiler rejects. I've had a quick look on Google and the consensus seems to be "you can't do it", but I can't understand why. Can anyone explain?</p>
<p>Clarification 2: I'm doing... | <p>The reason the enum can't be forward declared is that, without knowing the values, the compiler can't know the storage required for the enum variable. C++ compilers are allowed to specify the actual storage space based on the size necessary to contain all the values specified. If all that is visible is the forward... | <p>Because the enum can be an integral size of varying size (the compiler decides which size a given enum has), the pointer to the enum can also have varying size, since it's an integral type (chars have pointers of a different size on some platforms for instance).</p>
<p>So the compiler can't even let you forward-dec... | 9,689 |
<p>I have a collection of elements that I need to operate over, calling member functions on the collection:</p>
<pre><code>std::vector<MyType> v;
... // vector is populated
</code></pre>
<p>For calling functions with no arguments it's pretty straight-forward:</p>
<pre><code>std::for_each(v.begin(), v.end(), st... | <p>Boost Lambda makes this easy.</p>
<pre><code>#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/if.hpp>
std::for_each( v.begin(), v.end(),
if_( MyPred() )[ std::mem_fun(&MyType::myfunc) ]
);
</code></pre>
<p>You could even... | <p>For what its worth <a href="http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?STLAlgorithmExtensions/ForEachIf" rel="nofollow noreferrer">for_each_if</a> is being considered as an eventual addition to boost. It isn't hard to implement your own.</p>
| 29,025 |
<p>I fired up my printer again last night to print something (Printrbot LC that I have customized), and happened to notice the Octopi instance still had a file that I printed ~5 years ago. Also, I noticed i had files from ~2013 when I got started. My printer is from that time, so keep that in mind.</p>
<p>I've noticed ... | <p>This is clearly overextrusion relative to the volume the material is being deposited into, but that doesn't necessarily mean your extrusion rate is wrong. It could be:</p>
<ul>
<li>Nozzle smashed down into the bed (bed way too high) but somehow still extruding</li>
<li>Problem in Z axis movement preventing the head... | <p>Bad filament is my answer. I bought PRLine and both print terrible like your picture. Suspect 2 factors, one is that the line is less than 1.75, so they underextrude and so you see those lines and in some cases gaps, second is the material itself is slippery suggesting to me that it has florinated additives.</p>
| 1,623 |
<p>I tried to combined tables which is <strong>fus_shift and root table</strong> into a new table which is <strong>final table</strong> but it outputs like "<strong>ERROR at line 2:
ORA-01789: query block has incorrect number of result columns</strong>". I tried also joining table as my alternative but it also outputs ... | <p>You certainly cannot apply "Union" to your tables. It can be applied only if both queries return same number (and of similar type) of columns.</p>
<p>You can join the two tables but would have to use "table alias" while joining since "record_num" field is common in both the tables. Here is the query that would work... | <p>I would use the following method:</p>
<pre><code>SELECT *
FROM fus_shift
INNER JOIN root ON root.record_num = fus_shift.record_num
</code></pre>
| 45,044 |
<p>Is it possible to get the route/virtual url associated with a controller action or on a view? I saw that Preview 4 added LinkBuilder.BuildUrlFromExpression helper, but it's not very useful if you want to use it on the master, since the controller type can be different. Any thoughts are appreciated.</p>
| <p>You can get that data from ViewContext.RouteData. Below are some examples for how to access (and use) that information:</p>
<p>/// These are added to my viewmasterpage, viewpage, and viewusercontrol base classes:</p>
<pre><code>public bool IsController(string controller)
{
if (ViewContext.RouteData.Values["co... | <p>I wrote <a href="http://biasecurities.com/blog/2009/helper-to-access-route-parameters/" rel="nofollow noreferrer">a helper class</a> that allows me to access the route parameters. With this helper, you can get the controller, action, and all parameters passed to the action.</p>
| 18,320 |
<p>Lets say I have a concrete class Class1 and I am creating an anonymous class out of it.</p>
<pre><code>Object a = new Class1(){
void someNewMethod(){
}
};
</code></pre>
<p>Now is there any way I could overload the constructor of this anonymous class. Like shown below</p>
<pre><code>Object a ... | <p>From the <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5.1" rel="noreferrer">Java Language Specification</a>, section 15.9.5.1:</p>
<blockquote>
<p>An anonymous class cannot have an
explicitly declared constructor.</p>
</blockquote>
<p>Sorry :(</p>
<p>EDIT: As an alternative, ... | <p>It doesn't make any sense to have a named overloaded constructor in an anonymous class, as there would be no way to call it, anyway.</p>
<p>Depending on what you are actually trying to do, just accessing a final local variable declared outside the class, or using an instance initializer as shown by Arne, might be t... | 47,298 |
<p>When working with MSSQL on Windows I was used to a very convenient feature called integrated authentication. In short, being authenticated in Windows can give you access to the database, so no need to give any specific password. Now I am developing an application on Linux with no user interaction; this application n... | <p>First, you really should set a password on the mysql root account...</p>
<p>Second, yeah, you're pretty much going to have to put the password somewhere, unless you set up the application account to use a blank password too...</p>
| <p>You can put the settings in a .my.cnf file:</p>
<pre><code>[Client]
user=ken
password=ken
host=localhost
database=foo
</code></pre>
<p>You can use different config files using the --defaults-file option</p>
<p>Some more info on option files at <a href="http://dev.mysql.com/doc/refman/5.0/en/option-files.html" rel... | 42,170 |
<p>What is the easiest free method of encrypting my web traffic? I'd like to be able to log in to sites on my web server without sending my password in plaintext.</p>
<p><strong>Edit:</strong> My web server is running on the LAMP stack , although it is a shared host so I don't have root.</p>
| <p>Get an X.509 certificate (for example, generating your own, or getting one free from <a href="http://www.startssl.com/" rel="nofollow noreferrer">StartSSL</a>), and use it to set up SSL—a server-specific configuration task.</p>
<p>If you can't configure a new listener in your web server, there's not really a ... | <p>As stated above, publishing your own certification is free, however knowing more about your environment, may get you more specific answers. Are you running IIS? What will you be logging into that needs encryption? Are you using Windows Servers on the back end?</p>
| 39,570 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.