instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>So I need to generate a code that can be tied to a specific user/prospect with a dollar amount built into it. It needs to be reversible so that client application can confirm the validity of the code and apply the discount a manager intends.</p> <p>I'd like to make the code as short as possible but it needs to be ...
<p>Generate a public/private key pair for signing. Digitally sign the combination of user ID and coupon value using the private key. Publish the coupon value + signature as the coupon code, encoded, for example, using letters and numbers. The client application would verify the code by recreating the combination of dat...
<p>I'm guessing from way you've phrased the question you don't want to store the codes in a database (if you did, you could simply verify each code against the database)</p> <p>So, what you could do is take all the pertinent information about what is in the coupon, then hash it together with a secret salt to prevent t...
24,020
<p>So I was reading those Windows Vista UI guidelines someone linked to in another question, and they mentioned that you should be able to survive a switch to 120 DPI. Well, I fire up my handy VM with my app installed, and what do we get... AAAAGH!!! MASSIVE UI FAIL!</p> <p>Everything's all jumbled: some containers ar...
<p>Learn how the <em>Anchor</em> and <em>Dock</em> properties work on your controls, leave anything that can <em>AutoSize</em> itself alone, and use a <code>TableLayoutPanel</code> when you can.</p> <p>If you do these three things, you'll get a lot of the WPF design experience in Windows Forms. A well-designed <code>...
<blockquote> <p>If I were to stick with Windows Forms, what are all the tricks to achieving a font-size-independent layout that can survive the user setting his fonts large, or setting the display to 120 DPI?</p> </blockquote> <p>For one, <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.autoscal...
7,331
<p>I have created a custom installer dll &amp; everything is working fine. I just want to call another installer's <code>Uninstall</code> method from my current installation. When I do this, I get <code>error code 1618</code> (signifies another installer is already running). However when I call the <code>uninstall</...
<p>AFAIK calling an installer (either to install or uninstall) from another installer is not supported. It was supported in earlier versions of Windows Installer, but is now deprecated, and even then I'm not sure uninstallation of an other product was supported. The recommended way now is to use a bootstrapper to check...
<p>If this other product is your own (and hence you have access to what the installer should be doing), or you want to do something dirty, you could try removing the files/registry entries/etc yourself then unregistering the program in the registry (<code>HKEY_LOCAL(MACHINE|USER)\Software\Microsoft\Windows\CurrentVersi...
24,433
<p>We have very strange problem, one of our applications is continually querying server by using .net remoting, and every 100 seconds the application stops querying for a short duration and then resumes the operation. The problem is on a client and not on the server because applications actually queries several servers...
<p>100 Seconds is a give away number as it's the default timeout for a webrequest in .Net.</p> <p>I've seen in the past that the PSI (Project Server Interface within Microsoft Project) didn't override the timeout and so the default of 100 seconds was applied and would terminate anything talking to it for longer than t...
<p>How is the application coded to implement the continuous querying? Is it in a continuous loop? or a loop with a Thread.Sleep? or is it on a timer ?, </p> <p>It would first be useful to determine if your system is executing this "trigger" in your code when you expect it to, or if it is, and the remoting server is ...
37,813
<p>I need to create a linked server to a DB2 database on a mainframe. Has anyone done this successfully on a 64-bit version of SQL Server 2005? If so, which provider and settings were used?</p> <p>It's important that the linked server work whether we are using a Windows authenticated account to login to SQL Server or ...
<p>We had this same issue with a production system late last year (sept 2007) and the official word from our Microsoft contact was that they had a 64 bit oledb driver to connect to ASI/DB2 <strong>but</strong> it was in <strong>BETA</strong> at the time.</p> <p>Not sure when it will be out of beta but that was the new...
<p>What provider are you using for Sql 2000? I'm pretty sure MS has an x64 OLEDB driver for DB2 (part of Host Integration Server, but available as a separate download). IBM has x64 for .NET and ODBC, and possible OLEDB as well (though it's a PITA to find).</p> <p>Once you get the linked server setup, I'm pretty sure a...
3,208
<p>I have image data and i want to get a sub image of that to use as an opengl texture. </p> <pre><code>glGenTextures(1, &amp;m_name); glGetIntegerv(GL_TEXTURE_BINDING_2D, &amp;oldName); glBindTexture(GL_TEXTURE_2D, m_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2...
<p><strong>Edit:</strong> Use glPixelStorei. You use it to set <code>GL_UNPACK_ROW_LENGTH</code> to the width (in pixels) of the entire image. Then you call glTexImage2D (or whatever), passing it a pointer to the first pixel of the subimage and the width and height of the subimage.</p> <p>Don't forget to restore <code...
<p>For those stuck with <strong>OpenGL ES 1.1/2.0</strong> in 2018 and later, I did some tests with different methods how to update part of texture from image data (image is of same size as texture).</p> <p><strong>Method 1:</strong> Copy whole image with <em>glTexImage2D</em>:</p> <pre><code>glTexImage2D( GL_TEXTURE...
25,177
<p>Scenario: I have a function that I need to tweak in some way (example; make it work slightly different in different places). For some reason I end up having to add something ugly to the code, either in the function or at existing call sites. Assume that the sum total "ugly" is the same in both cases.</p> <p>The que...
<p>Put the ugly in the function, hands down. If this is in C++ be sure to have the implementation in the .cpp file. Perhaps you may consider writing two functions to abstract the ugly from the main function body.</p> <p>Procedural/OOP programming exists to take the "ugly" out of the interface (among other things). It ...
<p>I would put it in the function declaration personally - I can't grasp how putting it in the calls to the function would be "less ugly", since you'd likely(at least, you implied) that you would have to use the "ugly" more than once.</p>
25,362
<p>I want to set a background image for a div, in a way that it is in the upper <strong>RIGHT</strong> of the div, but with a fixed <code>10px</code> distance from top and right.</p> <p>Here is how I would do that if wanted it in the upper <strong>LEFT</strong> of the div:</p> <pre>background: url(images/img06.gif) n...
<p>Use the previously mentioned rule along with a top and right margin:</p> <pre><code>background: url(images/img06.gif) no-repeat top right; margin-top: 10px; margin-right: 10px; </code></pre> <p>Background images only appear within padding, not margins. If adding the margin isn't an option you may have to resort to...
<p>The correct format is:</p> <pre><code>background: url(YourUrl) 0px -50px no-repeat; </code></pre> <p>Where <code>0px</code> is the horizontal position and <code>-50px</code> is the vertical position.</p> <p>CSS <code>background-position</code> accepts negative values.</p>
13,979
<p>Is there a library out there which I can use in my current ASP.NET app, to validate queryStrings?</p> <p>Edit ~ Using Regex to look for patterns, like string, only, numeric only, string with length x,...etc</p> <p>Thanks</p>
<p>Don't know about a library, but you can use to check if the querystring exists:</p> <pre><code>if (!String.IsNullOrEmpty(Request.Querystring["foo"])) { // check further } else { // not there, do something else } </code></pre> <p>If you want to use Reglar Expressions to further validate, you can create a clas...
<p>Do you mean to ask about breaking the query string into its parts? ASP.Net already does that for you. You can access the individual paramaters via the Request.QueryString collection.</p> <p>For the query string: ?fruit=apple&amp;socks=white</p> <p>Request.QueryString["fruit"] will give you "apple", and Request.Qu...
31,304
<p>What's the "best" (taking both speed and readability into account) way to determine if a list is empty? Even if the list is of type <code>IEnumerable&lt;T&gt;</code> and doesn't have a Count property.</p> <p>Right now I'm tossing up between this:</p> <pre><code>if (myList.Count() == 0) { ... } </code></pre> <p>an...
<p>You could do this:</p> <pre><code>public static Boolean IsEmpty&lt;T&gt;(this IEnumerable&lt;T&gt; source) { if (source == null) return true; // or throw an exception return !source.Any(); } </code></pre> <p><strong>Edit</strong>: Note that simply using the .Count method will be fast if the underly...
<p>This extension method works for me:</p> <pre><code>public static bool IsEmpty&lt;T&gt;(this IEnumerable&lt;T&gt; enumerable) { try { enumerable.First(); return false; } catch (InvalidOperationException) { return true; } } </code></pre>
6,261
<p>Highly embedded (limited code and ram size) projects pose unique challenges for code organization.</p> <p>I have seen quite a few projects with no organization at all. (Mostly by hardware engineers who, in my experience are not typically concerned with non-functional aspects of code.)</p> <p>However, I have been t...
<p>I've written and maintained multiple embedded products (30+ and counting) on a variety of target micros, including MSP430's. The "rules of thumb" I have been most successful with are:</p> <ul> <li>Try to modularize generic concepts as much as possible (e.g. separate driver code from application code). -- It makes ...
<p>I've worked with some sensors like the Tmote Sky, I too have seen poor organization, and I have to admit i have contributed to it. Anyway I'd say that some confusion has to be, because loading too much modules or too much part of program will be (imho) resource killing too, so try to be aware of a threshold between ...
26,606
<p>I would like to debug an embedded system containing gdb remotely using some kind of gui (ie like ddd). The embedded system does not have the sources or build symbols. However my local x windows box has. However the execution must happen on the embedded system. How can I from my development box drive gdb remotely wit...
<p>I think, gdbserver could help you.</p>
<p>On Remote target:</p> <pre><code>target&gt; gdbserver localhost:1234 &lt;application&gt; </code></pre> <p>On Host (build machine):</p> <pre><code>host&gt; gdb &lt;application&gt; </code></pre> <p>Note that the on target may be stripped off from the symbols. But host may have all the symbols.</p> <pre><code>gd...
9,672
<p>I've heard that using hairspray is useful for keeping the 3D objects from peeling off of the bed, but every example I have seen where someone uses hairspray, they use it on a glass bed.</p> <p>Is it okay to use it on a metal bed as well?</p>
<p>I have been using a sort of a very strong hairspray called 3DLAC for about 2 years directly onto the aluminium heat bed of the Anet A8 printer I have.</p> <p>Basically, all those sprays contain copolymer constituents, PVA (PolyVinyl Alcohol), Vinyl or Acetate. These are also found in certain glue sticks or wood g...
<p>Do you mean bare metal or metal with some film on top? You can apply hair spray to bare metal, but you will have troubles cleaning it off. Solvents do not evaporate hair spray, they only turn it into thick sticky goo you will need to clean off. I recommend that you try glue stick or even beer (seriously) before hair...
541
<p>How would I go about...</p> <ul> <li><p>multiplying two 64-bit numbers </p></li> <li><p>multiplying two 16-digit hexadecimal numbers </p></li> </ul> <p>...using Assembly Language. </p> <p>I'm only allowed to use registers %eax, %ebx, %ecx, %edx, and the stack.</p> <p>EDIT: Oh, I'm using ATT Syntax on the x86<br>...
<p>Use what should probably be your course textbook, Randall Hyde's &quot;The Art of Assembly Language&quot;.</p> <p>See <a href="http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/HTML/AdvancedArithmetica2.html#1007619" rel="noreferrer">4.2.4 - Extended Precision Multiplication</a></p> <blockquote>...
<p>I'm betting you're a student, so see if you can make this work: Do it word by word, and use bit shifts. Think up the most efficient solution. Beware of the sign bit.</p>
11,336
<p>What application do you use to monitor HTTP communication on OS X?</p>
<p><a href="http://www.charlesproxy.com/" rel="noreferrer">Charles Proxy</a></p> <blockquote> <p>Charles is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (w...
<p>Depends on what you mean by monitor... </p> <p>If you simply want to know/stop when an installed application (or the OS) tries to "phone home", then I recommend <a href="http://www.obdev.at/products/littlesnitch/index.html" rel="nofollow noreferrer">LittleSnitch</a>.</p> <p>The peace of mind you gain is well worth...
17,515
<p>I don't quite understand how Silverlight code works within the browser. Are the assemblies downloaded to the client machine? Is there any chance of the code getting decompiled using Reflector or some similar tool? If so, what options does one have to protect the code? Do .net obfuscators work with Silverlight?</p>
<p>To view a Silverlight application the client download a .xap file that contains the dll and one configuration xml and optional resources. The dll contains compiled c# code that runs in a Silverlight runtime in client machine. Silverlight runtime is basically a subset of complete .net runtime. So the point is user ge...
<p>Yes, Silverlight xap files are nothing but zip files with your assemblies in them, so they do need protection via obfuscation. Give <a href="http://www.ssware.com/cryptoobfuscator/obfuscator-net.htm" rel="nofollow">Crypto Obfuscator</a> a try - it directly obfuscates xap files, it can also obfuscate XAML files in yo...
30,261
<p>How can I set the background color of an HTML element using css in JavaScript?</p>
<p>In general, CSS properties are converted to JavaScript by making them camelCase without any dashes. So <code>background-color</code> becomes <code>backgroundColor</code>.</p> <pre><code>function setColor(element, color) { element.style.backgroundColor = color; } // where el is the concerned element var el = do...
<pre><code>$(".class")[0].style.background = "blue"; </code></pre>
2,549
<p>Using VS2005/2008 as a resource editor, one of the options in the Add Resource dialog is HTML: it appears to allow me to embed HTML file(s) into a resource (res) file. Does anyone know how to grab the HTML (as a string) from VB6 code? The <a href="http://msdn.microsoft.com/en-us/library/aa244129(VS.60).aspx" rel="no...
<p>In Win32 C headers a resource format constant is defined called RT_HTML, it has the value 23. It should be possible to load the HTML resource type. Additionally you can verify the resource type number by looking at the built exe file with <a href="http://angusj.com/resourcehacker/" rel="nofollow noreferrer">Resource...
<p>here is a good tutorial in c++ <a href="http://www.rohitab.com/discuss/index.php?showtopic=15281" rel="nofollow noreferrer">http://www.rohitab.com/discuss/index.php?showtopic=15281</a> you can probably adapt the code(usually function names are the same for win32 routines search on msdn.microsoft.com for documentatio...
35,426
<p>We're using Stored Procedures for <em>every query</em> to the DB. This seems incredibly un-<a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" rel="nofollow noreferrer">DRY</a>:</p> <ol> <li>Design the table</li> <li>Design CRUD operation SPs for that table</li> <li>Design code (preferably a class) to f...
<p>One tip to avoid modification of at least the SPs is writing them to use 'introspection', that is, deducing the column names and datatypes from the internal tables or the information_schema views. </p> <p>It's more complex code to write, but it'll avoid having to modify it each time the table changes, and it can be...
<p>I don't think this really falls under the DRY guideline. This is simply about persistence, and if you're doing #3 manually then you should look at adopting one of the toolsets that make this easier. LINQ to SQL is my personal favorite, but there are many.</p> <p>Your #2 can easily be automated as well. Reducing you...
34,570
<p>Although my question might seem abstract I hope it's not. Suppose I develop an application, an ASP.NET MVC site and later I am tasked to build an Winforms client for this application how much and how can I reuse from the existing application?</p> <p>I defined the models, I defined controllers and views. They all wo...
<p>I have done this previously, not with asp.net MVC but with pure asp.net web forms. I used a home-grown MVP (Model-View-Presenter) pattern, and the absolute most important thing to allow the Presenter (== Controller in your case) to be used in a WinForms app was to not reference <em>anything</em> to do with system.w...
<p>Have a look at the <a href="http://www.codeplex.com/NSK" rel="nofollow noreferrer">Northwind starter kit</a> (don't be put off by the Northwind bit)- that has various GUIs attached to a layered architecture including both MVC and Winforms.</p> <p>It does exactly what you want to achieve.</p>
15,134
<p>For a while we were using a tool called CodeVeil. I'm just wondering if there are better alternatives out there.</p> <p>Edit: Before more people misunderstand the question, I'm aware that a determined cracker would probably be able to defeat any of these tools. I'm not too concerned about them though. These too...
<p>I've had a lot of success with Xenocode Postbuild. The tool can obfuscate .NET assemblies, protect agaist Reflector disassembly, combine .NET assemblies into a single executable ("virtualization") and even compile .NET applications to standalone executables that do not need .NET runtime installed.</p>
<p>I've heard that Obfusticator is good; it's used on .Net Reflector.</p>
13,237
<p>I haven't really looked into the new .NET stuff since 2.0, but I'm wondering what the preffered way is for creating Web Services is now (SOAP, not RESTful). I remember in the old days, you created a ASP.NET Web Service. Now, I've been looking at WCF, but it seems like there's some added complexity. I've GOOGLED ...
<p>A couple of things.</p> <p>1) It's still OK to do Add -> New Web Service (asmx).</p> <p>2) It's equally easy to do that with WCF (and it's still just SOAP).</p> <p>The benefit of going WCF is that you're 'future-compatible' if you want to change some features (such as the transport type, etc).</p>
<p>I really think MSDN's <a href="http://msdn.microsoft.com/en-us/library/ms734712.aspx" rel="nofollow noreferrer">Getting Started Tutorial</a> is worthwhile. It walks you through defining a contract, implementing the contract, hosting the service, and then consuming it. It starts from zero and walks you through each s...
43,088
<p>What to use for a medium to large python WSGI application, Apache + mod_wsgi or Nginx + mod_wsgi?<br /><br /> Which combination will need more memory and CPU time?<br /> Which one is faster?<br/> Which is known for being more stable than the other?<br /><br /> I am also thinking to use CherryPy's WSGI server but I h...
<p>For nginx/mod_wsgi, ensure you read:</p> <p><a href="http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html" rel="noreferrer">http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html</a></p> <p>Because of how nginx is an event driven system underneath, it has behavioural c...
<p>One thing that CherryPy's webserver has going for it is that it's a pure python webserver (AFAIK), which may or may not make deployment easier for you. Plus, I could see the benefits of using it if you're just using a server for WSGI and static content.</p> <p>(shameless plug warning: I wrote the WSGI code that I...
23,755
<p>Is there a way to encrypt the data file that mysql uses? I have a mysql server on an open machine, and I would like to encrypt the data file so even if someone copies the data files, they cannot read the data.</p> <p>Thanks</p>
<p>I am not sure what do you mean when you say that your machine is open. If people have access to the console, or to your account it is much harder of a task to encrypt the file.</p> <p>Did you look at <a href="http://en.wikipedia.org/wiki/TrueCrypt" rel="noreferrer">Truecrypt</a>? It works for most popular operating...
<p>you could encrypt the data within mysql using the built in encryption functionality.</p> <p>as for the files, any file solution should work fine.</p>
17,345
<p>I am looking for a .NET implementation of a priority queue or heap data structure</p> <blockquote> <p>Priority queues are data structures that provide more flexibility than simple sorting, because they allow new elements to enter a system at arbitrary intervals. It is much more cost-effective to insert a new job ...
<p>I like using the <code>OrderedBag</code> and <code>OrderedSet</code> classes in <a href="http://www.codeplex.com/PowerCollections" rel="noreferrer">PowerCollections</a> as priority queues.</p>
<p>The following implementation of a <code>PriorityQueue</code> uses <code>SortedSet</code> from the System library. </p> <pre><code>using System; using System.Collections.Generic; namespace CDiggins { interface IPriorityQueue&lt;T, K&gt; where K : IComparable&lt;K&gt; { bool Empty { get; } vo...
12,795
<p>I have been in both situations: </p> <ul> <li>Creating too many custom Exceptions</li> <li>Using too many general Exception class</li> </ul> <p>In both cases the project started OK but soon became an overhead to maintain (and refactor).</p> <p>So what is the best practice regarding the creation of your own Except...
<p><a href="http://www.javaspecialists.eu/" rel="noreferrer">The Java Specialists</a> wrote a post about <a href="http://www.javaspecialists.eu/archive/Issue162.html" rel="noreferrer">Exceptions in Java</a>, and in it they list a few "best practices" for creating Exceptions, summarized below:</p> <ul> <li><p>Don't Wri...
<h3>Don't eat exceptions, throw them <a href="https://stackoverflow.com/a/921583/1097600">https://stackoverflow.com/a/921583/1097600</a></h3> <p>Avoid creating your own exception. Use the below ones that are already there.</p> <pre><code>IllegalStateException UnsupportedOperationException IllegalArgumentException NoS...
4,662
<p>At my office we have an SVN server set up and I'd like to know how much traffic it is using. I'm not interested in the bandwidth, just the total number of 1s and 0s the SVN service is sending/receiving.</p> <p>The data will all be going via the <code>svn://</code> protocol, and the server is running XP pro.</p>
<p>Start | My Computer - right click Manage</p> <p>Computer Management - Performance Logs &amp; Alerts.</p> <p>Add a new log, set it up to monitor the SVN process once a day. Select the "I/O Other Bytes/sec" as the counter to record.</p>
<p>Can't you just monitor the SVN server process using task manager, and add the "I/O Other Bytes" column?</p> <p>Otherwise, <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="nofollow noreferrer">Sysinternal's Process Explorer</a> can certainly do this.</p>
44,080
<p>How do you schedule a Windows Mobile application to periodically start up to perform some background processing. For example, assume I'm writing an email client and want to check for email every hour, regardless of whether my app is running at the time.</p> <p>The app is a native C/C++ app on Windows Mobile 5.0 or...
<p>the function you need is:</p> <p><code>CeRunAppAtTime( appname, time )</code></p> <p>that isn't the exact signature, there is also <code>CeRunAppAtEvent</code>, they should both be in the MSDN docs (but linking is useless the way MSDN urls always change)</p> <p>The normal way to use these (and <code>RunAppAtTime<...
<p>Use CeSetUserNotificationEx instead of CeRunAppAtTime (as this is deprecated).</p>
7,088
<p>I want to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls), instead of the [Browse...] text I want to use [...]</p>
<p>This isn't technically possible for security purposes, so the user cannot be misled.</p> <p>However, there are a couple of workarounds, although these require working with the raw HTML rather than the .NET server control - take a look at <a href="http://www.quirksmode.org/dom/inputfile.html" rel="noreferrer">http:/...
<p>Some third party tools provide this option. For example, we use the Telerik Upload control:</p> <p><a href="http://demos.telerik.com/aspnet-ajax/upload/examples/localization/defaultcs.aspx" rel="nofollow noreferrer">Changing the text of the Browse/select button</a></p> <p><a href="http://www.telerik.com/community/...
11,995
<p>I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?</p>
<p>IDLE provides Emacs keybindings without having to install other software. </p> <ol> <li>Open up the menu item Options -> Configure IDLE...</li> <li>Go to Keys tab</li> <li>In the drop down menu on the right side of the dialog change the select to "IDLE Classic Unix"</li> </ol> <p>It's not the true emacs key bindin...
<p><a href="http://www.python.org/doc/2.5/lib/module-readline.html" rel="nofollow noreferrer">'readline' module</a> supposedly provides Emacs like key bindings and even functionality. However, it is not available on Windows but on Unix. Therefore, this might be a viable solution if you are not using Windows.</p> <pre>...
7,910
<p>I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally be allowed access to both servers.). Server B is also not open to anony...
<p>You can certainly obtain the login name of the caller, but not the password. NTLM uses a challenge/response mechanism, so the password is never transmitted. Your server must have access to a password-equivalent (a hash) in order to form the challenge and check the response, but even if you can get hold of it that ...
<p>Page.User will get you the Security Principal of the user the page is running under. </p> <p>From there you should be able to figure it out.</p>
19,210
<p>I have some slow internet task to save and load file, I'd like to do those slow tasks in some background thread. I am wondering whether that's doable, and if it is, any sample code?</p> <p>Then after it is finished, I'd like it to notice back to the main thread, so that I could update the UI.</p>
<p>Take a look at NSURLConnection. It will load an NSURL (using NSURLRequest) in the background, and send delegate methods regarding its status.</p>
<p>If you do decide you need a background thread even after using asynchronous HTTP calls to gather the data, don't forget to wrap the background thread code in a new NSAutoReelasePool and then release it at the end.</p>
44,989
<p>I seem to remember reading that it's possible to declare taglib directives such as:</p> <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; </code></pre> <p>in web.xml. This eliminates the need to duplicate this directive in every JSP file where the taglib is used. Could someone tell ...
<p>The <code>taglib</code> element in web.xml serves a different purpose to the <code>taglib</code> directive which you have above.</p> <p>As David said, the <code>taglib</code> directive is required on each page.</p> <p>If you have many pages which use common taglibs, you can shortcut this by putting the taglib dire...
<p>Sorry, you're slightly mistaken. If a page uses a taglib, you have to have a taglib directive for it on the page. You could place the common taglib directives in an include file that all of your pages include with an include directive, but at compile time the taglib directive has to be there.</p> <p>I prefer to NO...
28,013
<p>I have a bunch of C files that are generated by a collection of python programs that have a number of shared python modules and I need to account for this in my make system.</p> <p>It is easy enough to enumerate which python program need to be run to generate each C file. What I can't find a good solution for is de...
<p><a href="http://docs.python.org/library/modulefinder.html" rel="nofollow noreferrer">modulefinder</a> can be used to <a href="http://www.tarind.com/depgraph.html" rel="nofollow noreferrer">get the dependency graph</a>.</p>
<p>The <code>import</code> statements are pretty much all the dependencies there are. There are are two relevant forms for the import statements:</p> <pre><code>import x, y, z from x import a, b, c </code></pre> <p>You'll also need the <code>PYTHONPATH</code> and <code>sites</code> information that is used to build ...
28,734
<pre><code> $rowfetch =~ s/['-]//g; #All chars inside the [ ] will be filtered out. $rowfetch =~ m/(\w+), ?(.)/; printf $fh lc($2.$1); </code></pre> <p>I got help building this regular expression yesterday, but I don't fully understand it.<br><br>It takes a name like Parisi, Kenneth and prints out kparisi<B...
<p>I find the <code>YAPE::Regex::Explain</code> module very helpful -</p> <pre><code>C:\&gt;perl -e "use YAPE::Regex::Explain;print YAPE::Regex::Explain-&gt;new(qr/['-])-&gt;explain;" The regular expression: (?-imsx:['-]) matches as follows: NODE EXPLANATION -------------------------------------...
<p>1st line: characters inside [] (' and -) are matched and replaced (s) by nothing, thus removed. /g means global and will try to match everything in the string.</p> <p>2nd line: \w means a word character, + means more than once. ? means 0 or once. "." means anything. So it means find any word character found more th...
49,956
<p>For our software we use hardware dongles to protect the software. No protection is perfect but this commercial solution is affordable and keeps honest people honest (as mentioned in another thread). The advantage is the 128 bit key that is stored 'unreadable' on the hardware dongle. </p> <p>We want to remove this h...
<p>I run a software company that has dealt with this issue for nearly 20 years. As both a developer and a business owner, I'd like to first encourage you to broaden your goals a bit. For example, it is simply a mistake to define your problem as "preventing piracy." Your goal should be to maximize revenue.</p> <p>Wit...
<p>Whilst nothing is going to be perfect, check out the <a href="http://msdn.microsoft.com/en-us/library/aa380261(VS.85).aspx" rel="nofollow noreferrer">CryptProtectData</a> API if you want to do it yourself.</p> <p>To be honest though, you are likely in for less headaches just buying a solution.</p>
28,130
<p>When designing a wiki application, what things should I take into consideration?</p> <p>So far I have:</p> <ol> <li>revisions</li> <li>parsing some sort of markup text</li> <li>keeping track of links in wikis, and pages that link to other pages.</li> <li>related wikis i.e. wikis are related to others.</li> </ol> ...
<p>I have done a lot of research and work with wikis over the last several years, for my own use and to support technical teams for my various clients/employers.</p> <p>I have concluded that the most important criteria for a wiki is to make it transparent, like the original wiki at <a href="http://c2.com/" rel="norefe...
<p>Make sure you perform input validation on all the edits people make to prevent XSS. Nothing would ruin a good wiki like people getting hacked.</p>
34,450
<p>I want to use a Simulink mdl to generate C files in an automated fashion. I am currently trying to use an m-script and a dos command shell, but I am having issues with a "do you want to save" dialog hanging the m-script. By experimentation I know that the mdl is being modified when the "set_param" line is run (i.e...
<p>Use the following command to force the model to be closed without saving:</p> <pre><code> close_system(gcs, false); </code></pre> <p>E.g.</p> <pre><code> rtwdemo_counter set_param(gcs,'SystemTargetFile','ert.tlc') rtwbuild(gcs) close_system(gcs, false); exit </code></pre>
<p>can you do something like:</p> <blockquote> <p>matlab -r samplebuild -nosplash -nodesktop &lt; yes</p> </blockquote> <p>?</p> <p>Actually I know you can do it, just not sure it will work... ;)</p>
44,963
<p>Will content requested over https still be cached by web browsers or do they consider this insecure behaviour? If this is the case is there anyway to tell them it's ok to cache?</p>
<p>By default web browsers should cache content over HTTPS the same as over HTTP, unless explicitly told otherwise via the <a href="http://en.wikipedia.org/wiki/List_of_HTTP_headers" rel="nofollow noreferrer">HTTP Headers</a> received.</p> <p><a href="https://www.mnot.net/cache_docs/" rel="nofollow noreferrer">This lin...
<p>Https is cached by default. This is managed by a global setting that cannot be overridden by application-defined cache directives. To override the global setting, select the Internet Options applet in the control panel, and go to the advanced tab. Check the "Do not save encrypted pages to disk" box under the "Securi...
21,006
<p>I need to make some code to talk to a SOAP web service. Unfortunately I'm unable to get a connection to the service as it requires a SSL connection encrypted with a special certificate. I've been given a pk12 certificate which when installed into my keychain allows me to access the SOAP service manually via Safari...
<p>I've hit similar problems. Is this a self-signed certificate? If so, you may find all you need to do is alter the trust settings on this certificate.</p> <p>There is another workaround, where you say that this site should ignore trust settings, but this leaves you open to man-in-the-middle attacks. There is anot...
<p><a href="http://roman.tao.at/dev/php/php-soapclient-over-https-with-pkcs12-p12-certificates/" rel="nofollow">http://roman.tao.at/dev/php/php-soapclient-over-https-with-pkcs12-p12-certificates/</a></p>
45,352
<p>I have just inherited a server application, however it seems that the only copy of the database is corrupt and the working version is gone, so is it possible to find what queries the application is running so I can try to rebuild the tables?</p> <p>Edit: I have some files with no extensions that I are named the sam...
<p>Turn on SQL query logging and watch what the application asks for.</p>
<p>You could run the UNIX command "strings" on the program to see whether it has embedded sql strings:</p> <p><a href="http://en.wikipedia.org/wiki/Strings_(Unix)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Strings_(Unix)</a></p>
13,483
<p>Given a class, <a href="http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/views/navigator/ResourceNavigator.html" rel="noreferrer">org.eclipse.ui.views.navigator.ResourceNavigator</a> for example, how do I find out which jar file to use? I know it's in org.ecli...
<p>If you have the jar in your class path / project path hit CTRL-SHIFT-T and type the name ... the jar will be displayed at the bottom.</p> <p>If you haven't the class in your build path a) put together a dummy project containing all the jars b) I think there is a plugin to find jars from IBM Alphaworks (but that mi...
<p>I'm not sure I really understand the question, but if you're looking to verify that your class is really in the jar, you can always look through the jar itself, and for that you don't need any Eclipse plugins or specialized external application.</p> <p>JAR (Java ARchive) files are nothing more than <strong>ZIP</str...
34,670
<p>I'm displaying a set of images as an overlay using Google Maps. Displaying these images should be in an endless loop but most most browsers detect this, and display a warning. </p> <p>Is there a way to make a endless loop in JavaScript so that it isn't stopped or warned against by the browser?</p>
<p>Try <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval" rel="nofollow noreferrer">setInterval</a> or <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/settimeout" rel="nofollow noreferrer">setTimeout</a>.</p> <p>Here is an example:</p> ...
<p>Perhaps try using a timer which retrieves the next image each time it ticks, unfortunately i don't know any JavaScript so I can't provide a code sample</p>
8,855
<p>I'm new to development (an admin by trade) and I'm setting up my development environment and I would like to set up a CruiseControl.Net server on Server 2008. A quick Google did not turn up any instructions for getting it running on IIS 7.0, so I was wondering if anyone had experience getting this set up.</p>
<p>What Dale Ragan said; it installed flawlessly on our Windows Server 2008 machine, including the Dashboard running on IIS 7. Just give it a shot; should work fine.</p>
<p>I got it running by following the steps in <a href="http://www.matthewbussa.com/2011/05/installing-and-configuring-cruise.html" rel="nofollow">this blog</a>. Additionally, I had to enable ASP.NET, as shown in <a href="http://lamiavitaintrycatch.wordpress.com/2008/05/20/http-error-50019-iis-70-thoubles-fixed/" rel="n...
3,435
<p>I have some old databases i was handed that use SQL Server 2000 and they are getting SQL Injected with javascript script tags at the end of certain database fields. I need a trigger to strip out the injected on update until I have time to fix the front end that is allowing this. </p> <p>I am a SQL Server novice ...
<p>I think a constraint would be better. Anything that has compromised content would be better rejected.</p> <p>Set up a constraint on the field something like</p> <pre> CHARINDEX('&lt;script&gt',[fieldname]) = 0 </pre>
<p>something like:</p> <p>UPDATE table<br> SET field = REPLACE(field, '&lt;/script&gt;', REPLACE(field, '&lt;script&gt;',''))<br> WHERE table.pk IN (SELECT pk FROM inserted WHERE field LIKE '%script&gt;') </p> <p>?</p>
45,654
<p><strong><em>Note</strong>: The code in this question is part of <a href="http://www.codeplex.com/desleeper" rel="noreferrer">deSleeper</a> if you want the full source.</em></p> <p>One of the things I wanted out of commands was a baked design for asynchronous operations. I wanted the button pressed to disable while...
<p>I've been able to refine the original sample down and have some advice for anyone else running into similar situations.</p> <p>First, consider if BackgroundWorker will meet the needs. I still use AsyncCommand often to get the automatic disable function, but if many things could be done with BackgroundWorker.</p> ...
<p>As I answered in your other question, you probably still want to bind to this synchronously and then launch the commands asynchronously. That way you avoid the problems you're having now.</p>
18,277
<p>The exception mentions</p> <pre><code>FILE* __cdecl _getstream </code></pre> <p>I'm calling <code>fopen</code> and it keeps crashing. </p> <pre><code>AfxMessageBox("getting here 1"); FILE* filePtr = fopen(fileName, "rb"); AfxMessageBox("getting here 2"); </code></pre> <p>For some reason, I never get to the secon...
<p>I think memory corruption. On Windows (which the __cdecl makes me think you are using), there is the gflags utility which comes with the Windows Debugging Tools. With it, you can make each heap allocation have it's own page -- this will help catch memory overruns and double freeing immediately at the point of the ...
<p>I guess that something is wrong with fileName (does it have trailing zero ?)</p> <p>Try to comment <em>fopen</em> line out and see what will happen.</p>
33,548
<p>I'm consuming a third party .NET WebService in my client application. For debugging purposes I want to capture the SOAP requests that are being sent from my server. How would I go about doing this? This is being done on .NET 2.0 without the use of WCF or WSE.</p>
<p>If it's for debugging purposes I'd just configure the web request to use a proxy and send the entire request though fiddler (<a href="http://www.fiddlertool.com" rel="noreferrer">http://www.fiddlertool.com</a>) then you can see exactly what's getting transmitted over the wire.</p>
<p>You can use a SoapExtension to log the Soap calls.</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/cc164007.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc164007.aspx</a></p>
18,057
<p>I have a &quot;classic&quot; home built 3D printer, Arduino Mega, RAMPS 1.4 with Marlin 2.0.</p> <p>It worked, was put in storage, and now I am trying to get it running again.</p> <p>During all of the testing phases, the PID autotune, etc., the temperature of the hotend is stable.</p> <p>When printing, for a few lay...
<p><a href="https://i.stack.imgur.com/1ldX4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1ldX4.png" alt="Left right" /></a></p> <p><a href="https://i.stack.imgur.com/TtrmF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TtrmF.png" alt="Filament sensors" /></a></p> <p>The MK3 has...
<p>On the LCD, the MK3 will show <strong>Original Prusa MK3 OK</strong>, while the MK3S/+ will show <strong>Original Prusa MK3S OK</strong></p>
1,986
<p>I have a problem trying to model a many-to-one relationship in NHibernate, where the object on the 'one' side has a unique constraint on a column. The problem is as follows:</p> <p>I have two tables, 'Person' and 'Country'. Each Person has one and only one Country associated with it. A Country can have many Persons...
<p>You need to assign a Country instance to the Country property of the Person instance (not just set the ID). Something like: </p> <pre><code>Person p = new Person(); p.Country = session.Load&lt;Country&gt;(countryId); session.Save(p); </code></pre> <p>Then NHibernate will know what to do. This will also not cause...
<p>I had a similar requirement and solved it using <strong>SaveOrUpdateCopy</strong>.</p> <p>Lets say you have two different People objects, and each has a reference to a different Country object. As long as the Country <em>IDs</em> are the same, you won't get an exception and only 1 Country will be in the database.</...
36,999
<pre><code>var something = { wtf: null, omg: null }; </code></pre> <p>My JavaScript knowledge is still horribly patchy since I last programmed with it, but I think I've relearned most of it now. Except for this. I don't recall ever seeing this before. What is it? And where can I learn more about it?</p>
<p>It is an object literal with two properties. Usually this is how people create associative arrays or hashes because JS doesn't natively support that data structure. Though note that it is still a fully-fledged object, you can even add functions as properties:</p> <pre><code>var myobj = { name: 'SO', hello: ...
<p>This is an example of inline JavaScript object instantiation.</p>
21,569
<p>Does anyone here know SVG? If so, how did you learn it?</p> <p>Any books/tutorial pointer will be beneficial. Also I am a programmer, not a designer, so I want to pick up some skills there too.</p>
<p>I learned it developing <a href="http://www.w3.org/TR/SVGMobile12/" rel="nofollow noreferrer">SVG Tiny</a> software, mostly by reading the spec. SVG Tiny is basically a subset of full SVG and is focused on use in mobile phones and other "devices".</p> <p>Adding to the links from previous answers, <a href="http://ww...
<p><a href="http://en.wikibooks.org/wiki/SVG" rel="nofollow noreferrer">http://en.wikibooks.org/wiki/SVG</a> might help.</p>
43,210
<p>Is there a command-line argument that would force firefox.exe to launch a new process for a particular URL regardless of whether another instance of firefox is already running?</p>
<p>If you have a second profile (like 'sidekick'), the following will launch a new Firefox process:</p> <pre><code>firefox.exe -no-remote -p sidekick </code></pre> <p>However, if that profile is already used by a current Firefox session, that will not work.</p> <p>To create a new profile launch Firefox from the command...
<p>Starting a new process (<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#-new-instance" rel="nofollow noreferrer">instance</a>) is done by </p> <blockquote> <p><strong>-new-instance</strong><br> Open new instance, not a new window in running instance, which allows multiple copies o...
44,924
<p>One of the CAD programs I use is called <a href="http://www.tinkercad.com" rel="noreferrer">TinkerCAD</a>, which lets you export your design in either STL or OBJ form. What is the difference between these two file types? And which one is better to use?</p>
<p><strong>STL is the <em>de facto</em> standard in consumer-grade 3D printing</strong>. It is a bare-bone format that describes the shape of the object by defining the coordinates of all the vertices of all triangles that a surface may be subdivided into.</p> <p>This means that in STL any curved surface is represent...
<p>While the STL-format can only describe your object aproximatively by those well known triangles, OBJ-files can describe parts of your object parametrically by curves. This can lead to a higher precision and be a huge advance with regard to scalability. Which data format to choose depends, as always, on the applicati...
841
<p>Let's say that on the C++ side my function takes a variable of type <code>jstring</code> named <code>myString</code>. I can convert it to an ANSI string as follows:</p> <pre><code>const char* ansiString = env-&gt;GetStringUTFChars(myString, 0); </code></pre> <p>is there a way of getting</p> <p><code>const wchar_t...
<p>If this helps someone... I've used this function for an Android project:</p> <pre><code>std::wstring Java_To_WStr(JNIEnv *env, jstring string) { std::wstring value; const jchar *raw = env-&gt;GetStringChars(string, 0); jsize len = env-&gt;GetStringLength(string); const jchar *temp = raw; while ...
<p>Just use env->GetStringChars(myString, 0); Java pass Unicode by it's nature</p>
9,356
<p>Is there a way to determine (.NET preferably) if the current user is a domain user account or local user account?</p> <p>Ahead of time - I don not know the domain name this is running on so I can't just look for DOMAIN\Username v COMPUTER\Username. </p> <p>Part of the answer could be determining the DOMAIN or COMP...
<p>See that post and check if it's answering your question</p> <p><a href="https://stackoverflow.com/questions/140579/how-do-i-detect-if-my-program-runs-in-an-active-directory-environment">how-do-i-detect-if-my-program-runs-in-an-active-directory-environment</a></p>
<p>You could look at the full username, which is either &lt;domain name&gt;\&lt;username&gt; or &lt;machine name&gt;\&lt;username&gt; for domain and local accounts respectively. If the first part matches the domain name, it's obviously a domain account and the opposite holds true.</p>
39,963
<p>I'm developing a data access component that will be used in a website that contains a mix of classic ASP and ASP.NET pages, and need a good way to manage its configuration settings.</p> <p>I'd like to use a custom <code>ConfigurationSection</code>, and for the ASP.NET pages this works great. But when the component...
<p>Try this:</p> <pre><code>System.Configuration.ConfigurationFileMap fileMap = new ConfigurationFileMap(strConfigPath); //Path to your config file System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenMappedMachineConfiguration(fileMap); </code></pre>
<p>Use XML processing:</p> <pre><code>var appPath = AppDomain.CurrentDomain.BaseDirectory; var configPath = Path.Combine(appPath, baseFileName);; var root = XElement.Load(configPath); // can call root.Elements(...) </code></pre>
2,674
<p>I implemented a small OOP library in Lua, and two things are not quite right yet. I need your advice!</p> <h2>How to call super()?</h2> <p>I need to make a choice. The three arguments I need to resolve a call to super() are:</p> <ul> <li>The class from where the call is being made (CallerClass)</li> <li>The instance...
<pre><code>--# Python style, which is nice too: super(CallerClass, self):method() </code></pre>
<p>Thanks Chris, done.</p> <p>For those interested, the code is published on the Lua Users Wiki, see <a href="http://lua-users.org/wiki/ObjectLua" rel="nofollow noreferrer">ObjectLua</a>.</p>
27,763
<p>I'm currently working on a server-side product which is a bit complex to deploy on a new server, which makes it an ideal candidate for testing out in a VM. We are already using Hudson as our CI system, and I would really like to be able to deploy a virtual machine image with the latest and greatest software as a bu...
<p>Sorry to deny anyone an accepted answer here, but based on further research (thanks to your answers!), I've found a better solution and wanted to summarize what I've found.</p> <p>First, both VirtualBox and VMWare Server are great products, and since both are free, each is worth evaluating. We've decided to go wit...
<p>I'd recommend <a href="http://www.virtualbox.org/" rel="nofollow noreferrer">VirtualBox</a>. It is free and has a well-defined programming interface, although I haven't personally used it in automated build situations.</p>
21,235
<p>Does anyone know if there's an add-in that does autocomplete for queries on SQL Management Studio?</p>
<p>Take a look at <a href="http://www.red-gate.com/products/SQL_Prompt/index.htm" rel="noreferrer">Red Gate's SQL Prompt</a>.</p>
<p>It's not Management Studio, but <a href="http://www.toadworld.com/Products/ToadforSQLServer/tabid/217/Default.aspx" rel="nofollow noreferrer">Toad</a> has a freeware version with autocomplete.</p>
30,368
<p>Does anybody know the logic behind making DataSourceSelectArguments sealed?</p> <p>I've implemented a custom DataSource (and related classes) for some custom business objects and custom WebControls. When thinking in filters (like in a grid) I discovered that the DataSourceSelectArguments is sealed. Surely, I'm miss...
<p>My guess is because the class is a dumb data transfer object merely used to pass arguments to a method.</p> <p>This class itself doesn't have any operations defined on it, thus what sort of polymorphism would you expect? For example, the existing methods will only know about the properties of this class, which are ...
<p>My guess is because the class is a dumb data transfer object merely used to pass arguments to a method.</p> <p>This class itself doesn't have any operations defined on it, thus what sort of polymorphism would you expect? For example, the existing methods will only know about the properties of this class, which are ...
12,575
<p>As Scott Myers wrote, you can take advantage of a relaxation in C++'s type-system to declare clone() to return a pointer to the actual type being declared:</p> <pre><code>class Base { virtual Base* clone() const = 0; }; class Derived : public Base { virtual Derived* clone() const }; </code></pre> <p>The c...
<p>Use the Public non-virtual / Private virtual pattern :</p> <pre><code>class Base { public: std::auto_ptr&lt;Base&gt; clone () { return doClone(); } private: virtual Base* doClone() { return new (*this); } }; class Derived : public Base { public: std::auto_ptr&lt;Derived&gt; clone () { return...
<p>You could have two methods, a virtual clone() that returns a smart pointer wrapper around the base type, and a non-virtual clone2() that returns the correct type of smart pointer. </p> <p>clone2 would obviously be implemented in terms of clone and encapsulate the cast.</p> <p>That way can get the most derived sma...
32,472
<p>I was using GetWindowLong like this:</p> <pre><code>[DllImport("user32.dll")] private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); </code></pre> <p>But according to the MSDN docs I am supposed to be using GetWindowLongPtr to be 64bit compatible. <a href="http://msdn.microsoft.com/en-us/library/ms63...
<p>Unfortunately it's not that easy, because GetWindowLongPtr doesn't exist in 32bit Windows. On 32bit systems GetWindowLongPtr is just a C macro that points to GetWindowLong. If you really need to use GetWindowLongPtr on both 32 and 64 bit systems you'll have to determine the correct one to call at run time. See th...
<p>SoapBox is correct. </p> <p>Additionally, if you ever need to see how a type or function should Marshal in Win32, try using the <a href="http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx?ReleaseId=14120" rel="nofollow noreferrer">PInvoke Interop Assistant</a>. It will has built-in generations for mo...
41,337
<p>I'm working on mapping two objects in .NET. </p> <p>I would like to be able to print the items in the properties list from the Object Browser window in Visual Studio 2008. Is there a way to print that information out to the console?</p> <p>If that is not possible, what is a good method to print a general definit...
<p>To print the property list from the Object Browser you will probably need to write a VS add-in. For the second question: you can use <code>System.Reflection</code> to get all the properties and methods, and work from there.</p>
<p>To print the property list from the Object Browser you will probably need to write a VS add-in. For the second question: you can use <code>System.Reflection</code> to get all the properties and methods, and work from there.</p>
48,536
<p>I am using a WCF service and a net.tcp endpoint with serviceAuthentication's principal PermissionMode set to UseWindowsGroups.</p> <p>Currently in the implementation of the service i am using the PrincipalPermission attribute to set the role requirements for each method. </p> <pre><code> [PrincipalPermissio...
<p>If I understood well you want to select the role at runtime. This can be done with a <a href="http://msdn.microsoft.com/en-us/library/system.security.permissions.principalpermission.aspx" rel="nofollow noreferrer">permission</a> demand within the WCF operation. E.g.</p> <pre><code>public string method1() { Prin...
<p>Lars Wilhelmsen has posted a solution for this problem. Have a look at <a href="http://www.larswilhelmsen.com/2008/12/17/configurable-principalpermission-attribute/" rel="nofollow noreferrer">http://www.larswilhelmsen.com/2008/12/17/configurable-principalpermission-attribute/</a></p>
36,660
<p>I have a legacy C++ application that uses <a href="http://portals.omg.org/dds" rel="nofollow noreferrer">DDS</a> for asynchronous communication/messaging. I need to integrate this application into a JavaEE environment that uses JMS for messaging. Other than building a standalone JMS/DDS bridge module, are there an...
<p>If you want to continue to use your existing DDS product, your best bet will almost certainly turn out to be a custom bridge. Current DDS implementations are generally not interoperable at the message level and not even close at the QoS level.</p> <p>To use something like the RTI Message Service, you will have to ...
<p>RTI does also provide a separate DDS to JMS bidirectional bridge. This product is called Connext Integrator</p>
40,005
<p>Is which IPs are assigned to which ISPs public information? How do geo IP services obtain this information and maintain this information?</p> <p>How can I personally figure out where a certain IP belongs without using one of these services?</p>
<p>For what it's worth, I worked at a senior level in the ISP industry for more than a decade so I have quite some experience with this.</p> <p>Large IP ranges are allocated as needed by <a href="http://www.iana.org/" rel="noreferrer">IANA</a> to each of the <a href="http://en.wikipedia.org/wiki/Regional_Internet_Regi...
<p>Alnitak's answer is pretty much on the mark.</p> <p>As a side note, if you want to use a .dll to determine the user's location, then you can try this <a href="http://www.codeplex.com/IPAddressExtensions" rel="nofollow noreferrer" title="Click me! Click me!">IPAddressExtension</a> found on <a href="http://www.codepl...
34,553
<p>The situation is like this : Main project A. and a class library B. <strong>A references B</strong></p> <p>Project B has the classes that will be serialized. The classes are used in A. Now, the problem appears when from Project A I try to serialize the objects from B. An exception is thrown that says a class from A...
<p>I have written a tool called <a href="http://kent-boogaart.com/blog/sertool" rel="nofollow noreferrer">sertool</a> that will tell you what in your object graph cannot be serialized and how it is being referenced.</p>
<p>Let's say TA and TB are types defined in A and B. Let's say there's an interface I either in B or an assembly both B and A reference. TA implements I. TB has a public, settable property of type I named P.</p> <p>You can now do this:</p> <pre><code>TB b = new TB(); b.P = new TA(); </code></pre> <p>Since TA impleme...
22,001
<p>When I try to run a .NET assembly (<code>boo.exe</code>) from a network share (mapped to a drive), it fails since it's only partially trusted:</p> <pre><code>Unhandled Exception: System.Security.SecurityException: That assembly does not allow partially trusted callers. at System.Security.CodeAccessSecurityEngine...
<p>With .NET 3.5 SP1, .NET assemblies running from UNC shares have full permissions. </p> <p>See Brad Abrams's <a href="http://blogs.msdn.com/brada/archive/2007/10/26/adhoc-poll-allowing-net-exes-to-run-off-a-network-share.aspx" rel="noreferrer">Allow .exes to be run off a network shares</a> for workaround and discuss...
<p>I think you want to add the <a href="http://msdn.microsoft.com/en-us/library/system.security.allowpartiallytrustedcallersattribute.aspx" rel="nofollow noreferrer">AllowPartiallyTrustedCallers</a> attribute to your assembly. The error message implies that something that's calling into your boo.exe assembly is not fu...
4,407
<p>I am writing a few extensions to mimic the map and reduce functions in Lisp.</p> <pre><code>public delegate R ReduceFunction&lt;T,R&gt;(T t, R previous); public delegate void TransformFunction&lt;T&gt;(T t, params object[] args); public static R Reduce&lt;T,R&gt;(this List&lt;T&gt; list, ReduceFunction&lt;T,R&gt; ...
<p>These look very similar to extensions in Linq already:</p> <pre><code>//takes a function that matches the Func&lt;T,R&gt; delegate listInstance.Aggregate( startingValue, (x, y) =&gt; /* aggregate two subsequent values */ ); //takes a function that matches the Action&lt;T&gt; delegate listInstance.ForEach...
<p>You might want to add a way to do a map but return a new list, instead of working on the list passed in (and returning the list can prove useful to chain other operations)... perhaps an overloaded version with a boolean that indicates if you want to return a new list or not, as such:</p> <pre><code>public static Li...
6,127
<p>I have a ToggleButtonBar with a DataProvider setup like this:</p> <pre><code> &lt;mx:ToggleButtonBar itemClick="clickHandler(event);" selectedIndex="0"&gt; &lt;mx:dataProvider&gt; &lt;mx:String&gt;{resourceManager.getString('dashboard','daily')}&lt;/mx:String&gt; &lt;mx:String&gt;{resourceMana...
<p>I would abstract out the data for your data provider into a bindable variable, then just reset the data provider when you change locals.</p> <pre><code>&lt;mx:Script&gt; &lt;![CDATA[ [Bindable] myArray:Array = new Array( [resourceManager.getString('dashboard','daily')] ...
<p>The trick is to add brackets around each element in the dataProvider array, that way it gets parsed correctly. Note that this also binds correctly to locale changes in flex, no custom event dispatching is needed.</p> <pre><code>&lt;mx:ToggleButtonBar itemClick="clickHandler(event);" selectedIndex="0" dataProvid...
46,229
<p>Sorry if this is a really basic question but I struggling with how I should attack this. I am trying to wrap up some commands for a OLE object, the basic spec looks like this:</p> <pre><code>Set Window window_id //Units is part of the position setter. [ Position ( x, y ) [ Units paper_units ] ] [ Widt...
<p>That sounds reasonable to me. I would definately keep the construction of the ICommand instances internal to the CommandBuilder:</p> <pre><code>class CommandBuilder { private List&lt;ICommand&gt; _commands = new List&lt;ICommand&gt;(); public CommandBuilder Position(double x, double y) { _commands.Add(ne...
<p>Yes. I think you got it covered well enough.</p>
47,212
<p>I know that I can do something like</p> <pre><code>$int = (int)99; //(int) has a maximum or 99 </code></pre> <p>To set the variable <code>$int</code> to an integer and give it a value of <code>99</code>. </p> <p>Is there a way to set the type to something like <code>LongBlob</code> in MySQL for <code>LARGE</code>...
<p>No. PHP does what is called automatic type conversion.</p> <p>In your example</p> <pre><code>$int = (int)123; </code></pre> <p>the "(int)" just assures that at that exact moment 123 will be handled as an int.</p> <p>I think your best bet would be to use a class to provide some sort of type safety.</p>
<p>No, the type LongBlob is specific to MySQL. In PHP it is seen as binary data (usually characters), if you tried to convert it to an int it would take the first 32 bits of data (platform dependent) and push that into the variable.</p>
6,490
<p>I am developing a website using CodeIgniter and PHP. Some of my friends suggest I start using Subversion to take care of my organization. Could someone give me a basic explanation of what SVN is without the jargon and also if it is practical for a framework where 5 files are needed to run a single page?</p>
<p>Subversion allows you to store your source in a central location, make changes from multiple places (ie. laptop, desktop), track changes and revert changes to your source tree if needed.</p> <p>Have you ever made a big 'improvement' and then decided you were going in the wrong direction? With Subversion you can rev...
<p>SVN is a <a href="http://en.wikipedia.org/wiki/Revision_control" rel="nofollow noreferrer">version control</a> system - which means that it stores various previous versions of a given file, and allows many people to work on the same file, and in the end put all the changes together. It also helps you go back to a pr...
41,995
<p>So my favourite web tool, <a href="http://subtlety.errtheblog.com" rel="noreferrer">Subtlety</a>, was recently discontinued, which means that I no longer have easy access to the commit logs of various SVN projects that I follow. Are there any other tools that easily pump out an RSS feed of commits for a public SVN ...
<p>I was going to suggest Trac as well, until I realized you probably don't have administrative control over the repositories in question. Perhaps this apparent solution will work for you?</p> <p><a href="http://svnfeed.com/" rel="noreferrer">http://svnfeed.com/</a></p> <p>It seems to work well for the one repositor...
<p>There's <a href="http://www.subversionary.org/projects/subverssed" rel="nofollow noreferrer">subveRSSed</a>, which you just drop into your post-commit action.</p>
15,199
<p>I am having problems connecting to a Sqlite database through System.Data.Sqlite. I was trying to use FluentNhibernate but that didn't work, so I went back to basics but got the same error: Cannot find entry point sqlite3_open_v2 in DLL sqlite3.</p> <p>This is my (fairly simple I believe) code:</p> <pre><code>using...
<p>It may be the version of Sqlite3 you are working against. The V2 methods are relatively new - <a href="http://www.sqlite.org/34to35.html" rel="nofollow noreferrer">introduced in v3.5</a> </p>
<p>Another possible explanation is that you're using a 32 bit version of the provider in a 64 bit application.</p>
47,074
<p>Besides full-text indexing and using LIKE keyword, what are other tools to build search functionality on top of MS SQL? This question is particularly for searching records, not files.</p>
<p>2008's <a href="http://technet.microsoft.com/en-us/library/cc721269.aspx" rel="nofollow noreferrer">full text search capabilities</a> have been improved - perhaps look there first..</p>
<p>I believe MS SQL 2005+ has the capability to search using regular expression. </p> <p>MSDN has an article about this <a href="http://msdn.microsoft.com/en-us/magazine/cc163473.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163473.aspx</a>.</p>
10,493
<p>I have a do-while loop that's supposed to do three things, go through a text file line by line, the text file contains pathnames and filenames (C:\Folder\file1.txt).</p> <p>If the line contains a certain string, it then copies a file to that location, renames it to what it is named in the text file, and then replace...
<p>I don't believe</p> <pre><code>#3 = Replace$(#3, "abc", "xyz") </code></pre> <p>is valid. You will need to read the contents of that file in, preferable line by line (or some sensible chunk at a time), do your replacement, then write it back out to a new file. As you are copying the file anyway I would suggest re...
<p>One problem I see is that you're opening filehandle, then #3, but you close them in the same order, and you should be closing #3, then filehandle.</p> <p>What I see happening is that filehandle is opened, then it searches for a line that contains ".log", then it does something - so far, so good. However, it then op...
37,406
<p>I'm trying to create a user control that allows users to make something like the following:</p> <pre><code> &lt;uc1:MyControl id="controlThing" runat="server"&gt; &lt;uc1:BoundColumn id="column1" Column="Name" runat="server" /&gt; &lt;uc1:CheckBoxBoundColumn id="column2" Column="Selector" runat="server" /...
<p>The PersistenceMode.InnerProperty is what you want.. Here are the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.persistencemode.aspx" rel="nofollow noreferrer">MSDN docs.</a> Doing something like this will get you what you want:</p> <pre><code>[PersistenceMode(PersistenceMode.InnerProperty)] publi...
<p>Is it possible for you to override an existing control such as a ListView or GridView? That's your simplest option.</p> <p>But to create your own custom templated control you need to use ITemplate.</p> <p>I haven't done one but a quick google returned this: <a href="http://www.developerfusion.com/article/4410/in-d...
22,461
<p>e.g,</p> <pre><code>foo1 foo2 foo10 foo100 </code></pre> <p>rather than</p> <pre><code>foo1 foo10 foo100 foo2 </code></pre> <p>Update: not interested in coding the sort myself (although that's interesting in its own right), but having the database to do the sort for me.</p>
<p>You can use functions in your order-by clause. In this case, you can split the non-numeric and numeric portions of the field and use them as two of the ordering criteria.</p> <pre><code>select * from t order by to_number(regexp_substr(a,'^[0-9]+')), to_number(regexp_substr(a,'[0-9]+$')), a; </...
<p>I use the following function to 0-pad all sequences of digits shorter than 10 that could be found in the value, so that the total length of each to become 10 digits. It is compatible even with mixed sets of values that have one, many or none sequences of digits in them.</p> <pre><code>CREATE OR replace function NAT...
27,077
<p>Is there a good library to use for gathering user input in Linux from the mouse/keyboard/joystick that doesn't force you to create a visible window to do so? SDL lets you get user input in a reasonable way, but seems to force you to create a window, which is troublesome if you have abstracted control so the control...
<p>OK, if you're under X11 and you want to get the kbd, you need to do a grab. If you're not, my only good answer is ncurses from a terminal.</p> <p>Here's how you grab everything from the keyboard and release again:</p> <pre> /* Demo code, needs more error checking, compile * with "gcc nameofthisfile.c -lX11". /* ...
<p>For the mouse you can use <a href="http://www.linuxjournal.com/article/4600" rel="nofollow noreferrer">GPM</a>.</p> <p>I'm not sure off the top of my head for keyboard or joystick.</p> <p>It probably wouldn't be too bad to read directly off there <code>/dev</code> files if need be. </p> <p>Hope it helps</p>
7,290
<p>I am writing a scraper that downloads all the image files from a HTML page and saves them to a specific folder. All the images are part of the HTML page.</p>
<p>Here is some code to download all the images from the supplied URL, and save them in the specified output folder. You can modify it to your own needs.</p> <pre><code>""" dumpimages.py Downloads all the images on the supplied URL, and saves them to the specified output file ("/test/" by default) Usage: ...
<pre class="lang-py prettyprint-override"><code>import urllib.request as req with req.urlopen(image_link) as d, open(image_location, &quot;wb&quot;) as image_object: data = d.read() image_object.write(data) </code></pre>
32,121
<p>I'm currently in the process of fine-tuning my cheap CTC i3 clone. I'm using Cura 3.1 for slicing.</p> <p>After calibrating the extruder steps, I wanted to optimize the line width and flow compensation parameters. I am using a 0.4 mm nozzle and therefore set the line width parameter to 0.4 mm in Cura. I then printe...
<p>That is very bizarre. Since GCODE describe each movement of the printing head (so, the printer does not get to decide anything in terms of printing strategy, it just executes), I can only see three possibilities that would explain what's going on.</p> <p><strong>The print is being scaled up at printer level</stron...
<p>Cura does not adjust line width to account for lower flow (aka extrusion multiplier), they are independent settings. Therefore, if you have to reduce extrusion to get the correct wall thickness, then as you said, the lines may not be close enough together to fuse properly and you'll have a weak part. Try reducing th...
826
<p>I have a problem I have got stuck on. </p> <p>I want to export my Access table to an Excel file. Currently, I do that using <code>DoCmd.TransferSpreadsheet</code>, but I want some kind of formatting to be done on the exported data. Can I format that data I am sending to Excel or do I have to write a macro in Excel ...
<p>I don't really have any experience with this domain, but please note that Excel has a row limit that is way smaller than that of Access.</p>
<p>If you use <code>DoCmd.TransferSpreadsheet</code> and create an original and then edit it so that the formatting is correct, you can then run <code>DoCmd.TransferSpreadsheet</code> again and it will update the file with the values but keep the formatting.</p> <p>However, if a human then edits the file by adding new...
46,761
<p>These are some questions for any developer whose made the jump from Java to .Net:</p> <p>If you could go back to the start of your switched, what would you do to make the transition easier? </p> <p>Any books you would recommend?</p> <p>How is .Net compared to Java EE? Anything that totally bugs you?</p> <p>And ...
<p>I did several years of C/C++ development in between Java and .NET, so my experience may be a bit different.</p> <p>I found the move from Java to C# very easy. The languages are very similar and much of the framework works in similar ways. I loved Java, but I don't think I will be going back. I think the biggest dif...
<p>Don't think of it as a switch. If you learn a new language like C#, you're not trading in all the knowledge you have in Java. It takes several months until you skills in other languages start to degrade. Try it out and see if it's for you. Java will be there for several more years if you change your mind. :)</p...
37,586
<p>How do I do forward referencing / declaration in C++ to avoid circular header file references?</p> <p>I have the #ifndef guard in the header file, yet memory tells me I need this forward referencing thing - which i've used before >&lt; but can't remember how. </p>
<p>You predeclare the class without including it. For example:</p> <pre><code>//#include "Foo.h" // including Foo.h causes circular reference class Foo; class Bar { ... }; </code></pre>
<p>You won't get circular header files references if you have #ifndef guards. That's the point. </p> <p>Forward referencing is used to avoid #include(ing) header files for objects you use only by pointer or reference. However, in this case you are not solving a circular reference problem, you're just practicing goo...
22,234
<p>I'm using an Ender 5 with standard PLA and Creality slicer 4.8.2.</p> <p>How can I deliberately maximise stringing, and if possible get it to be as consistent as possible.</p> <p>My aim is to have &quot;thousands of hair like threads strung between two rocky pillars&quot;.</p> <p>If possible I'd like to do this in t...
<ol> <li>Eliminate retraction in slicer.</li> <li>Print at a higher hot end temperature; something like +10°C higher than recommenced temperature.</li> <li>Slow down speed hot end moves when not printing.</li> <li>Maximize hot end movement without printing where you want strings.</li> </ol>
<p>Slicers will perform a retraction when moving from one solid to another, the value of which is part of the settings. I've not researched if a specific slicer will allow a negative retraction, but if it's possible, it's likely to create adjustable stringing.</p> <p>If negative retraction is not possible, one can iden...
2,187
<p>I would like to learn more about C++0x. What are some good references and resources? Has anyone written a good book on the subject yet?</p>
<h2>Articles on</h2> <p><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=254" rel="noreferrer">Lambda Expressions</a>,</p> <p><a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=276" rel="noreferrer">The Type Traits Library</a>,</p> <p><a href="http://www.informit.c...
<p>There is a ton of stuff on this very site - some of the posts include very informative discussion. I would point you to Google but it's going to be more efficient to search in <a href="https://stackoverflow.com/questions/tagged/c%2b%2b0x">C++0x tagged posts</a> here imo. </p> <p>Here's <a href="https://stackoverf...
24,419
<p>I'm trying to log users out when the user's session timeout happens. Logging users out - in my case - requires modifying the user's "online" status in a database.<br> I was thinking that I might be able to use the observer pattern to make something that would monitor the state of the user session and trigger a call...
<p>Take the simplest case first. Suppose you have 1 user on your system, and you want their session to timeout, and you want accurate reporting of their status. The user has not been to a page in 12 minutes, and your session timeout is set to 10 minutes. One of two things will happen. Either they will visit again in a ...
<p>Ugly but maybe workable suggestion:</p> <p>Add an asynchronous keep-alive requester to pages, that updates their last-active timestamp. You can then have a cron job that marks users as offline if they have a last-active timestamp more than 20 seconds old. Setting that cron job to run every minute would do the trick...
30,728
<p>I have an application that runs a huge stored procedure on SQL Server 2000. Usually it takes about 1 minute to complete, but occasionally it will take MUCH longer. Just now I ran it three times in a row in my test system. It took 1:12, 1:23, and 55:25. What would cause that behavior? There are other things going on...
<p>Create a trace and examine it in Profiler. That should at least point towards where the problem lies - in your procedure or elsewhere.</p>
<p>It's probably parameter sniffing: based on the input, Sql Server chose a different query plan.</p> <p>Another possibility is that a separate query was running at the same time and locked everything up.</p>
24,602
<p>I have an html table which i bind data dynamically on the server side in C#.. The problem is that I have a search button that calls a search on the DB(in a search method on the server side) based on the information from the client page. this search method loads the info from the DB and updates the html table(this is...
<p>One way:</p> <pre><code> public class Sample : INotifyPropertyChanged { private const double Multiplier = 1.21; #region Fields private double price; private double vat; #endregion #region Properties public double Price { get { retur...
<p>Have a look at <a href="http://polymod.codeplex.com/" rel="nofollow">Polymod.NET</a>. If you have a 'Price' property on a domain object, you can create a model for that domain class, define a formula 'PriceVat' = Price * 0.1. The model will know that PriceVat changes when Price changes, and tell the UI about it.</p>...
48,713
<p>It's a simple case of a javascript that continuously asks "are there yet?" Like a four year old on a car drive.. But, much like parents, if you do this too often or, with too many kids at once, the server will buckle under pressure..</p> <p>How do you solve the issue of having a webpage that looks for new content i...
<p>stackoverflow does it some way, don't know how though. </p> <p>The more standard way would indeed be the javascript that looks for new content every few seconds.</p> <p>A more advanced way would use a <a href="http://en.wikipedia.org/wiki/Push_technology" rel="nofollow noreferrer">push-like</a> technique, by using...
<p>I would have a single instance calling the DB and if a newer timestamp exists, put that new timestamp in a application variable. Then let all sessions check against that application variable. Or something like that. That way only one innstance are calling the sql-server and the number of clients does'nt matter. </p>...
36,893
<p>I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains a TreeView. The second panel contains a label and is triggered by a selection in the tree. When I select a node the label gets updated as expected and the <code>TreeNode</code> that I clicked on becomes highlighted and the previously...
<pre><code> /// &lt;summary&gt; /// Remove selection from TreeView /// &lt;/summary&gt; /// &lt;param name="tree"&gt;&lt;/param&gt; public static void ClearTreeView(TreeView tree) { if (tree.SelectedNode != null) { tree.SelectedNode.Selected = false; } } <...
<p>You need to set the selection to false for all nodes. </p> <p>I use something like this for one of my applications (with my treeview tvCategories):</p> <pre><code>public void RefreshSelection(string guid) { if (guid == string.Empty) ClearNodes(tvCategories.Nodes); else SelectNode(guid, tvCa...
25,240
<p>The code below pretty much sums up what I want to achieve. </p> <p>We have a solution which comprises many different projects however we have a need to be able to call methods in projects from projects which are not referenced (would cause circular reference).</p> <p>I have posted previous questions and the code b...
<p>I used <code>Activator.CreateInstance</code> to do this. You load the assembly from a path and then create an instance of the class. For example, you could use this to load gadgets assemblies in a host application where the host doesnt know about the gadgets at compile time.</p> <p>Sample Pseudo Code (no error hand...
<p>I should probably clarify the motivation behind needing to do this. Perhaps there is a better way ....</p> <p>We have a baseform from which all other projects are referenced. As an example we pass an object which contains various settings to the project when it is loaded (from the baseform).</p> <p>If for example,...
48,371
<p>So... I used to think that when you accessed a file but specified the name without a path (CAISLog.csv in my case) that .NET would expect the file to reside at the same path as the running .exe. </p> <p>This works when I'm stepping through a solution (C# .NET2.* VS2K5) but when I run the app in normal mode (Star...
<p>When an application (WinForms) starts up, the <code>Environment.CurrentDirectory</code> contains the path to the application folder (i.e. the folder that contains the .exe assembly). Using any of the File Dialogs, ex. <code>OpenFileDialog</code>, <code>SaveFileDialog</code>, etc. will cause the current directory to ...
<p>You can use this to specify a path that resides at the same path of your exe @"..\CAISLog.csv". Please note that the double dots refer to the parent directory of where ever your .exe lies.</p> <p>RWendi</p>
33,406
<p>I've got a table that is supposed to track days and costs for shipping product from one vendor to another. We (brilliantly :p) stored both the shipping vendors (FedEx, UPS) with the product handling vendors (Think... Dunder Mifflin) in a "VENDOR" table. So, I have three columns in my SHIPPING_DETAILS table that all ...
<p>You defined the primary key twice. Try:</p> <pre><code>CREATE TABLE SHIPPING_GRID( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Unique ID for each row', shipping_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to VENDOR.no for the shipping vendor (vendors_type must be 3)', start_vendor_no IN...
<p>I ran the code here, and the error message showed (and it is right!) that you are setting <em>id</em> field twice as primary key.</p>
2,809
<p>I have a simple class in my WCF service that doesn't seem to be showing up properly for the client that accesses my WCF.</p> <p>My class has 4 public properties that are of type string.</p> <p>I marked the class with [DataContract()] and each member with [DataMember].</p> <p>Why is my constructor not visible? Is...
<p>Data contracts do not have anything to do with constructors. So, when you create your proxy on the client, you will only get a class that implements the data contract.</p> <p>If you want to add a similar constructor on the client side (assume the type generated is named SomeDataItem), you can add it using a partia...
<p>The parenthesises are not required when you mark a class as a data contract. Can you provide a code sample of you class?</p>
38,361
<p>I have heard that Microsoft SharePoint was used by many companies. Could someone tell me briefly what is SharePoint and why is it popular?</p>
<h2>What is SharePoint?</h2> <p>The latest version of Microsoft SharePoint software is really two different products: </p> <ol> <li><strong>Windows SharePoint Services</strong> is a free download for Windows Server. In the latest version, known as WSS v3, collaborative web sites templates include basic blog and wiki...
<p>Sharepoint, MS OFFICE proxy circa 2003...</p> <p>remember when you emailed a copy of that word doc out to the whole company, that's what sharepoint is for, but apparently you missed the introductory gotomeeting training course.</p>
11,469
<p>I'm preparing a string that will be <code>eval</code>'ed. The string will contain a clause built from an existing <code>Array</code>. I have the following:</p> <pre><code>def stringify(arg) return "[ '" + arg.join("', '") + "' ]" if arg.class == Array "'#{arg}'" end a = [ 'a', 'b', 'c' ] eval_str = 'p ' + ...
<p><code>inspect</code> should accomplish what you are wanting.</p> <pre><code>&gt;&gt; a = %w(a b c) =&gt; ["a", "b", "c"] &gt;&gt; a.inspect =&gt; "[\"a\", \"b\", \"c\"]" </code></pre>
<p>I may be misunderstanding you, but does this look better at all?</p> <pre><code>&gt;&gt; a = %w[a b c] =&gt; ["a", "b", "c"] &gt;&gt; r = "['#{a.join("', '")}']" =&gt; "['a', 'b', 'c']" &gt;&gt; r.class =&gt; String </code></pre> <p>I suppose I'm confused by the need for eval, unless that's a part of something out...
39,806
<p>I am trying to build a CAML query for SharePoint 2007 environment, to get items from a calendar list. Want to query items with a given 'From date' and 'To date', the calendar list contains 'EventDate' and 'EndDate' in Datetime format. I am only interested in the date part of the datetime field.</p> <p>How can I tri...
<p>Unfortunately you have to use CAML.</p> <p>You should be able to trim the time part...</p> <pre><code>&lt;Where&gt; &lt;Gt&gt; &lt;FieldRef Name='EventDate' /&gt; &lt;Value IncludeTimeValue='FALSE' Type='DateTime'&gt;2008-12-03T12:00:00Z&lt;/Value&gt; &lt;/Gt&gt; &lt;/Where&gt; </code></pre>
<p>Conversely, if you are working in with the object model in code, you can use LINQ to SharePoint (<a href="http://www.codeplex.com/LINQtoSharePoint" rel="nofollow noreferrer">http://www.codeplex.com/LINQtoSharePoint</a>).</p> <p>In the background, the project is just creating a CAML Query for you but you won't have ...
43,628