instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>We are attempting to use a SQL Server 2003 database for our test records and want a quick way to take NUnit and NAnt output and produce SQL schema and data. Is there a simple way to generate SQL Schema using the XSD file describing these XML documents?</p>
| <p>You could use XSD. No, I'm serious. Go to a command prompt and type xsd and press Enter.</p>
<p>Here's what you will see (truncated):</p>
<pre><code>I:\>xsd
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 1.0.3705.0]
Copyright (C) Microsoft Corporation 1998-2001. All... | <p>There's a tool called <a href="http://shrex.sourceforge.net/" rel="nofollow noreferrer">ShreX</a> that can can makes schemas from xsd and inserts from XML. It tries to do this by itself (you can annotade the xsd to steer it). If you want to decide the structure yourself it might not be what you want.</p>
| 13,102 |
<p>Reporting Services 2000 Standard Edition (currently RTM but hope to have SP2 soon).</p>
<p>I have a report which takes in a parameter - PlantID</p>
<p>I'd like to email a pdf of this report every month to the 80 different plant managers</p>
<p>So I have a table:</p>
<pre><code>PlantID ManagerEmail
1 ... | <p>A Data-Driven Subscription would be the ideal answer, but I see that Data-Driven Subscriptions are not available in RS 2000 Standard.</p>
<p><a href="http://www.codeproject.com/KB/database/DataDrivenSubscriptions.aspx" rel="nofollow noreferrer">This Article</a> discusses how to use a stored procedure to tweak a Rep... | <p>That would be my first thought on how to do it also.</p>
<p>You might also be able to set up a scheduled stored proc to execute it for you, but that's more of a guess than an experienced suggestion.</p>
| 29,905 |
<p>Is it ever OK to use <code>Environment.TickCount</code>to calculate time spans?</p>
<pre><code>int start = Environment.TickCount;
// Do stuff
int duration = Environment.TickCount - start;
Console.WriteLine("That took " + duration " ms");
</code></pre>
<p>Because <code>TickCount</code> is signed and will rollover a... | <p>Use Stopwatch class. There is a decent example on msdn: <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx</a></p>
<pre><code> Stopwatch stopWatch = Stopwatch.StartNew();
Thread.Sleep(1... | <p>You should use the <a href="https://stackoverflow.com/questions/28637/is-datetimenow-the-best-way-to-measure-a-functions-performance">Stopwatch</a> class instead.</p>
| 30,147 |
<p>By default, in C++, a single-argument constructor can be used as an implicit conversion operator. This can be suppressed by marking the constructor as explicit.</p>
<p>I'd prefer to make "explicit" be the default, so that the compiler cannot silently use these constructors for conversion.</p>
<p>Is there a way to ... | <p>Nope, you have to do it all by hand. It's a pain, but you certainly should get in the habit of making single argument constructors explicit. I can't imagine the pain you would have if you did find a solution and then had to port the code to another platform. You should usually shy away from compiler extensions like ... | <p>I think the answer is no!</p>
<p>Sorry, its not a very constructive answer. I hope somebody else might know more!</p>
| 21,007 |
<p>I only know a small amount about .NET MVC and haven't used it barely at all so far but I was wondering how would you create re-useable controls that can be spread across different applications?</p>
<p>We have various controls that have been created in external libraries and we reference the assembly if we want to u... | <p>For reuse of view elements, user controls and extensions of HtmlHelper should suit your needs. I have created a project that extends view pages to generate view elements using a fluent interface. Read about it <a href="http://lunaverse.wordpress.com/2008/11/24/mvcfluenthtml-fluent-html-interface-for-ms-mvc/" rel="... | <p>You can use pure javascript controls which can then "post back" via ajax. On the server side you have a controller + action which handles the date range changes.</p>
<p><a href="http://developer.yahoo.com/yui/examples/calendar/multi.html" rel="nofollow noreferrer">A calendar example</a></p>
| 45,058 |
<p>I'm trying to pass one method to another in elisp, and then
have that method execute it. Here is an example:</p>
<pre><code>(defun t1 ()
"t1")
(defun t2 ()
"t1")
(defun call-t (t)
; how do I execute "t"?
(t))
; How do I pass in method reference?
(call-t 't1)
</code></pre>
| <p>First, I'm not sure that naming your function <code>t</code> is helping as 't' is used as the <a href="http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(elisp)nil+and+t" rel="noreferrer">truth value</a> in lisp.</p>
<p>That said, the following code works for me:</p>
<pre><code>(defun test-func-1 () "test-func-1"
(int... | <p>Above answers are okey, but you can do something more interesting with defmacro, wich evaluates functions later for some reason:</p>
<pre><code>(defun n1 ()
"n1")
(defmacro call-n (n)
(apply n))
(call-n (n1))
</code></pre>
<p>A practical example with a for loop that takes any amount of functions and ... | 26,213 |
<p>During an ASP.NET page load I'm opening and closing multiple System.Data.SqlClient.SqlConnections inside multiple controls contained in the page. I thought it would be a good idea instead to create a "pool" of connections and when opening a connection check to see if the connection string matches that of an open con... | <p>Connection pooling is an essential feature of ADO.NET.</p>
<p>Read this <a href="http://msdn.microsoft.com/en-us/library/8xx3tyca.aspx" rel="nofollow noreferrer">MSDN article</a> or some of the other resources available on the net, like this <a href="http://weblogs.asp.net/sjoseph/archive/2005/03/23/395601.aspx" re... | <p>Yes, that is basically how connection pooling works in ADO.NET.</p>
<p>When you call <code>Open()</code> on a Connection-instance, it doesn't necessarily open a connection. It fetches an open connection from the pool, matching the connection string. <code>Close()</code> releases the connection back into the pool.</... | 21,426 |
<p>I have a class named Page with a private property currently called <code>_pageData</code> which stores all the information (such as title, content, keywords etc). </p>
<p>However, this to me doesn't look so good when I refer to it <code>$this->_pageData</code>. I want to think of a better name, and I'd imagine t... | <pre><code>class Page {
public $title = '';
public $keywords = array();
public $content = '';
// etc.
}
$page = new Page();
echo '<title>' . $page->title . '</title>';
echo $page->content;
</code></pre>
<p>Or you can use accessors/get-set and the like to protect your data, allow it t... | <p>That's very specific and I don't think there is a "standard" or "best practice". Just call it whatever it feels best in your opinion. In my own, I would simply call it "data" as Page is the class, $this = Page, so Page->Data. This would suffice for me.</p>
<p>I can't think of a better name... Maybe it sounds weird ... | 49,294 |
<p>I have a problem with <strong>scandir()</strong>: The manpage contains this as prototype:</p>
<pre><code>int scandir(const char *dir, struct dirent ***namelist,
int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **));
</code></pre>
<p>Therefore I have this:</p>
<pr... | <p>Actually, there's no such constraint that you can't pass a pointer to an inline function. The inline keyword serves only as a hint to the compiler to inline calls when it can.</p>
<p>The problem is that the manpage for scandir() is a little misleading. The prototype in for the 4th parameter is actually int (*cmp)(... | <p>You're giving it a pointer to an inline function? That doesn't make sense, actually I wonder that it even compiles with only a warning.</p>
<p><strong>EDIT</strong>: Chris above is right, the inline keyword is just ignored silently when it doesn't make sense / is not applicable.</p>
| 17,617 |
<p>I am sure a responsive UI is something that everyone strives for and the reccomended way to do stuff is to use the BackgroundWorker for this. </p>
<p>Do you find it easy to work with ? Do you use it often ? Or do you have your own frameworks for lengthy tasks and reporting process.</p>
<p>I have found that I am us... | <p>Multithreaded programming is hard to grasp in the beginning (and veterans still fail sometimes) and BackgroundWorker makes it a bit easier to use. I like the fact that BackgroundWorker has functionality which is easy to implement but even easier to wrongly implement in a subtle way, like cancellation.
I use it if I ... | <p>My biggest issue with the background worker class is that there really is no way to know when the worker has finished due to cancellation. The BackgroundWorker does not expose the thread it uses so you can't use the standard techniques for synchronizing thread termination (join, etc.). You also can't just wait in a ... | 7,240 |
<p>One challenge with Silverlight controls is that when properties are bound to code, they're no longer really editable in Blend. For example, if you've got a ListView that's populated from a data feed, there are no elements visible when you edit the control in Blend.</p>
<p>I've heard that the MVVM pattern, originate... | <p>I definitely think you should use the MVVM pattern for Silverlight applications - and one of the benefits of the pattern is that you can actually make your application really blendable through some simple techniques. I often refer to "blendability" as "design for designability" - that you use certain techniques to m... | <p>I've always thought MVVM and PresntationModel <a href="http://martinfowler.com/eaaDev/PresentationModel.html" rel="nofollow noreferrer">http://martinfowler.com/eaaDev/PresentationModel.html</a> are essentially the same thing. PresentationModel is a lot easier to say.
I've used it succesfully in java swing, windows ... | 49,109 |
<p>Say I have a class called PermissionManager which should only exist once for my system and basically fulfills the function of managing various permissions for various actions in my application. Now I have some class in my application which needs to be able to check a certain permission in one of its methods. This cl... | <p>If you are using a dependency-injection framework, then the common way to handle this is to either pass in a PermissionsManager object in the constructor or to have a property of type PermissionsManager that the framework sets for you. </p>
<p>If this is not feasible, then having users get an instance of this clas... | <p>The singleton pattern is not bad by itself, what makes it ugly is the way it's commonly used, as being the requirement of only wanting a single instance of a certain class, which I think it's a big mistake.</p>
<p>In this case I'd make PermissionManager a static class unless for any reason you need it to be an inst... | 30,666 |
<p>Perl has several built-in functions for accessing /etc/passwd on Unix systems (and elsewhere when supported) for user and group information. For instance,</p>
<pre><code>my $name = getpwuid($uid);
</code></pre>
<p>will return the user name given the user ID, or undef if there is no such user.</p>
<p>If a Perl scr... | <p>You could use the <a href="http://aspn.activestate.com/ASPN/CodeDoc/libwin32/NetAdmin/NetAdmin.html" rel="nofollow noreferrer"><code>Win32::NetAdmin</code> module</a>.</p>
<p><code>UserGetAttributes</code> and <code>GroupIsMember</code> look like they do what you need.</p>
| <p>Oddly enough, Interix's build of Perl that ships with Microsoft's Services for Unix does support getpw* and friends.</p>
| 21,413 |
<p>We have a COM object implemented with C++/ATL that includes a method which will return a DIB. We are also writing a .NET application that will use this COM object. Since we are writing both, we have the liberty of deciding how best to return this DIB from the COM object. To clarify, would it be best to return a n... | <p>COM/OLE has a standard interface for representing graphical images called <a href="http://msdn.microsoft.com/en-us/library/ms680761(VS.85).aspx" rel="nofollow noreferrer">IPicture</a> (and its scripting-friendly version <a href="http://msdn.microsoft.com/en-us/library/ms680762(VS.85).aspx" rel="nofollow noreferrer">... | <p>Have a look at the article <a href="http://www.codeproject.com/KB/GDI-plus/DIBtoBitmap.aspx" rel="nofollow noreferrer">DIB to System.Bitmap</a> on CodeProject. It has the code to convert from a DIB to a Bitmap. The idea is that the DIB is represented using a IntPtr.</p>
| 33,353 |
<p>I moved a bunch of projects to Solution Folders to chop up our list of projects into manageable folders, now each of the folders projects are not in alphabetical order. This only occurs on machines other than my own. Any ideas how to alleviate this?</p>
| <p>See the following bug information on MS Connect:
<a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=312252&wa=wsignin1.0" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=312252&wa=wsignin1.0</a></p>
<p>To summ... | <p>I found a tool that seems to do the trick:
<a href="http://solutionsorter.codeplex.com/" rel="nofollow noreferrer">http://solutionsorter.codeplex.com/</a></p>
| 37,186 |
<p>My boss has come to me and asked how to enure a file uploaded through web page is safe. He wants people to be able to upload pdfs and tiff images (and the like) and his real concern is someone embedding a virus in a pdf that is then viewed/altered (and the virus executed). I just read something on a procedure that ... | <p>I'd recommend running your uploaded files through antivirus software such as <a href="http://www.clamav.net/" rel="nofollow noreferrer">ClamAV</a>. I don't know about scrubbing files to remove viruses, but this will at least allow you to detect and delete infected files before you view them.</p>
| <p>Yes, ClamAV should scan the file regardless of the extension.</p>
| 5,307 |
<p>I've created some fairly simple XAML, and it works perfectly (at least in KAXML). The storyboards run perfectly when called from within the XAML, but when I try to access them from outside I get the error:</p>
<pre><code>'buttonGlow' name cannot be found in the name scope of 'System.Windows.Controls.Button'.
</cod... | <p>Finally found it. When you call Begin on storyboards that reference elements in the ControlTemplate, you must pass in the control template as well.</p>
<p>Changing:</p>
<pre><code>pressedButtonStoryboard.Begin(_xamlButton);
</code></pre>
<p>To:</p>
<pre><code>pressedButtonStoryboard.Begin(_xamlButton, _xamlButt... | <p>(@ Sam Meldrum) To get STOP working, add 'true for "isControllable" at the begin</p>
<pre><code>pressedButtonStoryboard.Begin(_xamlButton, _xamlButton.Template);
</code></pre>
<p>change to</p>
<pre><code>pressedButtonStoryboard.Begin(_xamlButton, _xamlButton.Template,true);
</code></pre>
<p>and now </p>
<pre><c... | 18,287 |
<p>Are there any optimizations to consider when connecting to Oracle with NHibernate? My calls to Oracle are taking an extremely long time. If I run the NHibernate query (copied from my output window in Visual Studio) directly against Oracle, it comes right back in under a second. Here is my config file for NHibernate.... | <p>You may consider using this tool for "debugging NHibernate"
<a href="http://ayende.com/projects/nhibernate-query-analyzer.aspx" rel="nofollow noreferrer">NHibernate Query Analyzer</a></p>
| <p>Make sure your connection pool is sufficiently large. Also, if you try debugging your code, you should be able to see where Hibernate is spending the majority of its time. It may be with processing the results, as someone commented earlier, especially if you have cascading relationships. If you do, try running those... | 42,883 |
<p>I'm using C# with <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> 3.5. Is it possible to serialize a block of code, transmit it somewhere, deserialize it, and then execute it?</p>
<p>An example usage of this would be:</p>
<pre><code>Action<object> pauxPublish = delegate(object... | <p><strong>YES!!!</strong></p>
<p>We have done this for a very real case of performance. Doing this at runtime or using a DSL was not an option due to performance. </p>
<p>We compile the code into an assembly, and rip the IL out of the method. We then get all the metadata associated with this method and serialize ... | <p>Another option is using the <a href="http://en.wikipedia.org/wiki/Dynamic_Language_Runtime" rel="nofollow noreferrer">DLR</a>, and constraining the code to execute...</p>
| 45,038 |
<p>We just added an autoupdater in our software and got some bug report saying
that the autoupdate wouldn't complete properly because the downloaded file's sha1 checksum wasn't matching. We're hosted on Amazon S3...</p>
<p>That's either something wrong with my code or something wrong with S3.</p>
<p>I reread my code ... | <p>Amazon's S3 will occasionally fail with errors during uploads or downloads -- generally "500: Internal Server" errors. The error rate is normally pretty low, but it can spike if the service is under heavy load. The error rate is never 0%, so even at the best of times the occasional request will fail.</p>
<p>Are you... | <p>More than sending bad data, I think I got an ERROR403. If I just try again it's usually ok.</p>
<p>And I agree : I saw a lot of report about people talking about amazon being totally down, but nobody talking about a "sometimes my access is refused" error, so I guess there might be an error on my side. I just set up... | 5,141 |
<p>I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema. How do I do this in Python?</p>
<p>I'd prefer something using the standard library, but I can install a third-party package if necessary.</p>
| <p>I am assuming you mean using XSD files. Surprisingly there aren't many python XML libraries that support this. lxml does however. Check <a href="http://lxml.de/validation.html" rel="noreferrer">Validation with lxml</a>. The page also lists how to use lxml to validate with other schema types.</p>
| <pre class="lang-py prettyprint-override"><code>import xmlschema
def get_validation_errors(xml_file, xsd_file):
schema = xmlschema.XMLSchema(xsd_file)
validation_error_iterator = schema.iter_errors(xml_file)
errors = list()
for idx, validation_error in enumerate(validation_error_iterator, start=1):
... | 38,390 |
<p>Are there any utilities that can examine a set of managed assemblies and tell you whether any of the types in one namespace depend on any in another? For example, say I have a <code>MyApp.BusinessRules</code> namespace and don't want it to access directly anything in <code>MyApp.GUI</code>, but both namespaces are ... | <blockquote>
<p>So far the only tool I have come across that looks like it might do this is NDepend, but I am wondering if there is a simpler solution.</p>
</blockquote>
<p>I am one of the developer of the tool <a href="http://www.NDepend.com" rel="nofollow noreferrer">NDepend</a>. Please could you let us know what ... | <p>Reflector does this.</p>
<p>Right click namespace, click Analyze, viola! :)</p>
| 39,211 |
<p>I am new to Java and am trying to run a program using Eclipse. But I have no idea how to get the command prompt running in with Eclipse...</p>
<p>I did some online research and couldn't get anything consolidated!</p>
<h3>Update:</h3>
<p>I'm not using an applet. It's a normal Java program trying to read a line from c... | <p>Check out this lesson plan on how to get started with Eclipse programs:</p>
<p><a href="http://www.ics.uci.edu/~thornton/ics22/LabManual/Lab0/" rel="nofollow noreferrer">Lesson</a></p>
<p>Specifically, see this image:</p>
<p><img src="https://www.ics.uci.edu/~thornton/ics22/LabManual/Lab0/Eclipse-ConsoleTab-Stopp... | <p>If you downloaded the Eclipse/Java package, and you wrote a Java program in Eclipse in a project, just click compile and run, it will run in the output window in Eclipse.</p>
| 24,304 |
<p>Has anyone attempted this? Is it possible, and if so, what kind of problems will I run into if I try to accomplish it?</p>
| <p>I have put an additional layer between the AppController and some special controllers in an app.</p>
<p>The only problem you'll run into is the merging of the $helpers and $components class attributes. In CakePHP, overriding those variables in your controllers will <em>not</em> overwrite those set by the AppControl... | <p>Why not try? At least, it's already being done with the Controller -> AppController -> MyController classes.</p>
| 47,020 |
<p>I have a problem with how ASP.Net generates the <strong>img</strong> tag.
I have a server control like this: </p>
<pre><code><asp:Image runat="server" ID="someWarning" ImageUrl="~/images/warning.gif" AlternateText="Warning" />
</code></pre>
<p>I expect it to generate this: </p>
<pre><code><img id="ctl00_... | <p>Looks like it's trying to use a custom handler (ashx) to deliver the image. Do you have any additional modules that may be overriding the default behaviour of the asp:Image?</p>
<p>Your JavaScript won't work because the image tag has not been given an ID in the HTML that was generated.</p>
| <p>You can get the actual ID that is generated by using ClientID. I use this to get the ID of a control for use in JavaScript using syntax similar to the following:</p>
<pre><code>document.getElementById('<%=ddlCountry.ClientID%>').style.display = "block";
</code></pre>
<p>However you can also use it in your c... | 30,562 |
<p>Is there any Visual Studio Add-In that can do the remove method refactoring?<br>
Suppose you have the following method: </p>
<pre><code>Result DoSomething(parameters)
{
return ComputeResult(parameters);
}
</code></pre>
<p>Or the variant where Result is void.</p>
<p>The purpose of the refactoring is t... | <p>If I understand the question, then Resharper calls this 'inline method' - <kbd>Ctrl</kbd> - <kbd>R</kbd> + <kbd>I</kbd></p>
| <p>You can also right click the method name and click "Find all References" in Visual Studio.</p>
<p>I personally would just do a <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>H</kbd> to <code>Find & Replace</code></p>
| 3,000 |
<p>I've been researching memory mapped files for a project and would appreciate any thoughts from people who have either used them before, or decided against using them, and why?</p>
<p>In particular, I am concerned about the following, in order of importance:</p>
<ul>
<li>concurrency</li>
<li>random access</li>
<li>... | <p>I think the advantage is really that you reduce the amount of data copying required over traditional methods of reading a file.</p>
<p>If your application can use the data "in place" in a memory-mapped file, it can come in without being copied; if you use a system call (e.g. Linux's pread() ) then that typically in... | <p>Concurrency would be an issue.
Random access is easier
Performance is good to great.
Ease of use. Not as good.
Portability - not so hot.</p>
<p>I've used them on a Sun system a long time ago, and those are my thoughts.</p>
| 23,392 |
<p>Parameterized Queries in .Net always look like this in the examples:</p>
<pre><code>SqlCommand comm = new SqlCommand(@"
SELECT *
FROM Products
WHERE Category_ID = @categoryid
",
conn);
comm.Parameters.Add("@categoryid", SqlDbType.Int);
comm.Parameters["@categoryid"].Value = CategoryID;
</code></pr... | <p>Let's say that you have your category ids in an integer array and Name is a string. The trick is to create the command text to allow you to enter all of your category ids as individual parameters and construct the fuzzy match for name. To do the former, we use a loop to construct a sequence of parameter names @p0 ... | <p>This approach will not work. Period.</p>
<p>The IN clause expects a list of parameters itself, so when you bind <em>one</em> parameter to it, you have the chance to pass in <em>one</em> value.</p>
<p>Build your statement string dynamically, with the exact amount of individual IN clause placeholders you intend to p... | 38,944 |
<p>I would like to create data visualizations in desktop apps, using frameworks, languages and libraries that help with this kind of task. Visualizations should be interactive: clickable, draggable, customizable, animated...</p>
<p>What I would like to create is something similar to the examples seen here: <a href="htt... | <p>Your post has far too many questions in it to be answered easily in one response, so you might try re-posting with specific questions. Data visualization is a HUGE area of study and it's not significantly different for web applications versus desktop applications. </p>
<p>Put simply, it's the display of data in a w... | <p>If you're willing to use the Flash/Flex/ActionScript/AIR development platform, then take a look at the "flare" library, from the prefuse project:</p>
<p><a href="http://flare.prefuse.org/" rel="nofollow noreferrer">http://flare.prefuse.org/</a></p>
<p>I've only gotten my feet wet with it at this point, but so far ... | 15,887 |
<p>How can I setup a shared ccache without falling into a permissions problem?</p>
<p>I would like to run a nightly or CI build with latest changes and share all created binaries throughout the R&D using a large ccache repository.</p>
| <p>See the newly written <a href="https://ccache.dev/manual/3.7.11.html#_sharing_a_cache" rel="nofollow noreferrer">Sharing a cache</a> section in ccache's manual. In essence, use the same <code>CCACHE_DIR</code> setting, set <code>CCACHE_UMASK</code> appropriately and consider using <code>CCACHE_BASEDIR</code>.</p>
| <p>If you also use the related <a href="http://distcc.samba.org/" rel="nofollow noreferrer">distcc</a>, then the permission problems would largely go away, as the compilations would be run under it's control on whatever compile-farm hosts you set.</p>
<p>You could also include the developers desktop machines among the... | 14,592 |
<p>I am looking for a very fast way to filter down a collection in C#. I am currently using generic <code>List<object></code> collections, but am open to using other structures if they perform better.</p>
<p>Currently, I am just creating a new <code>List<object></code> and looping thru the original list. ... | <p>If you're using C# 3.0 you can use linq, which is way better and way more elegant:</p>
<pre class="lang-c# prettyprint-override"><code>List<int> myList = GetListOfIntsFromSomewhere();
// This will filter ints that are not > 7 out of the list; Where returns an
// IEnumerable<T>, so call ToList to conv... | <p>If your list is very big and you are filtering repeatedly - you can sort the original list on the filter attribute, binary search to find the start and end points.</p>
<p>Initial time O(n*log(n)) then O(log(n)).</p>
<p>Standard filtering will take O(n) each time.</p>
| 4,581 |
<p>Are there are good uses of Partial Classes outside the webforms/winforms generated code scenarios? Or is this feature basically to support that?</p>
| <p>It is in part to support scenarios (WebForms, WinForms, LINQ-to-SQL, etc) mixing generated code with programmer code.</p>
<p>There are more reasons to use it. For example, if you have big classes in large, unwieldy files, but the classes have groups of logically related methods, partial classes may be an option to ... | <p>Correction, as Matt pointed out, both sides of the partial need to be in the same assembly.
my bad.</p>
| 19,406 |
<p>I have a php page that displays rows from a mysql db as a table. One of the fields contains HTML markup, and I would like to amke this row clickable and the html would open in a new popup window. What is the best way to do it, and is there a way to do it without writing the html to a file?</p>
<p>edit: this php pa... | <pre><code>child1 = window.open ("about:blank")
child1.document.write("Moo!");
child1.document.close()
</code></pre>
| <p>If you don't require a browser window (this suggestion involves a css modal box), you might want to consider one of the "lightbox" variations. </p>
<p><a href="http://jquery.com/demo/thickbox/" rel="nofollow noreferrer">Thickbox</a> can be used to load inline content from the page into a modal window. The link prov... | 42,208 |
<p>I'm doing some maintenance coding on a webapp and I am getting a javascript error of the form: "[elementname] has no properties"</p>
<p>Part of the code is being generated on the fly with an AJAX call that changes innerHTML for part of the page, after this is finished I need to copy a piece of data from a hidden in... | <p>"[elementname] has no properties" is javascript error speak for "the element you tried to reference doesn't exist or is nil"</p>
<p>This means you've got one or more of a few possible problems:</p>
<ol>
<li>Your page hasn't rendered yet and you're trying to reference it before it exists</li>
<li>You've got a spell... | <p>Generally you shouldn't use innerHTML, but create elements using DOM-methods. I cannot say if this is your problem.</p>
| 17,031 |
<p>I have a C++ DLL including bitmap resources created by Visual Studio.</p>
<p>Though I can load the DLL in VB6 using LoadLibrary, I cannot load the image resources either by using LoadImage or by using LoadBitmap. When I try to get the error using GetLastError(), it doesnot return any errors.</p>
<p>I have tried us... | <p>Since you are using the numeric ID of the bitmap as a string, you have to add a "#" in front of it:</p>
<pre><code>DLLHandle = LoadLibrary("Mydll.dll")
myimage = LoadBitmap(DLLHandle, "#101") ' note the "#"
</code></pre>
<p>In C++ you could also use the MAKEINTRESOURCE macro, which is simply a cast to LPCTSTR:</p... | <p>You've got the right idea. You probably have the call wrong. Perhaps you could show a bit of code as I can't guess as to what you're passing.</p>
| 44,893 |
<p>I would like to use anti virus integration with my .net application when uploading files using the application. Has any anti virus API available for .Net?</p>
| <p>I don't want to resurrect an old question, but I was in need of a solution that the question was asking about. I evaluated a lot of things and came to the conclusion that there was really not one good .NET library for this. So I made my own.</p>
<p>The library is called nClam, and it connects to a ClamAV server. ... | <p>I recommend you a nuget called anti-virus scanner, with that you can do it with ease <a href="https://www.nuget.org/packages/AntiVirusScanner/" rel="nofollow noreferrer">https://www.nuget.org/packages/AntiVirusScanner/</a>
This nuget basically calls microsoft windows defender apis.</p>
| 23,575 |
<p>I'm calling a WebService exposed by Oracle that accepts an input of an ItemID and returns to me the corresponding Item Number. I want to grab the Item Number that has been returned out of the XML contained in the response.</p>
<p>The XML looks like this:</p>
<pre><code><env:Envelope
xmlns:env="http://schemas.... | <p>I'd personally use LINQ to XML, because I find that easier to deal with than XPath, particularly when namespaces are involved. You'd do something like:</p>
<pre><code>XNamespace ns0 = "http://dev1/MyWebService1.wsdl";
String result = doc.Descendants(ns0 + "result").First().Value;
</code></pre>
<p>Note that <code>... | <p>There are very good and complete answers to this question.</p>
<p>I'd add <strong>just out of curiosity, that an extremely simple XPath expression does the job</strong> in this particular case:</p>
<p> <strong><code>normalize-space(/)</code></strong></p>
<p>This is easily done in C# using some... | 49,014 |
<p>What's a good way to survive abnormally high traffic spikes?</p>
<p>My thought is that at some trigger, my website should temporarily switch into a "low bandwidth" mode: switch to basic HTML pages, minimal graphics, disable widgets that might put unnecessary load on the database, and so-on.</p>
<p>My thoughts are:... | <p>The basics:</p>
<ol>
<li>Don't try to host high-volume sites on Windows unless you are a <em>true</em> Windows guru. It can be done, but it's a time versus cost issue.</li>
<li>Use static content (i.e., no database queries) everywhere you can.</li>
<li>Learn about cache-control headers and use them properly for ima... | <p>No one has mentioned load balancing... haproxy, etc. Optimize, cache and load balance should survive almost anything. That being said, I'm not sure if stackoverflow is behind a load balancer ;)</p>
| 26,856 |
<p>I need to move entire tables from one MySQL database to another. I don't have full access to the second one, only phpMyAdmin access. I can only upload (compressed) sql files smaller than 2MB. But the compressed output from a mysqldump of the first database's tables is larger than 10MB.</p>
<p>Is there a way to spli... | <p>First dump the schema (it surely fits in 2Mb, no?)</p>
<pre><code>mysqldump -d --all-databases
</code></pre>
<p>and restore it.</p>
<p>Afterwards dump only the data in separate insert statements, so you can split the files and restore them without having to concatenate them on the remote server</p>
<pre><code>m... | <p>Try csplit(1) to cut up the output into the individual tables based on regular expressions (matching the table boundary I would think).</p>
| 16,100 |
<p>I am working with some CSS that is poorly written to say the least. I am not a design/CSS expert, but I at least understand the <strong>C</strong> in CSS. While the builtin CSS support inside of VS-2008 is far improved over previous versions, it still doesn't quite do what I am looking for.</p>
<p>I was wondering i... | <p>The <a href="https://addons.mozilla.org/en-US/firefox/addon/5392" rel="noreferrer">Dust-Me Selectors Firefox extension</a> can scan a website and tell you what CSS is used and what is not. Removing unused CSS is one good first step in refactoring.</p>
<p>I have often found that when some section is removed from a w... | <p>I like Expression Web's CSS facilities. But it doesn't do much for minimizing or unifying your CSS. You have to understand how CSS works to use it properly.</p>
| 13,957 |
<p>Using Flex 3, I have a Button which is skinned using PNGs specified in a CSS style sheet.</p>
<pre><code>Button.addextra {
downSkin : Embed( source="img/add-extra-icon.png" );
overSkin : Embed( source="img/add-extra-icon.png" );
upSkin : Embed( source="img/add-extra-icon.png" );
disabledSkin : ... | <p>I believe you will need to change the overSkin, i think that would be the only way.</p>
| <p>I believe you will need to change the overSkin, i think that would be the only way.</p>
| 38,125 |
<p>Pretty basic question, I'm trying to write a regex in Vim to match any phrase starting with <code>"abc "</code> directly followed by anything other than <code>"defg"</code>. </p>
<p>I've used <code>"[^defg]"</code> to match any single character other than d, e, f or g.</p>
<p>My first instinct was to try <code>/ab... | <p>Here's the search string.</p>
<pre><code>/abc \(defg\)\@!
</code></pre>
<p>The concept you're looking for is called a negative look-ahead assertion. Try this in vim for more info:</p>
<pre><code>:help \@!
</code></pre>
| <p>/abc\ [^d][^e][^f][^g]</p>
<p>It's pretty cumbersome for larger words, but works like a charm.</p>
| 12,232 |
<pre><code>
class C {
public
T x;
};
</code></pre>
<p>Is there an elegant way for the constructor of x to know <strong>implicitly</strong> in what instance of C it is constructing?
<hr>
I've implemented such behavior with some dirty inelegant machinery. I need this for my sqlite3 wrapper. I don't lik... | <p>No. Objects aren't supposed to need to know where they're being used from in order to work. As far as x is concerned, it's an instance of T. That's it. It doesn't behave differently according to whether it's a member of class C, a member of class D, an automatic, a temporary, etc.</p>
<p>Furthermore, even if the T ... | <p>I experiment with things like this in C# all the time - I use reflection to do it.</p>
<p>Consider getting a reflection or code generation library for C++ to help you do what you want to.</p>
<p>Now, I can't tell you how to find a good reflection or code generation library for C++, but that's a different question!... | 43,908 |
<p>I ran accross a CSR file (Certificate Signing Request) and I need to extract some information from it.</p>
<p>There's a way to decode it using .NET Framework?</p>
| <p>It's not .NET, but for interactive use, try the OpenSSL utilities. Specifically:</p>
<pre><code>openssl req -text -in request.csr
</code></pre>
| <p>Try <a href="http://lipingshare.com/Asn1Editor/" rel="nofollow noreferrer">Liping Dai's website</a>. His LCLib has ASN1 Parser which wrote in C#. It can decode CSR. Work for me. </p>
| 24,547 |
<p>I am using Context.RewritePath() in ASP.NET 3.5 application running on IIS7.</p>
<p>I am doing it in application BeginRequest event and everything works file.</p>
<p>Requests for /sports are correctly rewritten to default.aspx?id=1, and so on.</p>
<p>The problem is that in my IIS log I see GET requests for /Defau... | <p>After some research, I've finally found a solution to the problem.</p>
<p>I have replaced the calls to Context.RewritePath() method with the new (introduced in ASP.NET 3.5) <strong>Context.Server.TransferRequest()</strong> method.</p>
<p>It seems obvious now, but not event Senior Dev Engineer on IIS Core team thou... | <p>Old question, but I found I did not encounter your problem when I did the following:</p>
<p>a) A rewrite rule in web.config to direct all requests to /default.aspx, eg:</p>
<pre><code> <rule name="all" patternSyntax="Wildcard" stopProcessing="true">
<match url="*"/>
<action type="Rewr... | 46,045 |
<p>In Oracle we can print output by <code>dbms_output.put_line()</code> but I don't know to do the same thing in DB2.</p>
<p>I currently use <code>signal</code> for printing some messages when I debug.</p>
| <p>With Sharepoint Designer you can edit the CAML of your XSLT List View. </p>
<p>If you set the Scope attribute of the View element to <em>Recursive</em> or <em>RecursiveAll</em>, which returns all Files and Folders, you can filter the documents by <em>FileDirRef</em>:</p>
<pre><code><Where>
<Contains>... | <p>What kind of document library information do you want in the view?
How do you want the user to filter the view?</p>
<p>In general the most powerful way of creating views in sharepoint is with the data view web part.
<a href="http://office.microsoft.com/en-us/sharepointdesigner/HA100948041033.aspx" rel="nofollow no... | 37,760 |
<p>I'm currently working on a very short project on Prolog, and just got stuck trying to apply a "filter" I have created to a list. I have what you could call the filter ready, but I can't apply it. It'd be better if I illustrate:</p>
<pre><code>filter(A, B)
</code></pre>
<p>...outputs 'true' if certain conditions a... | <p>If you are searching for higher-order functions in Prolog, you should definetly consult <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.35.4505" rel="noreferrer">Naish (1995)</a>, a very good resource on this.</p>
<p><P>His definition of <code>filter/3</code> is the following (he uses difference-li... | <p>Well what'd you know I just figured it out. So, here's me submitting an answer to my own question, as expected a really short function did the job:</p>
<pre><code>filterList(_,[],R,R). % Returns answer when the list is exhausted.
filterList(L,[A|List],Temp,Res) :-
filterList(L,List,New,Res), % Recursi... | 38,135 |
<p>I have a class library with all my database logic. My DAL/BLL. </p>
<p>I have a few web projects which will use the same database and classes, so I thought it was a good idea to abstract the data layer into its own project.</p>
<p>However, when it comes to adding functionality to classes for certain projects I w... | <p>You can't write a partial class across projects. A partial class is a compile-time-only piece of syntactic sugar - the whole type ends up in a single assembly, i.e. one project.</p>
<p>(Your original DAL file would have to declare the class to be partial as well, by the way.)</p>
| <p>While I agree with you Neil when it comes to pre-linq development, I also wish I could be able to do this in order to split up bussiness logic from partial classes generated by Linq2SQL designer.
For example:</p>
<pre><code>Northind.DAL (prj)
-NorthindDataContext (EntityNamespace set to "Northwind.BLL")
--Product()... | 39,932 |
<p>Is Eclipse the best <code>IDE</code> for Java? </p>
<p>If not, is there something better? </p>
<p>I want to know and possibly try it out. Thanks.</p>
| <p>Let me just start out by saying that Eclipse is a <em>fantastic</em> IDE for Java and many other languages. Its plugin architecture and its extensibility are hard to rival and the fact that it's free is a huge plus for smaller teams or tight budgets.</p>
<p>A few things that I <em>hate</em> about Eclipse.</p>
<ul... | <p>This is not really an answer, just an anecdote. I worked with guys who used emacs heavily loaded with macros and color coded. Crazy! Why do that when there are so many good IDEs out there?</p>
| 18,421 |
<p>I have an internal web app with an image at the top of the page, currently containing some english text with drop shadows. I now need to provide localized versions of this page for various languages. My main choices are:</p>
<p><UL>
<LI>Have a different graphic per supported language, containing the localized text.... | <p>Personally I'm a big fan of CSS techniques for visual effects like this. The big benefit is that you are offloading the processing of the effect to the client side, saving you bandwith and content creation time (custom text images for each locale is a big order!), and making the page download faster for the user. </... | <p>Maintaining images with text can be a pain - even without localization, I'd avoid it.</p>
<p>Two choices that I would attempt before going with your options are:</p>
<ul>
<li>Looking for a free program that generates drop-shadow images that you can have your program utilize whenever it detects that new text is ava... | 22,120 |
<p>I display some objects that have thumbnails in two ways: one in a DataGridView, and one in a custom control.</p>
<p>In the DataGridView, the thumbnail is displayed in a DataGridViewImageCell. If the thumbnail is missing, the cell displays an error icon.</p>
<p>I want to show that icon in my custom control, too. ... | <p>I'd recommend turning this problem on its head: make sure the grid <strong>never</strong> displays the error icon. You should be able to do this by catching the cell data display event. If the image is missing, display an image from your resource segment (and use the same image in the custom control, obviously).</p>... | <p>I think, this icon is available in "%visual_studio_directory"\Common7\VS2005ImageLibrary" directory.</p>
| 35,975 |
<p>How do you extract an HD and Bios Unique ID, using python script?</p>
| <p>Solutions that come to my mind:</p>
<ol>
<li>use <a href="http://python.net/crew/mhammond/win32/Downloads.html" rel="nofollow noreferrer">Win32 Python Extensions</a> and call Windows APIs to do that directly</li>
<li>Use a WMI-wrapper for Python</li>
</ol>
<p>(some <a href="http://www.microsoft.com/technet/scriptc... | <p>On Linux, look in the /proc directory. You'll have to parse the files to find what you are looking for.</p>
<p><a href="http://www.linux.com/feature/126718" rel="nofollow noreferrer">This</a> might help.</p>
| 28,115 |
<p>What's the best way to do it in .NET?
I always forget what I need to <code>Dispose()</code> (or wrap with <code>using</code>).</p>
<p>EDIT: after a long time using <code>WebRequest</code>, I found out about customizing <code>WebClient</code>. Much better.</p>
| <p>Syncronous Way:</p>
<pre><code>var request = HttpWebRequest.Create("http://www.contoso.com");
request.Timeout = 50000;
using (var response = request.GetResponse())
{
//your code here
}
</code></pre>
<p>You can also have the asynchronous way:</p>
<pre><code>using System;
using System.Net;
using System.IO;
usin... | <p>Run System.Net.WebClient in a seperate thread, set a timer to kill it after your maximum time.</p>
| 37,772 |
<p>Is it possible to create a SQL query which will return one column which contains the dates from a given date range (e.g. all dates from last year till today). E.g.</p>
<pre><code>dat
----
2007-10-01
2007-10-02
2007-10-03
2007-10-04
...
</code></pre>
<p>I am wondering if this is possible as an alternative to creati... | <p>AFAIK you cannot do that with a single SQL query. However the following block of code will do the job.</p>
<p>Currently in Transact-SQL (for SQL Server). I do not know how this translates to MySQL.</p>
<pre><code>DECLARE @start datetime
DECLARE @end datetime
DECLARE @results TABLE
(
val datetime not null
)
set ... | <p>AFAIK you cannot do that with a single SQL query. However the following block of code will do the job.</p>
<p>Currently in Transact-SQL (for SQL Server). I do not know how this translates to MySQL.</p>
<pre><code>DECLARE @start datetime
DECLARE @end datetime
DECLARE @results TABLE
(
val datetime not null
)
set ... | 20,084 |
<p>I'm trying to write a simple audio player for a website, and am using the EMBED... tag to embed the audio and setting HIDDEN="true" and using various javascript commands to control the audio playback. It works fine for realplayer and mplayer but the quicktime plugin doesn't respond to javascript if the hidden bit is... | <p>First, i suggest you to use the <code>object</code> html tag which is standardized, <code>embed</code> is not.</p>
<p>Then you could simply hide your embeded audio using CSS instead of this <code>hidden</code> param.</p>
<p>Even better, you should hide it using CSS through JavaScript, because if you do it this way... | <p>I found that setting height=0 width=0 worked the same as hidden=true and solved the problem</p>
| 9,745 |
<p>I have an action like this:</p>
<pre><code>public class News : System.Web.Mvc.Controller
{
public ActionResult Archive(int year)
{
/ *** /
}
}
</code></pre>
<p>With a route like this:</p>
<pre><code>routes.MapRoute(
"News-Archive",
... | <p>You have a couple problems, I think.</p>
<p>First, your route doesn't have a default value for "year", so the URL "/News.mvc/Archive" is actually not valid for routing purposes.</p>
<p>Second, you're expect form values to show up as route parameters, but that's not how HTML works. If you use a plain form with a se... | <p>I think I've worked out why - the route includes {year} so the generated routes always will too..</p>
<p>If anyone can confirm this?</p>
| 7,165 |
<p>One of the sites I maintain relies heavily on the use of <code>ViewState</code> (it isn't my code). However, on certain pages where the <code>ViewState</code> is extra-bloated, Safari throws a <code>"Validation of viewstate MAC failed"</code> error.</p>
<p>This appears to only happen in Safari. Firefox, IE and Oper... | <p>I've been doing a little research into this and whilst I'm not entirely sure its the cause I believe it is because Safari is not returning the full result set (hence cropping it).</p>
<p>I have been in dicussion with another developer and found the following post on Channel 9 as well which recommends making use of ... | <p>My first port of call would be to go through the elements on the page and see which controls:</p>
<ol>
<li>Will still work when I switch ViewState off</li>
<li>Can be moved out of the page and into an AJAX call to be loaded when required</li>
</ol>
<p>Failing that, and here's the disclaimer - I've never used this ... | 2,361 |
<p>I was happily using Eclipse 3.2 (or as happy as one can be using Eclipse) when for a forgotten reason I decided to upgrade to 3.4. I'm primarily using PyDev, Aptana, and Subclipse, very little Java development.</p>
<p>I've noticed 3.4 tends to really give my laptop a hernia compared to 3.2 (vista, core2duo, 2G). Is... | <p>Yes memory usage can get real high and you might run into problems with your JVM, as the default setting is a bit to low.
Consider using this startup parameters when running eclipse:</p>
<pre><code>-vmargs -XX:MaxPermSize=1024M -Xms256M -Xmx1024M
</code></pre>
| <p>Yes memory usage can get real high and you might run into problems with your JVM, as the default setting is a bit to low.
Consider using this startup parameters when running eclipse:</p>
<pre><code>-vmargs -XX:MaxPermSize=1024M -Xms256M -Xmx1024M
</code></pre>
| 12,535 |
<p>I'm going to make my monthly trip to the bookstore soon and I'm kind of interested in learning some user interface and/or design stuff - mostly web related, what are some good books I should look at? One that I've seen come up frequently in the past is <a href="https://rads.stackoverflow.com/amzn/click/com/032134475... | <p><a href="http://www.sensible.com/dmmt.html" rel="nofollow noreferrer">Don't Make Me Think</a> is the one!</p>
<p>Also check out <a href="http://www.sensible.com/" rel="nofollow noreferrer">Steve Krug's website</a> for tips and sample forms for usability testing.</p>
| <p>"Don't Make Me Think" is great. After sitting in on several usability studies I can safely say that several of his biggest points are the kinds of things drilled in your head over and over.</p>
<p>Joel Spolsky's book on user interfaces is also decent.</p>
<p><a href="https://rads.stackoverflow.com/amzn/click/com/... | 27,369 |
<p>I have printed two objects with my new 3D printer (Anycubic Mega S) and everytime, my prints are stuck to my bed (sort of glued to it). I cannot remove them by hand. I have tried waiting until it cools off, but the only thing that works is scraping really hard the bed with the spatula.</p>
<p>I'm scared that if I h... | <p>One method that works at our makerspace and also has worked for a user on another 3d printing forum is to use a 50:50 mix of water and denatured alcohol. While the print bed is warm, apply some to the perimeter of the print at the bed surface. Allow it to cool, try to remove the print. If it does not work, reheat th... | <p>I have had good luck using dental floss. If you can get it under the edge of the print, then you can pull it all the way through and prints come off easily. </p>
| 1,548 |
<p>Is there any way to detect, through WSH, which workstations, in a windows domain, has a locked session?</p>
| <p><a href="http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov04/hey1115.mspx" rel="nofollow noreferrer">http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov04/hey1115.mspx</a></p>
<p>If you scroll down, there is a check if computer is locked script on the page. The script basically grabs ... | <p>Not sure if you are using locked as in locked or as in hung but I use pstools to check for systems with the screen lock turned on. My command line is:</p>
<p>pslist \machinename > machinename.txt</p>
<p>then check the machine_name.txt file for logon.scr if present the screen is locked.</p>
| 42,353 |
<p>How can I fetch more than 1000 record from data store and put all in one single list to pass to django?</p>
| <p>Starting with Version 1.3.6 (released Aug-17-2010) you <strong>CAN</strong> </p>
<p><a href="http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes#Version_1.3.6_-_August_17,_2010" rel="noreferrer">From the changelog:</a></p>
<blockquote>
<p>Results of datastore count() queries <strong>and offsets for al... | <p>To add the contents of the two queries together:</p>
<pre><code>list1 = first query
list2 = second query
list1 += list2
</code></pre>
<p>List 1 now contains all 2000 results.</p>
| 33,081 |
<p>I'm trying to script the shutdown of my VM Servers in a .bat.
if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.</p>
<pre><code>c:
cd "c:\Program Files\VMWare\VmWare Server"
vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx suspend s... | <p>Run it inside another command instance with <code>CMD /C</code></p>
<pre><code>CMD /C vmware-cmd C:\...
</code></pre>
<p>This should keep the original BAT files running.</p>
| <p>You could write a little Program that executes the command an returns a value (say -1 for an error). This value can then be used in your Batch-File.</p>
| 9,994 |
<p>I'm looking for a Java profiler that works well with the JVM coming with WebSphere 6.0.2 (IBM JVM 1.4.2). I use yourkit for my usual profiling needs, but it specifically refuses to work with this old jvm (I'm sure the authors had their reasons...).</p>
<p>Can anybody point to a decent profiler that can do the job? ... | <p>Update: I found out that <a href="http://www.ej-technologies.com/products/jprofiler/overview.html" rel="nofollow noreferrer">JProfiler</a> integrates smoothly with WAS 6.0.2 (IBM JDK 1.4). </p>
| <p>What are you looking to profile? Is it stuff in the JVM or the App Server? If it's the latter, there's loads of stuff in WAS 6 GUI to help with this. Assuming you really want to see stuff like the heap etc, then the IBM <a href="http://alphaworks.ibm.com/tech/heapanalyzer" rel="nofollow noreferrer">HeapAnalyzer</a... | 8,711 |
<p>I have a DLL written in C++ that needs to be used by an application in C#. It works great under Vista x86, but under x64 it fails to load. So I build an x64 version of the DLL and I detect whether the OS is x86 or x64 and use the appropriate interop call to the appropriate DLL. This works fine under Vista x86, but u... | <p>The redist for VC90 for x64 will need to be installed on the client machine. As far as the manifest goes, I think you can alter it to remove the processorArchitecture tag. Either that or have it say "any".</p>
| <p>The side by side error is more then likely caused by you c++ dll manifest file settings either they are not getting embedded or you have chosen to not embed the manifest and is using the 32bit versions manifest.</p>
<p>The simple solution is to mark your c# application as for the x86 cup and run with the 32bit dll.... | 44,269 |
<p>I've evaluated some plugins from official IntelliJ repository, but none of them seems to provide more then basic syntax highlighting. Even highlighting is limited. For example, Database Navigator doesn't highlight IF. It would be great to have proper highlighting. And if it would have auto-complete feature and provi... | <p>Have you tried <a href="http://java.sstiller.de/sql/index.html" rel="nofollow noreferrer" title="KiwiSoft - SQL Query Plugin">SQL Query Plugin</a>? It comes with a great host of features, including multiple query windows, direct editing of tables, and of course, proper highlighting for PL/SQL syntax and a browser of... | <p>I've started using the <a href="http://plugins.intellij.net/plugin/?objc&pluginId=4486" rel="nofollow">SQL Code Assistant</a> plugin that instantly has recognised my PL/SQL packages and all these PL/SQL constructs (cursors etc) which the out-of-the-box IntelliJ functionality couldn't understand and was marking r... | 20,224 |
<p>If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using <code>each</code> may in some way have unintended side effects. So, is that true, and is one of the two following methods best, or is there a better way?</p>
<pre><code... | <p>The rule of thumb is to use the function most suited to your needs.</p>
<p>If you just want the keys and do not plan to ever <em>read</em> any of the values, use keys():</p>
<pre><code>foreach my $key (keys %hash) { ... }
</code></pre>
<p>If you just want the values, use values():</p>
<pre><code>foreach my $val ... | <p>I woudl say:</p>
<ol>
<li>Use whatever's easiest to read/understand for most people (so keys, usually, I'd argue)</li>
<li>Use whatever you decide consistently throught the whole code base. </li>
</ol>
<p>This give 2 major advantages:</p>
<ol>
<li>It's easier to spot "common" code so you can re-factor into functi... | 2,517 |
<p>In the KornShell (ksh) on <b>AIX UNIX Version 5.3</b> with the editor mode set to vi using:</p>
<pre><code>set -o vi
</code></pre>
<p>What are the key-strokes at the shell command line to autocomplete a file or directory name?</p>
| <p>ESC\ works fine on AIX4.2 at least. One thing I noticed is that it only autocompletes to the unique part of the file name.</p>
<p>So if you have the files x.txt, x171go and x171stop, the following will happen:</p>
<pre><code>Press keys: Command line is:
x x
<ESC>\ ... | <p>Extending the other answers: <ESC>* will list all matching files on the command line. Then you can use the standard vi editing commands to remove the ones you don't care about. So to add to the above table:</p>
<pre><code><ESC><shift-8> x.txt x171 x171go
</code></pre>
<p>Then use bac... | 10,660 |
<p>I'm looking to perform a perspective transform on a UIView (such as seen in coverflow)</p>
<p>Does anyonew know if this is possible? </p>
<p>I've investigated using <code>CALayer</code> and have run through all the pragmatic programmer Core Animation podcasts, but I'm still no clearer on how to create this kind of... | <p>As Ben said, you'll need to work with the <code>UIView's</code> layer, using a <code>CATransform3D</code> to perform the <code>layer's</code> <code>rotation</code>. The trick to get perspective working, as <a href="http://watchingapple.com/2008/04/core-animation-3d-perspective/" rel="nofollow noreferrer">described ... | <p>You can get accurate Carousel effect using iCarousel SDK.</p>
<p>You can get an instant Cover Flow effect on iOS by using the marvelous and free iCarousel library. You can download it from <a href="https://github.com/nicklockwood/iCarousel" rel="nofollow noreferrer">https://github.com/nicklockwood/iCarousel</a> and... | 45,254 |
<p>I am iterating though a TreeSet and printing it out:</p>
<pre><code>while (it.hasNext()) {
System.out.println(it.next());
}
</code></pre>
<p>output:</p>
<pre><code>after
explorers
giant
hoping
internet
into
.
.
.
virtual
world
</code></pre>
<p>However, I would like to <i>only</i> print out those strings who's... | <p>First of all, your regular expression is wrong. You want</p>
<pre><code>"^[m-z]"
</code></pre>
<p>Second of all, you don't show the code you're using to do the matching.</p>
<p>Third: If you're willing to do something besides regular expressions and iteration, you should look into SortedSet.tailSet. That's prob... | <p>seems like an homework but anyhow,
the "[^m-z]" means NOT m-z</p>
<p>try putting the "^" outside the "[]"</p>
<p>Have a look at the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html" rel="nofollow noreferrer">Pattern</a> class
and BTW, try <code>String.matches()</code></p>
| 41,055 |
<p>I've just found out about Stack Overflow and I'm just checking if there are ideas for a constraint I'm having with some friends in a project, though this is more of a theoretical question to which I've been trying to find an answer for some time.</p>
<p>I'm not much given into cryptography but if I'm not clear enou... | <p>You can do it the way you describe - effectively querying the hash, say, but there's not many systems with that requirement, because at that point the security requirements are interfering with other requirements for the system to be usable - i.e. no partial matches, since the encryption rules that out. It's the sa... | <p>You want do use md5 hashing. Basically, it takes your string and turns it into a hash that cannot be reproduced. You can then use it to validate against things later. For example:</p>
<pre><code>$salt = "123-=asd";
$address = "3412 g ave";
$sql = "INSERT INTO addresses (address) VALUES ('" . md5($salt . $address) ... | 21,855 |
<p>How much data should be in a table so that reading is optimal? Assuming that I have 3 fields varchar(25). This is in MySQL.</p>
| <p>Number of rows should not matter. Make sure the fields your searching on are indexed properly. If you only have 3 varchar(25) fields, then you probably need to add a primary key that is not a varchar.</p>
| <p>For optimal reading you should have an index. A table exists to hold the rows it was designed to contain. As the number of rows increases, the value of the index comes into play and reading remains brisk.</p>
| 36,586 |
<p>While there appears to some documentation on how to expose JMX through various firewall and tunneling schemes, I sort of want the opposite. I want to ensure that JMX is only accessible to local machine. Unfortunately it appears that the "out of the box" management options do not allow restricting the ports to a lo... | <p>A bit late answer but if it is still a problem for you (or someone else), I think this will do the trick:</p>
<pre class="lang-java prettyprint-override"><code>import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.net.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.serve... | <p>Can't help with the sun way of doing it. Even after jmx adapters started coming with the jdk (6 i think?) I kept using mx4j for the least-effort adapter setup. It is trivial to start up an mx4j http adapter on 127.0.0.1 or an internal-only interface. Then SOP was to ssh in with port forwards or use scripts with w... | 45,155 |
<p>Windows Mobile devices have different behaviour for suspending when the device is on battery power, or on external power.</p>
<p>in my application, written using VB.net, I need to be able to determine whether the device has external power connected.</p>
<p>is there a method to get this status from the Compact fram... | <p>If you're using WIndowsMobile 5.0 and later only, the <a href="http://www.developer.com/ws/pc/article.php/3547381" rel="nofollow noreferrer">State and Notification Broker</a> is where to look, specifically at the <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.status.aspx" rel="nofollow nore... | <p>This may go beyond what you were asking but I wrote something on the Windows Mobile Powermanagement APIS. It uses the same APIs that Chris just referenced but is .Net oriented (sorry, it is in C#, not VB.Net). </p>
<p><a href="http://www.codeproject.com/KB/mobile/WiMoPower1.aspx" rel="nofollow noreferrer">http://ww... | 47,398 |
<p>I've decided that I want to use Mercurial for a small, personal project. </p>
<p>Most of the help I've read about it talks about merging changes between multiple users. Since I'm solo, that's not going to happen.</p>
<p>Should I have multiple repositories? My development computer is already backed up nightly to... | <p>I use Mercurial to develop FsCheck, a unit testing framework hosted in codeplex. I am currently the only developer, but occasionally people send me patches.</p>
<p>Concretely, I have one folder in my filesystem called "FsCheck". In that, I have one repository, and thus folder, called main. Typically, I have a few f... | <p>I think this depends on whether or not you are maintaining an existing application <em>and</em> adding features (or fixing large bugs) at the same time.</p>
<p>This way you can fix bugs in the main branch while creating a new feature in it's own branch.</p>
<p>I do exactly that with my applications, but with a loc... | 34,978 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br />
<a href="https://stackoverflow.com/questions/6457130/pre-post-increment-operator-behavior-in-c-c-java-c-sharp">Pre & post increment operator behavior in C, C++, Java, & C#</a></p>
</blockquote>
<p>Here is a test case:</p>
<pre><code>
void foo(int i, in... | <p>This is an example of unspecified behavior. The standard does <strong>not</strong> say what order arguments should be evaluated in. This is a compiler implementation decision. The compiler is free to evaluate the arguments to the function in any order. </p>
<p>In this case, it looks like actually processes the a... | <p>The compiler might not be evaluating the arguments in the order you'd expect.</p>
| 12,372 |
<p>I have got a button with an onclick javascript event that does some form validation. If the validation fails, false is returned. Otherwise nothing is returned, and the form should be submitted. </p>
<p>But what's happening is the url loads in the address bar but the page never loads. No headers are sent, no error m... | <p>Check if you closed all your tags in the top of the page. In particular the head tag.</p>
| <p>Do you call submit() if validation passes?</p>
| 37,231 |
<p>I am trying to control a laser with the fan (D9) and ran into problems.
So I tried P44, no good then P6 also not good.\
What my problem is I am trying to "burn" a group of vertical lines spaced about 0.75" apart, and randomly the drive to the laser power supply is either "skipping" (missing the control pulse) or str... | <p>Thank you all for your suggestions and help.</p>
<p>It appears that I was just running the printer too fast and slowing it down to about 10% of my original speed "fixed" my problem.
I don't know where i got the rediculous speed from, but 1200 mm/min is WAY too fast.
More like 150 to maybe 200 mm/min is what it shou... | <p>This is a stab in the dark but maybe the Arduino (clone or genuine) and RAMPS1.4 combination is not powerful enough to handle the calculations required to control the laser and printing simultaneously (although I can't really see why the additional processing to control a laser would be over taxing the processor. Ho... | 650 |
<p>I'm having quite a bit of pain inserting and deleting UITableViewCells from the same UITableView!</p>
<p>I don't normally post code, but I thought this was the best way of showing where I'm having the problem:</p>
<hr>
<pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 5;
}
... | <p>Struggled to get this to work. Here's my code to add a row to my tableView:</p>
<pre><code>NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[tableView beginUpdates];
[dataSource insertObject:[artistField text] atIndex:0];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] wit... | <p>In the code you posted, your loop index runs from 0 to 4, which suggests that it would delete <i>all</i> of the rows in section 1, and then add five new rows to section 2. Since each section already has a row 0, this would add a <i>second</i> instance of section 2, row 0 to the table.</p>
<p>I would suggest having ... | 43,010 |
<p>I've started working with ASP.net AJAX (finally ☺). and I've got an update panel together with a asp:UpdateProgress. My Problem: The UpdateProgress always forces a line-break, because it renders out as a div-tag.</p>
<p>Is there any way to force it being a span instead? I want to display it on the same line as some... | <p>I've had the same issue. There is no easy way to tell the updateProgress to render inline. You would be better off to roll your own updateProgress element. You can add a beginRequest listener and endRequest listener to show and hide the element you want to display inline. Here is simple page which shows how to do it... | <p>You can make a div inline like this:</p>
<pre><code><div style="display:inline">stuff</div>
</code></pre>
<p>I'm skeptical of it rendering the div for you though... I don't remember having this problem on my pages...</p>
| 6,401 |
<p>Need some advice on working out the team velocity for a sprint.</p>
<p>Our team normally consists of about 4 developers and 2 testers. The scrum master insists that every team member should contribute equally to the velocity calculation i.e. we should not distinguish between developers and testers when working out ... | <p>Since Agile development is about transparency and accountability it sounds like the testers should have assigned tasks that account for their velocity. Even if that means they have a task for surfing the web waiting for testing (though I would think they would be better served developing test plans for the dev team... | <p>Sounds to me like your system is working, just not as well as you'd like. Is this a paid project? If it is, you could make pay be a meritocracy. Pay people based on how much of the work they get done. This would encourage cross discipline work. Although, it might also encourage people to work on pieces that weren't ... | 7,080 |
<p>I hope this question does not come off as broad as it may seem at first. I am designing a software application that I would like to be both cross-platform and modular. I am still in the planning phase and can pick practically any language and toolset.</p>
<p>This makes things harder, not easier, because there are se... | <p>Just to cite an example: for .NET apps there are the CAB (Composite Application Block) and the Composite Application Guidance for WPF. Both are mainly implementations of a set of several design patterns focused on modularity and loose coupling between components similar to a plug-in architecture: you have an IOC fra... | <p>With my limited Mono experience I can say I'm quite sold on it. The fact that there is active development and a lot of ongoing effort to bring it up to spec with the latest .Net technologies is encouraging. It is incredibly useful to be able to use existing .Net skills on multiple platforms. I had similar issues ... | 5,360 |
<p>I have the following component </p>
<pre><code>public class MyTimer : IMyTimer {
public MyTimer(TimeSpan timespan){...}
}
</code></pre>
<p>Where timespan should be provided by the property ISettings.MyTimerFrequency.</p>
<p>How do I wire this up in windsor container xml?
I thought I could do something like this... | <p>The solution actually came to me in a dream. Keep in mind that properties are not a CLR construct but rather C# syntactic sugar. If you don't believe me just try compiling</p>
<pre><code>public class MyClass {
public object Item {
get;
}
public object get_Item() {return null;}
}
</code></pre>
<p>result... | <p>Wouldn't the simplest solution be to add a method which wraps the property?</p>
| 23,311 |
<p>I have a table like so:</p>
<pre><code>keyA keyB data
</code></pre>
<p>keyA and keyB together are unique, are the primary key of my table and make up a clustered index.</p>
<p>There are 5 possible values of keyB but an unlimited number of possible values of keyA,. keyB generally increments.</p>
<p>For example, t... | <p>You should order your composite clustered index with the most selective column first. This means the column with the most distinct values compared to total row count.</p>
<p>"B*TREE Indexes improve the performance of queries that select a small percentage of rows from a table." <a href="http://www.akadia.com/serv... | <p>The best thing you can do is to try both solutions and measure the execution time.</p>
<p>In my experience, index tuning is all but exact-science.</p>
<p>Maybe having keyB before keyA in the index column order would be better</p>
| 44,751 |
<p>Are these two terms interchangeable?</p>
| <p>CIL is the term used in the <a href="http://www.ecma-international.org/publications/standards/Ecma-335.htm" rel="noreferrer">CLI Standard</a>. MSIL is (I suppose) CIL created by MS tools. Effectively they are synonymous.</p>
<p><a href="http://blogs.msdn.com/brada/archive/2005/09/20/CILorMSIL.aspx" rel="noreferrer"... | <p>Both the terms are similar but with following difference:</p>
<p>CIL – Common Intermediate Language – is the term used in the International Standard. </p>
<p>MSIL – Microsoft Intermediate Language – is the product term for the Microsoft implementation of that standard.</p>
| 37,504 |
<p>As a workaround for a problem, I think I have to handle KeyDown events to get the printable character the user actually typed.</p>
<p>KeyDown supplies me with a KeyEventArgs object with the properities KeyCode, KeyData, KeyValue, Modifiers, Alt, Shift, Control.</p>
<p>My first attempt was just to consider the KeyC... | <p>Many controls override the default key input events. For instance, a Panel won't respond to them by default at all. As for the case of simple controls, you could try:</p>
<pre><code>protected override bool IsInputKey(Keys keyData) {
// This snippet informs .Net that arrow keys should be processed in the panel (... | <p>Have a look at System.Text.Encoding.ASCII and System.Text.Encoding.Default</p>
| 24,216 |
<p>I'm working on a .NET web application and I'm using a CalendarExtender control within it to have the user specify a date. For some reason, when I click the icon to display the calendar, the background seems to be transparent.</p>
<p>I'm using the extender on other pages and do not run into this issue.</p>
<p>I'm n... | <p>So some more poking around and I figured out the issue. Part of the problem arises from the fact that the div layout I setup to create two separate columns is using the position:relative and float:right/left attributes. </p>
<p>From what I've read, as soon as you start augmenting the position attribute of a div tag... | <p>That doesn't look transparent to me, it looks like it's rendering "behind" the other elements.
Do you have a "z-index" specified for any items?</p>
| 38,805 |
<p>This code was working properly before, basically I have a master page that has a single text box for searching, I named it <strong><code>searchBox</code></strong>. I have a method to pull the content of <strong><code>searchBox</code></strong> on form submit and set it to a variable <strong><code>userQuery</code></s... | <p>There is a feature in AD for Win2k3 and higher to mark an object to prevent accidental deletion. This check box on the object actually changes the underlying permissions for you to remove delete permissions. Therefore it is not tool specific and must be respected by other tools (like powershell and vbscript).</p>
| <p>You could deny the Delete privalge from Administrators through Delegation at the root level and then you would need to be an enterprise admin to perform deletions. Ensure that no admins are in the Enterprise Admins group for day-to-day usage.</p>
| 31,363 |
<p>I've recently asked a question on StackoverFlow about the MVC: <a href="https://stackoverflow.com/questions/305988/can-the-mvc-design-pattern-architectual-pattern-be-used-in-desktop-application">Can the MVC Design Pattern / Architectural pattern be used in Desktop Application Development?</a></p>
<p>Based on the an... | <p><em>(The article is not an example of MVC AFAIK for the simple reason that there is no controller.. it is more close to .net data binding if you ask me.)</em><br>
MVC is not the Observer pattern. MVC is concerned with separation of concerns. The Model, the View and the Controller all do one job and trust the others ... | <p>I would agree that the article is not MVC. Its more of an implementation of observer pattern. Observer pattern in .NET can be implemented by using events, which was the case of the article. </p>
<p>MVC requires a controller class that controls what action to execute upon a request made from either the model, or the... | 39,649 |
<p>I'm experimenting with a personal finance application, and I'm thinking about what approach to take to update running balances when entering a transaction in an account.</p>
<p>Currently the way I'm using involves retrieving all records more recent than the inserted/modified one, and go one by one incrementing thei... | <p>Some sort of Identity / Auto-increment columnn in there would be wise as well, purely for the transaction order if anything. </p>
<p>Also in addition to just the date of the transaction, a date that the transaction is inserted into the database (not always the same) would be wise / helpful as well. </p>
<p>These s... | <p>If you have a large volume of transactions, then you are better off storing the running balance date-wise or even week/month-wise in a separate table.
This was if you are inserting rows for the same date you just need to change the running balance in one row.
The querying and reporting will be more trickier as usin... | 27,694 |
<p>I want to copy the entire contents of a directory from one location to another in C#.</p>
<p>There doesn't appear to be a way to do this using <code>System.IO</code> classes without lots of recursion.</p>
<p>There is a method in VB that we can use if we add a reference to <code>Microsoft.VisualBasic</code>:</p>
<... | <p>Much easier</p>
<pre><code>private static void CopyFilesRecursively(string sourcePath, string targetPath)
{
//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(dirPath.Replace(... | <p>Better than any code (extension method to DirectoryInfo with recursion)</p>
<pre><code>public static bool CopyTo(this DirectoryInfo source, string destination)
{
try
{
foreach (string dirPath in Directory.GetDirectories(source.FullName))
{
var newDirPath =... | 8,318 |
<p>I am building an application that is very similar to a shopping cart. The user selects a product from a list, and then based on that product, a few properties need to be set and saved.</p>
<p>Example.</p>
<p>If the user selects a type of paint that allows custom color matches, then I must allow them to enter in a... | <p>You can have a Product class with a collection of product properties </p>
<pre><code> public class Product
{
private Dictionary<string, string> properties;
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</valu... | <p>Depending on how you have you current objects setup; I would create 2 Paint classes. The first Paint class takes all the common properties/fields found in paint. I would then create a second class, we'll call it PaintSpecialize. PaintSpecialize will inherit from Paint (giving this class all of Paint's properties and... | 36,515 |
<p>I Have one entity [Project] that contains a collection of other entities [Questions].</p>
<p>I have mapped the relation with a cascade attribute of "all-delete-orphan".</p>
<p>In my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null since I don't want a... | <p>Straight from the <a href="http://www.hibernate.org/hib_docs/nhibernate/html/example-parentchild.html#example-parentchild-cascades" rel="noreferrer">documentation</a>. This explains your problem exactly i believe:</p>
<p>However, this code</p>
<pre><code>Parent p = (Parent) session.Load(typeof(Parent), pid);
// Ge... | <p>The delete is occurring on the Project first and cascading to the Question, but the Project delete includes a nulling of the project_id in the Questions (for referential integrity. You're not getting an exception on the deletion of the Question object, but because the cascade is trying to null the FK in the Questio... | 24,305 |
<p>I got this output when running <code>sudo cpan Scalar::Util::Numeric</code></p>
<pre>
jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric
[sudo] password for jmm:
CPAN: Storable loaded ok
Going to read /home/jmm/.cpan/Metadata
Database was generated on Tue, 09 Sep 2008 1... | <p>You're missing your C library development headers. You should install a package that has them. These are necessary to install this module because it has to compile some non-perl C code and needs to know more about your system.</p>
<p>I can't tell what kind of operating system you're on, but it looks like linux. If ... | <p>It can't find basic system headers. Either your include path is seriously messed up, or the headers are not installed.</p>
| 10,090 |
<p>These days, more languages are using unicode, which is a good thing. But it also presents a danger. In the past there where troubles distinguising between 1 and l and 0 and O. But now we have a complete new range of similar characters.</p>
<p>For example:</p>
<pre><code>ì, î, ï, ı, ι, ί, ׀ ,أ ,آ, ỉ, ﺃ
</code></pre... | <p>Besides the similar character bugs you mention and the technical issues that might arise when using different editors (w/BOM, wo/BOM, different encodings in the same file by copy pasting which is only a problem when there are actually characters that cannot be encoded in ASCII and so on), I find that it's not worth ... | <p>It depends on the language you're using. In Python, for example, is easierfor me to stick to unicode, as my aplications needs to work in several languages. So when I get a file from someone (something) that I don't know, I assume Latin-1 and translate to Unicode. </p>
<p>Works for me, as I'm in latin-america.</p>
... | 37,577 |
<p>I am using XmlSerializer to write and read an object to xml in C#. I currently use the attributes <code>XmlElement</code> and <code>XmlIgnore</code> to manipulate the serialization of the object.</p>
<p>If my xml file is missing an xml element that I require, my object still deserializes (xml -> object) just fine.... | <p>I've got an answer for the second part: <a href="http://msdn.microsoft.com/en-us/library/83y7df3e(VS.71).aspx" rel="nofollow noreferrer">"Attributes that control XML serialization"</a>.</p>
<p>Still investigating the first part...</p>
<p>EDIT: I strongly suspect you can't do this through XML deserialization itself... | <p>For extensibility reasons, <code>XmlSerializer</code> is very forgiving when it comes to deserialization; things like <code>[DefaultValue]</code>, <code>ShouldSerialize{Foo}</code> and <code>{Foo}Specified</code> are <em>mainly</em> used during <em>serialization</em> (the exception being <code>{Foo}Specified</code>,... | 32,453 |
<p>I have the task of developing an online examination software for a small university, I need to implement measures to prevent cheating...</p>
<p>What are your ideas on how to do this? </p>
<p>I would like to possibly disable all IE / firefox tabs, or some how log internet activity so I know if they are googling anw... | <p>Simply put, <strong>no</strong> there is no realistic way to accomplish this if it is an online exam (assuming they are using their own computers to take the exam).</p>
| <p>Randomize questions, ask a random set of questions from a large bank... time the answers...</p>
<p>Unless you mean hacking your site, which is a different question.</p>
| 6,905 |
<p>Without the use of any external library, what is the simplest way to fetch a website's HTML content into a String?</p>
| <p>I'm currently using this:</p>
<pre><code>String content = null;
URLConnection connection = null;
try {
connection = new URL("http://www.google.com").openConnection();
Scanner scanner = new Scanner(connection.getInputStream());
scanner.useDelimiter("\\Z");
content = scanner.next();
scanner.close();
}catch... | <p>Its not library but a tool named curl generally installed in most of the servers or you can easily install in ubuntu by </p>
<pre><code>sudo apt install curl
</code></pre>
<p>Then fetch any html page and store it to your local file like an example </p>
<pre><code>curl https://www.facebook.com/ > fb.html
</code... | 5,139 |
<p>Aside from trying</p>
<pre><code>perldoc <module name>
</code></pre>
<p>individually for any CPAN module that takes my fancy or going through the file system and looking at the directories I have no idea what modules we have installed. </p>
<p>What's the easiest way to just get a big list of every CPAN modu... | <p>This is answered in the Perl FAQ, the answer which can be quickly found with <code>perldoc -q installed</code>. In short, it comes down to using <code>ExtUtils::Installed</code> or using <code>File::Find</code>, variants of both of which have been covered previously in this thread.</p>
<p>You can also find the FAQ... | <p>As you enter your Perl script you have all the installed modules as .pm files below the folders in @INC so a small bash script will do the job for you:</p>
<pre><code>#!/bin/bash
echo -e -n "Content-type: text/plain\n\n"
inc=`perl -e '$, = "\n"; print @INC;'`
for d in $inc
do
find $d -name '*.pm'
done
</code>... | 14,071 |
<p>Has anyone managed to activate Gzip compression on a website in IIS6 ?
We're using Castle Monorail (it's very nice btw) and as a result have clean RESTful URLs with no extensions.....
..... and there's the rub -> as far as we can see we need extensions on our endpoints to allow gzip compression.</p>
<p>It seems the... | <p>Well I've found one way... it's a combination of the HTTPModule technique and Monorail filters.</p>
<p>So <a href="http://www.west-wind.com/WebLog/posts/102969.aspx" rel="nofollow noreferrer">the article above by Rick Strahl</a> is one of a number on the web that demonstrate using gzip / deflate compression. Lovely... | <p>This is a great walk-through on enabling gzip compression in IIS6:
<a href="http://engineering.leads360.com/post/9301650692/http-compression-gzip-on-iis-6" rel="nofollow">http://engineering.leads360.com/post/9301650692/http-compression-gzip-on-iis-6</a></p>
| 48,608 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.