instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'd like to create a script that will configure the Visual Studio IDE the way I like it. Nothing vastly complicated, just a few Tools/Options settings, adding some External Tools, that kind of thing. </p>
<p>I know that this can be done inside VS with Import/Export Settings, but I'd like to be able to automate it f... | <p>Answering my own question, in two ways:</p>
<ol>
<li><p>In VS2005/8, the things I mentioned (Tools/Options, External Tools) are all stored in the CurrentSettings.vssettings file, in the folder "Visual Studio 200{5|8}\Settings". This file is just XML, and it can be edited programmatically by anything that knows how ... | <p>On my machine Visual Studio stores it's local settings in a file called VCComponents.dat. Its a text file, so perhaps you could find a way of placing your settings directly in there.</p>
<p>The file is stored in my users local AppData\Local\Microsoft\VC folder</p>
| 6,419 |
<p>Does anyone know of a good code static code analyser for vb.net? </p>
<p>I've seen plenty for c#, and I think VS 2008 some one built in. But we're currently only using vs 2005...</p>
| <p><a href="http://en.wikipedia.org/wiki/FxCop" rel="noreferrer">FxCop</a> does just that.</p>
<p>Specific for VB.NET is <a href="http://en.wikipedia.org/wiki/Project_Analyzer" rel="noreferrer">Project Analyzer</a>.</p>
| <p>You can use the tool <a href="http://www.NDepend.com" rel="nofollow noreferrer">NDepend</a> which analysis all .NET code (C#, VB.NET, F#...).
For VB.NET code you'll miss 2 metrics on source code comment and source code cyclomatic complexity (but you still have CC computed from IL code).</p>
<p>See all feature of ND... | 44,523 |
<p>I am dropping something in a ListView in WPF. I need to know the item in the (X,Y) position I am dropping. How can I do this?</p>
<hr>
<p>The WPF ListView doesn't have GetItemAt. I return to my original problem.</p>
| <p>Done! Thanks to this article
<a href="http://www.codeproject.com/KB/WPF/WPF_Drag_And_Drop_Sample.aspx" rel="noreferrer">http://www.codeproject.com/KB/WPF/WPF_Drag_And_Drop_Sample.aspx</a></p>
<pre><code>private int GetCurrentIndex(GetPositionDelegate getPosition)
{
int index = -1;
for (int i = 0; i < cl... | <p>You want to use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.getitemat.aspx" rel="nofollow noreferrer">GetItemAt</a> function. You may also need to call the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.pointtoclient.aspx" rel="nofollow noreferrer... | 47,336 |
<p>I have 2 tables event + event_artist</p>
<h2>event</h2>
<pre><code>eventId | eventName
-------------------
1 , gig1
2, gig2
</code></pre>
<h2>event_artist</h2>
<pre><code>eventId, artistName
-------------------
1, Led Zip
1, The Beatles
</code></pre>
<p>ie Led Zep and the Beatles are both playing ... | <p>Saw this in SQL Server Magazine- not great, and the total list will have an upper length limit, but:</p>
<pre><code>drop table event
go
drop table event_artist
go
create table event (eventid int, eventname varchar(255))
go
create table event_artist (eventid int, artistname varchar(255))
go
insert into event val... | <p>SQL Server doesn't have anything built in to concatenate values in one statement like that. You could build the strings, but it has to be done one at a time.</p>
<p>However, you can get around this by building your own <a href="https://stackoverflow.com/questions/43940/custom-aggregate-functions-in-ms-sql-server">... | 37,799 |
<p>Is there an <strong>efficient</strong> way to create a file with a given size in Java?</p>
<p>In C it can be done with <a href="http://linux.die.net/man/2/ftruncate" rel="noreferrer">ftruncate</a> (see <a href="https://stackoverflow.com/questions/139261/how-to-create-a-file-with-a-given-size-in-linux#245239">that a... | <p>Create a new <a href="https://docs.oracle.com/javase/8/docs/api/java/io/RandomAccessFile.html" rel="noreferrer">RandomAccessFile</a> and call the setLength method, specifying the desired file length. The underlying JRE implementation should use the most efficient method available in your environment.</p>
<p>The fo... | <p>You can open the file for writing, seek to offset (n-1), and write a single byte. The OS will automatically extend the file to the desired number of bytes.</p>
| 30,422 |
<p>How do I inner join multiple columns from the same tables via Linq? </p>
<p>For example:
I already have this...</p>
<pre><code>join c in db.table2 on table2.ID equals table1.ID
</code></pre>
<p>I need to add this...</p>
<pre><code>join d in db.table2 on table2.Country equals table1.Country
</code></pre>
| <p>This is the only way I was able to get it to work (in c#).</p>
<pre><code>var qry = from t1 in table1
join t2 in table2
on new {t1.ID,t1.Country} equals new {t2.ID,t2.Country}
...
</code></pre>
| <p>In VB:</p>
<pre><code> dim qry = FROM t1 in table1 _
JOIN t2 in table2 on t2.ID equals t1.ID _
AND t2.Country equals t1.Country
</code></pre>
| 44,945 |
<p>Linux provides the stime(2) call to set the system time. However, while this will update the system's time, it does not set the BIOS hardware clock to match the new system time.</p>
<p>Linux systems typically sync the hardware clock with the system time at shutdown and at periodic intervals. However, if the machi... | <p>Check out the rtc man-page for details, but if you are logged in as root, something like this: </p>
<pre><code>#include <linux/rtc.h>
#include <sys/ioctl.h>
struct rtc_time {
int tm_sec;
int tm_min;
int tm_hour;
int ... | <p>If the text editor is different than kubuntu (kate is the default in editor), use your own with the <code>sudo</code> command in terminal.</p>
<ol>
<li>run terminal</li>
<li>copy and paste this command
<code>sudo kate /etc/default/rcS</code> press <kbd>Enter</kbd></li>
<li>enter user password (your login password) ... | 24,700 |
<p>While most operating systems and web browsers have very good support for <a href="http://en.wikipedia.org/wiki/Bi-directional_text" rel="nofollow noreferrer">bidirectional text</a> such as Hebrew and Arabic, most commercial and open-source software does not:</p>
<ul>
<li>Most text editors, besides the original note... | <blockquote>
<p>Do you share the same pain I do?</p>
</blockquote>
<p>No. And that's probably the answer: most people have no idea how bidirectional languages work. I for example have some troubles working with that. Because I'm interested in that topic quite a bit I was reading pango sources a while back, and th... | <p>A note regarding some of the answers - There are no "bidirectional languages". a language is either left to right or right to left (or top to bottom...). A Text or a String can be bidirectional if it contains both say Hebrew and English.</p>
<p>Regarding the question, Firefox seem to work swell for me. Also MSWord ... | 15,083 |
<p>I want to extend an existing application I made to make it set mixer volume by wheel-scrolling over it's notification area icon.</p>
<p>As far as I know, the notification area doesn't receive any WM_MOUSEWHEEL messages, but still I found an application that does exactly what I want to achieve (<a href="http://www.a... | <p>If you want to capture mouse/keyboard events outside of your application you will need <a href="http://msdn.microsoft.com/en-us/library/ms997537.aspx" rel="nofollow noreferrer">Low-level Hooks</a>.</p>
<p>A nice beginners article about installing a mouse hook in Delphi is <a href="http://delphi.about.com/od/windows... | <p>Not sure if this will solve the problem but it might be worth a try as a starting point. You could create a top level transparent window that you then position over the top of the taskbar icon. That top level window will receive mouse notifications when the mouse is over it. You can then process them as required. Ho... | 11,577 |
<p>I'd like to output html controls using xslt, but I need to be able to name the controls so that I can get at them when the form posts back.</p>
<p>I'd like to be able to name the radio button <code>"action_" + _case_id</code>.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="te... | <p>Use:
<strong><pre>
<input type="radio" name="{concat('action_', /*/*/*/case_id)}"
value="No" checked ="true"/>
</pre></strong></p>
<p>In case your xml document changes it may be necessary to substitute the "*" chars above with more detailed location steps.</p>
| <pre><code><?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="data.xsl"?>
<NewDataSet>
<Cases>
<Case>
<case_id>30</case_id>
</Case>
<Cases>
</NewDataSet>
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:st... | 43,750 |
<p>I want to retrieve a list of the files that has been added or deleted from our Subversion repository over, for example, the last month.</p>
<p>I'd prefer to have the file names, and not just a count.</p>
<p>Is this possible from the Subversion command line, or would I need to use a script to trawl the log?</p>
| <p>I don't think you can do it with just the command-line tools, but outputting it with an XML format and doing some grepping or filtering would probably give you what you want.</p>
<p>Try this for a start:</p>
<pre><code>svn log -v --xml | grep 'action="[A|D]"'
</code></pre>
| <p>I use a mishmash of the SVN log command and grep to get just the deletions.
e.g.</p>
<pre><code>% svn log -v -r \{2013-09-01\}:\{2013-10-31\}|grep ' D'
</code></pre>
<p>Will list the files deleted from the current branch in September-October, 2013 (Or... anything else with "space, space, dee" in it)</p>
| 34,903 |
<p>I am about to start a new project and would like to document its development in a very simple blog.</p>
<p>My requirements are:</p>
<ul>
<li>self-hosted on my Gentoo-based LAMP stack (that seems to rule out blogger)</li>
<li>Integration in a django based website (as in www.myproject.com/about, www.myproject.com/bl... | <p><strong>If you're the perfectionist kind, roll your own</strong>.</p>
<ul>
<li>It isn't that hard</li>
<li>You learn something useful</li>
<li>You'll get <em>exactly</em> what you want and need</li>
</ul>
<p>Be warned that you may run into a quagmire fighting comment spam, fixing security holes, etc. But it'll pro... | <p>I Haven't tried it myself yet (other than the demo), but I've bookmarked <a href="http://chyrp.net" rel="nofollow noreferrer">Chyrp</a> so that if I ever need to set up a quick & simple blog (kind of like you're describing) I could try this. So check it out, might be a good option for you.</p>
| 7,435 |
<p>I've got a console application that compiles and executes fine with Visual C++ 6.0, except that it will then only get as far as telling me about missing command line parameters. There doesn't seem to be anywhere obvious to enter these. How do I run or debug it with command line parameters?</p>
| <p>I assume you're talking about setting the command line parameters for running in the IDE.</p>
<p>Open the Project/Settings property page and go to the Debug tab.</p>
<p>There's a "Program arguments" field you can put them into.</p>
| <p>In VS2010:
Right click the project.
Select Properties.
Select Debug tab.
Start Options -> Command line arguments: Enter the arguments here.</p>
| 34,872 |
<p>Ok let me be honest, I haven't written more than 10 unit tests in my life probably.</p>
<p>I am embarking on a new project, and being the sole programmer means <b>I should be scared ... very scared</b>. </p>
<p>The idea that I can <b>pseudo guarantee</b> that my software works brings about a sense of joy.</p>
<p... | <p>The far biggest value that unit test have on my project is <strong>confidence</strong>. With that confidence it's much easier to add new features that weren't planned at the beginning and to tear code apart to change something or turn this around.</p>
<p><strong>With test I know</strong> I (or anyone else!) haven't... | <p>I'm currently in the process of trying to jump on the bandwagon. Work mates are already doing it before they've written a line of functional code. I'm still writing a full program before I've even run it through the main, let alone unit test it :/</p>
<p>I'll get there in the end I'm sure. But at the moment, I am o... | 44,348 |
<p>I have a Google App Engine that has a form. When the user clicks on the submit button, AJAX operation will be called, and the server will output something to append to the end of the very page where it comes from. How, I have a Django template, and I intend to use jquery. I have the following view:</p>
<pre><code>... | <p>Without being able to test the code, what are your results? Have you checked the results returned by the AJAX call? I would suggest you run Firefox with Firebug and log the AJAX results to the Firebug console to see what you get:</p>
<pre><code>//...
success: function( result ) {
console.log( resul... | <p>here is an example of my success function </p>
<pre><code>success: function(json){
$('#gallons_cont').html(json['gallons']);
$('#area_cont').html(json['area']);
$('#usage_cont').html(json['usage'])
$('#results_json').show('slow');
... | 25,646 |
<p>Looking for a way to read the unique ID / serial# of a USB thumb drive;
please note that<br>
- I am looking for the value of the manufacturer, not the one Windows allocates for it.<br>
- I need to support multiple OS (Windows, Unix, Mac), thus needs to be a Java solution</p>
<p>The idea is to be able to distinguish... | <p>I've never tried using it (it's been on my todo list for a good few months now), but there is the "marge" project on java.net:</p>
<p><a href="http://marge.java.net/" rel="nofollow noreferrer">http://marge.java.net/</a></p>
<p>This should let you connect to bluetooth devices (although I don't think it is 100% feat... | <p>I have never investigated this thoroughly, but from memory the <a href="http://users.frii.com/jarvi/rxtx/" rel="nofollow noreferrer">RXTX</a> library implementation of the javax.comm packages are supposedly very good and now have USB support.</p>
| 9,896 |
<p>How to use batch file to check if an application still running or not? If the application still running, this process will loop again and again. Else, there will be error message.</p>
<p>Thank you very much</p>
| <p>in windows you kan use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx" rel="noreferrer">pstools</a> pslist to check if a process name is running by using a .cmd script like the following. Pslist will return ERRORLEVEL 0 if the process is running, 1 if not.</p>
<pre><code>@echo off
CommandYo... | <p>Perhaps you mean tasklist? You can run that from the command line to get all running processes in windows...for the rest of what you are asking I think you will need to be more specific. </p>
| 36,392 |
<p>I have noticed that some browsers (in particular, Firefox and <a href="https://en.wikipedia.org/wiki/Opera_%28web_browser%29" rel="noreferrer">Opera</a>) are very zealous in using cached copies of <strong>.css</strong> and <strong>.js</strong> files, even between browser sessions. This leads to a problem when you up... | <p>This solution is written in PHP, but it should be easily adapted to other languages.</p>
<p>The original <code>.htaccess</code> regex can cause problems with files like <code>json-1.3.js</code>. The solution is to only rewrite if there are exactly 10 digits at the end. (Because 10 digits covers all timestamps from 9... | <p>Changing the filename will work. But that's not usually the simplest solution.</p>
<p>An HTTP cache-control header of 'no-cache' doesn't always work, as you've noticed. The HTTP 1.1 spec allows wiggle-room for user-agents to decide whether or not to request a new copy. (It's non-intuitive if you just look at the... | 14,468 |
<p>I just added asp.net calendar control in new page under sample folder in asp.net mvc beta application. when i execute the particaular page that i need and it shows the error following </p>
<p>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration speci... | <p>Before reading further, please exclude the following preconditions:</p>
<ol>
<li>You aren't using a web farm.</li>
<li>It appears when using built-in databound controls such as GridView, DetailsView or FormView which utilize “DataKeyNames”.</li>
<li>It appears if you have a large page which loads slowly for any rea... | <p>This happened to me just a few minutes ago. Luckily, I found <a href="http://www.dotneat.net/2008/12/13/ASPNETMVCValidationOfViewstateMACFailedError.aspx" rel="nofollow noreferrer">this blog post</a> on the subject. The upshot (for me, at least), was that I had two forms, one on the page and one on the control. </p>... | 26,431 |
<p>I'm trying to write some C# code that calls a method from an unmanaged DLL. The prototype for the function in the dll is:</p>
<pre><code>extern "C" __declspec(dllexport) char *foo(void);
</code></pre>
<p>In C#, I first used:</p>
<pre><code>[DllImport(_dllLocation)]
public static extern string foo();
</code></pre... | <p>You must return this as an IntPtr. Returning a System.String type from a PInvoke function requires great care. The CLR must transfer the memory from the native representation into the managed one. This is an easy and predictable operation.</p>
<p>The problem though comes with what to do with the native memory tha... | <p>Current answers are not complete so I just wanted to post full solution in one place. Returning IntPtr instead of string doesn't solve any problem at all as you still have to free native memory allocated in C script. The best possible solution is to allocate bytes buffer on managed side and pass the memory to C scri... | 48,339 |
<p>Are there SLA printable resins that can be printed with optical clarity and whose index of refraction make them potentially useful for optical applications? I would assume the surface may need polishing, and that's okay - I'm just asking whether the materials and process are otherwise suitable.</p>
| <p>No, at least not at a consumer level. The layering created by the printing process would create imperfections, and clear resin frequently yellows if not cured properly and then protected form strong UV light. Resins that do not yellow tend to have a blue cast to them.</p>
<p>You would be better off using a commercia... | <h1>Clear Resin isn't clear everywhere</h1>
<p>Any light-curing resin has a specific bandwidth to which it is totally opaque just to be able to cure. This is typically a blue color, but at this and adjacent wavelength, the lens will not allow light to pass through it, no matter if you can manage to get imperfections do... | 2,153 |
<p>Since AS3 does not allow private constructors, it seems the only way to construct a singleton and guarantee the constructor isn't explicitly created via "new" is to pass a single parameter and check it.</p>
<p>I've heard two recommendations, one is to check the caller and ensure it's the static getInstance(), and t... | <p>A slight adaptation of enobrev's answer is to have instance as a getter. Some would say this is more elegant. Also, enobrev's answer won't enforce a Singleton if you call the constructor before calling getInstance. This may not be perfect, but I have tested this and it works. (There is definitely another good way to... | <p>The pattern which is used by Cairngorm (which may not be the best) is to throw a runtime exception in the constructor if the constructor is being called a second time. For Example:</p>
<pre><code>public class Foo {
private static var instance : Foo;
public Foo() {
if( instance != null ) {
throw new ... | 15,915 |
<p>I have looked in vain for a good example or starting point to write a java based facebook application... I was hoping that someone here would know of one. As well, I hear that facebook will no longer support their java API is this true and if yes does that mean that we should no longer use java to write facebook a... | <p>Facebook stopped supporting the official Java API on 5 May 2008 according to their <a href="http://developers.facebook.com/blog/post/106" rel="nofollow noreferrer">developer wiki</a>.</p>
<p>In no way does that mean you shouldn't use Java any more to write FB apps. There are several alternative Java approaches outl... | <p>You might want to try <a href="http://www.springsource.org/spring-social" rel="nofollow">Spring Social</a>. It might be limited in terms of Facebook features, but lets you also connect to Twitter, LinkedIn, TripIt, GitHub, and Gowalla. </p>
<p>The other side of things is that as Facebook adds features some of the o... | 8,785 |
<p>I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person. </p>
<p>How can I validate whether this Person exists or not?</p>
<p>Instead of validating the user, is there a way to fill a dr... | <p>I haven't done this specifically, so there may be a better way, but I've been pulling a lot of data out of SharePoint and into an InfoPath Form (deployed to a SharePoint forms library and accessible through SharePoint Forms Service with MOSS Enterprise) and also going the other way using the SharePoint web services ... | <p>When doing something similar in an ASP.NET application, I've used the Sharepoint search and <a href="http://www.mobiusdevelopment.com/dev/Blog.asp?ArticleID=3235955046032961096" rel="nofollow noreferrer">searched the "People" Scope</a> for the specific user. You can also search across profile information so you can... | 35,501 |
<p>When I am stuck with a problem:</p>
<ul>
<li>I search Google for code snippets.</li>
<li>I look at isolating the problem, so that I can better explain it to others in order to get answers.</li>
</ul>
<p>What search techniques do you use to find the solution to your problem?</p>
<p>I started asking questions in St... | <p>Go and do something else. No, really. I've found that putting the problem away in the back of my mind helps. I can't count the number of times I thought of a great solution to something I've been working on when I was working on something else, or watching TV, or eating. It seems your brain is still working on the p... | <p>Go to the toilet.
You move, so your brain gets oxygen.
You relax, so you focus on other things.</p>
<p>Peeing for innovation! :)</p>
| 42,591 |
<p>The pages in question contain a lot of javascript and CSS. How well are these supported by mobile platforms generally?</p>
<p>Is there a browser emulator (or equivalent tool) to assist testing?</p>
| <p><a href="http://www.opera.com" rel="nofollow noreferrer">Opera</a> has an option to view pages as through a mobile device. I've found it useful in the past.</p>
| <p>You can install Opera Mini on an emulator like the Java WTK and test mobile rendering on a PC. One drawback is that Opera Mini still works through a proxy, so debugging local files/sites won't work - you have to upload your site to a world-accessible server.</p>
<p>Just google it.</p>
| 12,581 |
<p>Occasionally a program on a Windows machine goes crazy and just hangs. So I'll call up the task manager and hit the "End Process" button for it. However, this doesn't always work; if I try it enough times then it'll usually die eventually, but I'd really like to be able to just kill it immediately. On Linux I cou... | <p>"End Process" on the Processes-Tab calls <code>TerminateProcess</code> which is the most ultimate way Windows knows to kill a process.</p>
<p>If it doesn't go away, it's currently locked waiting on some kernel resource (probably a buggy driver) and there is nothing (short of a reboot) you could do to make the proce... | <p>When ntsd access is denied, try:</p>
<p>ZeroWave was designed to be a simple tool that will provide a multilevel termination of any kind of process.</p>
<p>ZeroWave is also a easy-to-use program due to its simple installation and its very friendly graphical interface.</p>
<p>ZeroWave has three termination modes a... | 7,262 |
<p>I've been searching around, and I haven't found how I would do this from C#.</p>
<p>I was wanting to make it so I could tell Google Chrome to go <strong>Forward</strong>, <strong>Back</strong>, <strong>Open New Tab</strong>, <strong>Close Tab</strong>, <strong>Open New Window</strong>, and <strong>Close Window</str... | <p>Start your research at <a href="http://dev.chromium.org/developers" rel="noreferrer">http://dev.chromium.org/developers</a></p>
<hr>
<p><strong>EDIT</strong>: Sending a message to a window is only half of the work. The window has to respond to that message and act accordingly. If that window doesn't know about a m... | <p>Ok, here's what I've got so far... I kinda know what I need to do, but it's just a matter of doing it now...</p>
<p>Here's the window from Spy++, I locked onto the <strong><em>Chrome_RenderWidgetHostHWND</em></strong> and clicked the Back button on my keyboard. Here's what I got:
<img src="https://i17.photobucket.... | 17,818 |
<p>I know there are several plugins that do asynchronous processing. Which one is the best one and why?</p>
<p>The ones I know about are:</p>
<ul>
<li><a href="http://backgroundrb.rubyforge.org/" rel="noreferrer">BackgrounDRb</a></li>
</ul>
| <p>starling and workling seem pretty interesting (see the <a href="http://railscasts.com/episodes/128-starling-and-workling" rel="noreferrer">screencast</a>) if you might have several such process, and you want to queue them.</p>
<p>you might also be interested by the <a href="http://railscasts.com/episodes/127-rake-i... | <p>BackgrounDRb is not threaded, its completely process based. It only has a feature of thread pools which user can use, if he wants to handle IO bound tasks concurrently.</p>
<p>Try 1.1 release and let me (on my blog) or on mailing list know about any issues.</p>
| 15,135 |
<p>I have a .Net app that will allow the users to attach files to a SQL Server 2005 database. I want to limit the filesize to 10MB, so from what I can tell, I have to declare the datatype varbinary(max), since the max size I can actually specify is 8000 bytes. But the ~2GB filesize varbinary(max) allows seems like ov... | <p>Using varbinary(max) is totally okay, since it is varbinary, you will only use as much place as the content requires, up to 2 gigs. However, you could add a CHECK CONSTRAINT in the db, checking the datalength() of the upload. I would rather just check the upload in the application though. </p>
| <p>I think you need to make it in the frontend. You can limit the HTTP request size in the web.config like that:</p>
<pre><code></configuration>
</system.web>
<httpRuntime maxRequestLength="60000"/>
</system.web>
</configuration>
</code></pre>
<p>You may also need to explicit... | 30,164 |
<p>I need to determine the current year in Java as an integer. I could just use <code>java.util.Date()</code>, but it is deprecated.</p>
| <p>For Java 8 onwards:</p>
<pre><code>int year = Year.now().getValue();
</code></pre>
<p>For older version of Java:</p>
<pre><code>int year = Calendar.getInstance().get(Calendar.YEAR);
</code></pre>
| <p>I use special functions in my library to work with days/month/year ints -</p>
<pre><code>int[] int_dmy( long timestamp ) // remember month is [0..11] !!!
{
Calendar cal = new GregorianCalendar(); cal.setTimeInMillis( timestamp );
return new int[] {
cal.get( Calendar.DATE ), cal.get( Calendar.MONTH ), cal.g... | 16,506 |
<p><a href="http://hessian.caucho.com" rel="nofollow noreferrer">Hessian</a> is a custom binary serialization protocol, (which is open-source - I think), that forms the basis for a binary cross platform remoting framework. I'd like to know if anyone here has used it, and if so, what sort of performance can we expect fr... | <p>Have you looked at the HessianC# project (<a href="http://www.hessiancsharp.org/" rel="nofollow noreferrer">http://www.hessiancsharp.org/</a>)?</p>
| <p>This is the sort of problem that web services were designed to solve. Although no longer simple, the SOAP format allows you to serialize objects to an XML representation on a Java/C# application, transmit them across the wire and deserialize them in the corresponding Java/C# application (Java/C# may be replaced wit... | 8,845 |
<p>Is there a preferred way to return multiple values from a C++ function? For example, imagine a function that divides two integers and returns both the quotient and the remainder. One way I commonly see is to use reference parameters:</p>
<pre><code>void divide(int dividend, int divisor, int& quotient, int&... | <p>For returning two values I use a <code>std::pair</code> (usually typedef'd). You should look at <code>boost::tuple</code> (in C++11 and newer, there's <code>std::tuple</code>) for more than two return results.</p>
<p>With introduction of structured binding in C++ 17, returning <code>std::tuple</code> should probab... | <p>Quick answer:</p>
<pre><code>#include <iostream>
using namespace std;
// different values of [operate] can return different number.
int yourFunction(int a, int b, int operate)
{
a = 1;
b = 2;
if (operate== 1)
{
return a;
}
else
{
return b;
}
}
int main()
{
... | 41,540 |
<p>I have a simple program print barcodes. The label format is in a preloaded form.
The value the barcode is passed by a parameter as follow.</p>
<pre><code>^XA
^XFR:FORM.ZPL
^FN999^FDH654321+Y0001+OABC+^FS
^PQ2,0,1,N
</code></pre>
<p>And it print two barcodes</p>
<pre><code>H654321+Y0001+OABC+
H654321+Y0001+OABC+
<... | <p>Ripped from a ZPL II manual:</p>
<blockquote>
<p>^AF^SN 0001, 1, Y^FS</p>
<p>Define serialized field, starting value of 1, increment by 1, insert leading zeros</p>
</blockquote>
<p>I have no way of knowing if this will help you though, since I have only experience with EPL2 label definitions.</p>
| <p>You should increment consider the symbol <code>%</code> as Zero, like this</p>
<p><code>^FN999^FDH654321+Y0001+OABC+^SF%%%%%%%%%dddd%%%%%%,1%%%%%%^FS %%%%%%= 1000000</code>.</p>
<p>Then
<code>^FN999^FDH654321+Y0001+OABC+^SF%%%%%%%%%dddd%%%%%%,1000000^FS</code></p>
| 44,639 |
<p>For debugging purposes, I need to recursively search a directory for all files which start with a UTF-8 byte order mark (BOM). My current solution is a simple shell script:</p>
<pre><code>find -type f |
while read file
do
if [ "`head -c 3 -- "$file"`" == $'\xef\xbb\xbf' ]
then
echo "found BOM in: $f... | <p>What about this one simple command which not just finds but clears the nasty BOM? :)</p>
<pre><code>find . -type f -exec sed '1s/^\xEF\xBB\xBF//' -i {} \;
</code></pre>
<p>I love "find" :)</p>
<p><strong>Warning</strong> The above will <strong>modify</strong> binary files which contain those three characters.</p>... | <p>If you are looking for UTF files, the <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?file" rel="nofollow">file command</a> works. It will tell you what the encoding of the file is. If there are any non ASCII characters in there it will come up with UTF.</p>
<pre><code>file *.php | grep UTF
</code></pre>
<p>That won... | 25,073 |
<p>I need help in</p>
<ul>
<li>figuring out how to iterate through currently open Excel add-in files <em>(.xla)</em> that have not been registered in Excel using the <code>Tools > Add-ins</code> menu path.</li>
<li>more specifically, I am interested in any workbook that doesn't appear in the Add-In dialog, but has ... | <p>As of Office 2010, there is a new collection .AddIns2 which is the same as .AddIns but also includes the unregistered .XLA plug-ins.</p>
<pre><code>Dim a As AddIn
Dim w As Workbook
On Error Resume Next
With Application
For Each a In .AddIns2
If LCase(Right(a.name, 4)) = ".xla" Then
Set w = ... | <p>I'm still on the lookout for a sane solution for this problem, but for the time being it seems that reading the window texts of all workbook windows gives a collection of all open workbooks, add-in or not:</p>
<pre><code>Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ... | 36,512 |
<p>In Haskell, is there a way to restrict a monad <code>M a</code> so that <code>a</code> satisfy a type class constraint?</p>
<p>I am translating the <a href="http://github.com/namin/spots/tree/master/probabilisticModeling/README.markdown" rel="noreferrer">probabilistic modeling example</a> from <a href="http://githu... | <p>My understanding of this is that you simply cannot, because a monad is meant to be generalized over all types, not some restricted subset of types such as <code>(Ord a)</code>.</p>
<p>Instead of restricting the monadic type <code>M a</code>, you can simply restrict functions which use that monadic type, e.g.,</p>
... | <p>Check out <a href="http://web.engr.oregonstate.edu/~erwig/pfp/" rel="nofollow noreferrer">Martin Erwig's library, PFP</a>:</p>
<blockquote>
<p>The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilisti... | 49,725 |
<p>This is actually a two part question. First,does the HttpContext.Current correspond to the current System.UI.Page object?</p>
<p>And the second question, which is probably related to the first, is why can't I use the following to see if the current page implements an interface:</p>
<pre><code>private IWebBase Find... | <p>No, from MSDN on HttpContext.Current: "Gets or sets the HttpContext object for the current HTTP request." </p>
<p>In other words it is an HttpContext object, not a Page.</p>
<p>You can get to the Page object via HttpContext using:</p>
<pre><code>Page page = HttpContext.Current.Handler as Page;
if (page != null... | <p>Please see my answer : <br/>
<a href="https://stackoverflow.com/questions/1054123/why-httpcontext-current-handler-is-null">Why HttpContext.Current.Handler is null?</a>
<br/><br/>
Maybe resolved your problem.<br/></p>
| 8,254 |
<p>When programmatically issuing HTTP POST requests, what timeout values would be sensible?</p>
<p>In my case, I'm looking to set 'sensible' timeout values when making POST requests in PHP, however this applies to any language.</p>
<p>I need to be able to issue a set of requests, each to a user-specified URL. If I do... | <p>I would recommend setting up a test, as there are too many factors involved to give a value that will always be sensible.</p>
<p>A POST request sends data to be processed. How long with the processing take? This will be application/data specific.</p>
<p>Where is the host? The user is supplying the URL, so that ... | <p>Most libraries have a connect timeout and a read timeout. That is, the timeout between trying to connect to the remote server, and the timeout after sending the request, that they should wait for a response.</p>
<p>If this is a local web service, I would set the connect timeout low, 1 second, or less if your librar... | 20,635 |
<p>I am currently creating an overnight job that calls a Unix script which in turn creates and transfers a file using <code>ftp</code>. I would like to check all possible return codes. The man page for <code>ftp</code> doesn't list return codes. Does anyone know where to find a list? Anyone with experience with thi... | <p>The <code>ftp</code> command does not return anything other than zero on most implementations that I've come across.</p>
<p>It's much better to process the three digit codes in the log - and if you're sending a binary file, you can check that bytes sent was correct.</p>
<p>The three digit codes are called 'series ... | <p>Why not just store all output from the command to a log file, then check the return code from the command and, if it's not 0, send the log file in the email?</p>
| 16,940 |
<p>Anet A8 with Cura. First time use. The extrusion temperature is set at 190 °C for PLA but the temperature never quite gets that hot, e.g. 189.2 °C. So the printer never prints.</p>
<p>The bed temperature is fine.</p>
<p>Any suggestions on how to fix?</p>
| <p>Two common problems to look out for in this situation:</p>
<ul>
<li>Make sure that your <strong>part fan</strong> (the fan that is supposed to cool the filament you just extruded, and that does not start spinning until the print starts) do <em>not</em> blow air on the hot end of your extruder.</li>
<li>Make sure th... | <p>I had the same problem.</p>
<p><em><strong>If</strong> your mains supply is 110 V</em>, then make sure that the voltage selector switch of your PSU is set to 110 V... it should then print.</p>
<p>If the voltage selector switch is set to the default of 220 V, <em>and the mains supply is only 110 V</em>, then the PSU ... | 807 |
<p>I've got a section of code on a b2evo PHP site that does the following: </p>
<pre><code>$content = preg_replace_callback(
'/[\x80-\xff]/',
create_function( '$j', 'return "&#".ord($j[0]).";";' ),
$content);
</code></pre>
<p>What does this section of code do? My guess is that it strips out ascii char... | <p>Not really stripping, it replaces high-Ascii characters by their entities.</p>
<p>See <a href="http://fr.php.net/manual/en/function.preg-replace-callback.php" rel="nofollow noreferrer" title="PHP: preg_replace_callback - Manual">preg_replace_callback</a>.<br>
create_function is used to make an anonymous function, b... | <p>It's a lot simpler to use <code>preg_replace</code> with the <code>/e</code> flag in your case:</p>
<pre><code>$content = preg_replace(
'/[\x80-\xff]/e',
'"&#".ord($0).";"',
$content);
</code></pre>
| 37,800 |
<p>How do I programatically (Using C#) find out what the path is of my My Pictures folder? </p>
<p>Does this work on XP and Vista?</p>
| <p>The following will return a full-path to the location of the users picture folder (Username\My Documents\My Pictures on XP, Username\Pictures on Vista)</p>
<pre><code>Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
</code></pre>
| <p>Using Microsoft.VisualBasic.FileIO.SpecialDirectories.MyPictures you can get that, works in vista and XP.</p>
| 14,145 |
<p>I'm using NHibernate 2 and PostgreSQL in my project. SchemaExport class does a great job generating DDL scheme for database, but it's great until the first application. </p>
<p>Is there any way to generate "migration" DLL (batch of "ALTER TABLE"'s instead of DROP/CREATE pair) using NHibernate mapping files?</p>
| <p>Look into <a href="http://morten.lyhr.dk/2008/03/nhibernates-schemaupdate-feature.html" rel="nofollow noreferrer">SchemaUpdate</a>. Very similiar API as SchemaExport but it only creates migrations.</p>
| <p>While SchemaUpdate very much answers my needs, it still has several problems. For example it refuses to put a new restriction on existing database column even if it's not gonna conflict with existing data.</p>
<p>I'm going froward to extend SchemaUpdate a little bit or, if fail, switch to one of that hand driven mi... | 14,030 |
<p>I have 4 versions of file A.txt in my subversion repository, say: A.txt.r1, A.txt.r2, A.txt.r3 and A.txt.r4. My working copy of the file is r4 and I want to switch back to r2. I don't want to use "<em>svn update -r 2 A.txt</em>" because this will delete all the revisions after r2, namely r3 and r4. </p>
<p>So is th... | <p>To make a new revision of A.txt that is equal to revision 2:</p>
<pre><code>svn up -r HEAD
svn merge -r HEAD:2 A.txt
svn commit
</code></pre>
<p>Also see the description in <a href="http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo" rel="noreferrer">Undoing chan... | <p>Update won't delete any revisions on the server. The only changes it makes are to your local working copy:</p>
<p><a href="http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.update.html" rel="nofollow noreferrer">SVN Update Command</a></p>
<p>"brings changes from the repository into your working copy"</p>
<p>"sync... | 11,988 |
<p>It should also support SSH2 and public key auth for starters.
secondly on Mac/Windows it should have a decent installer.</p>
| <h2>As of 2011...</h2>
<p>It's an old question, but still very relevant. Over the past few years I have had to work on projects on various platforms using just about every version control system out there. Although ultimately I find that nothing beats the safety and expedience of knowing the command line well, the rea... | <p>Another reasonable solution should be <code>git-gui</code>, which requires a Tcl/Tk framework to be installed.</p>
| 12,769 |
<p>I was considering printing some pieces for my irrigation system, like tube connectors and such. I am aware that PLA is hydrophilic so I was wondering with what kind of product I could coat the pieces, non-toxicity is a requirement because it will water edible greens.</p>
<p>So, what kind of non-toxic product can I ... | <p>Before worrying too much about the hydrophilic properties of PLA, it might be worthwhile to test a fitting.</p>
<p>First, print a fitting and see that the freshly made print is strong enough to carry the pressure of the water, and the compression force of hose clamp you may need to connect the stiff irrigation hose... | <p>PLA will biodegrade over time. ABS would last longer, and stand up to higher temps.</p>
| 887 |
<p>With the introduction of .NET 3.5 and the <code>IQueryable<T></code> interface, new patterns will emerge. While I have seen a number of implementations of the Specification pattern, I have not seen many other patterns using this technology. Rob Conery's Storefront application is another concrete example using ... | <p>It has certainly made the repository pattern much simpler to implement as well. You can essentially create a generic repository:</p>
<pre><code>public class LinqToSqlRepository : IRepository
{
private readonly DataContext _context;
public LinqToSqlRepository(DataContext context)
{
_context = contex... | <p>It has certainly made the repository pattern much simpler to implement as well. You can essentially create a generic repository:</p>
<pre><code>public class LinqToSqlRepository : IRepository
{
private readonly DataContext _context;
public LinqToSqlRepository(DataContext context)
{
_context = contex... | 13,949 |
<p>If I am 3D printing on my Ender 3, and I pause the print, the extruder lets out more filament for like 2 seconds. This leaves a glob of dry filament on my print, which the could contact the nozzle tip, causing it to slide the build platform.</p>
<p>I have fixed the build platform sliding problem by attaching the inc... | <p>They're caused by filament being pulled during travel so they qualify as stringing.</p>
<p>You need to look at your retraction and heat, speed as well makes a difference. You can try combing and other things or just pull them off.</p>
| <p>You should provide a better picture, i.e. a finished print.</p>
<p>Stringing is generally something you don't worry about - adjust your retraction settings a tiny bit to retract more.
I didn't see what software you used, that will help with where the settings are.</p>
<p>Also the plate is very different from the res... | 2,217 |
<p>Please don't reply I should use ddd, nemiver, emacs, vim, or any other front-end, I just prefer gdb as it is, but would like to see its output with some terminal colors.</p>
| <h1>.gdbinit</h1>
<p>You can tweak your <code>~/.gdbinit</code> to have colors. You can use mammon's <code>.gdbinit</code> which is available here:</p>
<p><a href="https://github.com/gdbinit/gdbinit" rel="noreferrer">https://github.com/gdbinit/gdbinit</a></p>
<p>You can tweak it as much as you want too. I found this... | <p>you can get whatever colors you want;</p>
<pre><code># gdb
(gdb) shell echo -en '\E[47;34m'"\033[1m"
...
anything is now blue foreground and white background
...
(gdb) shell tput sgr0
... back to normal
</code></pre>
| 25,717 |
<p>JSON text (<a href="http://www.ietf.org/rfc/rfc4627.txt?number=4627" rel="noreferrer">RFC 4627</a>) has unambigious representation of objects, arrays, strings, numbers, Boolean values (literally <code>true</code> or <code>false</code>) and <code>null</code>. However, it has nothing defined for representing time info... | <p>The only representation that I have seen in use (though, admittedly, my experience is limited to <a href="http://dojotoolkit.org/" rel="nofollow noreferrer">DOJO</a>) is <a href="http://en.wikipedia.org/wiki/ISO_8601" rel="nofollow noreferrer">ISO 8601</a>, which works nicely, and represents just about anything you ... | <p>I recommend using <a href="https://www.ietf.org/rfc/rfc3339.txt" rel="nofollow">RFC 3339</a> format, which is nice and simple, and understood by an increasing number of languages, libraries, and tools.</p>
<p>Unfortunately, RFC 3339, Unix epoch time, and JavaScript millisecond time, are all still not quite accurate... | 11,685 |
<p>What's the difference between failover and disaster recovery?</p>
| <p>Failover: When one machine fails, another machine (usually in the same location) takes over and resumes service</p>
<p>Disaster recovery: When Godzilla destroys your data center, you do have alternative locations to keep providing your service and protocols/means for the other location to know how to keep deliverin... | <p>Since a disaster (like 9/11) can <strong>completely</strong> destroy a datacenter, does it mean that DR is the processes of rebuilding everything for that datacenter?</p>
| 14,614 |
<p>I'm looking for an algorithm to detect if two rectangles intersect (one at an arbitrary angle, the other with only vertical/horizontal lines).</p>
<p>Testing if a corner of one is in the other ALMOST works. It fails if the rectangles form a cross-like shape.</p>
<p>It seems like a good idea to avoid using slopes ... | <p>The standard method would be to do the <strong>separating axis test</strong> (do a google search on that).</p>
<p>In short:</p>
<ul>
<li>Two objects don't intersect if you can find a line that separates the two objects. e.g. the objects / all points of an object are on different sides of the line.</li>
</ul>
<p>T... | <p>If you're using Java, all implementations of the Shape interface have an <a href="http://java.sun.com/javase/6/docs/api/java/awt/Shape.html#intersects(double,%20double,%20double,%20double)" rel="nofollow noreferrer">intersects</a> method that take a rectangle. </p>
| 14,072 |
<p>For a beginner, which is the best book to start with for studying Bayesian Networks? </p>
| <p>I would recommend "Probabilistic Graphical Models" by Daphne Koller and Nir Friedman. Its an excellent starter-to-intermediate handbook on both directed (Bayesian Networks) and undirected (Markov Networks) graphical models. The examples given are elaborate and easy to understand.</p>
| <p>Mitchell's <em>Machine Learning</em> is an extremely important primer in the area of AI. It covers Bayesian Networks, devoting, as I recall, an entire chapter to it.</p>
<p>I'd also check out Weka's Bayesian Network class to understand a practical implementation. If you don't know about Weka, check it out here: <... | 44,923 |
<p>I currently use nant, ccnet (cruise control), svn, mbunit. I use msbuild to do my sln build just because it was simpler to shell out. </p>
<p>Are there any merits to switching my whole build script to MSBuild? I need to be able to run tests, watir style tests, xcopy deploy. Is this easier?</p>
<p><strong>Update: A... | <p>I like MSBuild. One reason is that .csproj files are msbuild files, and building in VS is just like building at the command line. Another reason is the good support from TeamCity which is the CI server I've been using. If you start using MSBuild, and you want to do more custom things in your build process, get th... | <p>I use MSBuild <em>alongside</em> Nant, because the current version of Nant can't as yet compile .NET 3.5 applications (same was true when .NET 2.0 first came out).</p>
| 3,183 |
<p>I'm creating some text boxes on my form programmatically which I need to reference later using FindControl.</p>
<p>I've put the FindControl instruction in the page load method after the code which creates them but get an error:</p>
<blockquote>
<p><strong>Object reference not set to an instance of an object.</st... | <p>Did you put your textbox control inside of another control such as a panel or grid? If so you need to recursively search all the controls on the page. </p>
<p>Here is an example of a recursive FindControl implementation: <a href="http://www.codinghorror.com/blog/2005/06/recursive-pagefindcontrol.html" rel="nofollow... | <p>If you make your TextBox controls during an OnInit override (before calling base.OnInit(e) I believe) they will be available during Page.OnLoad and any associated events. You also get them into the ViewState object graph in their correct position which is invaluable for dealing with post backs and especially server... | 23,129 |
<p>I have a question related to how relative paths are interpreted in various environments .
If I have a C code to be compiled on linux using Makefile and gcc , and if some source file has :</p>
<pre><code>fopen(“../../xyz.ctl”, ”r”);
</code></pre>
<p>where should this file be located. Or in other words,
if I have <... | <p>Your Makefile invokes gcc which compiles your code containing fopen().
fopen() is called when you execute the newly compiled code. The path is relative to your current working directory when you launched the program.</p>
| <p>The path in code compiled by any Unix tool is relative to the path in which the final executable is executed.</p>
<p>gcc does not try to understand what you do and it doesn't analyze paths which you compile into your application.</p>
<p>As far as I know, the Windows copy command is the only command which tries to ... | 44,176 |
<p>Erlang support to partition its nodes into groups using the <a href="http://erlang.org/doc/man/global_group.html" rel="nofollow noreferrer">global_group</a> module.
Further, Erlang supports adding nodes on the fly to the node-network. Are these two features usable with each other?<br>
As far as I understand, you hav... | <blockquote>
<p>A node is an executing Erlang runtime
system which has been given a name,
using the command line flag -name
(long names) or -sname (short names).</p>
<p>A hidden node is a node started with
the command line flag -hidden.
Connections between hidden nodes and
other nodes are not transit... | <blockquote>
<p>A node is an executing Erlang runtime
system which has been given a name,
using the command line flag -name
(long names) or -sname (short names).</p>
<p>A hidden node is a node started with
the command line flag -hidden.
Connections between hidden nodes and
other nodes are not transit... | 26,500 |
<p>I have a code snippet written in PHP that pulls a block of text from a database and sends it out to a widget on a webpage. The original block of text can be a lengthy article or a short sentence or two; but for this widget I can't display more than, say, 200 characters. I could use substr() to chop off the text at... | <p>By using the <a href="http://www.php.net/wordwrap" rel="noreferrer">wordwrap</a> function. It splits the texts in multiple lines such that the maximum width is the one you specified, breaking at word boundaries. After splitting, you simply take the first line:</p>
<pre><code>substr($string, 0, strpos(wordwrap($stri... | <p>I used this before</p>
<pre><code><?php
$your_desired_width = 200;
$string = $var->content;
if (strlen($string) > $your_desired_width) {
$string = wordwrap($string, $your_desired_width);
$string = substr($string, 0, strpos($string, "\n")) . " More...";
}
echo $string;
?&... | 10,541 |
<p>I'm looking for a reasonably fast event handling mechanism in Java to generate and handle events across different JVMs running on different hosts.</p>
<p>For event handling across multiple threads in a single JVM, I found some good candidates like Jetlang. But in my search for a distributed equivalent , I couldn't ... | <p><a href="http://www.hazelcast.com" rel="noreferrer">Hazelcast</a> Topic is a distributed pub-sub messaging solution.</p>
<pre><code>public class Sample implements MessageListener {
public static void main(String[] args) {
Sample sample = new Sample();
Topic topic = Hazelcast.getTopic ("def... | <p>If a <a href="http://activemq.apache.org/" rel="nofollow noreferrer">JMS implementation</a> isn't for you, then you may be interested in an <a href="http://xmpp.org/about/" rel="nofollow noreferrer">XMPP</a> approach. There are multiple implementations, and also have a <a href="http://en.wikipedia.org/wiki/Publish/s... | 21,871 |
<p>So, I've been reading through and it appears that the Boost libraries get used a lot in practice (not at my shop, though). Why is this? and what makes it so wonderful? </p>
| <p><a href="http://www.boost.org/" rel="noreferrer">Boost</a> is used so extensively because:</p>
<ul>
<li>It is open-source and peer-reviewed. </li>
<li>It provides a <a href="http://www.boost.org/doc/libs" rel="noreferrer">wide range</a> of platform agnostic functionality that STL missed.</li>
<li>It is a complemen... | <p>I use the filesystem library quit a bit, and the boost::shared_ptr is pretty nifty. I hear it does other things too.</p>
| 15,266 |
<p>I would like to set the log file name for a log4j and log4net appender to have the current date. We are doing Daily rollovers but the current log file does not have a date. The log file name format would be </p>
<pre><code>logname.2008-10-10.log
</code></pre>
<p>Anyone know the best way for me to do this?</p>
<... | <p>DailyRollingFileAppender is what you exactly searching for.</p>
<pre><code><appender name="roll" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="application.log" />
<param name="DatePattern" value=".yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternL... | <p>Even if you use <code>DailyRollingFileAppender</code> like @gedevan suggested, you will still get <code>logname.log.2008-10-10</code> (After a day, because the previous day log will get archived and the date will be concatenated to it's filename).</p>
<p>So if you want <em>.log</em> at the end, you'll have to do it ... | 23,387 |
<p>I was reading <em><a href="https://rads.stackoverflow.com/amzn/click/com/1430209879" rel="noreferrer" rel="nofollow noreferrer">More Joel on Software</a></em> when I came across <a href="http://en.wikipedia.org/wiki/Joel_Spolsky" rel="noreferrer">Joel Spolsky</a> saying something about a particular type of programme... | <p><strong>In Java,</strong> the 'int' type is a primitive, whereas the 'Integer' type is an object.</p>
<p><strong>In C#,</strong> the 'int' type is the same as <code>System.Int32</code> and is <a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/value-types" rel="noreferrer">a value t... | <p>In java as per my knowledge if you learner then, when you write int a; then in java generic it will compile code like <code>Integer a = new Integer()</code>.
So,as per generics <code>Integer</code> is not used but <code>int</code> is used.
so there is so such difference there.</p>
| 2,298 |
<p>This would be useful when I have a user's address or zipcode, and used that to find their timezone so they don't have to enter it in a separate field.</p>
| <p>I would recommend against trying to deduce the timezone from the users zip code.</p>
<p>To the user the question:</p>
<p>"What is your zip code" isn't likely to change very often.</p>
<p>It will change, but probably less frequently then the question "what time zone are you in".</p>
<p>For example, if the user tr... | <p>Yes - you can use a geocoder such as geonames.org to get latitude,longitude from the zipcode (the geocoder may also include timezone or have a separate webservice for that).</p>
<p>If your geocoder doesn't do it, then given the latitude and longitude you can get a timezone from this webservice:</p>
<p><a href="htt... | 47,898 |
<p>I'm looking for sources of inspiration and/or design patterns for navigation 'breadcrumbs'. So far I have found the <a href="http://patterntap.com/tap/collection/breadcrumbs" rel="noreferrer">breadcrumb collection on Pattern Tap</a>. Does anyone know of any other sources?</p>
| <p>The article '<a href="http://www.alistapart.com/articles/taminglists/" rel="noreferrer">Taming lists</a>' from A List Apart has some good advice on CSS styling for breadcrumbs (look down for the heading 'Breadcrumb Trails').</p>
| <p>If using Microsoft ASP.NET, there's a built in control: <a href="http://msdn.microsoft.com/en-us/library/x20z8c51.aspx" rel="nofollow noreferrer">SiteMapPath</a>.</p>
| 7,230 |
<p>I can't seem to find a true restful Blog API - are there any?
I'm writing some blog software and wondered if there was a standard restful API, if not I'll go buy the RESTful Web Services book and design my own.</p>
| <p>How about <a href="http://www.atomenabled.org/developers/protocol/#whatIsAtom" rel="noreferrer">AtomPub</a>?</p>
<blockquote>
<p>Atom is the name of an XML-based Web
content and metadata syndication
format, and an application-level
protocol for publishing and editing
Web resources.</p>
</blockquote>
<p>I... | <p>I don't know about REST, but have you look at MetaWeblog API? It's XML-RPC though.</p>
| 37,075 |
<p>I'm trying to go deep into Dictionary ADT and Skip List for Java. My textbook doesn't cover a lot about this and whatever it has covered is very complicated. Which is the best online site to get more information on Dictionary ADT and Skip List for Java. I'm looking for the one which talks visually and gives a lot of... | <p>Since it sounds like you're in an algorithms class, I would separate the implementation of a dictionary and a skip list from what is provided by the Java API. At this point, it's more important that you understand the concept of what these abstract data types are, because they can be implemented in any language (C#,... | <p>You can download the PDF of William Pugh's original paper describing skip lists and the theory behind it <a href="ftp://ftp.cs.umd.edu/pub/skipLists/skiplists.pdf" rel="nofollow">here</a>.</p>
<p>Also, <a href="http://iamwww.unibe.ch/~wenger/DA/SkipList/" rel="nofollow">this</a> is a good applet to visualize the op... | 32,005 |
<p>I want to catch all unhandled exceptions thrown in a remote object on <em>the server</em> and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary.</p>
<p>I think I have to use a custom channel sync, but can anyone confirm this and/or ... | <p>I would use the Microsoft Enterprise Library Exception Handling app block -- it lets you handle errors and convert specific types of exception to a different type of exception before rethrowing to the client.</p>
| <p>I would use the Microsoft Enterprise Library Exception Handling app block -- it lets you handle errors and convert specific types of exception to a different type of exception before rethrowing to the client.</p>
| 6,429 |
<p>I've found a similar question on stack overflow, but it didn't really answer the question I have. I need to make sure that my asp.net application is formatting the date dd/mm/yyyy the same as my SQL Server 2005.</p>
<p>How do I verify the date culture (if that's what it's called) of the server matches how I've prog... | <p>When you get a DateTime out of the database, it should be in a non-cultured format (like the DateTime object, based on the number of ticks since a certain date). It is only when you are converting that value into a string that you need to be concerned with culture. In those cases, you can use yourDateTimeValue.ToS... | <p>** Watch out because SQL DateTime columns are non-nullable and their minimum value is 1/1/1753 while .net DateTimes are non-nullable with min values of 1/1/0001. **</p>
<p>If you're pulling data from a real DateTime column, by default it will always be in the same standard format. For saving the data to the column... | 15,089 |
<p>I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middleman? I.e., have the form speak... | <p>I think using the Windows Forms WebBrowser control is your best bet. To do this, you'll need your Silverlight app on a webpage, then you point your WebBrowser at the page's URI.</p>
<p>To keep your WebBrowser control from acting like IE, I'd recommend setting the following:</p>
<pre><code>webBrowser.AllowNavigati... | <p>Silverlight in a winform app just sounds like bad news. It would mean you are running to different CLR's in a single app and would have to deal with alot of added complexity to make it work. If possible consider using the full WPF within your app instead here is a <a href="http://blog.paranoidferret.com/index.php/20... | 24,164 |
<p>I own a Creality CR-10 (using Ultimaker Cura for slicing) and I am experiencing terrible printing problems.</p>
<p>My problem: I am not able to print anything that takes several hours to print. For parts printed in 30 minutes or so, my printer usually works.</p>
<p>The prints end up like this (unfinished and with... | <p><strong>Stringing?</strong></p>
<p>The stringing is explained by your relatively low retraction settings, 1.5 mm is not much for a Bowden setup. As do too high printing temperatures.</p>
<p><strong>Stopping mid printing?</strong></p>
<p>What you are experiencing is called clogging, the extruder cannot push t... | <p>I had the same thing! On my anycubic I3 mega.</p>
<p>Tried a lot of stuff and got so sick of it so I installed a 10:1 gearbox on my extruder motor. So now it provides 10x more torque and since I havent got the issue anymore where the extruder is just grinding on the filament and the motor is just skipping steps. </... | 1,186 |
<p>I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value.</p>
<p>I've given him a number of different reasons against this, t... | <p>There's a compromise. Your coworker is actually onto something, but I think he's doing it wrong. I'm not sure that totally random testing is very useful, but it's certainly not invalid.</p>
<p>A program (or unit) specification is a hypothesis that there exists some program that meets it. The program itself is then ... | <p>How can your guy run the test again when it has failed to see if he has fixed it? I.e. he loses repeatability of tests.</p>
<p>While I think there is probably some value in flinging a load of random data at tests, as mentioned in other replies it falls more under the heading of load testing than anything else. It i... | 5,239 |
<p>Is it possible to inherit from both ViewPage and ViewPage<T>?? Or do I have to implement both. Currently this is what I have for ViewPage. Do i need to repeat myself and do the same for ViewPage<T>??</p>
<pre><code> public class BaseViewPage : ViewPage
{
public bool LoggedIn
{
... | <p>Create both versions:</p>
<pre><code>public class BaseViewPage : ViewPage
{
// put your custom code here
}
public class BaseViewPage<TModel> : BaseViewPage where TModel : class
{
// code borrowed from MVC source
private ViewDataDictionary<TModel> _viewData;
[System.Diagnostics.CodeAn... | <p>I wouldn't put this in the View, instead I'd have it as a property on the ViewModel (have a BaseViewModel). It will be easier to test as well as ensuring you're not going down the slope of putting business logic into the views.</p>
| 48,400 |
<p>I am going to be making an application that lets users input several parameters for a bowling ball layout, and then show what that layout would look like on the ball. I have found some good resources for sphere math, so if I have a sphere whose center is (0,0,0), I will be able to get the values of the points I nee... | <p>If you're gonna be using WPF I recommend you use <a href="http://www.codeplex.com/perspective" rel="nofollow noreferrer">Perspective</a> or <a href="http://www.codeplex.com/3DTools" rel="nofollow noreferrer">3DTools</a>. They're both easy to use and do the job fine. </p>
<p>If I had to recommend only one I would go... | <p>If you use GLUT, you could just have the library draw the sphere for you without you having to figure out the points.</p>
| 31,711 |
<p>Search the web for the phrase "I cosay". I run across this phrase being used from time to time by individuals in tech forums, but for the life of me, I cannot figure out what it means or how it makes sense in the context of the conversations where it is used.</p>
<p>Am I just way behind the times? New slang?</p>
| <p>As far as I can tell from the contexts Google pulls up, it is a very poorly machine-translated form of "codigo". "digo" or some variant is "I say", so it forms it as "I cosay" when it really shouldn't be translated at all. Roughly translated it should probably be "code" or "encoding".</p>
| <p>Without context, I'll have to say a cosay is the counter-say in the same vein that cosine is a counter to sine.</p>
| 40,609 |
<p>I'm attempting to use File.Move to move a file from one UNC location to another. This blows up if the UNC path for the destination happens to be the local machine (error: Access to the path is denied). Example <code>File.Move(@"\\someServer\path\file.txt", @"\\blah2\somewhere\file.txt")</code>. This assumes there... | <p>Maybe it's a typo, but shouldn't it be <code>@"\\blah2\somewhere\file.txt"</code>, i.e. with two backslashes?</p>
| <p>I can't seem to reproduce the bug. Maybe it has something to do with permissions? Can you move to anywhere on the local machine using a UNC address or do they all throw the exception?</p>
| 23,713 |
<p>How can i make my flash applications in a browser in full screen mode? I know that the stage can be put in that mode, but when i run the application in any browser this doesn't work. So, this can be done, but how?</p>
| <p>In the HTML including the Flash SWF, add the following parameter to your <object> tag:</p>
<pre><code><param name="allowFullScreen" value="true" />
</code></pre>
<p>and the following attribute to your <embed> tag:</p>
<pre><code>allowFullScreen="true"
</code></pre>
<p>Or, if you are using <a hr... | <p>I believe it is a simple actionscript command. <a href="http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary372.html" rel="nofollow noreferrer" title="Source">Source</a></p>
<pre><code> fscommand( "fullscreen" , "true" )
</code></pre>
| 21,537 |
<p>I need to know when the user finishes editing a cell in an NSTableView. The table contains all of the user's calendars (obtained from the CalCalendarStore), so in order for the user's changes to be saved I need to inform the CalCalendarStore of the changes. However, I can't find anything that gets called after the u... | <p>You can achieve the same result without subclassing <code>NSTableView</code> by using <code>NSNotificationCenter</code> or using the <code>NSControl</code> methods. See the Apple documentation here:</p>
<p><a href="http://developer.apple.com/library/mac/#qa/qa1551/_index.html">http://developer.apple.com/library/mac... | <p>Subclass NSArrayController and override objectDidEndEditing: (be sure to call super's implementation). </p>
<p>This will mostly only be invoked by text fields NSTextFieldCell or NSComboBoxCell (but only when changing the value by typing it, not by selecting the value from the combo's menu). There may be a few othe... | 23,594 |
<p>Recently, <a href="https://stackoverflow.com/questions/204814/is-there-any-valid-reason-to-ever-ignore-a-caught-exception">I made a post about the developers I'm working with not using try catch blocks properly</a>, and unfortuantely using try... catch blocks in critical situations and ignoring the exception error a... | <p>Have you considered using an ORM like NHibernate? There's no point in re-inventing the wheel.</p>
<p>To me this is a code smell:</p>
<pre><code>BLLCustomer cust = ((BLLCustomer)new BLLCustomer()).FillByID(34);
</code></pre>
<p>Too many brackets!</p>
<p>I've found that using the active record pattern in a langua... | <p>Why not just catch the exception in the Page_Load event? Some exception you might expect and know how to deal with, other exceptions should be handled by a global exception handler. </p>
| 29,115 |
<p>I'm looking for an answer in MS VC++.</p>
<p>When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I actually want.</p>
<p>Example in pseudo code:</p>
<pre><code>FunctionB()
{
...
throw e;
...
}
Fun... | <p>If you are just interested in where the exception came from, you could just write a simple macro like</p>
<pre><code>#define throwException(message) \
{ \
std::ostringstream oss; \
oss << __FILE __ << " " << __LINE__ << " " \
<<... | <p>Other languages? Well, in Java you call e.printStackTrace(); It doesn't get much simpler than that.</p>
| 5,671 |
<p>Please let me know how can I disable basic authentication on Tomcat 5.5.27</p>
| <p>Authentication is there only if you configure it yourself. By default web applications do not use authentication.</p>
| <p>But if, as I suspect, you didn't put it there yourself, it would have been helpful for you to be told where to look. In Java, at any rate, there is probably a web.xml file in a source directory (WEB_INF/).</p>
| 41,835 |
<p>Is it better to learn how to code AJAX without the use of an AJAX library? What are the advantages of coding from scratch over using a library such as jQuery?</p>
<h3>See also:</h3>
<p><a href="https://stackoverflow.com/questions/122902/what-are-some-of-the-pros-and-cons-of-using-jquery">What are some of the pros an... | <p>For learning, yes, avoid libraries. Especially for something as conceptually simple as AJAX, forcing yourself to learn how the browser can be used "raw" will benefit you immensely later on, even if you are using a library to take care of the drudgery and abstract away browser differences.</p>
<p>Once you have a sol... | <p>I think it's all a matter of what your end goal is. If your looking to have a good fundamental understanding of AJAX so you can make educated decisions about which framework is best and why certain things work then learning AJAX without the help of a framework is best for you. If your goal to learn how to architec... | 26,498 |
<p>I found <a href="http://www.jenitennison.com/xslt/grouping/muenchian.html" rel="noreferrer">this page</a> describing the Muenchian method, but I think I'm applying it wrong.</p>
<p>Consider that this would return a set of ages:</p>
<pre><code>/doc/class/person/descriptive[(@name='age')]/value
</code></pre>
<block... | <p>Here's an example:</p>
<pre><code><root>
<item type='test'>A</item>
<item type='test'>B</item>
<item type='test'>C</item>
<item type='test'>A</item>
<item type='other'>A</item>
<item type='test'>B</item>
<it... | <p>Aren't you missing a reference to 'descriptive' right after the preceding-value? Some thing like the following:</p>
<pre><code>/doc/class/person/descriptive[(@name='age')][not(value=preceding-sibling::descriptive[@name='age']/value)]/value
</code></pre>
<p>(Haven't tested it)</p>
| 28,186 |
<p>How do I get the caller's IP address in a WebMethod?</p>
<pre><code>[WebMethod]
public void Foo()
{
// HttpRequest... ? - Not giving me any options through intellisense...
}
</code></pre>
<p>using C# and ASP.NET</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.userhostaddress.aspx" rel="noreferrer">HttpContext.Current.Request.UserHostAddress</a> is what you want.</p>
| <p>I made the following function:</p>
<pre><code>static public string sGetIP()
{
try
{
string functionReturnValue = null;
String oRequestHttp =
WebOperationContext.Current.IncomingRequest.Headers["User-Host-Address"];
if (string.IsNullOrEmpty(oRequestHttp))
{
... | 15,828 |
<p>Greetings!</p>
<p>I'm creating a User Control that will display data in a GridView control. We are using n-tier architecture and the data in question is retrieved from our database and returned to us as a ReadOnlyCollection. OurNewObject is a class containing several properties and an empty constructor that takes... | <p>Normally, you would create a separate object that contains your data access method(s), rather than putting the methods in the code-behind. The separate object can be an instance or static, but the object itself must have a parameterless constructor (or no constructor at all).</p>
<p>Also, the TypeName property on t... | <p>Try adding the <code>DataKeyNames</code> (add the primary key) attribute to the <code>GridView</code> and see if that works?</p>
| 38,989 |
<p>We have an old system running on a WinServer2003 R2 - IIS6 and it was written using classic ASP.</p>
<p>We need to trap all errors and for that, I configured IIS to redirect 404s and 500s to a custom page (custom errors config) that writes the info to a log file (this page creates and manages the logs).</p>
<p>Her... | <p>You need to ensure Server Side Debugging is not enabled in the ASP module. </p>
<p>Classic ASP server 500 errors are returned as 200's. An attempt is made at opening the Server Side Debug Application, that then can't be found and IIS subsequently returns a 200 response.</p>
| <p>maybe its this issue</p>
<p><a href="http://www.webdevbros.net/2006/11/26/ie7-bug-blank-page-white-screen-after-some-refreshs/" rel="nofollow noreferrer">http://www.webdevbros.net/2006/11/26/ie7-bug-blank-page-white-screen-after-some-refreshs/</a></p>
| 30,161 |
<p>This has happened to me 3 times now, and I am wondering if anyone is having the same problem. I am running Visual Studio 2008 SP1, and hitting SQL Server 2005 developer edition. </p>
<p>For testing, I use the Server Explorer to browse a database I have already created. For testing I will insert data by hand (right... | <p>Just so you know, when your computer just snaps right back to the BIOS boot screen with no blue screen or other crash data, this is called a "<a href="http://en.wikipedia.org/wiki/Triple_fault" rel="nofollow noreferrer">triple fault</a>" Basically, there was an exception (on a hardware level) whose exception handler... | <p>Are you overclocking the machine? Reboots like that are a sign that you have a bad overclock, ie. too high, bad voltage settings, bad memory timings.</p>
| 24,306 |
<pre><code>String s = "";
for(i=0;i<....){
s = some Assignment;
}
</code></pre>
<p>or</p>
<pre><code>for(i=0;i<..){
String s = some Assignment;
}
</code></pre>
<p>I don't need to use 's' outside the loop ever again.
The first option is perhaps better since a new String is not initialized each time. Th... | <h3>Limited Scope is Best</h3>
<p>Use your second option:</p>
<pre><code>for ( ... ) {
String s = ...;
}
</code></pre>
<h3>Scope Doesn't Affect Performance</h3>
<p>If you disassemble code the compiled from each (with the JDK's <code>javap</code> tool), you will see that the loop compiles to the exact same JVM ins... | <p>It seems to me that we need more specification of the problem.</p>
<p>The </p>
<pre><code>s = some Assignment;
</code></pre>
<p>is not specified as to what kind of assignment this is. If the assignment is </p>
<pre><code>s = "" + i + "";
</code></pre>
<p>then a new sting needs to be allocated.</p>
<p>but if i... | 13,533 |
<p>I understand that the function is not allowed to change the state of the object, but I thought I read somewhere that the compiler was allowed to assume that if the function was called with the same arguments, it would return the same value and thus could reuse a cached value if it was available. e.g.</p>
<pre><code... | <p><code>const</code> is about program semantics and not about implementation details. You should mark a member function <code>const</code> when it does not change the visible state of the object, and should be callable on an object that is itself <code>const</code>. Within a <code>const</code> member function on a cla... | <p>I doubt it, the function could still call a global function that altered the state of the world and not violate const.</p>
| 12,405 |
<p>Assume you are doing something like the following</p>
<pre><code>List<string> myitems = new List<string>
{
"Item 1",
"Item 2",
"Item 3"
};
ComboBox box = new ComboBox();
box.DataSource = myitems;
ComboBox box2 = new ComboBox();
box2.DataSource = myitems
</code></pre>
<p>So now we have 2 c... | <p>This has to do with how data bindings are set up in the dotnet framework, especially the <code>BindingContext</code>. On a high level it means that if you haven't specified otherwise each form and all the controls of the form share the same <code>BindingContext</code>. When you are setting the <code>DataSource</code... | <p>A better workaround (depending on the size of the datasource) is to declare two <code>BindingSource</code> objects (new as of 2.00) bind the collection to those and then bind those to the comboboxes.</p>
<p>I enclose a complete example.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Co... | 2,292 |
<p>I need to create a custom control to display bmp images with alpha channel. The background can be painted in different colors and the images have shadows so I need to truly "paint" the alpha channel.</p>
<p>Does anybody know how to do it?</p>
<p>I also want if possible to create a mask using the alpha channel info... | <p>The way I usually do this is via a DIBSection - a device independent bitmap that you can modify the pixels of directly. Unfortunately there isn't any MFC support for DIBSections: you have to use the Win32 function CreateDIBSection() to use it.</p>
<p>Start by loading the bitmap as 32-bit RGBA (that is, four bytes p... | <p>You need to do an <a href="http://en.wikipedia.org/wiki/Alpha_Blend" rel="nofollow noreferrer">alpha blend</a> with your background color, then take out the alpha channel to paint it to the control.</p>
<p>The alpha channel should just be every 4th byte of your image. You can use that directly for your mask, or you... | 39,552 |
<p>I find it odd that in Visual C# 2008 Express edition, when you use the database explorer, your options are:</p>
<ol>
<li>Microsoft Access</li>
<li>SQL Server Compact 3.5, and </li>
<li>SQL Server Database File. </li>
</ol>
<p>BUT if you use Visual Web Developer 2008 Express, you can connect to a regular SQL Serve... | <p>You should be able to choose the SQL Server Database file option to get the right kind of database (the <code>system.data.SqlClient</code> provider), and then manually correct the connection string to point to your db.</p>
<p>I think the reasoning behind those db choices probably goes something like this: </p>
<u... | <p>My guess is that with VWD your solutions are more likely to be deployed to third party servers, many of which do not allow for a dynamically attached SQL Server database file. Thus the allowing of the other connection type.</p>
<p>This difference in IDE behavior is one of the key reasons for upgrading to a full ve... | 22,919 |
<p>I have a remote JS that must appear in the head of the document. If the server is slow to respond or inaccessible, obviously this slows or prevents the page from loading. I have been searching for a simple way to set a limit of say 3 seconds (probably less) for it to give up and simply not load the functionality.<... | <p>Include the .JS file after the page is done loading:</p>
<pre><code><script type='text/javascript'>
window.onload = function(){
document.write("<script type='text/javascript' src='http://domain.com/file.js'></script>");
}
</script>
</code></pre>
<p>Place that in the HEAD of your document, ... | <p>If that is an issue, split the .js apart and have the low end css functions in the and the slow ones in the onload="";</p>
| 45,090 |
<p>I cannot get the internet explorer web developer tool bar to work with a pop-up, it won't render at the bottom of the pop-up. Any suggestions? </p>
| <p>I am pretty sure it won't work with modal popup windows. If you are opening popups as modal you may have to change the code to mode-less just for debugging purposes.</p>
| <p>Add a Javascript error in the code of the page, such as blabla();. It will make IE display the Javascript error dialog from which you can start the Developer Tools. You need to have Javascript error messages on I think:</p>
<p>Tools - Internet Options, the Advanced tab
Make sure "Display a notification about every ... | 28,063 |
<p>How to encode video on the fly and send it trough the network from C#?</p>
<p>Can't find a suitable library. I need to encode in WMV and don't mind if the actual encoding is made in C++ as long as the library has a .NET assembly available.</p>
<p>Thanks</p>
| <p>I'm aware of <a href="http://ffmpeg.mplayerhq.hu/" rel="nofollow noreferrer">ffmpeg</a>, but it is native C code only. If you're ok with interoperability this may be your ticket.</p>
<p>Edit: It turns out someone already wrapped this in a .NET assembly. It's called <a href="http://www.intuitive.sk/fflib/" rel="no... | <p>Depending on what you are encoding (size, framerate, hardware, etc) real-time encoding may not even be possible. Video encoding is VERY CPU intensive.</p>
| 6,585 |
<p>We are designing an application which would also have a need to manage a large number of files (docs, spreadsheets, scanned files, pdfs, etc.). We will need to associate files with other data in the system.</p>
<p>This will be a web-based application.(asp.net)</p>
<p>While there are many ways to solve this problem... | <p>It would be helpful to know what platform you are using. Since most of my experience is with the Java platform here's some links:</p>
<p>JSR-170: Content Repository API
<a href="http://www.cmswatch.com/Feature/123" rel="nofollow noreferrer">http://www.cmswatch.com/Feature/123</a></p>
<p>And here is the reference ... | <p>There are quite a number of commercial Document Management Systems out there, and they are configurable to the various categories you need to store. They generally also support revision control and archiving. Examples include:</p>
<ul>
<li><a href="http://www.openedms.com/" rel="nofollow noreferrer">OpenEDMS</a><... | 42,532 |
<p>If I have a base class such that</p>
<pre><code>public abstract class XMLSubscription <T extends XMLMessage>
</code></pre>
<p>Is it possible to write a method in XMLSubscription that returns a class object of T?</p>
<p>The only possible solution that I came up with is to have each descendant of XMLSubscript... | <p>Unfortunately - and yes, this is due to type erasure - there is no way to return the <code>Class</code> object without providing it at runtime somehow.</p>
<p>Fortunately this is not usually too difficult. Here's how I've typically done this / seen it done:</p>
<pre><code>public abstract class XMLSubscription <... | <p>As you guessed, T is erased by the compiler. When you instantiate the object it has no idea that's it's supposed to deal with <em>XMLStatusMessage</em> objects. Your base class would define the following template method, and 1.5's covariant return types would keep the compiler happy with the concrete subclasses:</p>... | 47,144 |
<p>I understand that server-side validation is an absolute must to prevent malicious users (or simply users who choose to disable javascript) from bypassing client-side validation. But that's mainly to protect your application, not to provide value for those who are running browsers with javascript disabled. Is it re... | <p>I browse with NoScript in Firefox, and it always annoys me when I get pages that don't work. That said - know your audience. If you're trying to cater to paranoid computer security professionals - assume they might not have JavaScript enabled. If you're going for a general audience, JavaScript is probably on.</p>
| <p>I think it's fair to assume that the majority of visitors to your site will have JavaScript enabled. Some of the more trafficked sites out there have a dependency on JavaScript. For example, I was surprised to learn that you can't authenticate through a Passport-enabled site without a JS-enabled browser. </p>
| 18,827 |
<p>I have read that the iPhone SDK (part of Xcode 3) is restricted to Mac's with the intel chipset. Does this restriction apply to only the simulator part of the SDK or the complete shebang?</p>
<p>I have a Powerbook G4 running Leopard and would very much like to do dev on it rather than fork out for a new machine.</p... | <p>As things have moved on since the original post on 3by9.com, here are the steps that I had to follow to get the environment working on my PowerBook G4.</p>
<p><strong>BTW, I would like to say that I realise that this is not a supported environment and I share this for purely pedagogic rea</strong>sons.</p>
<ol>
<l... | <blockquote>
<p>I have a Powerbook G4 running Leopard and would very much like to do dev on it </p>
</blockquote>
<p>Not sure what sort of application you are developing, but if you jailbreak your iPhone, you can:</p>
<ul>
<li>develop applications using Ruby/Python/Java which won't require compiling at all</li>
<li... | 5,866 |
<p>I haven't been able to find any documentation on hardware access via the iPhone SDK so far. I'd like to be able to send signals via the dock connector to an external hardware device but haven't seen any evidence that this is accessible via the SDK (not interested in possibilities on jailbroken iPhones).</p>
<p>Anyo... | <p>It will with the new SDK (3.0):</p>
<p><a href="http://developer.apple.com/iphone/program/accessories/" rel="nofollow noreferrer">iPhone OS Accessories</a></p>
<blockquote>
<p>Using iPhone SDK 3.0 your application can communicate with accessories attached to iPhone or iPod touch through either the 30-pin dock co... | <p>This falls into the range of capabilities that requires working with Apple to get a special license. At, I presume, a special price.</p>
<p>This has changed to some extent with the 3.0 version of the iPhone firmware. If PyjamaSam is correct there is still some special activity required to get the connector specif... | 13,018 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.