instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>How to create a project in WebLogic Workshop (version 10.3) with support for JPA entity beans?</p>
<p>I am trying create a separate EJB and EJBClient projects in Workshop and EJB3 session beans work just fine, but I am having problems with JPA entity beans. </p>
<p>It seems that when creating a new project you can... | <p>Simplest thing seems to be to just add the JPA libraries to EJB project and be done with it. It seems that Workshop has no specific support for JPA in EJB projects. Not that it is needed.</p>
| <p>Simplest thing seems to be to just add the JPA libraries to EJB project and be done with it. It seems that Workshop has no specific support for JPA in EJB projects. Not that it is needed.</p>
| 37,821 |
<p>I've written a simple multi-threaded game server in python that creates a new thread for each client connection. I'm finding that every now and then, the server will crash because of a broken-pipe/SIGPIPE error. I'm pretty sure it is happening when the program tries to send a response back to a client that is no l... | <p>Read up on the try: statement.</p>
<pre><code>try:
# do something
except socket.error, e:
# A socket error
except IOError, e:
if e.errno == errno.EPIPE:
# EPIPE error
else:
# Other error
</code></pre>
| <p>My answer is very close to S.Lott's, except I'd be even more particular:</p>
<pre><code>try:
# do something
except IOError, e:
# ooops, check the attributes of e to see precisely what happened.
if e.errno != 23:
# I don't know how to handle this
raise
</code></pre>
<p>where "23" is the ... | 21,727 |
<p>Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality. I've been using it for a while (with a simple PInvoke, will post code later). I'm looking to see if there's a better and/or more robust way.</p>
<p>Thanks.</p>
| <p>As promised, here is the code for integrating with JDEdewards using XML. It's a webservice, but could be used as you see fit.</p>
<pre><code>namespace YourNameSpace
</code></pre>
<p>{</p>
<pre><code>/// <summary>
/// This webservice allows you to submit JDE XML CallObject requests via a c# webservice
/// &l... | <p>I changed our JDE web service to use XML Interop after seeing this code, and we haven't had any stability problems since. Previously we were using the COM Connector, which exhibited regular communication failures (possibly a connection pooling issue?) and was a pain to install and configure correctly.</p>
<p>We did... | 11,043 |
<p>I need to see if a given process id is running, and it must work in either Java or JRuby (preferably a Ruby solution). It can be system dependent for Linux (specifically Debian and/or Ubuntu).</p>
<p>I already have the PID I am looking for, just need to see if it is currently running.</p>
<hr>
<p>UPDATE:</p>
<p... | <p><a href="https://stackoverflow.com/questions/141162/how-can-i-determine-if-a-different-process-id-is-running-using-java-or-jruby-on#141731">Darron's comment</a> was spot on, but rather than calling the "kill" binary, you can just use Ruby's Process.kill method with the 0 signal:</p>
<pre><code>#!/usr/bin/ruby
pid... | <p>I can't speak for JRuby, but in Java, the only way to check is if you launched the process from Java (in which case you would have an instance of <a href="http://java.sun.com/javase/6/docs/api/index.html?java/lang/Process.html" rel="nofollow noreferrer">Process</a> that you could do things with).</p>
| 17,050 |
<p>I'm writing a script to remove some build artifacts older than 1 week. </p>
<p>The files have names in the form <em>artifact-1.1-200810391018.exe</em>.</p>
<p>How do I go about removing only the files that are greater than 1 week old, excluding the time in hours and minutes at the end of the date-time-stamp?</p>
... | <p>You mean, something along the line of:</p>
<pre><code>find /path/to/files -name "artifact*" -type f -mtime +7 -exec rm {} \;
</code></pre>
<p>?</p>
| <p>If you trust the mtime of the file, you can do it in a simple sweep with find:</p>
<pre><code>find "${NIGHTLY_LOCATIONS}" -name $ARTIFACT_PREFIX -type f -mtime +7 -delete
</code></pre>
| 30,876 |
<p>I am working on some batch file.
I need to read name from some text file. Let me explain it</p>
<p>I have one file <code>File.txt</code>, which has entry like <code>FirstName=John</code>.
Now my batch file should read text <code>John</code> from the file and I should be able store <code>John</code> in some variable... | <pre><code>@echo off
setlocal
for /F "tokens=1,2 delims==" %%a in (File.txt) do set Title=%%b
echo %Title%
</code></pre>
<p>Does extract the first name value into <code>Title</code>... but only for the last line containing <code>Firstname</code>!</p>
<pre><code>@echo off
setlocal
for /F "tokens=1,2 delims==" %%a in (... | <p>You problem is that <code>John</code> is the second token found, <code>Firstname</code> being the first token found. You have many options. </p>
<ul>
<li>You can use <code>tokens=2</code> to skip the first token and get only the second token into variable <code>%%I</code>. No other variable is generated.</li>
<li>Y... | 48,428 |
<p>We have a shrink wrap type Windows server application where we need to create a self signed certificate on the server to be used by some WCF web services. From our searches on the web, it appears that the makecert utility in the PlatformSDK from Microsoft cannot be distributed with our application, so we're looking... | <p>[Unfortunately, I can't comment on anything yet, so I'll post this as an answer.]</p>
<p>I see that this post is a bit old, but I'm in a similar boat and I found this in the Visual Studio 2008 redist.txt file:</p>
<pre><code>Windows SDK Files
Subject to the license terms for the software, the following files may ... | <p>Woohoo! It's time for pinvoke for you</p>
<p>crypt32 provides a <a href="http://msdn.microsoft.com/en-us/library/aa376039.aspx" rel="nofollow noreferrer">CertCreateSelfSignCertificate</a> function; if that succeeds you can store it in the user's personal store (or the machine store assuming you're working elevated)... | 22,726 |
<p>Using any tools which you would expect to find on a nix system (in fact, if you want, msdos is also fine too), what is the easiest/fastest way to calculate the mean of a set of numbers, assuming you have them one per line in a stream or file?</p>
| <p>Awk</p>
<pre><code>awk '{total += $1; count++ } END {print total/count}'
</code></pre>
| <p>Perl.</p>
<pre><code>@a = <STDIN>;
for($i = 0; $i < #@a; $i++)
{
$sum += $a[i];
}
print $a[i]/#@a;
</code></pre>
<p>Caveat Emptor: My syntax may be a little whiffly.</p>
| 26,351 |
<p><strong>Can anyone recommend a tool for quickly posting test messages onto a JMS queue?</strong></p>
<p><strong>Description</strong>:</p>
<ol>
<li>The tool should allow the user to enter some data, perhaps an XML
payload, and then submit it to a queue.</li>
<li>I should be able to test consumer without producer.</li... | <p>This answer doesn't apply to all JMS brokers, but if you happen to be using <a href="http://activemq.apache.org/" rel="noreferrer">Apache ActiveMQ</a>, the web-based admin console (by default at <a href="http://localhost:8161/admin" rel="noreferrer">http://localhost:8161/admin</a>) allows you to manually send text m... | <p>I'm a brazilian developer and I made a Java program for Post HTTP and JMS Messages his available for download at: <a href="https://sites.google.com/site/felipeglino/softwares/posttool" rel="nofollow">https://sites.google.com/site/felipeglino/softwares/posttool</a></p>
<p>In thath page you can found english instruct... | 5,881 |
<p>A Session is per browser (determined via cookies), but when does an "Application" start, and end, and how does IIS know know when a request is a part of the same same "Application" instance (if not done via cookies the same way that sessions are)?</p>
| <p>"Application" scope is global, and every request to a website shares the same application. Anything stored in the application is visible to <strong>all</strong> users. The application starts when the first request to the website is made, and ends when IIS stops the website (for example, when IIS itself is shut down,... | <p>Application is said to be start when it is first deployed on the webserver and is available to the users for access. Each time it is un-deployed or the server is shut down the application ends.</p>
<p>The second part is not clear but assuming for determining the application, each application has a root which is uni... | 39,635 |
<p>The question is how to make the similar thing like symlink in windows like in *nix. It's really hard to write whole path to the file in console (even using [tab], it's not the way if you need to change language). Adding everything in PATH is tiring too. It'll be great to make a symlink running one command.</p>
<p>A... | <p>They're called <a href="https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5388706.html" rel="nofollow noreferrer">junctions</a></p>
<p>And if you want a <a href="http://www.rekenwonder.com/linkmagic.htm" rel="nofollow noreferrer">GUI</a> to do it for you...</p>
| <p>You can create junctsymlinksions in windows with <code>mklink</code>.</p>
<p>edit: If you use Vista.</p>
| 11,553 |
<p>I have an invokeworkflow activity inside a replicator activity. The workflow that I'm trying to invoke requires 2 parameters to be passed to it, an integer and a string parameters, and these should be passed to the workflow by the replicator activity. Any ideas on how this could be done?</p>
<p>Thanks.</p>
| <p>Here is a full example (note that whatever is included in the constructors can be set in the properties pane of the designer): Workflow3 is the target workflow that contains only a CodeActivity and the behind code is the following:</p>
<pre><code>public sealed partial class Workflow3 : SequentialWorkflowActivity
{
... | <p>You can declare two properties in the target workflow like this:</p>
<pre><code> public static readonly DependencyProperty MyIntProperty =
DependencyProperty.Register("MyInt", typeof(int), typeof(Workflow3));
public static readonly DependencyProperty MyStringProperty =
DependencyProp... | 36,463 |
<p>I have a z-axis which follows schematically the same principle as the makerbot one's (threaded rod and two leading rods with linear ball bearings carrying a level). It is from an old experimental lab doing physics or chemistry.</p>
<p>The axis move gorgeously about 5 cm, but then it get's stuck on either sides of t... | <p>There could be a few issues at play.</p>
<ol>
<li>The smooth rods are not parallel which is causing the bearings to bind the further you go up.</li>
<li>Part of the thread is damaged not allowing it to pass through the nut.</li>
<li>The threaded rod is bent significantly to where it either doesn't pass through the ... | <p>There could be a few issues at play.</p>
<ol>
<li>The smooth rods are not parallel which is causing the bearings to bind the further you go up.</li>
<li>Part of the thread is damaged not allowing it to pass through the nut.</li>
<li>The threaded rod is bent significantly to where it either doesn't pass through the ... | 217 |
<p>The handle of a micro wave oven broke.</p>
<p>I can't just order a replacement part because I can't even attach the new one. </p>
<p>The problem is that the screw heads are somewhere on the interior side of the door, which cannot be disassembled (non destructively at least). I wouldn't even do it because of safety... | <p>This answer is intended to be a generic answer for Z-offset determination. The question is not clear on how the Z-offset has been determined. It appears as if this distance is measured, while in reality this cannot be measured.</p>
<p>A touch (or a inductive or capacitive) probe uses a trigger point to determine th... | <p>You should be able to offset this with a <code>G54 Z-1.3</code> - <strong>if your setup accepts these gcodes</strong>. </p>
<p>If you do this, always add a <code>G53</code> to the very start and just before the <code>M30</code> to clear all offsets after job finish (or in the event of a cancel, at the start of the ... | 1,468 |
<p>I need to write a script to change a filename from aDate.txt to bDate.txt where:</p>
<ul>
<li>aDate is the current system date in <em>yyyymmdd</em> format and </li>
<li>bDate is the current system date - 1 in <em>yyyymmdd</em> format.</li>
</ul>
<p>I currently have:</p>
<pre><code>set yy=%date:~6,2%
set mm=%date:... | <p>You have to do it the difficult way. I suggest to use <a href="http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_21316459.html" rel="noreferrer">this</a> solution by SteveGTR. I copy the text below, because at least at least I cannot always see the solution on that site. </p>
<hr>
<p>Here's a... | <p>Can be done with adding jscript code to a batch file.
Here's the <code>dayAdder.bat</code> that accepts only one argument - the days you want to add to the current date and prints the result:</p>
<pre><code> @if (@X) == (@Y) @end /* JScript comment
@echo off
cscript //E:JScript //nologo "%~f0"... | 46,323 |
<p>I have the following code in my Site.Master page of an almost empty ASP.NET MVC Project. </p>
<pre><code><li>
<%= Html.ActionLink("Home", "Index", "Home")%>
</li>
<li>
<%= Html.ActionLink("Feed List", "FeedList", "Home")%>
</li>
<li>
<%= Html.ActionLink("Mon... | <p>Create a FeedsController.cs and move these to that controller</p>
<pre><code>public ActionResult FeedList()
{
ViewData["Title"] = "Feed List";
return View();
}
public ActionResult MonitoredFeeds()
{
ViewData["Title"] = "Monitored Feeds";
return View();
}
</code></pre>
<p>Then fix these to use the ... | <p>Your controller is called "Home", therefore your views should be in the Views/Home folder, not in Views/Feeds.</p>
<p>The error message clearly states that it is searching for ~/Views/Home/FeedList.aspx and ~/Views/Home/FeedList.ascx</p>
| 41,813 |
<p>I have a database where one of the common queries is has a "where blobCol is null", I think that this is getting bad performance (as in a full table scan). I have no need to index the contents of the blobCol. </p>
<p>What indexes would improve this? Can an index be built on an expression (blobCol is not null) rathe... | <p>Yes, most DBMSs support it, for instance in <a href="http://www.postgresql.org/docs/8.2/static/sql-createindex.html" rel="nofollow noreferrer">PostgreSQL</a> it is</p>
<pre><code>CREATE INDEX notNullblob ON myTable (blobCol is not NULL);
</code></pre>
<p>It seems that the best you could do on SQL Server though is ... | <p>Some databases allow indexes on expressions but a plain index should reduce the running time of your query significantly.</p>
| 35,341 |
<p>On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same but is there any special cases for emai... | <p>While it would still be a good idea to strip <code><script></code> tags from your document before sending it, I think that the threat is low. I believe that you would be hard pressed to find an email client (still receiving support) that does not strip scripts before rendering an email.</p>
| <p>I believe that by marking the email body as text/plain would avoid javascript and/or html attacks (but I wouldn't trust outlook on following what the headers suggest).</p>
| 13,931 |
<p>For years we've been using RealNetworks' Helix server to serve streaming video courses.</p>
<p>It has been a pretty reliable solution up until now.</p>
<p>As of late, our support calls due to RealPlayer issues has gone from 2 or 3 a week (mostly PEBKAC or firewall issues) to up to about 10 a day.</p>
<p>I've been ar... | <p>You could do it the way <a href="http://www.youtube.com/" rel="nofollow noreferrer">youtube</a> / <a href="http://video.google.com/" rel="nofollow noreferrer">google video</a> / <a href="http://www.google.com/search?hl=en&q=online+video&btnG=Search" rel="nofollow noreferrer">dozens of other sites</a> do it. ... | <p>You could do it the way <a href="http://www.youtube.com/" rel="nofollow noreferrer">youtube</a> / <a href="http://video.google.com/" rel="nofollow noreferrer">google video</a> / <a href="http://www.google.com/search?hl=en&q=online+video&btnG=Search" rel="nofollow noreferrer">dozens of other sites</a> do it. ... | 29,872 |
<p>Does it matter to developers that the current, and newer versions of .Net don't support windows 2000?</p>
<p>It scares me to think that several of my clients still use Windows 2000 and although I may decide to stop supporting Windows 2000 one day, I don't like that Microsoft is pushing it on people's products. </p>... | <p>Considering that Microsoft has a double interest in this matter (selling you the new OS and producing the .NET framework), I would be very suspicious.</p>
<p>In actual fact, you will be able to support new .NET versions on older OSes using <a href="http://www.mono-project.com/Main_Page" rel="nofollow noreferrer">M... | <p>Since I've gone through this recently here is Microsoft's stated support guidelines.
<a href="http://support.microsoft.com/?LN=en-us&pr=lifecycle&scid=gp%3B%5Bln%5D%3Blifecycle&x=15&y=11" rel="nofollow noreferrer">Lifecycle guidance.</a></p>
<p>FYI support for XP should go through at least 2010 and ... | 18,295 |
<p>i have a data access layer which returns data from stored procedures. If i bind this to a gridview control in asp.net 2.0, the users then have an option of filtering on that data select list where in they can choose the conditional clause of </p>
<ul>
<li><p>like</p></li>
<li><p>=</p></li>
<li><p>or</p></li>
<li><p... | <p><a href="http://www.outlookcode.com/article.aspx?id=28" rel="noreferrer">This page</a> has some really good insight on where Outlook keeps all its stuff. It suggests the following:</p>
<blockquote>
<p>All Outlook macros are stored in a single file named VbaProject.otm in the user's %appdata%\Microsoft\Outlook fol... | <p>Ran into this same problem. </p>
<ul>
<li>First reviewed the .otm file mentioned by @Anonymous Type and @Dave DuPlantis</li>
<li>Not corrupted... hmm </li>
</ul>
<p>I checked my Ribbon in Outlook for the Developer tab. It was missing and simply re-adding it to my Ribbon fixed my problem. </p>
| 28,926 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/174968/how-many-parameters-are-too-many">How many parameters are too many?</a> </p>
</blockquote>
<p>I was just writing a function that took in several values and it got me thinking. When is the number number ... | <p>According to Steve McConnell in <em>Code Complete</em>, you should</p>
<blockquote>
<p>Limit the number of a routine's
parameters to about seven</p>
</blockquote>
| <p>I would say maximum 4 . Anything above , I think should be placed within a class . </p>
| 41,243 |
<p>I need to convert an arbitrary amount of milliseconds into Days, Hours, Minutes Second.</p>
<p>For example: 10 Days, 5 hours, 13 minutes, 1 second.</p>
| <p>Well, since nobody else has stepped up, I'll write the easy code to do this:</p>
<pre><code>x = ms / 1000
seconds = x % 60
x /= 60
minutes = x % 60
x /= 60
hours = x % 24
x /= 24
days = x
</code></pre>
<p>I'm just glad you stopped at days and didn't ask for months. :)</p>
<p>Note that in the above, it is assumed ... | <p>Here is more precise method in JAVA , I have implemented this simple logic , hope this will help you:</p>
<pre><code> public String getDuration(String _currentTimemilliSecond)
{
long _currentTimeMiles = 1;
int x = 0;
int seconds = 0;
int minutes = 0;
int hours... | 21,158 |
<p>I'm trying to figure out how to consume a WCF service in BizTalk 2006 R2 (sending a request and receiving a response).</p>
<p>I've gotten as far as going through the "Add Generated Items" wizard. Now I am trying to find out how to use the items it generated in an orchestration.</p>
<p>How should the request be ma... | <p>Below is a description of how to do this - I'm going to presume at least basic knowledge of things like BizTalk mapping, please let me know if you need any more detail and I'll update.</p>
<p>After generating the items in BizTalk you should have (at the least):</p>
<ul>
<li>An orchestration file with Messages and ... | <p>BizTalk is overkill if you are just using it to orchestrate WCF services. You can use WCF services in .NET 3.5 inside of Windows Workflow Foundation a bit more easily. </p>
<p>That said, here is a screencast that should help:</p>
<p><a href="http://www.pluralsight.com/community/blogs/aaron/archive/2007/11/15/49172... | 24,875 |
<p>In my tests I need to test what happens when an OracleException is thrown (due to a stored procedure failure). I am trying to setup Rhino Mocks to </p>
<pre><code>Expect.Call(....).Throw(new OracleException());
</code></pre>
<p>For whatever reason however, OracleException seems to be sealed with no public constru... | <p>Here is how you do it:</p>
<pre><code> ConstructorInfo ci = typeof(OracleException).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] {typeof(string), typeof(int)}, null);
var c = (OracleException)ci.Invoke(new object[] { "some message", 123 });
</code></pre>
<p>Thanks to all t... | <p>Can you write a trivial stored procedure that fails/errors each time, then use that to test?</p>
| 14,859 |
<p>Is there an easy way to create standalone .exe files from Lua scripts? Basically this would involve linking the Lua interpreter and the scripts.</p>
<p>I believe it is possible (PLT Scheme allows the creation of standalone executables in the same way), but how, exactly?</p>
| <p>Check out for <a href="http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#srlua" rel="noreferrer">srlua</a>. It does what you need. </p>
<p>It's from one of the Lua authors. On this address there is also pre-compiled Windows binaries, so that would be even easier for you I think.</p>
| <p>As this topic has somewhat 'perpetual' interest and the possible answers are 'fluid' in the sense that new solutions may emerge (while older ones may become obsolete), here's yet another possibility (for Windows) and pure Lua source dependencies.</p>
<p>Link: <a href="http://chiselapp.com/user/tonypdmtr/repository/... | 23,638 |
<p>In PHP, I can write:</p>
<pre><code>$vname = 'phone';
$$vname = '555-1234';
print $phone;
</code></pre>
<p>... And the script will output "555-1234".</p>
<p>Is there any equivalent in Perl?</p>
<p>Is there any way to constrain <code>$phone</code> to the scope of the local block, as if I'd written <code>my $phone... | <p>What you're attempting to do is called a "symbolic reference." While you can do this in Perl <a href="http://perl.plover.com/varvarname.html" rel="noreferrer">you shouldn't</a>. Symbolic references only work with global variables -- not lexical (<code>my</code>) ones. There is no way to restrict their scope. <strong... | <p>You do realize that PHP inherits many of its features from Perl, right?</p>
<p>Not only can Perl do all of the symbolic reference stuff PHP can,</p>
<pre><code>use strict;
use warnings;
use 5.010;
our $test=1;
# Access $test through the special hash %::
say ${$::{test}}++;
# This is essentially what the previou... | 35,800 |
<p>I have an SSIS package that does the following:
Selects the connection strings from a table of servers. The connection string is either the name of the server along with the domain (i.e. Dalin.myhouse.com) or is the direct IP to a server.</p>
<p>The package iterates through each connection string and populates a d... | <p>I can't see how this can be accomplished without the variables being set within a Script Task, since ExecuteSQL tasks have to be set to a database connection. Script Tasks work for this because their connection is within the context of the server that's executing them. That being said, you could use a Script Task ... | <p>So you need the Execute SQL task to take parameters?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms187685.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms187685.aspx</a></p>
<p>Maybe I've misunderstood...</p>
| 48,274 |
<p>What techniques do you know\use to create user-friendly GUI ? </p>
<p>I can name following techniques that I find especially useful: </p>
<ul>
<li>Non-blocking notifications (floating dialogs like in Firefox3 or Vista's pop-up messages in tray area)</li>
<li>Absence of "Save" button<br>
MS OneNote as an example.<... | <p>If you do give the user a question, don't make it a yes/no question. Take the time to make a new form and put the verbs as choices like in mac. </p>
<p>For example:</p>
<pre><code> Would you like to save?
Yes No
</code></pre>
<p>Should Be:</p>
<pre><code> Would you like to save?
Save ... | <p>The best technique I found is to put your self in the users shoes. What would you like to see from the GUI and put that in front. This also gives you the ability to prioritize as those things should be done first then work from there.</p>
<p>To do this I try to find "layers of usefulness" and add / subtract from th... | 6,437 |
<p>I am trying to write a web service to spec and it requires a different response body depending on whether the method completes successfully or not. I have tried creating two different DataContract classes, but how can I return them and have them serialized correctly? </p>
| <p>The best way to indicate that your WCF web service has failed would be to throw a FaultException. There are settings in your service web.config files that allow the entire fault message to be passed to the client as part of the error.</p>
<p>Another approach may be to inherit both of your results from the same bas... | <p>If you are using a xml based binding, then I believe there is no way to do that. A simple solution in that case would to just have part of the message flag if there was a failure, and store the failure information somewhere if needed. For a JSON binding you may be able to use a method that returns an object, then re... | 16,972 |
<p>I have a problem of playing FLV file which id embed in my swf when i place it on server, swf plays correctly but not FLV</p>
<p>any solution will be highly appreciated.</p>
<hr>
<p>thanks for all replys, its works in All browesers other than IE 6 now , </p>
<p>i will paste the code here for the flv to chk .</p>... | <p>As said before check the mime type on the server.</p>
<p>If the FLV is playing in some browsers and not in others there is probably an issue with the Flash Player. First in all browsers go the URL where the FLV lives on the server so see if you actually access the file from a browser. Then check for each browser se... | <p><em>"Apache 5.5"</em>? Apache httpd only goes to 2.x, so can we assume you mean Apache Tomcat 5.5? Or??? <strong>More information is required.</strong> Maybe even a link if you can. Flash players are really good about playing valid FLV video files via HTTP, even with bad mime type headers.</p>
| 30,007 |
<p>I have a VB.NET windows application that pulls information from an MS Access database. The primary role of the application is to extract information from Excel files in various formats, standarize the file layout and write that out to csv files. The application uses MS Access as the source for the keys and cross re... | <p>Microsoft provide a <a href="http://www.microsoft.com/downloads/details.aspx?familyid=D842F8B4-C914-4AC7-B2F3-D25FFF4E24FB&displaylang=en" rel="nofollow noreferrer">free tool</a> to migrate an Access Database to SQL Server. Once you've upgraded you should be able to change your connection string to point at SQL ... | <p>Making sure the scope is clear:</p>
<ol>
<li>Use a .NET program to </li>
<li>drive an Access database front-end which enables you to</li>
<li>Extract data from a number of Excel spreadsheets,</li>
<li>Massaging the data appropriately, and</li>
<li>Save the result in a CSV file.</li>
</ol>
<p>What sorts of volumes ... | 31,861 |
<p>How do I change the system-wide short date format in Ubuntu? For example, Thunderbird is showing dates in the DD/MM/YY format, and I would like to change it to MM/DD/YY or YYYY-MM-DD.</p>
<p>The best information I can find so far is in this thread:</p>
<p><a href="http://ubuntuforums.org/showthread.php?t=193916" ... | <ul>
<li>Install and launch "dconf Editor", navigate to com -> canonical -> indicator -> datetime.</li>
<li>Set the value of <code>time-format</code> to <code>custom</code>.</li>
<li>Customize the Time & Date format by editing the value of <code>custom-time-format</code>, e.g. set it to <code>%Y-%m-%d %H:%M:%S</cod... | <p>Thunderbird uses the system's date format, and that format depends on the system's locale settings. You have two options:</p>
<ol>
<li>modify the system locale, the instructions are in the forum thread you linked above, or</li>
<li>set <code>LC_TIME</code> to a locale that uses the format you want. The <a href="htt... | 19,345 |
<p>Is it practical (or possible) to create a Websphere Portlet for a Classic ASP website?</p>
| <p>Websphere is Java based, but you can mix any web content using IFRAMEs or Ajax to inject HTML in your ASP page. </p>
<p>Practical? I don't think so.</p>
| <p>Probably, but you would still need to have seperate hosting environments for your Java Portlets and your IIS ASP applications, even if called within an IFrame.</p>
| 19,017 |
<p>first time here.</p>
<p>I recently bought an Anycubic Mega S and I'm venturing in the 3D world. Lots to learn for sure. I have printed a few items so far and all went pretty well.</p>
<p>My question is about something that caught my attention while browsing on Thingiverse. I was looking for an organizer for a board ... | <p>Thingieverse does respect the orientation an item was designed in, just like most slicers will. Designers will often choose any one of the three planes (XY, YZ, ZX) as their first by preference, then work out the other parts in relation to the first. This does often not take into account the actual print orientation... | <p>When I design parts in CAD software I pick a starting plane and go from there. And that starting plane doesn't correspond to how the part is designed to be printed. That usually comes later.</p>
| 1,724 |
<p>I'm trying to keep dependencies to a minimum for a program I contribute to, it's a small text editor.</p>
<p>GTK Textview doesn't seem to come with a built-in undo function. Is there any reference implementation I've been missing on so far? Is everyone writing their own undo function for their TextView widgets?</p>... | <p>As far as I know, GTK TextView doesn't include an undo function. So while I am not familiar with Python's GTK library, I would think it doesn't have one.</p>
<p>The Ruby-GNOME2 project has a <a href="http://ruby-gnome2.sourceforge.jp/hiki.cgi?Simple+Text+Editor" rel="nofollow noreferrer">sample text editor</a> that... | <h1>Use GtkSource</h1>
<ul>
<li><a href="https://wiki.gnome.org/Projects/GtkSourceView" rel="nofollow noreferrer">https://wiki.gnome.org/Projects/GtkSourceView</a></li>
<li><a href="https://lazka.github.io/pgi-docs/GtkSource-3.0/" rel="nofollow noreferrer">https://lazka.github.io/pgi-docs/GtkSource-3.0/</a></li>
<li><a... | 10,173 |
<p>When <code>{0}</code> is used to initialize an object, what does it mean? I can't find any references to <code>{0}</code> anywhere, and because of the curly braces Google searches are not helpful.</p>
<p>Example code:</p>
<pre><code>SHELLEXECUTEINFO sexi = {0}; // what does this do?
sexi.cbSize = sizeof(SHELLEXECU... | <p>What's happening here is called <strong>aggregate</strong> initialization. Here is the (abbreviated) definition of an aggregate from section 8.5.1 of the ISO spec:</p>
<blockquote>
<p>An aggregate is an array or a class with no user-declared constructors, no private or protected non-static data members, no base ... | <p>{0} is an <strong>anonymous array</strong> containing its element as 0.</p>
<p>This is used to <strong>initialize one or all elements of array with 0.</strong></p>
<p>e.g. int arr[8] = {0};</p>
<p>In this case all the elements of arr will be initialized as 0.</p>
| 11,461 |
<p>In my Spring MVC based applications i use Freemarker and i like it very much, but it's lacking advantages provided by Composite View pattern. </p>
<p>I'm thinking of trying to use Tiles2 together with Freemarker - does anyone know where do i find a simple example of SpringMVC together with Tiles2+Freemarker?</p>
| <p>nevermind, i've solved it. i just had to specify freemarker templates in tiles definitions file</p>
<pre><code><definition name="template" template="/WEB-INF/ftl/main.ftl">
</code></pre>
<p>and add freemarker servlet/maping to web.xml</p>
<pre><code><servlet>
<servlet-name>freemarker</ser... | <p>Another product you could use instead of Tiles is <a href="http://www.opensymphony.com/sitemesh/" rel="nofollow noreferrer">SiteMesh</a>, which I've used in some apps. It's worth checking out.</p>
| 27,250 |
<p>The IT department of a subsidiary of ours had a consulting company write them an ASP.NET application. Now it's having intermittent problems with mixing up who the current user is and has been known to show Joe some of Bob's data by mistake.</p>
<p>The consultants were brought back to troubleshoot and we were invit... | <p>I would agree. These guys seem quite incompetent.</p>
<p>(BTW, I'd check to see if in "SomeProprietarySessionManagementLookup," they're using static data. Saw this -- with behavior <em>exactly as you describe</em> on a project I inherited several months ago. It was a total head-slap moment when we finally saw it ..... | <p>On the second point, I would not use exceptions here. Exceptions are reserved for exceptional cases.<br>
However, division of anything by zero certainly does not equal zero (in math, at least), so this would be case specific.</p>
| 19,886 |
<p>Is there a C# equivalent method to Java's <code>Exception.printStackTrace()</code> or do I have to write something myself, working my way through the InnerExceptions?</p>
| <p>Try this:</p>
<pre><code>Console.WriteLine(ex.ToString());
</code></pre>
<p>From <a href="http://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx</a>:</p>
<blockquote>
<p>The default implementation of ToStrin... | <p>Also look at Log4Net... its a port of Log4J to .NET.</p>
| 43,294 |
<p>My code processes all the files in a folder on a Windows box. I want to offer the user (who happens to also be me) the option to select the folder to be processed, using the standard File Chooser dialog.</p>
<p>I am trying to use the <a href="http://msdn.microsoft.com/en-us/library/ms646927(VS.85).aspx" rel="nofoll... | <p>Unfortunately, I think you're calling the wrong function entirely. It's been a while since I've done Win32 gui stuff.. but I seem to recall that there was a different way of bringing up a "select directory" box. It wasn't a straight Win32 function, but was some shell API function that required a whole heap of code t... | <p>As Greg mentions, the function you want is a shell function. The specific function you need is <a href="http://msdn.microsoft.com/en-us/library/aa453669.aspx" rel="nofollow noreferrer"><code>SHBrowseForFolder</code></a>, which is pretty messy to call. There's also <a href="http://docs.activestate.com/activepython/2.... | 34,954 |
<pre><code>Control.TabIndex
</code></pre>
<p>Only allows me to overide the Tab order of controls in a given container. </p>
<p>Is there a way to specify this across all the controls in, for example a UserControl, regardless of the contains used to arrange the controls.</p>
<p>Cheers,</p>
<p>Jan</p>
| <p>I'm not sure that there is a particularly good way of doing what you are asking, but check out <a href="http://www.julmar.com/blog/mark/PermaLink,guid,6e4769e5-a0b3-47b2-a142-6dfefd0c028e.aspx" rel="nofollow noreferrer" title="Changing WPF focus in code">Changing WPF focus in code</a>.</p>
<p>That uses <code>Keyboa... | <p>This kind of focus handling is horrible in WPF. The best approch is to make a lot of controls not accept focus with Focusable="False".</p>
<p>The TabNavigation answer would solve the tab key however the arrow keys will not work like you want.</p>
| 27,297 |
<p>Say I have a xml document that looks like this</p>
<pre><code><foo>
<bar id="9" />
<bar id="4" />
<bar id="3" />
</foo>
</code></pre>
<p>I would like to use linq to reset the id's to 0, 1 ,2.
What would be the easiest way to do this?</p>
<p>Thanks</p>
| <pre><code>XElement xml = GetXml();
var i = 0;
foreach (var e in xml.Elements("bar"))
e.SetAttributeValue("id", i++);
</code></pre>
| <p>You can do it with linq methods instead of foreach, but there isn't much bang for the buck:</p>
<pre><code>XElement xml = GetXml();
int updatedElements = xml.Elements("bar")
.Select((x, i) =>
{
x.SetAttributeValue("id", i);
return x;
})
.Count();
</code></pre>
<p>Here, the Count(... | 39,857 |
<p>We have developed a software system using ActiveX/COM (VB6) technology from microsoft. In the last year, i get more and more interested in automated build processes and SCM at a whole. I intensively searched big parts of the web for information about best practices how to do scm with COM based software systems.</p>
... | <p>You can tell VB6 to reuse GUID's (IID's CLSID's LIBID's etc.) by changing the compatbility setting of the project to from "No Compatbility" to "Binary Compatibility". You can find these settings under Project-><em>Your-Project</em> Properties. The compatibility setting is on the Component tab of the Project Properti... | <p>As Mike Spross suggests, you should use Binary Compatibility. You can (and should) build on a clean machine. You do this by keeping a copy of the current production binaries (ActiveX DLLs & OCXs) in a "compatible" directory in your source control system. All the projects should refer to this copy when you select... | 21,596 |
<p>I know I could do this with closures (<code>var self = this</code>) if object was a function:</p>
<pre><code><a href="#" id="x">click here</a>
<script type="text/javascript">
var object = {
y : 1,
handle_click : function (e) {
alert('h... | <p>So, the event handler part wires up just fine (I tested it myself) but, as your comment indicates, you have no access to the "y" property of the object you just defined.</p>
<p>This works:</p>
<pre><code>var object = {
y : 1,
handle_click : function (e) {
alert('handling click');
//want to access y ... | <p>I see how to do it with Jason's latest one. Any way to do it without the anonymous function?</p>
| 39,381 |
<p>My database consists of 3 tables (one for storing all items, one for the tags, and one for the relation between the two):</p>
<p>Table: Post
Columns: PostID, Name, Desc</p>
<p>Table: Tag
Columns: TagID, Name</p>
<p>Table: PostTag
Columns: PostID, TagID</p>
<p>What is the best way to save a space separated string... | <p>Roughly, something like this:</p>
<pre><code>class Post {
static hasMany [tags:Tag]
}
class Tag {
static belongsTo = Post
static hasMany [posts:Post]
}
class someService {
def createPostWithTags(name, desc, tags) {
def post = new Post(name: name, desc: desc).save()
tags.spli... | <p>If you have a Tag Table, wouldn't you have a row for each Tag?</p>
<pre><code>tag.id = 1; tag.name = 'smart'
tag.id = 2; tag.name = 'funny'
tag.id = 3; tag.name = 'wonderful'
</code></pre>
<p>In Groovy/Grails, you'd retrieve them as a list, possibly concatenating them into a space separated list for display.</p>
... | 30,472 |
<p>In C++, on the stack, a simple variable is assigned a memory address so that we can use a pointer to contain this memory to point to it; then is a pointer also assigned a memory address?</p>
<p>If yes, can we have a pointer of pointers?</p>
| <p>Yes, you are right. We can have pointers to pointers:</p>
<pre><code>int a;
int b;
int * pa = &a;
int ** ppa = &pa;
// set a to 10
**ppa = 10;
// set pa so it points to b. and then set b to 11.
*ppa = &b;
**ppa = 11;
</code></pre>
<p>Read it from right to left: <em>ppa is a pointer to a pointer to an... | <p>A pointer is just a variable (memory location) that stores the address of other variables. Its own address can of course be stored somewhere else.</p>
| 42,679 |
<p>We have an app in AppStore <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=292436957" rel="nofollow noreferrer">Bust~A~Spook</a> we had an issue with. When you tap the screen we use CALayer to find the position of all the views during their animation and if you hit one we start a die sequ... | <p>Are you using a UIScrollView to host all this? There's a property of that called delaysContentTouches. This defaults to YES, which means the view tries to ascertain whether a touch is a scroll gesture or not, before passing it on. You might try setting this to NO and seeing if that helps.</p>
| <p>Delayed touches usually indicates a CPU overload. Using a NSTimer for frame-to-frame based action is prone to interfering with the touch handling.</p>
<p>If that's the case for your app, then my advice is very simple: OpenGL.</p>
| 32,377 |
<p>I'm at a point in my freelance career where I've developed several web applications for small to medium sized businesses that support things such as project management, booking/reservations, and email management.</p>
<p>I like the work but find that eventually my applications get to a point where the overhear for m... | <p>Although there are certainly good articles on that topic, none of them is a substitute of real-world experience.</p>
<p>Maintainability is nothing you can plan straight ahead, except on very small projects. It is something you need to take care of during the whole project. In fact, creating loads of classes and inf... | <p>You should consider maybe using SharePoint. It's an environment that is already designed to do all you have mentioned, and has many other features you maybe haven't thought about (but maybe you will need in the future :-) )</p>
<p><a href="http://www.microsoft.com/Sharepoint/default.mspx" rel="nofollow noreferrer">... | 13,176 |
<p>I am running windows XP with ruby 1.8.6 patchlevel 111. I am using HTTP to connect to a remote server and it has been running fine. All of a sudden it started to through the exception listed below (I did not change any code since the last time I ran it successfully). Does anybody know what is going on?</p>
<pre>
... | <p>Maybe the remote host is down? Or a new firewall has been put between your machine and the remote host?</p>
<p>"Timeout::Error" usually points to that direction.</p>
| <p>besides the obvious (firewall, you got blacklisted for bad user-agent or ignoring robots.txt), you can try curl</p>
<p><a href="http://curl.haxx.se/libcurl/ruby/" rel="nofollow noreferrer">http://curl.haxx.se/libcurl/ruby/</a></p>
<p>OR increase net/http timeout to say, 30+ seconds</p>
<p><a href="http://groups.g... | 21,398 |
<p>What is the difference between <code>new</code>/<code>delete</code> and <code>malloc</code>/<code>free</code>?</p>
<p>Related (duplicate?): <a href="https://stackoverflow.com/questions/184537/in-what-cases-do-i-use-malloc-vs-new">In what cases do I use malloc vs new?</a></p>
| <h2><code>new</code> / <code>delete</code></h2>
<ul>
<li>Allocate / release memory
<ol>
<li>Memory allocated from 'Free Store'.</li>
<li>Returns a fully typed pointer.</li>
<li><code>new</code> (standard version) never returns a <code>NULL</code> (will throw on failure).</li>
<li>Are called with Type-ID (compiler calcu... | <p>1.new syntex is simpler than malloc()</p>
<p>2.new/delete is a operator where malloc()/free()
is a function.</p>
<p>3.new/delete execute faster than malloc()/free() because new assemly code directly pasted by the compiler.</p>
<p>4.we can change new/delete meaning in program with the help of operator overlading.<... | 29,732 |
<p>This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ <code>std::fstream</code> classes don't take a <code>std::string</code> in their constructor or open methods. Everyone loves code examples so:</p>
<pre><code>#include <... | <p>By taking a C string the C++03 <a href="http://en.cppreference.com/w/cpp/io/basic_fstream" rel="noreferrer"><code>std::fstream</code></a> class reduced dependency on the <code>std::string</code> class. In C++11, however, the <code>std::fstream</code> class does allow passing a <code>std::string</code> for its constr... | <p>Is there any class in STL that takes a string... I dont think so (couldnt find any in my quick search). So it's probably some design decision, that no class in STL should be dependent on any other STL class (that is not directly needed for functionality).</p>
| 5,222 |
<p>I have tried this...</p>
<pre><code>Dim myMatches As String() =
System.Text.RegularExpressions.Regex.Split(postRow.Item("Post"), "\b\#\b")
</code></pre>
<p>But it is splitting all words, I want an array of words that start with#</p>
<p>Thanks!</p>
| <p>This seems to work...</p>
<p>c#</p>
<pre><code>Regex MyRegex = new Regex("\\#\\w+");
MatchCollection ms = MyRegex.Matches(InputText);
</code></pre>
<p>or vb.net</p>
<pre><code>Dim MyRegex as Regex = new Regex("\#\w+")
Dim ms as MatchCollection = MyRegex.Matches(InputText)
</code></pre>
<p>Given input text of...... | <p>Here is a code in Javascript:</p>
<pre><code>text = "what #regEx can I use to #split a #string into whole words but only"
// what #regEx can I use to #split a #string into whole words but only"
text.match(/#\w+/g);
// [#regEx,#split,#string]
</code></pre>
| 18,080 |
<p>Our DB server fell, and we need to restore some of it's DB's. We can find only the LDF file of the needed DB. Is there a tool that can use that for restoring? We're using SQL 2005.</p>
| <p>No. You will also need the .mdf</p>
| <p>The LDF file is the transaction log, I doubt you can get anything useful out of it alone.</p>
<p>You do have backups, right?</p>
| 39,187 |
<p>I found a list of iPhone supported font here<br>
<a href="http://daringfireball.net/misc/2007/07/iphone-osx-fonts" rel="nofollow noreferrer">http://daringfireball.net/misc/2007/07/iphone-osx-fonts</a></p>
<p>But I just wanted to confirm that, can we use all this fonts in application, or we are restricted to some cl... | <p>You should be able to use any of those fonts, provided you know the appropriate name. There are calls to enumerate the font families and individual fonts in those families on the phone, but a complete listing is available <a href="http://iosfonts.com/" rel="noreferrer">on this site</a>.</p>
| <p>I created <a href="http://itunes.apple.com/app/ifonts/id392614957" rel="nofollow">iFonts</a> so I could email the list to a designer. It's compatible all the way down to 3.0, so you can see what fonts are available on different versions of iOS, and you don't have to worry about whether a web page is accurate or comp... | 30,979 |
<p>I am currently looking at developing a mobile apps for the S60 platform and is specifically looking at PyS60. It seems to suggest that the it can be compiled into native .sis files without the need for an embedded python interpreter. Reading through the documentations I could not find any statements where this is ex... | <p>Once you've written your code in python, you can convert this to a .sis file using ensymble.</p>
<p><a href="http://code.google.com/p/ensymble/" rel="noreferrer">http://code.google.com/p/ensymble/</a></p>
<p>This software allows you to make your .py file into a .sis file using the py2sis option - however, it won't... | <p>Linux is not officially supported for Series60 development yet. You will save yourself a lot of headache using Windows, weirdly enough.</p>
<p>As far as Python is oncerned, I think the developed application is packaged into a .sis file but still requires the PyS60 interpreter to run once installed.</p>
| 43,410 |
<p>I keep thinking it means that I can plug it directly into <a href="http://rads.stackoverflow.com/amzn/click/B007KG0ZYI" rel="nofollow noreferrer">my power supply</a> instead of running it though my RAMPs 1.4; is that correct?</p>
<p>Here is the link to it, <a href="http://www.robotdigg.com/product/209" rel="nofollo... | <p>"Mains voltage" is the alternating current provided by your wall outlets (eg 120v in USA). In order to use a mains voltage heatbed in a 3d printer, you will need to wire up your controller to switch an AC SSR. That way, your low-voltage-DC RAMPS board can control AC current. </p>
<p>If you plug a heatbed directly i... | <p>"Mains voltage" is the alternating current provided by your wall outlets (eg 120v in USA). In order to use a mains voltage heatbed in a 3d printer, you will need to wire up your controller to switch an AC SSR. That way, your low-voltage-DC RAMPS board can control AC current. </p>
<p>If you plug a heatbed directly i... | 346 |
<p>Current main problem is that at various points during a print, one layer doesn’t attach well to the layer below it. That is what appears to be causing the artifacts in the second picture below, but the picture may not show it clearly.</p>
<h2>Background</h2>
<p>I have a Makerbot Replicator 5th generation printer. Th... | <p>Your printer is improperly leveled with respect to the distance of the nozzle to the bed. This, and a high raft to print part distance, causes consecutive layers to not adhere well. </p>
<p>PLA should not need that high temperatures to print nor does it need a raft. Rafts are interesting when printing filaments tha... | <p>Reading your print settings, I noticed some oddities:</p>
<ul>
<li>215 °C</li>
<li>raft</li>
</ul>
<p>These are settings one does not expect for PLA but seem reasonable for ABS. The 215 °C could be reasonable if</p>
<ul>
<li>the melt zone is extremely short and partially insulated (Makerbot Mk 10 style)</li>
<li>the... | 1,144 |
<p>I have a table in Access 2003 VBA with 164 columns but the data I get has 181 column and it is possible that it will get bigger in the future.
I need to know how to resize my table an to add extra colums during the runtime
I know how to check how many colums I need so I just need to know how to resize my own table.... | <p>Another option; rather than have a "<em>short-fat</em>" table with lots of columns, have a "<em>tall-skinny</em>" table with lots of rows:</p>
<p><strong>Short-fat:</strong></p>
<pre><code> ID
FirstName
LastName
...
Amount
1 Joe Smith ... $123
2 Bob Roberts ... $214
3 Jim Black ... $500... | <p>the problem is that i don't have the rights to change the design
the complete database is already created my job is just to impiment the reading of csv data but these dam... data need more colums than there were implimented by the previos programmer
thats why i can't just delete the table
and besides there are abo... | 38,669 |
<p>I filled up a combobox with the values from an Enum.</p>
<p>Now a combobox is text right? So I'm using a getter and a setter. I'm having problems reading the text.</p>
<p>Here's the code:</p>
<pre><code>public BookType type
{
get
{
return (BookType)Enum.Parse(typeof(BookType), this.typeComboBox.T... | <pre><code>string selectedText = this.ComboBox.GetItemText(this.ComboBox.SelectedItem);
</code></pre>
<p>The GetItemText method analyzes the item and returns the text of the bound to that item.</p>
| <p>The combobox starts at index -1, which has no text, thus an empty string: ""</p>
<p>I then change the index to a BookType that I need and then I get the wrong output...</p>
| 40,697 |
<p>I found this question: How to find out which CVS tags cover which files and paths?</p>
<p>However, the results are not at all what I'm expecting.
I'm using the following:</p>
<pre><code>cvs -n -q update -r ET30908
</code></pre>
<p>I'm looking for every file tagged with 'ET30908'.</p>
| <p>I find the easiest way to do this is to check out the project. </p>
<pre><code>cvs co -d tag-ET30908 -r ET30908 modulename
</code></pre>
<p>This will create a directory on disk called "tag-ET30908" that contains only those files with the tag specified.</p>
<p>You can even keep this directory around and later do ... | <p>The only way to know this is to iterate on all files as CVS is file-oriented, not changeset or snapshot-oriented. There is no central file/place where all tags are entered.</p>
| 49,269 |
<pre><code>typedef union
{
uint ui[4];
} md5hash;
void main(void)
{
int opt;
while ((opt = getopt(argc, argv, "c:t:s:h:")) != -1) {
switch (opt) {
case 'h':
hash = optarg;
break;
default: /* '?' */
exit(EXIT_FAILURE);
}
}
md5hash... | <ol start="2">
<li>You seem to have two variables called hash, except one is implicit in your code.</li>
<li>The <code>sscanf</code> statement attempts to read <code>hash</code> back into itself, but obviously it will not find any hexadecimal digits.</li>
<li><code>%x</code> may load a different sized integer in hexade... | <pre><code>int
parse_hex(char *s, unsigned char *hex, int len)
{
int i, r = 0;
len *= 2;
for (i = 0; ; i++, s++)
{
if (*s == 0 && !(i & 1))
return i / 2;
if (i == len)
{
fprintf(stderr, "parsehex: string too long\n");
//exit(1);
}
if (... | 45,771 |
<p>I want to add "share this on Facebook" to a page. I've got this working just fine using this URL format:</p>
<p><a href="http://www.facebook.com/sharer.php?u=my.url.here" rel="nofollow noreferrer">http://www.facebook.com/sharer.php?u=my.url.here</a></p>
<p>but the problem is, that's designed specifically to be a p... | <p>Check out Facebook Connect</p>
<p><a href="http://developers.facebook.com/connect.php" rel="nofollow noreferrer">http://developers.facebook.com/connect.php</a></p>
<p>It is there new JS API... </p>
<p>The method you want to call when you get everything lined up is:</p>
<p>FB.Connect.showFeedDialog(bundle_id, pos... | <p>facebook connect javascript SDK has been changed..
its here <a href="https://developers.facebook.com/docs/reference/javascript/" rel="nofollow">https://developers.facebook.com/docs/reference/javascript/</a></p>
<p>Thanks</p>
| 49,325 |
<p>Templates are a pretty healthy business in established programming languages, but are there any good ones that can be processed in JavaScript?</p>
<p>By "template" I mean a document that accepts a data object as input, inserts the data into some kind of serialized markup language, and outputs the markup. Well-known... | <p><a href="http://ejohn.org/" rel="noreferrer">John Resig</a> has a mini javascript templating engine at <a href="http://ejohn.org/blog/javascript-micro-templating/" rel="noreferrer">http://ejohn.org/blog/javascript-micro-templating/</a></p>
| <p><a href="http://code.google.com/p/querytemplates/" rel="nofollow noreferrer">QueryTemplates</a>
Demo: <a href="http://sandbox.meta20.net/querytemplates-js/demo.html" rel="nofollow noreferrer">http://sandbox.meta20.net/querytemplates-js/demo.html</a></p>
| 15,679 |
<p>Has anyone tried installing SQL Server 2008 Developer on a machine that already has 2005 Developer installed?</p>
<p>I am unsure if I should do this, and I need to keep 2005 on this machine for the foreseeable future in order to test our application easily. Since I sometimes need to take backup files of databases a... | <p>Yes this is possible. You will have to create a named instance not used by another version of SQL Server as per the previous answer and version 3.5 of .Net installed. Works great!!</p>
<p>Here the list of prerequisites:</p>
<ul>
<li>.NET Framework 3.5 SP1</li>
<li>Windows Installer 4.5</li>
<li>Windows PowerShell... | <p>Unfortunately, it seems SQL Server 2008 Client Tools requires Visual Studio 2008 SP1, and I'm loath to install a beta of this on my main development machine.</p>
<p>I'll wait until SP1 is RTM before I move on.</p>
<p><strong>Edit</strong>: Yes, I do have Visual Studio 2008 on this machine, but I'd like to avoid be... | 2,651 |
<p>I have an ISAm table in mySql that was created similar to this:</p>
<pre><code>create table mytable (
id int not null auto_increment primary key,
name varchar(64) not null );
create unique index nameIndex on mytable (name);
</code></pre>
<p>I have multiple processes inserting rows into this table. If two proces... | <p>Do not bother locking, your index will prevent duplicates. You should handle the error code from your application.</p>
<p>MySQL should return an error code of 1062 (or SQLSTATE 23000) when your unique key constraint is violated.</p>
| <p>By the way you described the fear of encountering a DEADLOCK, the causation may not be clearly understood (unless there is more to your querying than described in the question).</p>
<p>A good <a href="http://www.codinghorror.com/blog/archives/001166.html" rel="nofollow noreferrer">summary someone else wrote</a>:</p... | 20,458 |
<p>I've been working a little with DevExpress CodeRush and Refactor! Pro this week, and I picked up a commentor plug-in that will automatically generate comments as you type code.</p>
<p>I don't want to go into how good a job it does of picking out basic meaning (pretty good, actually) but it's default implementation ... | <p>I think comments like that are useless, unless of course the code is awful. With proper formatting of code it's not difficult to see where a block starts and where a block ends because usually those blocks are indented.</p>
<p>Edit:
If a procedure is so big that is not readily apparent what block of code is being ... | <p>If you have to consider whether or not a certain type of comment is usable or not, it's most likely the latter. </p>
<p>Comments are for explaining certain blocks of code or an entity in its whole, to ease up on comprehension; not to make the formatting easier to read. </p>
<p>Having a plugin always conform to thi... | 41,928 |
<p>Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code?</p>
| <p>You can use XML style comments, and use tools to pull those comments out into API documentation.</p>
<p>Here is an example of the comment style:</p>
<pre><code>/// <summary>
/// Authenticates a user based on a username and password.
/// </summary>
/// <param name="username">The username.</para... | <p>I was always told to use block comments opened with 2 or more asterisks do delimit documentation comments.</p>
<pre><code>/**
Documentation goes here.
(flowerboxes optional)
*/
</code></pre>
| 5,480 |
<p>We have a .NET web service API. Currently, people use the SOAP definition to consume the API, because we require authentication through a custom Authentication element in the SOAP header. Works perfectly. fine.</p>
<p>SOAP requires the request to be a POST. We want to allow the users to use a the GET verb (so it ca... | <p>If the web service needs to be secured, and I'm assuming that it does since you currently have an Authentication header, then you should reconsider using GET and not using SSL, at least for the authentication piece. At a minimum I would POST the authorization request via SSL to the web service/application. If you ... | <p>Using a GET only API, I would have a first method which fetches a unique session ID.</p>
<p>Eg: GET /api?action=auth&username=user&password=hashedpassword
Would return a 16 chars token, which you store on your side and you require this unique token for every subsequent call.</p>
<p>If the API was done in P... | 34,066 |
<p>In the company that i work, we develop all the GUI in C#, but the application kernel is mainly developed in Delphi 5 (for historical reasons), with a lot of components made in COM+. Related to this very specific sort of application a I two questions:</p>
<ul>
<li><p>Experienced guys in Delphi and/or COM, do you hav... | <p>I think you should have a good look at Delphi 2009.</p>
<p>Delphi 2009 has changes to the COM support, including a text-based replacement for the binary TLB files.</p>
<p>You can read more on <a href="http://chrisbensen.blogspot.com/2008/07/tiburn-sneak-peek-com_23.html" rel="nofollow noreferrer">Chris Bensen's bl... | <p>Same experience with the TLB interface here: we simply stopped using it.</p>
<p>We work with several separate IDL files (hand-build) for different parts of our framework, making use of the #include construct to include them into the IDL of the actual application, then generate the single tlb using MIDL and tlibimp ... | 3,759 |
<p>I have a local svn repository in my PC, I have been using it for a hobby project and it wasn't meant to be accessible to anyone, so I commited files with passwords in them.</p>
<p>Now, I'm thinking of making the repository available for other people and I don't want to have that data there.</p>
<p>Is there a way t... | <p>Check the Subversion FAQ: <a href="http://subversion.apache.org/faq.html#removal" rel="nofollow noreferrer">How do I completely remove a file from the repository's history?</a></p>
| <p>The easiest thing would be to check out the contents of the repository, remove all the sensitive information, import the working directory into a new repository, and make that available to the public. It is very likely that whoever will be using your project will be interested in its current state, not in the chang... | 25,153 |
<p>I have decided that all my WPF pages need to register a routed event. Rather than include</p>
<pre><code>public static readonly RoutedEvent MyEvent= EventManager.RegisterRoutedEvent("MyEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BasePage));
</code></pre>
<p>on every page, I decided to creat... | <p>Here's how I've done this in my current project.</p>
<p>First I've defined a class (as @Daren Thomas said - just a plain old C# class, no associated XAML file), like this (and yes, this is a real class - best not to ask):</p>
<pre><code>public class PigFinderPage : Page
{
/* add custom events and properties he... | <p>Little update : I just tried to do it, and it didn't work. He is what I changed to solve the problem:</p>
<p>1.In many forums, you will read that the sub pages must inherit from a simple cs class, without XAML. Though it works. I do inherit from a normal XAML page without any problem.</p>
<p>2.I replaced the follo... | 6,098 |
<p>I have an Ender 5 printer, which is a frame-based printer with no enclosure. However, I want to print ABS. Some experiments with a massive cardboard box have shown me I need an enclosure.</p>
<p>Because the printer has a box frame, fitting some perspex sheets will be easy. The bit that won't be easy is the top - th... | <p>Sides without a top will help.</p>
<p>Sides with a top will help more.</p>
<p>Do you need either? That depends. How warm, how dry, how drafty is your printing room?</p>
| <p>If ambient temp gets under 70°F, layer adhesion becomes a real problem. I have found that enclosing the space and adding heat makes the printing more reliable.</p>
<p>This answer is based on a few years of solely printing ABS. I've got my printer on a tool cart and the spool holder is above on a post. The first tim... | 1,583 |
<p>In a language where both are available, would you prefer to see an instance constructor or a static method that returns an instance?</p>
<p>For example, if you're creating a <code>String</code> from a <code>char[]</code>:</p>
<ol>
<li><p><code>String.FromCharacters(chars);</code></p></li>
<li><p><code>new String(c... | <p>In <a href="https://rads.stackoverflow.com/amzn/click/com/0321356683" rel="noreferrer" rel="nofollow noreferrer">Effective Java, 2nd edition</a>, Joshua Bloch certainly recommends the former. There are a few reasons I can remember, and doubtless some I can't:</p>
<ul>
<li>You can give the method a meaningful name. ... | <p><em>Of course, there are several advantages of static factory methods over constructors.</em></p>
<ol>
<li>factory methods help us to write flexible code. Whereas constructors made it tightly coupled.</li>
<li>Static factory methods improve the readability since these allow you to create different instances.</li>
<... | 23,635 |
<p>I have to build an HTML table that shows data for users versus pages visited. It seems klunky to use for and/or foreach loops, but I can't think of anything better. I'm using PHP, but I would assume that this is language agnostic.</p>
| <p>Avoiding loops is probably not possible, if not in implementation, then it will still happen at machine level. </p>
<p>However, if you want to try stay 'pure' without nasty code, you can at least do: </p>
<pre><code>$tableformat = '<table><thead>%s</thead><tbody>%s</tbody></table&g... | <p>I usually use loops and <code>implode</code> for this, in PHP. In a language, which supports functional programming I would do it differently.</p>
<pre><code>function render_table($data) {
$html = '<table>';
$tr = array();
foreach (array_keys($data[0]) as $key) {
$tr[] = '<th>' . htmlspecialch... | 33,269 |
<p>The <code>curses.ascii</code> module has some nice functions defined, that allow for example to recognize which characters are printable (<code>curses.ascii.isprint(ch)</code>).</p>
<p>But, diffrent character codes can be printable depending on which locale setting is being used. For example, there are certain poli... | <p>If you convert the character to a unicode then you can use unicodedata:</p>
<pre><code>>>> unicodedata.category(u'ą')[0] in 'LNPS'
True
</code></pre>
| <p>Well, it is called curses.ascii, so using ASCII rules for what's printable should not be a surprise. If you are using an ISO 8-bit code, or you are operating from a known code page, you will need rules that correspond to what the actual codes and their displays are.</p>
<p>I think using unicode characters and stan... | 42,602 |
<p>Has anyone had and solved a problem where programs would terminate without any indication of why? I encounter this problem about every 6 months and I can get it to stop by having me (the administrator) log-in then out of the machine. After this things are back to normal for the next 6 months. I've seen this on Wi... | <p>Perhaps it's not solved by you logging in, but by the user logging out. It could be a memory leak and logging out closes the process, causing windows to reclaim the memory. I assume programs indicated multiple applications, so it could be a shared dll that's causing the problem. Is there any kind of similarities ... | <p>You need to take this issue to the software developer. </p>
| 6,897 |
<p>We have an home-brewed XMPP server and I was asked what is our server's MSL (Maximum Segment Lifetime).<br>
What does it mean and how can I obtain it? Is it something in the Linux <code>/proc</code> TCP settings?</p>
| <p>The MSL (Maximum Segment Lifetime) is the longest time (in seconds) that a TCP segment is expected to exist in the network. It most notably comes into play during the closing of a TCP connection -- between the CLOSE_WAIT and CLOSED state, the machine waits 2 MSL's (conceptually a round trip to the end of the intern... | <p>This looks like it can answer your question:</p>
<p><a href="http://seer.support.veritas.com/docs/264886.htm" rel="nofollow noreferrer">http://seer.support.veritas.com/docs/264886.htm</a></p>
<p>I suggest that you ask why someone asked you this and find out how that applies to XMPP.</p>
<p>TCP/IP Illustrated volu... | 36,821 |
<p>I have a weird issue that only seems to be affecting IE 7. The web site is a 3.5 c# asp.net website that utilizes ajax and the ajax control toolkit deployed to a win 2003 server. Everything appears to be correct in the web.config. In fact, everything works perfectly in IE6 and Firefox 3. It is only in IE7 that I get... | <p>Believe it or not, but emptying the temporary internet files solved the problem. I hate things like this!</p>
| <p>Are you sure that it is only IE7? Maybe other browsers are supressing the error. Firebug on Firefox might bring this to the surface.</p>
<p>The two times I have seen something like this were
a) using jQuery in the same project as ASP.NET Ajax, here jQuery's noConflict method helped out</p>
<p>b) Check the posi... | 48,264 |
<p>I'm creating a custom drop down list with AJAX dropdownextender. Inside my drop panel I have linkbuttons for my options.</p>
<pre><code><asp:Label ID="ddl_Remit" runat="server" Text="Select remit address."
Style="display: block; width: 300px; padding:2px; padding-right: 50px; font-family: Tahoma; font-size:... | <p>I'm not sure what your setDDL method does in your script but it should fire if one of the link buttons is clicked. I think you might be better off just inserting a generic html anchor though instead of a .net linkbutton as you will have no reference to the control on the server side. Then you can handle the data e... | <p>the add should probably look like this (add the '' around the string and add a ; to the end of the javascript statement).</p>
<pre><code>lb.Attributes.Add("onclick", "setDDL('" + lb.Text + "');");
</code></pre>
<p>OR!</p>
<p>set the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbu... | 11,212 |
<p>I was trying to find online some exercises to practice scaling techniques (memchached, SQL Optimization, sharding dbs), but I could only find descriptions of these techniques, not any project on which to try them.</p>
<p>This link with <a href="http://www.slideshare.net/Georgio_1999/how-to-scale-your-web-app" rel="... | <p>I find that the site <a href="http://highscalability.com/" rel="nofollow noreferrer">High Scalability</a> has some nice insights.</p>
| <p>It might be interesting to hack at Wordpress. Their caching plugins take care of a lot of scaling issues but it would be cool to write your own plugin or hack at the source to cut down on SQL queries or to cache static pages. If you come up with something, make sure to let the rest of the community know!</p>
| 47,320 |
<p>Can anyone link me to a decent c++ tutorial that's actually currently in date? Almost everything I find applies to 2005 and the code examples are riddled with errors which won't run in my 2008 version of the visual compiler.</p>
| <p>The book <em>Accelerated C++</em> is a good start to learn C++.</p>
| <p>Visual C++® 2008: How to Program, Second Edition</p>
<p>came up on safari a little while ago, looks quite good for an introduction to visual studio and C++</p>
| 43,936 |
<p>I'm deploying to Ubuntu slice on slicehost, using Rails 2.1.0 (from <code>gem</code>)</p>
<p>If I try <code>mongrel_rails</code> start or script/server I get this error:</p>
<pre><code> Rails requires RubyGems >= 0.9.4. Please install RubyGems
</code></pre>
<p>When I type <code>gem -v</code> I have version <co... | <p>Have you tried reinstalling RubyGems? I had a pretty similar error message until I reuninstalled and for some reason, it installed into a different directory and then the problem went away.</p>
| <p>Have you tried reinstalling RubyGems? I had a pretty similar error message until I reuninstalled and for some reason, it installed into a different directory and then the problem went away.</p>
| 4,902 |
<p>I'm trying to learn how to do passphrase-based encryption with Java. I'm finding several examples online, but none (yet) on Stack Overflow. The examples are a little light on explanation for me, particularly regarding algorithm selection. There seems to be a lot of passing strings around to say what algorithms to... | <p>I'll be cautious about giving or taking security-related advice from a forum... the specifics are quite intricate, and often become outdated quickly.</p>
<p>Having said that, I think Sun's <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html" rel="noreferrer">Java Cryptography... | <p>If you don't need to decrypt the passphrase, but just generate an encryption key based on a password/passphrase, you can implement the <a href="http://www.ietf.org/rfc/rfc2898.txt" rel="nofollow noreferrer">PKCS#5 standard</a>, using the JCE Cipher and MessageDigest classes.</p>
| 48,661 |
<p>Here is an example of what I've got going on:</p>
<pre><code>CREATE TABLE Parent (id BIGINT NOT NULL,
PRIMARY KEY (id)) ENGINE=InnoDB;
CREATE TABLE Child (id BIGINT NOT NULL,
parentid BIGINT NOT NULL,
PRIMARY KEY (id),
KEY (parentid),
CONSTRAINT fk_parent FOREIGN KEY (parentid) REFERENCES Parent (id) ON ... | <p>In the simpler case, what happens if a record is deleted from Child and it has a referencing Uncle? That's unspecified, so the constraints fail for that anyway.</p>
<p>If deleting a Child does not delete its Uncles, then what happens instead? Uncle.childid cannot be null.</p>
<p>What you want is one of these three... | <p>the design is all wrong. You should have single table, with parent child relationship (literrally).
Then you can figure out uncles (and aunts) with a query</p>
<p><code>
select id from persons where -find all children of the grandparents<br>
parent id in (<br>
select parentid from persons --find the grandpare... | 8,500 |
<p>My university is part of MSDNAA, so I downloaded it a while back, but I just got around to installing it. I guess part of it replaces FrontPage for web editing, and there appears to be a video editor and a vector graphics editor, but I don't think I've even scratched the surface of what it is and what it can do. Cou... | <p>Expression Studio is basically a design studio. It consists of a bunch of design software that Microsoft has bought for the most part. The audience is designers, not developers. The gist of the software is that Expression Blend enables designers and programmers to work seamlessly together in letting the designer cre... | <p>The <a href="http://www.microsoft.com/expression/" rel="nofollow noreferrer">Expression site</a> is the first place to start. These are tools that bridge the developer/designer gap for building rich internet applications with Silverlight and WPF. They compete with Adobe Studio products.</p>
<p>Whilst Visual Studio ... | 4,846 |
<p>I have a generic class that should allow any type, primitive or otherwise. The only problem with this is using <code>default(T)</code>. When you call default on a value type or a string, it initializes it to a reasonable value (such as empty string). When you call <code>default(T)</code> on an object, it returns nul... | <p>Keep in mind that default(string) is null, not string.Empty. You may want a special case in your code:</p>
<pre><code>if (typeof(T) == typeof(String)) return (T)(object)String.Empty;
</code></pre>
| <p>The discussion for String is not working here.</p>
<p>I had to have following code for generics to make it work -</p>
<pre><code> private T createDefault()
{
{
if(typeof(T).IsValueType)
{
return default(T);
}
el... | 5,146 |
<p>I'm beginner in Java. I'm reading data from device through serial port. I'm getting data for every one minute, but first reading is coming half, after that data is coming correctly.</p>
<p>Output I'm getting is: </p>
<blockquote>
<p>6050.003120815340006050.003120815350006050.0</p>
</blockquote>
<p>Correct outpu... | <p>This looks as if you were reading the rest of some message which was sent before you started.</p>
<p>Try to read as much data as possible as you start the program to clear any hardware buffers. After that, start your processing.</p>
| <p>This looks as if you were reading the rest of some message which was sent before you started.</p>
<p>Try to read as much data as possible as you start the program to clear any hardware buffers. After that, start your processing.</p>
| 43,677 |
<p>I've got a message contained in an byte[], encrypted with "RSA/ECB/PKCS1Padding". To decrypt it I create a Cipher c and initiate it with</p>
<pre><code>c = Cipher.getInstance("RSA/ECB/PKCS1Padding");
</code></pre>
<p>Untill now I have only decrypted small messages, using the <em>doFinal()</em> method, returning an... | <p>I think using RSA encryption for anything but key transport is abuse.</p>
<p>Generate a new key for a symmetric cipher and encrypt your bulk data with that. Then encrypt the key with RSA. Send the symmetrically-encrypted cipher-text along with the asymmetrically-encrypted content encryption key to your recipient.</... | <p>Like Erickson said,</p>
<p>The steps you should take encrypt are:</p>
<ol>
<li>Generate RSA key pair (or retrieve public key from a key store)</li>
<li>Generate Symmetric key (AES)</li>
<li>Encrypt data with AES key</li>
<li>Encrypt AES key with public RSA key</li>
<li>Store (or send to person with private key) th... | 37,757 |
<p>Here's the deal. Is there a way to have strings tokenized in a line based on multiple regexes?</p>
<p>One example:</p>
<p>I have to get all href tags, their corresponding text and some other text based on a different regex.
So I have 3 expressions and would like to tokenize the line and extract tokens of text matc... | <p>If you're specifically after parsing links out of web-pages, then Perl's <a href="http://search.cpan.org/perldoc?WWW::Mechanize" rel="nofollow noreferrer">WWW::Mechanize</a> module will figure things out for you in a very elegant fashion. Here's a sample program that grabs the first page of Stack Overflow and parse... | <p>Modifying Bruno's example to include error checking:</p>
<pre><code>my $input = "...";
while (1) {
if ($input =~ /\G(\w+)/gc) { print "word: '$1'\n"; next }
if ($input =~ /\G(\s+)/gc) { print "whitespace: '$1'\n"; next }
if ($input !~ /\G\z/gc) { print "tokenizing error at character " . pos($input) . ... | 19,441 |
<p>I've got a file filled with records like this:</p>
<pre><code>NCNSCF1124557200811UPPY19871230
</code></pre>
<p>The codes are all fixed-length, and some of them link to other flat files (sort of like a relational database). What's the best way of querying this data using LINQ?</p>
<p>This is what I came up with i... | <p>For one thing I wouldn't read it all into memory to start with. It's very easy to write a LineReader class which iterates over a file a line at a time. I've got a version in <a href="http://pobox.com/~skeet/csharp/miscutil" rel="nofollow noreferrer">MiscUtil</a> which you can use.</p>
<p>Unless you only want to rea... | <p>I don't think there's a better way out of the box.</p>
<p>One could define a Flat-File Linq Provider which could make the whole thing much simpler, but as far as I know, no one has yet.</p>
| 44,743 |
<p>A couple of prints after leveling the bed (<10), I noticed some weird sound, and saw the nozzle scratching the build-plate.
What is really weird, is that I noticed (My printer is in quite a dark edge, so the build plate isn't really illuminated), that there were some scratches from a print before, but it worked ... | <p>As the question continued in comments, it can be read that the build plate had over-tight screws and loose screws on the build plate. This uneven tension could lead to stresses that warp the bed, e.g. lower corner and bulging out in the middle of the bed. When levelling on the corners, the nozzle could hit the bulge... | <p>I currently have a couple scratches on the base of my Cr-10. They may have come, for me, from using tape on the bed as well as the nozzle being too close and rubbing. I have not noticed any quality difference during my prints. Noting Oscar, warping could also cause the nozzle to scrape the build plate when it goes o... | 1,127 |
<p>We're attempting to update our application in order to submit it for Vista certification. Part of the requirements are to handle only known exceptions and have Windows Error Reporting deal with all unhandled exceptions. </p>
<p>We have a global exception handler in our application (subscribed to the <code>Applica... | <p>Why not just throw a new exception and set the InnerException property to be the unhandled one? The default StackTrace property will concatenate both traces together. </p>
<p>Bear in mind that if you're debugging from a memory dump that you've retrieved from WinQual then it'll be a native exception that's trapped a... | <p>Yea, as Marc states, just use THROW and the original exception will be re-thrown with the stack trace information preserved.</p>
<p>A THROW E will start the whole exception stack over again with the original stack information lost. Typically this is not what you want.</p>
<p>Alternative you can throw a new except... | 30,133 |
<p>Does anyone have a technique for generating SQL table create (and data insert) commands pragmatically from a CSV (or sheet in a .xls) file? </p>
<p>I've got a third party database system which I'd like to populate with data from a csv file (or sheet in a xls file) but the importer supplied can't create the table s... | <p>In SQL server it is as easy as</p>
<pre><code>SELECT * INTO NewTablenNmeHere
FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\testing.xls','SELECT * FROM [Sheet1$]')
</code></pre>
| <p>Unfortunately I'm using an SQLEngine for embedded systems so it does not support BULK INSERT or OLEDB datasources, which is why I was thinking of taking the sql statement generation approach.</p>
| 4,295 |
<p>I need to develop some programs for mobile devices but haven't decided the platform to build upon. I'm looking for Palm or Pocket PC devices that have Touch screen and Wi-Fi connection and are cheep because I'll need to buy several of them. </p>
<p>I don't really need camera, mp3 players, video players, pdf readers... | <p><strong>Windows Mobile</strong><br>
It supports C#, and Visual Studio comes with the mobile SDK. So if you know C# you probably already have the tools you need. And in spite of the iPhone/iPodTouch buzz, the Windows Mobile deployment is still 10X greater.</p>
| <p>Windows Mobile and CE used to suck, really, really badly. These days however it's definitely passable and worth checking out, especially if you code C#.
Just remember that it is the baby brother of the full framework and has nowhere near enough toys and throws a lot of NotImplementedExceptions. :)</p>
| 6,123 |
<p><em>Existing</em> code is using an <code>asp:repeater</code> to build an HTML table. (emphasis on the existing design). This is some partial pseudo-code to generate the table:</p>
<pre><code><asp:repeater OnItemDataBound="ItemDataBound" ... >
<headertemplate>
<table>
<thead&g... | <p>Place two ASP:Placeholder controls in your item template. In the codebehind, on the ItemDataBound event, determine which style you want to show, and hide one placeholder.</p>
| <p>An alternative to Jonathan's suggestion is to just dynamically build the item on the backend in the ItemDataBound event, some people find that easier to work with, rather than toggling visibility.</p>
<p>I personally in this case would just put a literal in, with mode="Passthrough" and would build it on the backend... | 44,503 |
<p>What is the best way to store DateTime in SQL for different timezones and different locales<br>
There a few questions/answers about timezones, but none is addressing the locale problems.
DateTime.ToUniversalTime is locale specific, and I need it locale independent.</p>
<p>For example:</p>
<pre><code> DateTime.Now... | <p>For your update I have found something that might help you : </p>
<pre><code>Run regedt32
Navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
Right click on this entry and select Permissions
Add the ASPNET user
Give it Read permission
2. Change settings in machine.... | <p>The "non-programming way" is to grant the user that user your web application/web service with access to registry (Event Log are written in the event log). </p>
| 37,377 |
<p>My reuirement:</p>
<p>Input File:</p>
<p>1,abc,xyx</p>
<p>2,def,mno</p>
<p>3,ghi,suv</p>
<p>DB Table Structure:</p>
<p>Col1 char</p>
<p>col2 char</p>
<p>col3 char</p>
<p>col4 char</p>
<p>col5 char</p>
<p>Data in Table after BCP:</p>
<p>col1 col2 col3 col4 col5</p>
<p>1 abc xyz ab xy</p>
<p>2 ... | <p>You can BCP into a staging table and then insert from the staging table in the appropriate structure to another table.</p>
<p>You can also use the <code>BULK INSERT</code> from within SQL with the same format file and source file as you would from the external BCP command so that you can run the entire batch in SQL... | <p>If you're not afraid to program a little, you can do this with ADO.NET. This, and any other transformations you wish to make on the fly, can be done quite easily by implementing a custom IDataReader. SqlBulkCopy takes an IDataReader and bulk inserts the data it provides. Your reader can then consume the input file a... | 48,757 |
<p>I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following browser set.</p>
<p>IE 7+
FF 2+
Chrome and Safari</p>
<p>I've tried a couple of jQuery plugins but there always seems to be... | <p>I used <a href="http://dev.iceburg.net/jquery/jqModal/" rel="nofollow noreferrer">jqModal</a> few times and I'm very satisfied. It is pretty configurable yet very light weight.</p>
| <p>I went through a similar exercise, tried most of the plugins I could find. I used YUI for quite a while with good results; the only issue I ran into was resizing centered modals, which is quite an obscure use case.</p>
<p>I ended up with <a href="http://dev.iceburg.net/jquery/jqModal/" rel="nofollow noreferrer">htt... | 21,846 |
<p>Would it be possible to show an image in full screen mode using silverlight. I'm looking out for some thing like the full screen option of the flash video players.</p>
| <p>You can set </p>
<p>Application.Current.Host.Content.IsFullScreen = true;</p>
<p>this has to be done from a mouse button event or a click, you can't force the user into full screen without some interaction on their part.</p>
<p>Then you'll need to scale the image. If it's in an element that scales aut... | <p>Set System.Windows.Interop.BrowserHost.IsFullScreen = true.</p>
| 17,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.