instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am having difficulty determining if the body of a text email message is base64 encoded.
if it is then use this line of code;
making use of jython 2.2.1</p>
<pre><code>dirty=base64.decodebytes(dirty)
</code></pre>
<p>else continue as normal.</p>
<p>This is the code I have atm. What line of code will allow me to ... | <p>Try:</p>
<pre><code>enc = msg['Content-Transfer-Encoding']
</code></pre>
<p>It's a header so you won't be able to get it looking at the body. You should be able to get at the same place you find out the Subject.</p>
| <p>It is a header but you have to get the payload first from the message.</p>
<p>It'll be:</p>
<pre><code>header = msg.get_payload()[0]
header['Content-Transfer-Encoding']
</code></pre>
<p>I'm using Python 3</p>
| 42,077 |
<p>What is the difference between <code>IQueryable<T></code> and <code>IEnumerable<T></code>?</p>
<hr>
<p>See also <a href="https://stackoverflow.com/questions/2433306/whats-the-difference-between-iqueryable-and-ienumerable?rq=1">What's the difference between IQueryable and IEnumerable</a> that overlaps w... | <p>The primary difference is that the LINQ operators for <code>IQueryable<T></code> take <code>Expression</code> objects instead of delegates, meaning the custom query logic it receives, e.g., a predicate or value selector, is in the form of an expression tree instead of a delegate to a method.</p>
<ul>
<li><code... | <p>ienumerable:when we want to deal with inprocess memory, i.e without dataconnection
iqueryable:when to deal with sql server, i.e with data connection
ilist : operations like add object, delete object etc</p>
| 31,493 |
<p>Is there a way to programmatically find the location of the current user's Outlook .pst file(s) through an API call or registry entry?</p>
| <p>With <a href="http://www.dimastr.com/redemption/" rel="noreferrer">Outlook Redemption</a>, you can iterate the message stores in VBA using <code>RDOStores</code>collection, accessible via the <code>RDOSession.Stores</code> property.</p>
<p>I am looking into the possibility of doing something similar in out-of-the-b... | <p>The path should be somewhere under:</p>
<blockquote>
<p>[HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows Messaging
Subsystem\Profiles\Outlook]</p>
</blockquote>
<p>Maybe this helps a bit.</p>
| 23,802 |
<p>It seems like searching with CAML and SPQuery doesn't work properly against custom metadata, when searching for SPFolders instead of files, or when searching for custom content types. I've been using U2U to test a variety of queries, and just not getting anywhere. The doc's aren't very complete on the topic, and g... | <p>After more research, I'm answering my own question.</p>
<p>Apparently the methods that I'm using to query don't return SPFolders as items in the result set. Only list items are returned, basically just documents.</p>
<p>My fix was to execute a CAML query for all the documents with a certain metadata tag/value, an... | <p>Try adding <a href="http://www.codeplex.com/spm" rel="nofollow noreferrer">SharePoint Manager</a> and <a href="http://www.codeplex.com/SPCamlViewer" rel="nofollow noreferrer">Stramit CAML Viewer</a> to your toolset.</p>
<p>I have found both to be very important for figuring out CAML problems.</p>
| 21,047 |
<p>SQL Server 2005 introduced <a href="http://msdn.microsoft.com/en-us/library/ms175887.aspx" rel="nofollow noreferrer">Database Mail</a> for sending e-mail messages from the SQL Server Database Engine in a robust fashion. Database Mail comes with a number of interesting <a href="http://msdn.microsoft.com/en-us/library... | <p>No there is not. You can query the DMVs manually to view the data within them. Setting up any sort of pretty interface wouldn't be of much use as you can't do anything with those DMVs besides look at them.</p>
<p>Database mail is a pretty robust system.</p>
<p>What specific issues are you trying to troubleshoot?... | <p>None that I know of. What kind of users would be poking around in the back-end - what would they be doing? Once things are set up, the mail process seems to run pretty smoothly. Are you having frequent problems?</p>
| 46,989 |
<p>I'm currently working on an application with a frontend written in Adobe Flex 3. I'm aware of <a href="http://code.google.com/p/as3flexunitlib/" rel="noreferrer">FlexUnit</a> but what I'd really like is a unit test runner for Ant/NAnt and a runner that integrates with the Flex Builder IDE (AKA Eclipse). Does one exi... | <p>The <a href="http://code.google.com/p/dpuint/" rel="noreferrer">dpUint</a> testing framework has a test runner built with AIR which can be integrated with a build script.</p>
<p>There is also my <a href="http://developer.iconara.net/objectlib/flexunitautomation.html" rel="noreferrer">FlexUnit</a> automation kit whi... | <p>An alternative to FlexUnit is the <a href="http://www.asunit.org/" rel="nofollow noreferrer">AsUnit</a> testing tools. There are versions for actionscript 2 and 3. It also has good integration with <a href="http://www.projectsprouts.org/" rel="nofollow noreferrer">Project Sprouts</a>, which is a build tool for Flex ... | 2,440 |
<p>Anyone have any good urls for templates or diagram examples in Visio 2007 to be used in software architecture?</p>
| <p><a href="http://softwarestencils.com/uml/index.html" rel="noreferrer">Here is a link</a> to a Visio Stencil and Template for UML 2.0.</p>
| <p>There should be templates already included in Visio 2007 for software architecture but you might want to check out <a href="http://office.microsoft.com/en-us/templates/CT102115841033.aspx" rel="nofollow noreferrer">Visio 2007 templates</a>.</p>
| 4,055 |
<p>I'm trying to put together a blog, and have gone with SubText and I've just installed SyntaxHighlighter but it doesn't seem to work properly. SubText or FCKEditor seems to tamper with the HTMl, inlineing everything in the pre tags and placing line-breaks at the end of each line.</p>
<p>Bad times!</p>
<p>Anyone kn... | <p>in FCKEditor its related to a bug in IE where innerHTML is rendered incorrectly in <strong>pre</strong> tags. Its a common problem.</p>
<p>I've written a plugin for FCKEditor that uses SyntaxHighlighter to format code correctly. You can read about it <a href="http://www.psykoptic.com/blog/post/2008/12/01/Code-Synta... | <p>This is caused by how each browser implements HTML design mode, and unfortunately, they all seem to mangle perfectly good HTML. There's no option to prevent this behavior, but some post processing could be done with JavaScript using regular expressions to tidy things up (or using a <a href="http://ejohn.org/blog/pur... | 11,823 |
<p>Not entirely sure what's going on here; any help would be appreciated.</p>
<p>I'm trying to create a new .NET MVC web app. I was pretty sure I had it set up correctly, but I'm getting the following error:</p>
<pre><code>The type 'System.Web.Mvc.ViewPage' is ambiguous: it could come from assembly
'C:\MyProject\bin... | <p>Are you using a CodeBehind file, I don't see CodeBehind="" attribute where you are specifying the Inherits from? Then you have to point inherits to the class name of the codebehind.</p>
<p>Example:</p>
<pre><code><%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehi... | <p>No this should be a structural error message.</p>
<p>Check <a href="http://trikks.wordpress.com/2011/08/26/the-type-is-ambiguous-it-could-come-from-assembly-or-from-assembly-please-specify-the-assembly-explicitly-in-the-type-name/" rel="nofollow">http://trikks.wordpress.com/2011/08/26/the-type-is-ambiguous-it-could... | 7,107 |
<p>I have the following situation:</p>
<p>I have a certain function that runs a loop and does stuff, and error conditions may make it exit that loop.
I want to be able to check whether the loop is still running or not.</p>
<p>For this, i'm doing, for each loop run:</p>
<pre><code>LastTimeIDidTheLoop = new Date();
</... | <p>what about:</p>
<pre><code>newDate = new Date()
newDate.setSeconds(newDate.getSeconds()-30);
if (newDate > LastTimeIDidTheLoop) {
alert("oops");
}
</code></pre>
| <p>Create a date object and use setSeconds().</p>
<pre><code>controlDate = new Date();
controlDate.setSeconds(controlDate.getSeconds() + 30);
if (LastTimeIDidTheLoop > controlDate) {
...
</code></pre>
| 45,300 |
<p>We offer a number of online services. We are required to develop a system which provides a quick/simple experience for users if they are transferred from one service (on <code>domain1.com</code>) to another service (on <code>domain2.com</code>).</p>
<p>Is there a safe and secure way to log a user in automatically o... | <p><strong>Single sign-on</strong> (SSO) is conceptually pretty simple.</p>
<ul>
<li>User hits <code>domain1.com</code>.</li>
<li><code>domain1.com</code> sees there's no session cookie.</li>
<li><code>domain1.com</code> redirects to <code>sso.com</code></li>
<li><code>sso.com</code> presents login page, and take cred... | <p>What about SEO?
It looks like every request before succesfull login is redirected to other domain and back.
I would tell that this is very ugly.
What headers should you send? 301 to SSO and then back 301 to original page? So search bot is "requested" to change his index for that page twice?</p>
| 44,509 |
<h1>Outline</h1>
<p>OK, I have Google'd this and already expecting a big fat <strong>NO!!</strong> But I thought I should ask since I know sometimes there can be the odd little gem of knowledge lurking around in peoples heads ^_^</p>
<p>I am working my way through some excercises in a book for study, and this particu... | <p>I think to be honest you a better just boning up on your standard design patterns and applying them to the individual problems that you face in developing your UI.</p>
<p>While there are common UI "themes" (such as dealing with modifier keys) the actual implementation may vary widely.</p>
<p>I have O'Reill... | <p>I don't think the that benefit of design patterns come from trying to find a design pattern to fit a problem. You can however use some heuristics to help clean up your design in this quite a bit, like keeping the UI as decoupled as possible from the rest of the objects in your system.</p>
<p>There is a pattern that... | 3,240 |
<p>For this directory structure:</p>
<pre><code>.
|-- README.txt
|-- firstlevel.rb
`-- lib
|-- models
| |-- foo
| | `-- fourthlevel.rb
| `-- thirdlevel.rb
`-- secondlevel.rb
3 directories, 5 files
</code></pre>
<p>The glob would match: </p>
<pre><code>firstlevel.rb
lib/secondlevel.rb
l... | <p>Apologies if I've missed the real point of the question but, if I was using sh/bash/etc., then I would probably use <em>find</em> to do the job:</p>
<pre><code>find . -name '*.rb' -type f
</code></pre>
<p>Globs can get a bit nasty when used from within a script and <em>find</em> is much more flexible.</p>
| <p>Looks like it can't be done from <code>bash</code></p>
<p>If you using <code>zsh</code> then</p>
<pre><code>ls **/*.rb
</code></pre>
<p>will produce the correct result. </p>
<p>Otherwise you can hijack the <code>ruby</code> interpreter (and probably those of other languages) </p>
<pre><code>ruby -e "puts Dir.gl... | 6,625 |
<p>In (Visual Basic, .NET):</p>
<pre><code> Dim result As Match = Regex.Match(aStr, aMatchStr)
If result.Success Then
Dim result0 As String = result.Groups(0).Value
Dim result1 As String = result.Groups(1).Value
End If
</code></pre>
<p>With: aStr equal to (whitespace is normal space and there are sev... | <p>I think it's because the matching starts at the first character and moves on from there... </p>
<p>For your first regular expression:</p>
<pre><code>Does "AMEVDIEERPK + 7 Oxidation (M)" match "\s*(\d*).*?Oxidation\s+(M)"? Yes.. stop matching.
</code></pre>
<p>For your second regular expression:</p>
<pre><code>D... | <p>". * ?" in this example will always match zero characters, since "* ?" does shortest possible match. As a result, since the thing right before the 'O' is a space, "\ d *" can match 0 digits.</p>
<p>(Sorry about the spaces in the quotes; the auto-formatter was eating my syntax.)</p>
<p>Reference: <em><a href="http:... | 43,232 |
<p>I need to style links for a Blackberry browser that has disabled CSS.</p>
<p>The following is what I try to achieve: </p>
<pre><code><style type="text/css">
a.hover {
border:0;
}
a {
text-decoration: none;
}
</style>
</code></pre>
<p>Is it even possible, just using html?</p>
| <p>You can only set the color.</p>
<pre><code><body link="XXX" alink="YYY" vlink="ZZZ">
</code></pre>
<p>XXX being the color used for links, YYY the color when mouse hovers the link and ZZZ the color for already visited links. Color can be given in hex notation just like with stylesheets</p>
<pre><code>#AABBC... | <p><code>tex-decoration:bilnk</code>; this makes your text blink-blink, like rapper</p>
| 38,316 |
<p>We have the following simple Stored Procedure that runs as an overnight SQL server agent job. Usually it runs in 20 minutes, but recently the MatchEvent and MatchResult tables have grown to over 9 million rows each. This has resulted in the store procedure taking over 2 hours to run, with all 8GB of memory on our SQ... | <p>There's probably a lot of stuff going on here, and it's not all your query. </p>
<p>First, I agree with the other posters. Try to rewrite this without a temp table if at all possible.</p>
<p>But assuming that you need a temp table here, you have a BIG problem in that you have no PK defined on it. It's vastly goi... | <p>Looking at the code above, why do you need a temp table?</p>
<pre>
<code>
DELETE FROM MatchEvent WHERE
MatchId IN (SELECT MatchId FROM MatchResult)
DELETE FROM MatchResult
-- OR Truncate can help here, if all the records are to be deleted anyways.
</code>
</pre>
| 28,219 |
<p>Can Eclipse make parameters for generated methods (overwriting, implementing interface, etc.) final, and if so, how?</p>
<p>If I'm not mistaken, IntelliJ had an option for it. I could not find something similar in Eclipse.</p>
<p>I have become accustomed to making parameters final manually, but I am hoping for an ... | <p>AFAIK, that is not possible. I've not found any option to customize it under <code>Window > Preferences > Java > Editor > Templates or under Window > Preferences > Java > Code Style > Code Templates</code>.</p>
<p>Anyway, Eclipse 3.3+ comes with "save actions", an alternative mechanism for ... | <p>There's cleanup options under 'Project' -> 'Preferences' -> 'Java Code Style' -> 'Clean up', but these can be applied after code has been generated...</p>
| 24,418 |
<p>I have the following class in C++:</p>
<pre><code>class a {
const int b[2];
// other stuff follows
// and here's the constructor
a(void);
}
</code></pre>
<p>The question is, how do I initialize b in the initialization list, given that I can't initialize it inside the body of the function of the co... | <p>Like the others said, ISO C++ doesn't support that. But you can workaround it. Just use std::vector instead.</p>
<pre><code>int* a = new int[N];
// fill a
class C {
const std::vector<int> v;
public:
C():v(a, a+N) {}
};
</code></pre>
| <p>You can't do that from the initialization list, </p>
<p>Have a look at this:</p>
<p><a href="http://www.cprogramming.com/tutorial/initialization-lists-c++.html" rel="nofollow noreferrer">http://www.cprogramming.com/tutorial/initialization-lists-c++.html</a></p>
<p>:)</p>
| 19,563 |
<p>The case goes as following:
You have a Boolean property called FullScreenEnabled. You enter some method, and the code within this method is executed iff FullScreenEnabled is true. Which of the 2 approaches below do you use in your everyday programming:</p>
<pre><code> private bool FullScreenEnabled { get; set; }... | <pre><code>private void MyMethod(bool arg){
if(arg)
return;
//do stuff
};
</code></pre>
<p>(for voting)</p>
| <pre><code>private void MyMethod(bool arg){
if(!arg){
//do stuff
}
}
</code></pre>
<p>(for voting)</p>
| 17,555 |
<pre><code>var i : integer;
i := 1234567;
</code></pre>
<p>Given the above, I want the string "1,234,567" as output (assuming UK locale). IntToStr just gives me "1234567". I'm sure there's a one-liner for this, but I can't find it...</p>
| <p>Try the format function.</p>
<pre><code>Label1.Caption := Format('%.0n', [i + 0.0]);
</code></pre>
| <pre><code>stringreplace(format('%n',[1234567.0]),'.00','',[]);
</code></pre>
| 37,850 |
<p>I have an application that is using Windows Authentication and a SqlRoleProvider for user authentication and role management respectively. It is working fine with my test users that I have added to the database as defaults. The application requires users to login (using Windows credentials) and then be able to use... | <p>I was able to locate the solution after digging and playing around a bit more. I added the following code to my Global.asax file and it is accomplishing what I am hoping for.</p>
<pre><code>protected void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs e)
{
if (!Roles.IsUserI... | <p>I would add the default role to the user directly after the user was fetched.</p>
<p>Something like such:</p>
<pre><code>user = Membership.GetUser()
if (user != null)
{
// default role
string[] defaultRoles = {"MyRole"};
AddUsersToRoles(user, defaultRoles);
}
</code></pre>
| 46,120 |
<p>I have a function in which I get en external resource from the web using cocoa's Url object. And it works fine on the simulator, but occasionally fails on the device itself (it's a google query so the resource obviously does exist). Which leads me to believe that there is some internal timeout barrier on the hardwa... | <p>iPhone imposes a timeout for application launch. So if you perform an extensive processing in applicationDidFinishLaunching: for instance, the application will be terminated and a crash log will be produced. Unfortunately I've found no mention of it in the official documentation.</p>
<p>After the launch process has... | <p>I know iPhone OS will kill an app if it uses too much memory, so I wouldn't be surprised if it uses the same policy if an app is unresponsive to events for too long.</p>
<p>If you were writing a desktop app, the problem would manifest as a spinning rainbow beach ball cursor, and your app would not respond to mouse ... | 20,459 |
<p>I need to perform a complicated calculation. In my case it seemed most natural to create a Calculator class (abstracted using a strategy pattern).</p>
<p>To perform the calculation the class needs to accept about 20 inputs, some of which are optional, some of which could change in the future etc. Once the <strong>C... | <p>Most people suggest using a "Parameter Class", and a "Result Class". I agree with this approach, but it seems to me that your parameters fall into several categories. Perhaps you could create a parameter class for the required parameters, and a separate parameter class for the optional parameters or groups of option... | <p>You haven't mentioned the language, but I'll assume c#.
I would probably pass them in as a struct (or class) and return the outputs the same way.</p>
<p>Alternatively, I'd find some way to refactor it and simplify the expected input/output.</p>
| 45,712 |
<p>I want to print a lemon squeezer and I would prefer to use PET-G. I don't know if it is safe to use, because lemons contain lots of citric acid. Does it dissolve PETG? I haven't found an answer anywhere on the Internet. There are generally few things that dissolve PETG. These are aromatic compounds like toluene, phe... | <p>According to <a href="http://kmac-plastics.net/data/chemical/petg-chemical.htm#.XV7Vokd7m4o" rel="nofollow noreferrer">kmac-plastics</a>, PETG is stable at temperatures below 50°C specifically for citric acid (also acetic acid) and others on the linked list. It is also safe with diesel oil and many alcohols. The lis... | <p>The PETG is food safe (plastic water bottles are made of them), however the colour additives may not be a) stable, or b) food safe. If you are going to make a lemon squeezer then I would suggest that you use a virgin material that is just pet-g with no additives.</p>
<p>However, you could only ever use it one. Any ... | 1,444 |
<p>The following SQL separates tables according to their relationship. The problem is with the tables that sort under the 3000 series. Tables that are part of foreign keys and that use foreign keys. Anyone got some clever recursive CTE preferably or a stored procedure to do the necessary sorting?? Programs connectiong ... | <p>Thank you for a working solution NXC. You put me on the right track to solve the problem using a recursive CTE.</p>
<pre><code>WITH
TablesCTE(TableName, TableID, Ordinal) AS
(
SELECT
OBJECT_SCHEMA_NAME(so.id) +'.'+ OBJECT_NAME(so.id) AS TableName,
so.id AS TableID,
0 AS Ordinal
FROM dbo.sysobj... | <p>This causes problems with self-referencing tables. You'll need to manually exclude any foreign keys that point to self referencing tables.</p>
<pre><code>INNER JOIN sys.foreign_keys f
ON (f.parent_object_id = so.id AND f.parent_object_id != f.referenced_object_id)
/* Manually exclude self-referencing tables ... | 45,858 |
<p>Which of <a href="http://en.wikipedia.org/wiki/Crystal_Reports" rel="noreferrer">Crystal Reports</a> and <a href="http://en.wikipedia.org/wiki/SQL_Server_Reporting_Services" rel="noreferrer">SSRS</a> (SQL Server Reporting Services) is better to use?</p>
| <p>On the one-hand, Crystal Reports is a steaming pile of expensive and overhyped donkey poo, and on the other hand SSRS actually fulfils all the promises that CR marketing makes - and it's free.</p>
<p>My contempt for CR stems from many years of being obliged to use the horrible thing. There's really no point in deta... | <p>For those who are comparing the old Crystal Reports XI and Reporting Service 1.0 please see this 2005 post:</p>
<p>SQL Server Reporting Services and Crystal Reports: A Competitive Analysis
<a href="http://www.crystalreportsbook.com/SSRSandCR_Conclusion.asp" rel="nofollow noreferrer">http://www.crystalreportsbook.co... | 20,336 |
<p>I'm trying to build a better username/password field for my workplace and would like to be able to complain when they have their caps lock on.</p>
<p>Is this possible? And if so I'd like to have it detected before the client types their first letter.</p>
<p>Is there a non-platform specific way to do this?</p>
| <p>Try this, from java.awt.Toolkit, returns a boolean:</p>
<pre><code>Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK)
</code></pre>
| <p>here is some info on the class
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Toolkit.html#getLockingKeyState(int)" rel="nofollow noreferrer">http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Toolkit.html#getLockingKeyState(int)</a></p>
| 11,402 |
<p>I'm trying to get udp multicast data using sockets and c++ (c). I have a server with 2 network cards so I need to bind socket to specific interface. Currently I'm testing on another server that has only one network card.</p>
<p>When I use INADDR_ANY I can see the udp data, when I bind to specific interface I don't ... | <p>After some searching and testing I found out <a href="http://www.kohala.com/start/mcast.api.txt" rel="noreferrer">here</a> that when <strong>binding</strong> udp multicast socket we specify port and leave address empty e.g. specify <code>INADDR_ANY</code>.</p>
<p>So the following</p>
<pre><code>addr.sin_family = A... | <p>I think you need to add IP_MULTICAST_IF</p>
<pre><code> struct ip_mreq multi;
multi.imr_multiaddr.s_addr = inet_addr(group.c_str());
multi.imr_interface.s_addr = (source_iface.empty() ?
htonl(INADDR_ANY): inet_addr(source_iface.c_str()));
status = setsockopt(me->ns_fd, IPPROTO_IP... | 47,228 |
<p>How would I only allow users authenticated via Python code to access certain files on the server?</p>
<p>For instance, say I have <code>/static/book.txt</code> which I want to protect. When a user accesses <code>/some/path/that/validates/him</code>, a Python script deems him worthy of accessing <code>/static/book.t... | <p><a href="http://en.wikipedia.org/wiki/Comparison_of_SSH_clients" rel="nofollow noreferrer">wikipedia's comparison of ssh clients</a> has columns for tunnelling, SOCKS etc. may help you find something suitable</p>
| <p>you can just set-up any application to start with windows and auto-connect your tunnel on startup. I personnally use Easytunnel... just checked the option to connect all tunnels on startup, and set-up windows to start Easytunnel on bootup. It works great, tho you'll need to set-up your server's inactivity timeout, o... | 48,690 |
<p>I assume 100 bytes is too small and can slow down larger file transfers with all of the writes, but something like 1MB seems like it may be too much. Does anyone have any suggestions for an optimal chunk of bytes per write for sending data over a network?</p>
<p>To elaborate a bit more, I'm implementing something ... | <p>If you can, just let the IP stack handle it; most OSes have a lot of optimization already built in. Vista, for example, will dynamically alter various parameters to maximize throughput; second-guessing the algorithm is unlikely to be beneficial.</p>
<p>This is especially true in higher-order languages, far from the... | <p>One empirical test you can do, if you haven't already, is of course to use a sniffer (tcpdump, Wireshark etc.) and look at what packet sizes are achieved when using other software for up/downloading. That might give you a hint.</p>
| 39,089 |
<p>I am in a Windows Desktop application and I have a data stream and a mime type in the database. Is there a better way than writing it to a temp folder and launching the default editor for it?</p>
<p>If I have to use the temp folder how can I get the file extension from the MIME type in a C# Windows Desktop applicat... | <p>Lookup the MIME type in <code>HKEY_CLASSES_ROOT\MIME\Database\Content Type</code> to find out the corresponding file extension and go from there. Some starter links:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ms775147(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/... | <p>It depends on what you want to do with that data stream. If all you want to do is open the default program for that file type, writing a temp file and calling Process.Start on it isn't a bad way to go. If you're looking to perform other operations on the data... well, it depends what operations you had in mind.</p... | 39,433 |
<p>This loop is slower than I would expect, and I'm not sure where yet. See anything?</p>
<p>I'm reading an Accces DB, using client-side cursors. When I have 127,000 rows with 20 columns, this loop takes about 10 seconds. The 20 columns are string, int, and date types. All the types get converted to ANSI string... | <p>I can't tell from looking at your code, someone more familiar with COM/ATL may have a better answer.</p>
<p>By trial n error I would find the slow code by commenting out inner loop operations out until you see perf spike, then you have your culprit and should focus on that.</p>
| <p>Try profiling. If you don't have a profiler a simple way could be to wrap all calls in your loop you think may take some time with something like the following:</p>
<pre><code>#define TIME_CALL(x) \
do { \
const DWORD t1 = timeGetTime();\
x;\
const DWORD t2 = timeGetTime();\
std::cout << "Call to '" &... | 34,100 |
<p>How is your javaScript code organized? Does it follow patterns like MVC, or something else? </p>
<p>I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with <a href="http://jquery.com" rel="noreferrer"... | <p>..but Javascript has many facets that <strong>are</strong> OO.</p>
<p>Consider this:</p>
<pre><code>var Vehicle = jQuery.Class.create({
init: function(name) { this.name = name; }
});
var Car = Vehicle.extend({
fillGas: function(){
this.gas = 100;
}
});
</code></pre>
<p>I've used this techniq... | <p>Not 100% sure what you mean here, but I will say that after doing ASP.NET for the last 6 years, my web pages are now mostly driven by JavaScript once the basic page rendering is done by the server. I use JSON for everything (have been for about 3 years now) and use <a href="http://www.mochikit.com" rel="nofollow nor... | 5,249 |
<p>In a .NET WinForms app, how do I get a specific drive's icon (C:\ for example) for whatever version of Windows the client might be running?</p>
| <p>I don't know if it will work, but you could try <a href="http://www.codeguru.com/csharp/csharp/cs_misc/icons/article.php/c4261" rel="nofollow noreferrer">this</a>, pointing at the drive root.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/bb762179(VS.85).aspx" rel="nofollow noreferrer">SHGetFileInfo</a> is how the operating system exposes information about objects in the file system. How you go about calling it from a .NET WinForms app? I can't help you there.</p>
| 49,032 |
<p>In relation to <a href="https://stackoverflow.com/questions/283431/why-would-an-command-not-recognized-error-occur-only-when-a-window-is-populated">another question</a>, how do you account for paths that may change? For example, if a program is calling a file in the same directory as the program, you can simply use ... | <p>Simple answer: You work out the absolute path based on the environment.</p>
<p>What you really need is a few pointers. There are various bits of runtime and environment information that you can glean from various places in the standard library (and they certainly help me when I want to deploy an application on wind... | <p>I figured out by using <strong>os.getcwd()</strong>. I also learned about using <strong>os.path.join</strong> to automatically determine the correct path format based on the OS. Here's the code:</p>
<pre><code>def openNewRecord(self, event): # wxGlade: CharSheet.<event_handler>
"""Create a new, blank reco... | 36,406 |
<p>When providing a link to a PDF file on a website, is it possible to include information in the URL (request parameters) which will make the PDF browser plugin (if used) jump to a particular bookmark instead of just opening at the beginning?</p>
<p>Something like: <a href="http://www.somehost.com/user-guide.pdf?book... | <p>Yes, you can link to specific pages by number or named locations and that will always work <strong>if the user's browser uses Adobe Reader as plugin for viewing PDF files</strong>.</p>
<p>For a specific page by number:</p>
<pre><code><a href="http://www.domain.com/file.pdf#page=3">Link text</a>
</code>... | <p><a href="http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf#page=5&zoom=auto,-169,394" rel="noreferrer" title="PDF Open Parameters">PDF Open Parameters</a> documents the available URL fragments you can use.</p>
| 15,275 |
<p>What is the standard encoding of C++ source code? Does the C++ standard even say something about this? Can I write C++ source in Unicode?</p>
<p>For example, can I use non-ASCII characters such as Chinese characters in comments? If so, is full Unicode allowed or just a subset of Unicode? (e.g., that 16-bit first pa... | <p>Encoding in C++ is quite a bit complicated. Here is my understanding of it.</p>
<p>Every implementation has to support characters from the <em>basic source character set</em>. These include common characters listed in §2.2/1 (§2.3/1 in C++11). These characters should all fit into one <code>char</code>. In addition ... | <p>AFAIK It's not standardized as you can put any type of characters in wide strings.
You just have to check that your compiler is set to Unicode source code to make it work right.</p>
| 42,977 |
<p>We're looking for a way to log any call to stored procedures in Oracle, and see what parameter values were used for the call.</p>
<p>We're using Oracle 10.2.0.1</p>
<p>We can log SQL statements and see the bound variables, but when we track stored procedures we see bind variables B1, B2, etc. but no values.</p>
<... | <p>You could take a look at the <a href="http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76936/dbms_app.htm" rel="noreferrer">DBMS_APPLICATION_INFO package</a>. This allows you to "instrument" your PL/SQL code with whatever information you want - but it does entail adding calls to each procedure to b... | <p>Yes, I think I should have used the term 'trace'</p>
<p>I'll try to describe what we've done:</p>
<p>Using the enterprise manager (as dbo) we've gone to a session, and started a trace</p>
<p>start trace
Enable wait info, bind info</p>
<p>Run an operation on our application that hits the DB</p>
<p>Finish the tra... | 31,217 |
<p>I am starting a new <strong>client/server</strong> project at work and I want to start using some of the newer technologies I've been reading about, LINQ and Generics being the main ones. Up until now I have been developing these types of applications with MySQL as clients were unwilling to pay the large licence co... | <p>The answer to the question on any project in regards to what platform/technologies to use is: <strong>What does everyone know best?</strong></p>
<ol>
<li><p>Yes express <a href="http://www.microsoft.com/express/2005/sql/download/" rel="nofollow noreferrer">can still be downloaded</a>.</p></li>
<li><p>Will it fit yo... | <p>Note sure about #2 but you can download <a href="http://www.microsoft.com/sql/editions/express/default.mspx" rel="nofollow noreferrer">SQL Server Express 2005 here</a>.</p>
| 4,646 |
<p>I'm currently developing a website and my client wants the text of various articles to overflow into two columns. Kind of like in a newspaper? So it would look like:</p>
<pre class="lang-none prettyprint-override"><code>Today in Wales, someone actually Nobody was harmed in
did something interesting. ... | <p>The good news is that there is a <a href="http://www.w3.org/TR/css3-multicol/" rel="nofollow noreferrer">CSS-only solution</a>. If it was implemented, it would look like this:</p>
<pre><code>div.multi {
column-count: 3
column-gap: 10px;
column-rule: 1px solid black;
}
</code></pre>
| <p>First off, i don't think just css can do that, but i would love to be proven wrong.</p>
<p>Second, just counting paragraphs won't help you at all, you need at least all the heights and calculate the middle of the text height based on that, but you'd have to account for window resizing etc. I don't think there is a ... | 23,670 |
<p>In my database, I have an entity table (let's call it Entity). Each entity can have a number of entity types, and the set of entity types is static. Therefore, there is a connecting table that contains rows of the entity id and the name of the entity type. In my code, EntityType is an enum, and Entity is a Hibernate... | <p>HQL:</p>
<pre><code>select entity from Entity entity where :type = some elements(entity.types)
</code></pre>
<p>I think that you can also write it like:</p>
<pre><code>select entity from Entity entity where :type in(entity.types)
</code></pre>
| <p>Is your relationship bidirectional, i.e., does <code>EntityType</code> have an <code>Entity</code> property? If so, you can probably do something like <code>entity.Name from EntityType where name = ?</code></p>
| 7,185 |
<p>I have run across an XML Schema with the following definition:</p>
<pre><code><xs:simpleType name="ClassRankType">
<xs:restriction base="xs:integer">
<xs:totalDigits value="4"/>
<xs:minInclusive value="1"/>
<xs:maxInclusive value="9999"/>
</xs:restric... | <blockquote>
<p>can totalDigits always be represented with a combination of minInclusive and MaxInclusive?</p>
</blockquote>
<p>In this case, yes. As you're dealing with an integer, the value must be a whole number, so you have a finite set of values between <code>minInclusive</code> and <code>maxInclusive</code>. I... | <p>totalDigits is the total number of digits the number can have, including decimal numbers. So a totalDigits of 4 would allow 4.345 or 65.43 or 932.1 or a 4 digit whole integer as in the example above. Same for negative. Any of those previous examples can all be made negative and still validate as a totalDigits of ... | 20,330 |
<p>We have recently implemented Transparent Data Encryption in SQL Server 2008 for local databases on our developers laptops to keep them protected in the case a laptop is stolen or lost. This works fine. </p>
<p>Now we are trying to figure out a way to have the certificate expire everyday, forcing an automated proces... | <p>Short answer: No</p>
<p>Long answer: Once a message (piece of data) is encrypted, that same key will decrypt the same encrypted message, regardless of what time the decryption algorithm is applied. If the key is changed every day, the data must be decrypted with the old key and re-encrypted with the new. If this... | <p>Without additional detail I fail to understand how your TDE setup will protect data in case it is lost or stolen. </p>
<p>If you are not using full disk encryption (via Bitlocker, Truecrypt, etc) then I as an attacker in physical possession of your hardware can easily reset the local admin password, boot up the la... | 24,335 |
<p>I am releasing a database build to SQL Server 2000 via a batch file using isql. The batch file is used so multiple files are released consistently to different SQL Servers (development, test, live).</p>
<p>The SQL Server uses ANSI code page 1252 (from sp_helpsort) but isql is an OEM client using code page 437. This... | <p><code>isql</code> is obsolete. It isn't included in SQL Server 2005 or later, because it uses the DB-Library connections, which are also obsolete. For the reasons why, and the effects this has, see <a href="http://msdn.microsoft.com/en-us/library/aa174595(SQL.80).aspx" rel="nofollow noreferrer">Connecting Early Vers... | <p>Further to the accepted answer, I have tested using sqlcmd against a SQL Server 2000 database and it works. You obviously have to run sqlcmd from a machine with the SQL Server 2005 client tools installed.</p>
| 14,601 |
<p>Java SE 6 (64 bit only) is now on OS X and that is a good thing. As I understand it since Eclipse is still Carbon and thus 32 bit, it cannot be used for 1.6 on Leopard, only 1.5. </p>
<p>Does anyone know if NetBeans 6.x can be used with Java SE 6 on Leopard utilizing its JVM?</p>
| <p>Yes, you should be able to. </p>
<p>A number of blogs have reported running Netbeans on 1.6 as well as the the problems they had with earlier versions of NB. The NB issue tracker also has a number of bugs that have been fixed that affected 1.6 on Mac OS.</p>
<p>If you have trouble getting it to run, you might also... | <p>I haven't tried it yet, but can't think of any reason why not.</p>
| 21,016 |
<p>Are there any good reasons not to use \u0000 as a delimiter within a Java String? I would be encoding and decoding the string myself.</p>
<p>This is for saving a list of user-inputted (I'm expecting input to be typed?) strings to an Eclipse preference and reading it back. The list may be variable size so I don't th... | <p>There used to be some libraries which erroneously handled Java strings as null terminated. I don't know if it's still true but it's worth keeping such things in mind. Especially if you interop with external libraries that will handle strings as null terminated.</p>
| <p>Sounds like you are trying to use it to store a list. Why not use <code>ArrayList<String></code> ? Having a <code>\u0000</code> in a String is bad. Consider using a byte array. </p>
<p>As you say its for saving something in the eclipse settings, i wouldn't use embedded NULs, since the files seem to be user-re... | 41,206 |
<p>I want to use the same functionality available when a Panel.AutoScroll is true, but with the scrollbars invisible.</p>
<p>To do so I need to know how can I scroll to left/right up/down using functions in my code.</p>
| <p>You should be able to use the VerticalScroll and HorizontalScroll properties of the component:</p>
<pre><code>c.HorizontalScroll.Value += 100;
c.VerticalScroll.Value = c.VerticalScroll.Maximum;
</code></pre>
| <p>There's probably a property on the panel to do this, alternatively you can loop through all the panels children and adjust their positions.</p>
<p>Eg. to move all controls 10 px:</p>
<pre><code>int xoffset = 10;
foreach(Control c in panel1.Controls)
c.Location.X += xoffset;
</code></pre>
<p>The controls can ... | 32,863 |
<p>I currently am trying to write a Python program using scheme semantics so I can later translate it into Scheme without relying on a lot of Pythonic stuff.</p>
<p>I'm trying solve the sliding puzzle problem (where you have 9 slots and 8 tiles arranged in a square) using a*, depth first, and breadth first search algo... | <p>I wrote an 8-puzzle solver in Lisp about a year ago. I just used a list of 3 lists, each sublist with 3 elements being the numbers. It's not constant time, but it is portable.</p>
<p>Anyways, if you are really interested in doing this functionally (Scheme doesn't require you to) what is easiest to do is to create s... | <p>Cool, thanks for the lisp code. I'll need to study it to make sure I get it.</p>
<p>As for the first answer, the first time I was "writing c" in lisp because that's the only way I knew how to program and didn't have a clue why anyone would use lisp. This time around, I've been playing around with scheme, but want... | 45,149 |
<p>My installer build "signs" a DLL using a Code Signing certificate during the build process. </p>
<p>I've noticed that if I try to build twice in succession, the second build fails because the DLL is already signed so signcode chokes. Obviously I can fix this by signing a copy of the DLL in the build, but the proble... | <pre><code>signtool remove /s C:\path\to.exe.or.dll
</code></pre>
<p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa387764(v=vs.85).aspx" rel="noreferrer">signtool</a> is available in Windows SDK, and must be at least from Windows 8 SDK kit (version 6.2.9200.20789) to have the <code>remove</code> ... | <p>Check if your build tool supports "Re-signing". This should replace all existing signatures.</p>
<p>If not, you can use <a href="http://www.cgsoftlabs.ro/studpe.html" rel="nofollow">Stud_PE</a> to remove the signature block.
Open the DLL or EXE in Stud_PE, go to the sections tab, right click the digital signature s... | 44,329 |
<p>I recently got a KP3S Kingroon 3D printer and have been trying to set it up.</p>
<p>After a couple of test prints, the Y-axis seems to only move in one direction. At first, I thought it was a motor issue, but when I go into the manual move directions for the Y-axis it seems that both inputs lead to the motor spinnin... | <p>The answer might just be replace the mother board.</p>
<p>If I understood everything correctly there are 5 things to check to break down the problem:</p>
<ul>
<li>the motor,</li>
<li>the cable,</li>
<li>the stepper connection,</li>
<li>the software input, and</li>
<li>the firmware.</li>
</ul>
<p>Using Repetier I dis... | <p>The question body has changed to rule out broken endstops. As a generic answer for steppers only going into a single direction, if an axis of a 3D printer only moves in one direction it usually implies that the end stop of that axis is triggered. If triggered, the firmware doesn’t allow the stepper to move to the di... | 2,083 |
<p>I have an application where I perform hundreds of thousands of calculations. Currently all of our values are Doubles. I am utilizing JFormula engine for most of the calculations, and have noticed the api takes a double parameter, so there is some autoboxing taking place when I pass in a Double. I have read some a... | <p>As well as the other suggestions (which are good - profiling and benchmarking are very important) I'd say that if JFormula is doing <em>anything</em> significant within each method call then the boxing/unboxing when making the call is likely to be insignificant. Unboxing in particular is fast as it doesn't require a... | <p>What you can try is to make simple benchmarks with and without autoboxing. run them through a time-profiler (visualvm recommended). Find the time difference and scale it to your program to find approximate time hit in your program</p>
| 29,806 |
<p>We have a POST to a PL/SQL database procedure that (a) does some database operations based on the POST parameters and (b) redirects the user to a page showing the results.</p>
<p>The problem is, when the user does a browser "refresh" of the results page, that still has the original request, so it calls the database... | <p>see <a href="http://www.decompile.com/cpp/faq/file_and_line_error_string.htm" rel="noreferrer">http://www.decompile.com/cpp/faq/file_and_line_error_string.htm</a>
specifically:</p>
<pre><code>#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define AT __FILE__ ":" TOSTRING(__LINE__)
</code></pre>
<p>so you... | <p>While some of the above "work", personally I'd recommend just using a simple string API instead of the dreck that comes in libc. There are a number of portable APIs, some of which are also optimized for ease of inclusion in your project ... and some like <a href="http://www.and.org/ustr/" rel="nofollow noreferrer">u... | 29,753 |
<p>A brief search shows that all available (uUnix command line) tools that convert from xsd (XML Schema) to rng (RelaxNG) or rnc (compact RelaxNG) have problems of some sort.</p>
<p>First, if I use rngconv:</p>
<pre><code>$ wget https://msv.dev.java.net/files/documents/61/31333/rngconv.20060319.zip
$ unzip rngconv.20... | <p>Converting XSD is a very hard task; the XSD specification is a bit of a nightmare and extremely complex. From some quick <a href="http://www.tbray.org/ongoing/When/200x/2006/11/27/Choose-Relax" rel="nofollow noreferrer">research,</a> it seems that it is easy to go from RelaxNG to XSD, but that the reverse may not be... | <p>Again, regarding editors: I see that there's no way to do this with Oxygen which seems to be a popular tool.</p>
| 14,836 |
<p>I am looking to purchase a new development PC. My budget is not more than $1,000 USD (including monitor). I am open to laptop (desktop replacement type) or the traditional desktop PC would do just fine.</p>
<p>My primary development environment will be Microsoft, Visual Studio 2008 (and support of older Visual St... | <p>There are some instruction level differences between AMD and Intel but nothing that Visual Studio is going to uncover. Perhaps if you were developing with Sun Studio you might run into them (I have!). </p>
<p>I would go for a 64 bit machine and run 32 bit VMs on it if you feel the need to do testing in that envir... | <p>Get 4 gigs rams minimum equal that you need a system that can handle more than 3 gigs (so 64bits OS). Rams is cheap and IDE with all others software (debugging, testing, database client, etc) will require you some rams if you want something fast.</p>
| 18,744 |
<p>The current guidlelines for explicit member implementation recommend:</p>
<ul>
<li>Using explicit members to approximate private interface implementations. <em>If you need to implement an interface for only infrastructure reasons and you <strong>never</strong> expect developers to directly call methods on that inte... | <p>There's no boxing taking place in your example... it's just a cast, and it's resolvable at compile time, so it should not have any impact on performance at all.</p>
<p><strong>Edit:</strong> Looking at it with ILDASM, the interface cast will give you a virtual method call versus a regular method call, but this is n... | <p>Why not just have them both call a private method that performs the function of the explicitly implemented interface?</p>
<pre><code>public void IXmlSerializable.WriteXml( XmlWriter writer )
{
InternalWriteXml( writer );
}
public void WriteTo(XmlWriter writer)
{
writer.WriteStartElement("foo");
Intern... | 43,130 |
<p>From wikipedia: </p>
<blockquote>
<p>the cross product is a binary operation on two vectors in a <strong>three-dimensional</strong> Euclidean space that results in another vector which is perpendicular to the plane containing the two input vectors.</p>
</blockquote>
<p>Given that the definition is only defined i... | <p>Implementation 1 returns the magnitude of the vector that would result from a regular 3D cross product of the input vectors, taking their Z values implicitly as 0 (i.e. treating the 2D space as a plane in the 3D space). The 3D cross product will be perpendicular to that plane, and thus have 0 X & Y components (... | <p>I'm using 2d cross product in my calculation to find the new correct rotation for an object that is being acted on by a force vector at an arbitrary point relative to its center of mass. (The scalar Z one.)</p>
| 30,233 |
<p>I have a site, foo.com, that makes ajax requests to bar.foo.com. Will this work.</p>
<p>Also, if foo is a secure connection, https, does bar.foo.com need to be https too? Can these two sites use different certificates?</p>
| <p>With plain-http AJAX: You are talking about doing cross-domain XMLHttpRequest, which is not permitted by browsers. There's a <a href="https://wiki.mozilla.org/Cross_Site_XMLHttpRequest" rel="noreferrer">W3C proposal pending</a> to implement this in a secure way in the future (partially implemented by IE8, IIRC), but... | <p>Most browsers will, depending on their security/privacy setting, block any outside call made - and only allow AJAX calls made to the same domain. Even subdomains are blocked, because on shared environments they might pose a real threat.</p>
<p>In short: only make AJAX calls through the same domain (perhaps call a p... | 28,655 |
<p>Expanding on <a href="https://stackoverflow.com/questions/7535/sql-server-2008-compatability-with-sql-server-2005">this question</a>, what is the best way to develop against both SQL Server 2005 and SQL Server 2008?</p>
<p>I'd like to see if I could just use Orcas technology on my current Vista 64 machine and since... | <p>The safest practice is to code against the oldest database server you support. This version is the one that will be far more likely to give you trouble. By and large the new versions of the db will have backwards compatibility to support your TSQL and constructs. It is far to simple to introduce unsupported code ... | <p>The referenced question suggests changing the database compatibility level, this is a short term solution that would not be automated easily. </p>
<p>Its important to have automated testing, and if your reading stackoverflow, you probably agree. </p>
<p>I would say get both MS SQL Server 2005 and 2008 running.<br>... | 14,803 |
<p>I'm going to be building an application within the next six months that will be functioning as a 2-way video-conferencing system, as well as sharing some other data back and forth. I'll probably be using some sort of relatively expensive USB webcam, and am aware of the USB Video Class Device standard, which seems t... | <p>with gnome, you have <a href="http://ekiga.org" rel="nofollow noreferrer">ekiga</a>. You can cross compile it for win32 too. It uses OPAL (Open Phone Abstraction Library) underneath. Maybe the tool itself will suit your needs, otherwise you can adapt it (OSS) or you can only keep low level API</p>
| <p>I agree with PW.</p>
<ul>
<li>OPAL is an excellent choice. </li>
<li>It supports audio and video devices</li>
<li>It compiles on windows, linux, and a few others</li>
</ul>
<p>Also
- I recommend using the SIP protocol (as opposed to H323)
- You don't need to use Ekiga. Ekiga is a front-end to OPAL. You can take a ... | 23,096 |
<p>OK. This is a bit of a vanity app, but I had a situation today at work where I was in a training class and the machine was set to lock every 10 minutes. Well, if the trainers got excited about talking - as opposed to changing slides - the machine would lock up.</p>
<p>I'd like to write a teeny app that has nothing... | <p><strong>for C# 3.5</strong></p>
<p>without notifyicon therefore you will need to terminate this application in task manager manually</p>
<pre><code>using System;
using System.Drawing;
using System.Windows.Forms;
static class Program
{
static void Main()
{
Timer timer = new Timer();
// time... | <p>(Windows 10 / .Net 5 / C# 9.0)</p>
<p>Instead of faking activity, you could</p>
<blockquote>
<p>inform the system that it is in use, thereby preventing the system
from entering sleep or turning off the display while the application
is running</p>
</blockquote>
<p>using <a href="https://learn.microsoft.com/fr-fr/wind... | 2,410 |
<p>I'm modifying a mature CGI application written in Perl and the question of content encoding has come up. The browser reports that the content is iso-8859-1 encoded and the application is declaring iso-8859-1 as the charset in the HTTP headers but doesn't ever seem to <em>actually do</em> the encoding. None of the ... | <p>By default Perl handles strings as being byte sequences, so if you read from a file, and print that to STDOUT, it will produce the same byte sequence. If your templates are Latin-1, your output will also be Latin-1.</p>
<p>If you use a string in text string context (like with <code>uc</code>, <code>lc</code> and so... | <p>If the browser reports the content as iso-8859-1, maybe your perl script didn't output the correct headers to specify the charset?</p>
| 21,637 |
<p>How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the "X" button in the top-right corner on a Pocket PC)?</p>
<p>The Deactivate event isn't the right way because it occurs in circumstances other than minimization, such as when a messa... | <p>I think the way to go here is processing the <a href="http://msdn.microsoft.com/en-us/library/aa922525.aspx" rel="nofollow noreferrer">WM_ACTIVE</a> message and then checking if the fMinimized parameter is not zero. You can find more information on how to declare this messages in your code in <a href="http://www.pin... | <p>What exactly do you mean by smart-minimized? I suppose you mean your app being automatically minimised on no activity for some time? Well, I don't think that there is an event for that.</p>
<p>The author of this <a href="http://blogs.msdn.com/windowsmobile/archive/2005/08/03/447404.aspx" rel="nofollow noreferrer">b... | 47,751 |
<p>I'm trying to make a script that sleeps my wireless card in linux. For that I'm using the <code>deepsleep</code> command of <code>iwpriv</code>:</p>
<pre><code>iwpriv wlan0 deepsleep 1
</code></pre>
<p>The problem is that this command only works if the wireless card is disconnected and disassociated. When it's con... | <p>Many drivers use the convention that associating with the NULL AP disconnects from the current AP. Add to this a brief delay, and you might have what you want. For example,</p>
<pre><code>iwconfig wlan0 ap 00:00:00:00:00:00
sleep 1
iwpriv wlan0 deepsleep 1
</code></pre>
<p>Typically, it shouldn't take more than 25... | <p>I don't have a fix, but you could try setting the ESSID of the card to a random string and hope that no access points nearby use that ESSID. That should prevent autoconnecting to any unencrypted network found. Not a solution, but maybe a better band-aid.</p>
| 27,317 |
<p>How can I get data from a database that I can only access through an ODBC Data Source (DSN) in T-SQL MS SQL Server, any version?</p>
| <p>After reading the following, I decided to create SSIS packages to get data from another data source via DSN. </p>
<blockquote>
<p>With Linked Servers, you have a little
more flexibility, but also some
additional security concerns. You are
linking to the other data source as a
specific user, with that us... | <p>The selecting is the easy part, but the real question is how do you connect to the datasource. </p>
<p>First, where are you selecting data from? Are you writing code, or just using the Query analyzer tool (2000) or Management Studio (2005)?</p>
<p>You'll need to setup your connection to the database regardless. ... | 30,191 |
<p>I'm relatively new to the Python world, but this seems very straight forward.</p>
<p>Google is yelling at me that this code needs to be optimized:</p>
<pre><code>class AddLinks(webapp.RequestHandler):
def post(self):
# Hash the textarea input to generate pseudo-unique value
hash = md5.new(... | <p>The main overhead here is the multiple individual puts to the datastore. If you can, store the links as a single entity, as Andre suggests. You can always split the links into an array and store it in a ListProperty.</p>
<p>If you do need an entity for each link, try this:</p>
<pre><code># For each line in the inp... | <p>How frequently is this getting called? This doesn't look that bad... especially after removing the duplicate request.</p>
| 31,124 |
<p>I'm working on a programming problem which boils down to a set of an equation and inequality:</p>
<pre><code>x[0]*a[0] + x[1]*a[1] + ... x[n]*a[n] >= D
x[0]*b[0] + x[1]*b[1] + ... x[n]*b[n] = C
</code></pre>
<p>I want to solve for the values of <code>X</code> that will give the absolute minimum of <code>C</cod... | <p>This looks like a <a href="http://en.wikipedia.org/wiki/Linear_programming" rel="noreferrer">linear programming</a> problem. The <a href="http://en.wikipedia.org/wiki/Simplex_algorithm" rel="noreferrer">Simplex algorithm</a> normally gives good results. It basically walks the boundaries of the subspace delimited by ... | <p>This <a href="http://www.lindo.com/" rel="nofollow noreferrer">company</a> has a tool to do that sort of thing.</p>
| 28,122 |
<p>With my jquery I'm trying to make the transition from a message to a loading function easy on the eyes by animate the opasity of the message out, inserting the loading.gif and animating the opacity back in. It fails.</p>
<pre><code>$('#powerSearchSubmitButton').click(function(ev) {
startLoad();
return false... | <p>Try this:</p>
<pre><code>$(this).fadeOut(500, function() {
$(this).html("<img src='content/pics/loadingBig.gif' alt='loading'/>");
});
$(this).fadeIn(500);
</code></pre>
| <p>Apply the animation to a container instead, or use the .css() method to set the opacity (inline styles might interfere with jQuery's ability to animate the corresponding properties).</p>
| 44,198 |
<p>We are currently having two UI design for internet and intranet the underlying reason being is that they both serve different purpose so they have different UI design.</p>
<p>But however users want to have a more synchronized look and feel between internet and intranet.</p>
<p>What are the reasons you all can thin... | <p>The browsers being to access the web pages may be a reason.
While (big) corporate intranets may be Windows dominated and hence Internet Explorer may be a safe assumption to make, out in the (wild,wild) internet, one can't be sure and have to design more inter-operable content.</p>
| <p>If the functionality of the two is significantly different, then I believe the UI must also be different.</p>
<p>You can make the two similar by use of colours, menu positioning, themes and so on.</p>
| 30,068 |
<p>let's assume i have a self referencing hierarchical table build the classical way like this one:</p>
<pre><code>CREATE TABLE test
(name text,id serial primary key,parent_id integer
references test);
insert into test (name,id,parent_id) values
('root1',1,NULL),('root2',2,NULL),('root1sub1',3,1),('root1sub2',4,1),('... | <p>Pulling this result in recursively is tricky (although possible). However, it's typically not very efficient and there is a <em>much</em> better way to solve this problem.</p>
<p>Basically, you augment the table with an extra column which traces the tree to the top - I'll call it the "Upchain". It's just a long str... | <p>This sounds like an exercise from "SQL For Smarties" by Joe Celko... </p>
<p>I don't have my copy handy, but I think it's a book that'll help you quite a bit if this is the kind of problems you need to solve.</p>
| 17,301 |
<p>I'm creating a Firefox extension for demo purposes.
I to call a specific JavaScript function in the document from the extension.
I wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox):</p>
<pre><code>document.funcToBeCalled = function() {
// function body
};
</code></pre>
... | <p>It is for security reasons that you have limited access to the content page from extension. See <a href="http://developer.mozilla.org/en/docs/XPCNativeWrapper" rel="noreferrer">XPCNativeWrapper</a> and <a href="http://developer.mozilla.org/en/Safely_accessing_content_DOM_from_chrome" rel="noreferrer">Safely accessin... | <p>You can do it, but you need to have control over the page and be able to raise the privilege level for the script. <a href="http://developer.mozilla.org/en/How_to_Build_an_XPCOM_Component_in_Javascript" rel="nofollow noreferrer">Mozilla Documentation gives an example</a> - search for "Privilege" on the page.</p>
| 18,264 |
<p>In reading about Perl 6, I see a feature being trumpeted about, where you no longer have to do:</p>
<pre><code>return "0 but true";
</code></pre>
<p>...but can instead do:</p>
<pre><code>return 0 but True;
</code></pre>
<p>If that's the case, how does truth work in Perl 6? In Perl 5, it was pretty simple: 0, "",... | <p>See <a href="http://dev.perl.org/perl6/doc/design/syn/S12.html#Roles" rel="noreferrer">Synopsis 12: Roles</a>.</p>
<p>The rules are the same, but the "but" copies the 0 and applies a role to the copy that causes it to be true in boolean context.</p>
<p>You can do the same thing with overload in Perl 5.</p>
| <p>One false value that gets neglected nearly everywhere is "0". I recently made this painful discovery that "0" is <strong>false</strong> in PERL 5. Gee. A non-empty string that's false. I was really hoping that would change in PERL6, but I guess not.</p>
<pre><code>> if ( "0" ) { say "True" } else { say "False... | 15,224 |
<p>I am going to start a C# project from scratch that will consist of several modules so it <strong>can be sold by modules</strong> of an existing PHP/ASP/MySQL/Oracle/MS SQL application that manages to show 3D objects and create 2D and 3D CAD files from a web app that the user can use to create all the stuff.</p>
<p>... | <p>For a quick hit of each of your explicit questions I would say.</p>
<p>As for the how of integration, learn inversion of control principals and how it is used for extensibility purposes. Keep an eye on MEF, Microsoft Extensibility Framework. As for the what, your integration points will depend mostly on the type ... | <p>First make something that works, then get feedback from potential customers.</p>
| 38,929 |
<p>I have a ListBox and I want to add a context menu to each item in the list. I've seen the "solution" to have the right click select an item and suppress the context menu if on white space, but this solution feels dirty. </p>
<p>Does anyone know a better way?</p>
| <p>Just to elaborate a little further to what Frans has said...Even though the ListBox owns the ContextMenuStrip, you can still customize the items in the menu strip at the time it's opening. Thus customizing it's contents based on the mouse position within the listbox.</p>
<p>The example below selects the item in the... | <pre><code>//Create and Initialize the contextMenuStrip component
contextMenuStrip_ListaAulas = new ContextMenuStrip();
//Adding an Item
contextMenuStrip_ListaAulas.Items.Add("Modificar");
//Binding the contextMenuStrip with the ListBox
listBox_Aulas.ContextMenuStrip = contextMenuStrip_ListaAulas;
//The solution bel... | 49,341 |
<p>I have a client who is interested in adding in electronic signature support to a long (40 question) seller application form. I'm a little stumped on whether there is an existing standard or process that's out there that folks in the financial world would expect to see?</p>
<p>I could certainly add in a system where... | <p>What purpose is the signature trying to fill? Are you trying to verify that the form actually came from a specific seller? (If so, you would have to know their public key ahead of time.) Are you trying to hold the seller accountable for their answers at a later date? (In that case, you might need some kind of third-... | <p>If these forms are meant to be shared throught to a general public you'll need to know (and can validate, that's the hardest part) all the producers of these amount of certificates people could use to sign these forms, and it's almost impossible.</p>
<p>With closed environments (like functionaries, doctors...) wher... | 17,088 |
<p><a href="http://99-bottles-of-beer.net/" rel="nofollow noreferrer">99 bottles of beers</a> made me realize that ADA, Erlang and Smalltalk were not so odd languages after all.</p>
<p>There are plenty of unusual tools and I supposed that a lot of them are even used :-)</p>
<p>Have you ever worked with very original ... | <p>I've been working professionally with <strong><a href="http://www.dyalog.com/" rel="nofollow noreferrer">Dyalog</a> <a href="http://en.wikipedia.org/wiki/APL_(programming_language)" rel="nofollow noreferrer">APL</a></strong> for almost three years now. It's always fun and challenging to learn a completely different ... | <p>I haven't worked with any unusual technologies but I believe Ada is still very much alive within the defence/aerospace/high reliability circles. It's something I would like to pick up one day.</p>
| 13,996 |
<p>I have what I thought would be a simple question.</p>
<p>I don't have an auto leveling probe, I do my leveling manually with 4 screws and a piece of paper (I measured the thickness to 0.1 mm).</p>
<p>For the longest time I would have trouble with the first layer, sometimes having to give the bed screws a quar... | <p>It is preferred to get the distance correct by hardware changes (leveling screws). But it is possible to do it with software. You can not only change the Z offset in the slicer or in the configuration of Marlin, but also with G-code commands. </p>
<p>The "paper drag" method is perfect for determining the correct Z ... | <p>You don't! Level the bed such that you know the nozzle is above the bed. Stop the print. Disable the steppers. Let it all cool down. Tram the bed (or what you call level). Then start the print again. It doesn't matter what first layer height your slicer thinks it is. All that matters is that it sticks and doesn't el... | 1,074 |
<p>I'm currently in the process of becoming a maintainer of a small open source project (a Facebook toolkit), and of course, one of the responsibilities is to answer user questions on our forum. While I'm happy to help users learn how to work with our toolkit and deal with issues they may run into (which may eventually... | <p>Make a FAQ page or a tutorial covering some of the basics, that will eliminate quite a lot of questions.</p>
| <p>Make a FAQ page or a tutorial covering some of the basics, that will eliminate quite a lot of questions.</p>
| 35,857 |
<p>This might be an interesting question. I need to test that if I can successfully upload and fetch the PDF file. This works for the text based files but I just wanted to check for PDF. For this unit test to run I need a PDF file. There are couple of options. I can create a dummy PDF file and store it some folder and ... | <p>Save a PDF file with your tests in a resources directory. Your tests should be as simple as possible, and creating a file is just one more point that could fail.</p>
| <p>My concern is that if I place a file in a different directory.. let's say resources under unit tests then don't I need the complete path to the file to access it. I am running my tests manually. Also, when I move to a different machine and place my solution in a folder with different name then the path to the file g... | 19,095 |
<p>This is kind of an unorthodox question. </p>
<p>I'm kinda new to using IDA Pro.<br>
Is there a way to edit the assembly code and then have IDA save the result as an executable?<br>
Is there some kind of plugin maybe that does that? because it seems that IDA doesn't want to save as an EXE.<br>
Or do I need to manua... | <p>Version 6.1+ (maybe 6.2+) of IDA Pro will allow you to apply your patches directly to the input file. Equally, it allows you to revert the changes back.</p>
| <p>I've seen somewhere else that you'd have to produce a .diff file from there then open with a text editor and use another program to patch the original file.</p>
| 42,395 |
<p>Some RepRap models use only a single motor for the Z axis, others use two.</p>
<p>For example, there is the <a href="http://reprap.org/wiki/3drag" rel="noreferrer">3drag</a> that has only one motor and a smooth rod on the other side. There are modifications that add a threaded rod on the other side that is connecte... | <p>There are three main options here for Mendel style ZX gantries:</p>
<ul>
<li>One Z screw and motor, which is similar to a cantilevered design but somewhat more stable because of the opposite smooth rod</li>
<li>Two Z screws and two motors</li>
<li>Two Z screws and one motor, with belt synchronization of the two sid... | <p>The general concept is to provide additional stability during the print. In the case of the 3drag machine you mentioned, you could run the risk of the -X- axis sagging due to the weight of the print head and/or additional wear on the rod or bearings on the one side (smooth side) as a result of the off balance weight... | 218 |
<p>A word of warning: I'm a n00b to <code>git</code> in general. My team uses feature branches in <code>svn</code>, and I'd like to use <code>git-svn</code> to track my work on a particular feature branch. I've been (roughly) following <a href="http://andy.delcambre.com/2008/03/04/git-svn-workflow.html" rel="noreferrer... | <p>Muchas gracias to Bart's Blog for this handy <a href="http://www.jukie.net/~bart/blog/svn-branches-in-git" rel="noreferrer">reference for svn branches in git</a>. Apparently all I needed was to specify a remote branch when creating the <code>git</code> branch, e.g., </p>
<pre><code>git checkout -b git-topic-branch-... | <p>I use git-svn but I haven't used the features that interoperate with SVN branches. Having said that, I notice that the tutorial you were following didn't use the <a href="http://git-scm.com/docs/git-svn" rel="nofollow noreferrer">-T, -b, -t</a> options to git svn init. These options tell git-svn what the upstream tr... | 23,423 |
<p>I need to create feature which will iterate through all subsites of site collection and add some sample content to each of them (sample content=new pages,images,documents,possibly some lists). There is solution that uses recursion to loop through sites (it can be found <a href="http://blog.rafelo.com/2008/07/iterati... | <p>That is a very common method of performing looping of sites and web parts.</p>
<p>Speed with 100 sub-sites will not be a problem. It is really quick, if you do alot of processing that can slow it down.</p>
<p>The one thing to watch is the disposal of items if you leave the open or don't close you can suck all the... | <p>You can look at the answer I gave to <a href="https://stackoverflow.com/questions/633633/sharepoint-how-can-i-find-all-the-pages-that-host-a-particular-web-part">this</a> question. I think I've used the correct dispose patterns for that piece of code.</p>
| 48,520 |
<p>Even though chrome runs tabs as different processes it appears to not support this... any ideas or documentation I might have missed?</p>
| <p>Try two different incognito windows.</p>
| <p>If you want to stay logged in for a period of time, the best thing to do is to create a new profile for each set of credentials. Click the face icon in the top right-hand corner and select "new user."</p>
<p><img src="https://i.stack.imgur.com/SoVNQ.png" alt="creating a new profile"></p>
<p>If you just want to log... | 6,226 |
<p>I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE device, but I keep getting an error:</p>
<p>‘Could not create remote file’ </p>
<p>My development environment is VS2005 (VB.NET)</p>
<p>My code:</p>
<pre><code>ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.... | <p>I have run into this once before but I can't really remember what was causing it.</p>
<p>The only thing I can think of from looking at your code is this line:</p>
<pre><code>ObjRapi.CopyFileToDevice("C:\results.txt", "\ \results.txt")
</code></pre>
<p>I'm not sure but you could try and change the destination pat... | <p>You have to use the following code:</p>
<pre><code>op.CopyFileToDevice(@"C:\results.txt", @"\Temp\results.txt");
</code></pre>
<p>In your code you are not mentioning the path where you want to copy the file.</p>
<p>Hope this will help you.</p>
| 35,022 |
<p>I'm using the following as a way of seeing listing the various methods in my developement</p>
<pre><code>print basename(__FILE__) . "::serve_table()"
</code></pre>
<p>is there any function that's able to return the name of a class method so I don't have to trpe it each time?</p>
| <p>Use <code>__FUNCTION__</code> and <code>__LINE__</code> and <code>__CLASS__</code> and <code>__METHOD__</code></p>
| <p>I'm not understanding if you need a way to list all the methods of a class or if you need to retrieve the method name you have just called.</p>
<p>If the former, using reflection:</p>
<pre><code>$class = new ReflectionCLass("classname");
$methods = $class->getMethods();
foreach($methods as $m)
print $m->... | 42,638 |
<p>How can this line in Java be translated to Ruby:<br>
String className = "java.util.Vector";<br>
...<br>
Object o = Class.forName(className).newInstance(); </p>
<p>Thanks!</p>
| <pre><code>Object::const_get('String').new()
</code></pre>
| <p>If you're using ActiveSupport (i.e. Rails), there is a method added to <code>String</code> that does this:</p>
<pre><code>"String".constantize.new
</code></pre>
| 19,048 |
<p>I am testing a couple of workflows for their workflow history cleanup time intervals. The workflow History needs to be retained for a specific number of days. I have implemented the solutions recommended <a href="http://mdablog.spaces.live.com/Blog/cns!B0C40902E1212960!796.entry" rel="nofollow noreferrer">here</a> <... | <p>This link should sort you out...</p>
<p><a href="http://weblogs.asp.net/danlewis/archive/2008/09/06/determine-which-version-of-sharepoint-is-installed.aspx" rel="nofollow noreferrer">Determining sharepoint versions</a></p>
<p>Edit: The article has now disappeared, so see Dan's answer below</p>
| <p>Check this article on "How to check if SharePoint Standard or SharePoint Enterprise is installed?"</p>
<blockquote>
<p>The SKU key is nothing but a GUID as you can see in the above table, so we can easily retrieve this information using the below code, use a visual webpart and add this Render method in your UserC... | 45,463 |
<p>I would like to create a blog where my Twitter updates essentially create blog posts, with a comment thread. If there isn't blog software that does this right now (I did some searching but couldn't find the commenting aspect) what would be the simplest approach and starting blog software to do this?</p>
<p>Potentia... | <p>Most projects of reasonable size should have a programming/coding standards document that dictates common conventions and naming guidelines that should be followed.</p>
<p>Another way to help with this is through code reviews. Obviously some coordination among reviewers is required (the document helps with that, to... | <p>Divide your packages/modules into logical groups and use descriptive and concise names. Avoid generic names except if they are really counters etc. Create conventions for groups of functions or functionality and stick to them.</p>
| 13,732 |
<p>I am using Visual C++ 2005 Express Edition and get the following linker errors:</p>
<pre><code>19>mylib1.lib(mylibsource1.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::exception::_Raise(void)const " (__imp_?_Raise@exception@std@@QBEXXZ) referenced in functio... | <p>Adding this line:</p>
<pre><code>#define _STATIC_CPPLIB
</code></pre>
<p>before including the vector header seems to do the trick.</p>
| <p>The third error makes it clear that <code>#define the _HAS_EXCEPTIONS 0</code> does not affect . Now, might include (makes sense, sharing code might reduce the size of your executable). That would explain why you still have errors if you define it before <em>your</em> inclusion of . This kind of defines should be ... | 31,037 |
<p>Here's the XML file i'm working on:</p>
<pre><code><list>
<activity>swimming</activity>
<activity>running</activity>
<activity>soccer</activity>
</list>
</code></pre>
<p>The index.php, page that shows the list of activities with checkboxes, a button to de... | <p>the DOMNodeList items are indexed starting with 0;
You need to move the $count++ to the end of the while loop in the output step.</p>
| <p>In addition to moving $count++ to the end of the while loop, it might be a good idea to have delete.php check to make sure the $_POST['activity'] is numeric and within the specified range, just to ensure there are no fatal error messages generated on your page.</p>
| 23,788 |
<p>I've been kicking around this idea for a while and would like to read your thoughts.</p>
<p>I'd like to create a .NET service to send and track email messages.</p>
<p>My rough ideas:</p>
<ol>
<li><p>Within various applications, serialize instances of .NET email (System.Net.Mail.MailMessage) objects and put them i... | <p>You will need to learn everything you can about the SMTP protocol, even if you are using higher level tools that do most of the work for you. In my own experience with processing outbound and inbound emails with .NET, I didn't really "get it" until I learned to telnet to port 25 of an SMTP server and send en email ... | <p>You may find some of the answers to <a href="https://stackoverflow.com/questions/124304/handling-undelivered-emails-in-webapp">Handling undelivered emails in webapp</a> useful.</p>
| 19,870 |
<p>I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user.</p>
<p>The way I'm doing this now is just loading both controls and setting up an OnRadioButtonS... | <p>Yep, that's pretty much how I do it. I would set the CheckedChanged event of both radio buttons to point at a single event handler and would place the following code to swap out the visible control.</p>
<pre><code>private void OnRadioButtonCheckedChanged(object sender, EventArgs e)
{
Control1.Visible = RadioBu... | <p>Well you could also use databinding... seems a bit more elegant to me. Suppose you have two radiobuttons "rbA" and "rbB" and two textboxes "txtA" and "txtB". And you want to have txtA visible only when rbA is checked and txtB visible only when rbB is checked. You could do it like so :</p>
<pre><code>private void Fo... | 15,880 |
<p>I'm writing an iPhone app that takes a photo and then uploads it to a server. How do I upload a photo to a server with Cocoa? I suppose I use NSUrl somewhere.</p>
<p>Thanks!</p>
| <p>Header:</p>
<pre><code>@interface EPUploader : NSObject {
NSURL *serverURL;
NSString *filePath;
id delegate;
SEL doneSelector;
SEL errorSelector;
BOOL uploadDidSucceed;
}
- (id)initWithURL: (NSURL *)serverURL
filePath: (NSString *)filePath
delegate: (id)delegate... | <p>If you want to upload multiple images then <a href="http://iphoneapp-dev.blogspot.com/2011/05/this-example-shows-how-to-upload-images.html" rel="nofollow">this demo</a> is good option.</p>
| 15,229 |
<p>I frequently run into large, non-template classes in C++ where simple methods are defined directly in the class body in the header file instead of separately in the implementation file. For example:</p>
<pre><code>class Foo {
int getBar() const { return bar; }
...
};
</code></pre>
<p>Why do this? It seems like... | <p>The C++ standard says that methods defined inside the class definition are <code>inline</code> by default. This results in obvious performance gains for simplistic functions such as getters and setters. Link-time cross-module optimization is harder, although some compilers can do it.</p>
| <p>You answered your own question, they are indeed inline methods.</p>
<p>Reasons to use them are performance. </p>
| 33,458 |
<p>How do I insert a current_timestamp into an SQL Server 2005 database datable with a timestamp column?</p>
<p>It should be simple but I cannot get it to work. Examples would be much appreciated.</p>
| <p>if you can execute a query from PHP then it should just be a matter of using 'getdate()' ;</p>
<pre><code>update MyTable set MyColumn=getdate();
</code></pre>
<p>or</p>
<pre><code>insert into MyTable (MyColumn) values (getdate());
</code></pre>
| <p>If you explain the error you are receiving (and post your insert or update code), it might make it easier to see what your problem is. One possible issue is that you must be inserting into a datetime field (or in 2008 you could use a date field as well). Occasionally people think that they can insert the current dat... | 29,621 |
<p>Everyone I talk to who knows (knew) about it claims it was the greatest thing since sliced bread. Why did it fail? Or, if it didn't fail, who's using it now?</p>
| <p>Check out <a href="http://www.gigaspaces.com" rel="noreferrer">GigaSpaces</a>. It's a quite successful Jini/Javaspaces implementation.</p>
<p>I think Jini has a great model, but it is stuck with Java. Web-services is more appealing because it works with standarized protocols, even though Jini service discovery is m... | <p>Zeroconf and other discovery protocols are similarly referred to as the greatest thing since sliced bread; it's just that the flavor keeps changing.</p>
| 6,661 |
<p>Now that most of the major browsers support full page zoom (at present, the only notable exception being Google Chrome), are liquid or elastic layouts no longer needed? Is the relative pain of building liquid/elastic layouts worth the effort? Are there any situations where a liquid layout would still be of benefit? ... | <p>Yes, because there are a vast variety of screens out there commonly ranging from 15" to 32".
There is also some variation in what people consider a "comfortable" font size.
All of which adds up to quite a range of sizes that your content will need to fit into.</p>
<p>If anything, liquid layout is becoming even more... | <p>Liquid layouts can cause usability problems, though.</p>
<p>Content containers that become too wide become exceptionally difficult to read.</p>
<p>Many blogs have fixed width content containers specifically for this reason.</p>
<p>Alternatively, you can create multi-column content containers so that you get an ef... | 8,767 |
<p>I'm using a UITableView to show some data from an array. This array can be changed at any time by other threads. (I believe that whether the array is mutable, or just replaced entirely, doesn't make a difference.) Access to the array itself is threadsafe.</p>
<p>What's the proper way to ensure thread safety with re... | <p>From your description, you really have TWO different data sets:</p>
<ul>
<li>The actual data, as it exists in your model</li>
<li>The data that's displayed to the user</li>
</ul>
<p>Thus, you already have, in effect, a 'shadow' array (virtual shadow, which may be stretching the metaphor too far). I'd say your best... | <p>I have the same situation. I have an array of C++ objects that provide the info in the tableview.</p>
<p>As Ben referred to, I also have a temporary "shadow" array into which new information is downloaded over the Internet. When the query is complete, I reconcile that array with the one backing the tableview, whi... | 43,114 |
<p>I've started using Vim to develop Perl scripts and am starting to find it very powerful. </p>
<p>One thing I like is to be able to open multiple files at once with:</p>
<pre><code>vi main.pl maintenance.pl
</code></pre>
<p>and then hop between them with:</p>
<pre><code>:n
:prev
</code></pre>
<p>and see which fi... | <p>Why not use tabs (introduced in Vim 7)?
You can switch between tabs with <code>:tabn</code> and <code>:tabp</code>,
With <code>:tabe <filepath></code> you can add a new tab; and with a regular <code>:q</code> or <code>:wq</code> you close a tab.
If you map <code>:tabn</code> and <code>:tabp</code> to your <kbd... | <p>if you're on osx and want to be able to click on your tabs, use MouseTerm and SIMBL (taken from <a href="http://ayaz.wordpress.com/2010/10/19/using-mouse-inside-vim-on-terminal-app/" rel="nofollow noreferrer">here</a>). Also, check out this <a href="https://stackoverflow.com/questions/1727261/scrolling-inside-vim-in... | 7,720 |
<p>Should I keep project filesm like Eclipse's .project, .classpath, .settings, under version control (e.g. Subversion, GitHub, CVS, Mercurial, etc)?</p>
| <p>You do want to keep in version control <strong>any portable setting files</strong>,<br>
meaning:<br>
Any file which has no absolute path in it.<br>
That includes:</p>
<ul>
<li>.project, </li>
<li>.classpath (<em>if no absolute path used</em>, which is possible with the use of IDE variables, or user environment vari... | <p>It seems like these project files can change over time as you work on a project so yes, I place them under version control.</p>
| 14,151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.