instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Can any one tell me how to convert an legacy application which is vb6 ( COM dll's ocx and exes) to use Regfree COM .</p>
<p>I tried opening the dlls in visual studio and created manifest file, but some of the dlls it is giving error.</p>
<p>Is there any tools out there which will help me to do this process?</p>
... | <p>To create manifest files you can try to use Make My Manifest from <a href="http://mmm4vb6.atom5.com/" rel="nofollow noreferrer">http://mmm4vb6.atom5.com/</a>.</p>
<p><em>EDIT</em> The MMM website is down. I see <a href="http://web.archive.org/web/20140829021337/http://mmm4vb6.atom5.com/" rel="nofollow noreferrer">h... | <p>Make My Manifest can accomodate late binding as well as early binding. You simply have to add the references to the late-bound dependencies manually, by file location or by ProgId.</p>
<p>You might look at <a href="http://mmm4vb6.atom5.com/mmm-demo-1248.html" rel="nofollow noreferrer">http://mmm4vb6.atom5.com/mmm-... | 33,999 |
<p>I am writing a little application, which is writing jpeg images at a constant rate on a SD card.
I choose an EXT3 filesystem, but the same behaviour was observed with an EXT2 filesystem.</p>
<p>My writing loop looks like this :</p>
<pre><code>get_image()
fwrite()
fsync()
</code></pre>
<p>Or like this :</p>
<pre>... | <p>Is it necessary to <code>fsync()</code> after every file? You may have better luck letting the OS decide when a good time is to write out all enqueued images to the SD card (amortizing the startup cost of manipulating the SD card filesystem over many images, rather than incurring it for every image).</p>
<p>Can yo... | <p>Might also consider the SD Card, is it NOR or NAND? This page shows an order of magnitude between sd cards (2M/s vs 20M/s).<br>
<a href="http://www.robgalbraith.com/bins/camera_multi_page.asp?cid=6007-9597" rel="nofollow noreferrer">http://www.robgalbraith.com/bins/camera_multi_page.asp?cid=6007-9597
</a><br>
... | 23,326 |
<p>How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write.</p>
<p>I looked on google and found a <a href="http://mamchenkov.net/wordpress/2005/04/27/subversion-and-file-permis... | <p>One possible solution would be to write a script that you check in with the rest of your code and which is run as the first step of your build process.</p>
<p>This script runs through your copy of the codebase and sets read permissions on certain files.</p>
<p>Ideally the script would read the list of files from a... | <p>Consider using <a href="http://svnbook.red-bean.com/nightly/en/svn.advanced.locking.html" rel="nofollow noreferrer"><code>svn lock</code></a> to disallow others from writing to the file.</p>
| 8,005 |
<p>Have someone ever done this before???</p>
<p>I am trying to use MinGW to compile a program using the MySQL libraries. I keep getting the message that the function 'rint' is redefined. Ok it's true that the function is in both files config-win.h, from MySQL and math.h from the standard library, but both of them are ... | <p>Also a guess, but it appears as if math.h AND config-win.h have a function called rint, make sure that there aren't two functions with the same names. </p>
<p>BTW, because I am not entirely sure, I'm making this community editable, feel free to edit this post if I am incorrect.</p>
| <p>I don't know the stack in question but my guess would be that somehow math.h is getting double included. Take a look at the math.h file. There should be an <a href="http://en.wikipedia.org/wiki/Include_guard" rel="nofollow noreferrer">include guard</a> somewhere close to the top. Follow the link if you're not fam... | 21,448 |
<p>I have a team of developers distributed Globally over different time zones.</p>
<p>what are the best tools to achieve maximum productivity in such a team?</p>
<p>I am looking for:</p>
<ul>
<li>Source Control</li>
<li>Bug Tracking</li>
<li>Build Management</li>
<li>Any other thing that may help</li>
</ul>
<p>Than... | <p>For the first two:</p>
<ul>
<li>Distributed source control, like <a href="http://git.or.cz/" rel="nofollow noreferrer">git</a></li>
<li>A good issue tracking tool, like <a href="http://www.atlassian.com/software/jira/" rel="nofollow noreferrer">Jira</a></li>
</ul>
| <p>I think you'll need a few more things to help out with this project than what you've asked.</p>
<p>First, I'll give my recommendations for your list:</p>
<ul>
<li>Source control: git or svn, if yu use either of these, you'll need a way to let your developers know who checked in what and when, Trac is good for this... | 47,652 |
<p>I'm about to release a set of Eclipse plug-ins as Open Source and noticed that most source code released under the LGPL/EPL contains a header banner in each file that refers to the license or contains the license itself.</p>
<p>Since adding these banners to each file manually seems to be a daunting and error-prone ... | <p>Concerning best practises, I believe you should have your license text in a separate file and have a build tool (ie ant) to add it at the beginning of all other files. Since you are talking about an open source project you would need a build process anyway for thinks like generating the javadocs, publishing releases... | <p>A more Eclipse-like approach than the manual addition is the following, done via GUI in Eclipse. Note that these are the Linux / Windows menus; Mac is a bit different.</p>
<ol>
<li>Open <code>Windows->Preferences</code></li>
<li>Navigate to <code>Java->Code Style->Code Templates</code></li>
<li>Edit the <... | 25,059 |
<p>I have a python module that defines a number of classes:</p>
<pre><code>class A(object):
def __call__(self):
print "ran a"
class B(object):
def __call__(self):
print "ran b"
class C(object):
def __call__(self):
print "ran c"
</code></pre>
<p>From within the module, how might I... | <pre><code>import sys
getattr(sys.modules[__name__], 'A')
</code></pre>
| <pre>
classes = [x for x in globals().values() if isinstance(x, type)]
</pre>
| 42,332 |
<p>I have a single-threaded application that loads several assemblies at runtime using the following:</p>
<pre><code>objDLL = Assembly.LoadFrom(strDLLs[i]);
</code></pre>
<p>I would like the assemblies loaded in this manner to use the same log4net.ILog reference as the rest of the assemblies do. But it appears the ru... | <p>If all your assemblies implement a common interface, then you could have a property or constructor parameter that allows you to pass your local instance of ILog to the dynamically loaded assemblies. </p>
| <p>Something about the runtime loaded class prevents the usual one ILog per class from working. I can get a valid ILog instance, but unlike all the other instances it appears not to be configured (all the Is**Enabled flags are set to false). Perhaps the "root" logger is not accessible to the classes loaded at runtime??... | 16,482 |
<p>I'm using the PHP function imagettftext() to convert text into a GIF image. The text I am converting has Unicode characters including Japanese. Everything works fine on my local machine (Ubuntu 7.10), but on my webhost server, the Japanese characters are mangled. What could be causing the difference? Everything shou... | <p>Here's the solution that finally worked for me:</p>
<pre><code>$text = "你好";
// Convert UTF-8 string to HTML entities
$text = mb_convert_encoding($text, 'HTML-ENTITIES',"UTF-8");
// Convert HTML entities into ISO-8859-1
$text = html_entity_decode($text,ENT_NOQUOTES, "ISO-8859-1");
// Convert characters > 127 int... | <p>Does that particular font file exist on your production machine? If using FTP to upload your files, are you using binary encoding?</p>
| 24,108 |
<p>I am working on a project and trying to determine what platform to use. Right now, my first choice would be to use ASP.Net MVC with a MySql database. My concern with this is that the MySql drivers have a GPL license. I am creating this for a company and therefore it can't be an open-source project. Here are the ques... | <p>Using the MySQL libraries will GPL your code base.</p>
<p>If you're writing the code for multiple customers, you will be obligated to release the source code to you system to THOSE customers. You have no obligation under the GPL to open the source code to the public at large, you simply can not prevent someone else... | <p>@Jeff-Donnici: I have definitely not ruled out using SQL Server. The 2 reasons I'm leaning towards MySql is in that 1) if it ever becomes too big for a shared hosting provider, that would be a much cheaper option and 2) I will need to be able to create multiple databases and from what I have seen of the shared hosti... | 35,413 |
<p>I am checking whether the new name already exists or not.</p>
<p>Code 1</p>
<pre><code>if(cmbxExistingGroups.Properties.Items.Cast<string>().ToList().Exists(txt => txt==txtNewGroup.Text.Trim())) {
MessageBox.Show("already exists.", "Add new group");
}
</code></pre>
<p>Otherwise I could have... | <p>I appreciate the cleverness of the first sample (assuming it works), but the second one is a lot easier for the next person who has to maintain the code to figure out.</p>
| <p>I imagine that on the WTF's per minute scale, the first would be off the chart. Count the dots, any more than two per line is a potential problem</p>
| 19,315 |
<p>How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request.</p>
<p>This would allow people to hit a url to the type <a href="http://www.foo.com?Image=test.jpg" rel="nore... | <p>This is ugly, but the best way is to look at the file and set the content type as appropriate:</p>
<pre><code>switch ( fileExtension )
{
case "pdf": Response.ContentType = "application/pdf"; break;
case "swf": Response.ContentType = "application/x-shockwave-flash"; break;
case "gif": Response.Content... | <p>This is part of a solution I use on a local intranet. Some of the variables you will have to collect yourself as I pull them from a database but you may pull them from somewhere else.</p>
<p>The only extra but I've got in there is a function called <strong>getMimeType</strong> which connects to the database and pul... | 2,542 |
<p>We know from <a href="https://3dprinting.stackexchange.com/a/183/11242">this answer</a>, 3d printed materials continue to outgas after printing and being cured. My question relates to this:</p>
<ul>
<li>How much does heating the printed object after printing (or being cured) affect out-gassing? </li>
<li>Does the c... | <p>This is not an answer to your question, but it relates to outgassing so I am sharing it here. </p>
<p>I have used the acetone vapor method of smoothing the surface of ABS prints. It works really well, and the surface becomes much smoother and glassy. I printed a large coffee mug (lets, for the moment, ignore foo... | <p>The effect of temperature on outgas rates is a subject for Engineering.SE . As to continued outgassing - depends on the material in question. To pick an extreme example, solid CO2 (dry ice) will outgas until it's gone. But stuff that's got VOCs is expected to outgas; said volatiles leave by design and the remainin... | 982 |
<p>I have been trying to get more in to TDD. Currently keeping it simple with lots of <code>Debug.Asserts</code> in a console application.</p>
<p>Part of the tests I wanted to complete was ensuring that events were raised from the object, the correct number of times, since client code will depend on these events.</p>
... | <p>The easiest thing you can do is subscribe an anonymous method or a lambda to the event and increment a counter that's local to your test in it. No need to use an extra class at all.</p>
<p>I found this won't make your code very readable so I've done about the same thing. I've written monitor objects in several proj... | <p>looks fine to me - since it works ;-)</p>
| 43,311 |
<p>Does anybody if the Anycube Mega X comes with a nozzle for 1.75 mm filaments or is it 2.85 mm?
I saw online that it works with 1.75 mm filaments but the Cura settings given by the manufacturer had 2.85 mm.</p>
<p>I should mention that using a 1.75 mm filament works BUT my designs have clear under-extrusion, which is... | <p>Reading all 49 pages of the manual was fruitless. I'm astonished that there is no reference to the filament diameter used in this printer.</p>
<p>From <a href="https://www.3djake.com/anycubic-3d-printer-and-accessories/mega-x" rel="nofollow noreferrer">3dJake's web site</a> comes a confirmation that the printer uses... | <p>This is a well-known problem with Cura. The filament diameter is set to 2.85 mm by default (probably because Ultimaker printers use 2.85 mm filament). This will cause extreme under-extrusion if your printer uses 1.75 mm filament. Simply change the filament diameter to 1.75 mm in Cura's printer definition, and everyt... | 1,927 |
<p>Is there a tool or script which easily merges a bunch of <a href="http://en.wikipedia.org/wiki/JAR_%28file_format%29" rel="noreferrer">JAR</a> files into one JAR file? A bonus would be to easily set the main-file manifest and make it executable.</p>
<p>The concrete case is a <a href="http://jrst.labs.libre-entrepri... | <p>Eclipse 3.4 JDT's Runnable JAR export wizard.</p>
<p>In Eclipse 3.5, this has been extended. Now you can chose how you want to treat your referenced JAR files.</p>
| <p>Sounds like <a href="http://ant.apache.org/" rel="nofollow noreferrer">Apache Ant</a> is what you're looking for.</p>
| 10,684 |
<p>I need an algorithm that can determine whether two images are 'similar' and recognizes similar patterns of color, brightness, shape etc.. I might need some pointers as to what parameters the human brain uses to 'categorize' images. .. </p>
<p>I have looked at hausdorff based matching but that seems mainly for match... | <p>I have done something similar, by decomposing images into signatures using <a href="http://en.wikipedia.org/wiki/Wavelet" rel="nofollow noreferrer">wavelet transform</a>.</p>
<p>My approach was to pick the most significant <em>n</em> coefficients from each transformed channel, and recording their location. This was ... | <p>There are some good answers in the other thread on this, but I wonder if something involving a spectral analysis would work? I.e., break the image down to it's phase and amplitude information and compare those. This may avoid some of the issues with cropping, transformation and intensity differences. Anyway, that... | 10,154 |
<p>The following test fails:</p>
<pre><code>#!/usr/bin/env python
def f(*args):
"""
>>> t = 1, -1
>>> f(*map(lambda i: lambda: i, t))
[1, -1]
>>> f(*(lambda: i for i in t)) # -> [-1, -1]
[1, -1]
>>> f(*[lambda: i for i in t]) # -> [-1, -1]
[1, -... | <p>They are different, because the value of <code>i</code> in both the generator expression and the list comp are evaluated lazily, i.e. when the anonymous functions are invoked in <code>f</code>.<br>
By that time, <code>i</code> is bound to the last value if <code>t</code>, which is -1.</p>
<p>So basically, this is w... | <p>Expression <code>f = lambda: i</code> is equivalent to:</p>
<pre><code>def f():
return i
</code></pre>
<p>Expression <code>g = lambda i=i: i</code> is equivalent to:</p>
<pre><code>def g(i=i):
return i
</code></pre>
<p><code>i</code> is a <a href="http://docs.python.org/ref/naming.html" rel="nofollow nor... | 16,909 |
<p>I have developed a COM component (dll) that implements an Edit() method displaying a WTL modal dialog.</p>
<p>The complete interface to this COM component corresponds to a software standard used in the chemical process industry (CAPE-OPEN) and as a result this COM component is supposed to be usable by a range of 3r... | <p>Are you using a parent for the Dialog? e.g.</p>
<pre><code>MyDialog dialog(pParent);
dialog.DoModal();
</code></pre>
<p>If you are, try removing the parent. Especially if the parent is the desktop window.</p>
| <p>Whatever you do, <strong>do not</strong> use the desktop window as the parent for your modal dialog box.</p>
<p>See here for explanation: <a href="http://blogs.msdn.com/b/oldnewthing/archive/2004/02/24/79212.aspx" rel="nofollow">http://blogs.msdn.com/b/oldnewthing/archive/2004/02/24/79212.aspx</a></p>
<p>To quote ... | 5,875 |
<p>I have a pretty generic Article model, with m2m relation to Tag model. I want to keep count of each tag usage, i think the best way would be to denormalise count field on Tag model and update it each time Article being saved. How can i accomplish this, or maybe there's a better way?</p>
| <p>You can do this by creating an <a href="http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships" rel="nofollow noreferrer">intermediate model</a> for the M2M relationship and use it as your hook for the <code>post_save</code> and <code>post_delete</code> signals to update th... | <p>This is a new feature in Django 1.2:
<a href="http://docs.djangoproject.com/en/dev/ref/signals/#m2m-changed" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/signals/#m2m-changed</a></p>
| 29,787 |
<p>In the external code that I am using there is enum: </p>
<pre><code>enum En {VALUE_A, VALUE_B, VALUE_C};
</code></pre>
<p>In another external code that I am using there are 3 #define directives: </p>
<pre><code>#define ValA 5
#define ValB 6
#define ValC 7
</code></pre>
<p>Many times I have int X which is equal t... | <p>Since you can't just cast here, I would use a free function, and if there are likely to be other enums that also need converting, try to make it look a little bit like the builtin casts:</p>
<pre><code>template<typename T>
T my_enum_convert(int);
template<>
En my_enum_convert<En>(int in) {
sw... | <p><strong>Converting <em>enum-to-int</em>, e.g. int(VALUE_A), happens automatically/transparently.</strong></p>
<p><strong>Converting <em>int-to-enum</em>, e.g. <em>En(ValA)</em>,</strong> can benefit from sanity checking to make sure the <em>int</em> value is a valid member of the <em>enum.</em> (Though hopefully t... | 48,009 |
<p>I have three unordered lists that have been created as Scriptaculous Sortables so that the user can drag items within the lists and also between them:</p>
<pre><code>var lists = ["pageitems","rowitems","columnitems"];
Sortable.create("pageitems", { dropOnEmpty: true, containment: lists, constraint: false });
... | <p>Maybe the empty list has no height, and therefore no droppable area available. If that's the case, perhaps you just need to set a minimum height, or some padding on the block.</p>
| <p>Make sure your target list is styled float:left</p>
<p>I had a similar experience today.</p>
| 10,720 |
<p>I would like to have my warnings set to the highest level using Microsoft Visual C++ compiler. Similar to using -pedantic on gcc. What compiler switches do you use to have the most warnings enabled?</p>
| <p>The highest warning level on Visual C++ is /Wall. The warning level can also be set numerically with /W0, /W1, ... /W4 to generate increasing levels of warnings.</p>
<p>The compiler will also check for 64 bit portability issues with /Wp64.</p>
<p>And you can tell it to treat warnings as errors with /WX</p>
<p>V... | <p><code>/W4 /Wall</code> should do the trick.</p>
| 27,126 |
<p>Most python frameworks will have a development webserver of some kind that will have a warning that it isn't for use as production servers. How much different do they tend to be from their production equivalents?</p>
<p>I haven't quite decided which framework to go with, much less what production server to use, so... | <p>The lower environments should try to match the production environment as closely as possible given the resources available. This applies to all development efforts regardless of whether they are python-based or even web-based. In practical terms, most organizations are not willing to spend that type of money. In thi... | <p>Your staging environment should mimic your production environment. Development is more like a playground, and the control on the development environment should not be quite so strict. However, the development environment should periodically be refreshed from the production environment (e.g,. prod data copied to the ... | 26,615 |
<p>How to hide the default toolbar and to disallow the default context menu of the <code>DocumentViewer</code> control?</p>
| <p>You can hide (or change) the toolbar by creating a control template for DocumentViewer without the toolbar.</p>
<p>start with the sample template from <a href="https://msdn.microsoft.com/en-us/library/aa970452(v=vs.100)" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/aa970452(v=vs.100)</a> and a... | <p>You can prevent the default context menu from appearing by handling the <code>ContextMenuOpening</code> event, and setting <code>ContextMenuEventArgs.Handled</code> to true.</p>
<p>As for the toolbar, I'm not sure - maybe you could somehow change the default style of the DocumentView to not include the toolbar? I h... | 24,664 |
<p>I have a web project, a C# library project, and a web setup project in Visual Studio 2005. The web project needs the C# library needs to be registered in the GAC. This is simple, just add the GAC folder to the setup project and drop the primary output of the C# library in there. The C# library also needs to be regis... | <p>To register the assemblies with COM use: regasm /codebase. See: <a href="http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx</a> for details. Your method for installing into the GAC seems fine to me.</p>
| <p>WIX, will allow you to install your COm objects and assemblies in the GAC with little fuss</p>
<p><a href="http://sourceforge.net/projects/wix" rel="nofollow noreferrer">WIX</a></p>
| 19,796 |
<p>How do you quickly find the URL for a Win32 API on MSDN? It's easy for .NET methods -- just add the method name (for example, System.Byte.ToString) to <a href="http://msdn.microsoft.com/library/" rel="nofollow noreferrer">http://msdn.microsoft.com/library/</a>.</p>
<p>However, for Win32 APIs (say GetLongPathName),... | <p>Google might be your best bet. I know the msdn site search has time and again pointed me in the wrong direction, but a quick switch to Google ("GetLongPathName site:msdn.microsoft.com") never steers me wrong.</p>
| <p>FWIW if you have the <strong>MSDN</strong> installed locally on your machine the <a href="http://www.zeusedit.com/forum/viewtopic.php?p=3758" rel="nofollow noreferrer">Zeus</a> editor has a feature to search the local copy of the <strong>MSDN</strong>.</p>
<p>For example, placing the cursor on the <strong>GetLongPa... | 10,085 |
<p>Is it possible to use a standard color inkjet cartridge to color filament for full color 3D printing?</p>
<p>It seems like a natural next step to me, but I haven't seen much of anything on this. (Just a few ancient experiments on reprap wiki.)</p>
<p>I've learned that some inkjet printers have the heads built into t... | <p>I don't think it makes a lot of sense - you don't need that kind of resolution, and getting a sufficient amount of ink that way to coat the filament would be hard. If you're going to be switching colors rapidly, you'd need a long purge between colors anyway. I also doubt the type of ink is suitable for sticking to f... | <p>AS an FYI, this is becoming available commercially:
<a href="https://www.xyzprinting.com/en-US/product-level/PROFESSIONAL/color-series" rel="nofollow noreferrer">https://www.xyzprinting.com/en-US/product-level/PROFESSIONAL/color-series</a></p>
| 1,734 |
<p>In a database prototype, I have a set of fields (like name, description, status) that are required in multiple, functionally different tables.</p>
<p>These fields always have the same end user functionality for labeling, display, search, filtering etc. They are not part of a foreign key constraint. How should this ... | <p>it sounds like you might be taking the idea of normalization a bit too far. remember, it's the idea that you're reducing redundancy in your <strong>data</strong>. your example seems to indicate you're worried about "redundancy" in the meta information of your database design.</p>
<p>ultimately though, <code>user.na... | <p>Normalisation is often best practice in any relational database (within reason). </p>
<p>If you have fields like state (meaning the state within a country), then a reference table like "State" with (id, short_name, long_name etc...) might be the way to go, then each record that references a state only need a state_... | 29,925 |
<p>I'm doing an AutoLisp project which uses long associative structures to do heavy geometrical processing - so I'm curious about the associative list intense use timing results.
How simple/complex is the implementation? It uses some data structure or a normal list of dotted pairs?
The are any extension for b-tree or s... | <p>In Common Lisp and Emacs Lisp association lists are linked lists, so they have linear search time. Assuming that AutoLisp is the same (and if it isn't, then their use of the term "Associative List" is misleading), you can assume that all operations will be linear in the length of the list. For example, an alist wi... | <p>There is no extension for b-tree that I know of but if you use Visual LISP you can use ActiveX objects and thus access most types of databases.</p>
| 32,882 |
<p>What does it mean that a Transaction Log is Full? I have it the file set to grow 20% when needed. I have 4GBs left on the drive. How do I solve this issue permanently?
Running these commands solves the issue temporarily:</p>
<pre>
DBCC SHRINKFILE('MyDatabase_log', 1)
BACKUP LOG MyDatabase WITH TRUNCATE_ONLY
DBCC SH... | <p>The Transaction Log is where SQL server 'Records' every change it makes so that if something goes wrong, (From software crash to Power failure, to an asteroid strike... well maybe not an an asteroid strike), it can "recover" by "undoing" all the changes it has made, since the last consistent "CheckPoint" - back to... | <p>I wouldn't do a 20% growth rate. That can have big consequences when it needs to grow. If it ever grew to, say, 100GB it'd have to grow by 20GB on the next growth - prepare for your system to slow down rather whilst this happens... Rather, I'd set it to a fixed rate - say 100MB. Of course we don't know the current s... | 38,814 |
<p>Is there any open-source, <code>PHP based</code>, role-based access control system that can be used for <code>CodeIgniter</code>?</p>
| <p>Brandon Savage gave a presentation on his PHP package "<a href="http://www.brandonsavage.net/projects.php" rel="noreferrer">ApplicationACL</a>" that may or may not accomplish role-based access. <a href="http://phpgacl.sourceforge.net/" rel="noreferrer">PHPGACL</a> might work as well, but I can't tell you for sure.</... | <p>Ion Auth Library uses users and groups - <a href="https://github.com/benedmunds/CodeIgniter-Ion-Auth" rel="nofollow">https://github.com/benedmunds/CodeIgniter-Ion-Auth</a>
but there are no working RBAC system to use them and manage. But you can white your functions.</p>
| 13,866 |
<p>Given a word, I've to replace some specific alphabets with some specific letters such as 1 for a, 5 for b etc. I'm using regex for this. I understand that StringBuilder is the best way to deal with this problem as I'm doing a lot of string manipulations. Here is what I'm doing:</p>
<pre><code>String word = "foobooa... | <p>I think this is a case where clarity and performance happily coincide. I would use a lookup table to do the "translation".</p>
<pre><code> public static void translate(StringBuilder str, char[] table)
{
for (int idx = 0; idx < str.length(); ++idx) {
char ch = str.charAt(idx);
if (ch < table... | <p>I would NOT recommend using any regex for this, those are actually all painfully slow when you're doing simple operations. Instead I'd recommend you start with something like this</p>
<pre><code>// usage:
Map<String, String> replaceRules = new HashMap<String, String>();
replaceRules.put("ao", "1");
repl... | 35,690 |
<p>The default <strong>asp.net</strong> membership provider uses a <code>.mdf</code> sql server database file in the <code>app_code</code> database.<br>
How scalable is this in terms of calling a flat file database instead of running it in a standard sql environment?<br>
Is this recommended only for small/medium traffi... | <p>It's a reasonable trade off for any site that can run on one server. It's fairly reasonable for small to medium traffic sites.</p>
<p>When you grow to a point of a web farm, then you'll be better off with a separate server. Also, depending on how database dependent your application is, you may find better performan... | <p>I wouldn't recommend this for anything but a "learning" project.</p>
<p>For any real application, regardless of size, you don't know what type of "next feature" you will add. You want to have a real independent database in which you can delegate functionality to, in which you can set jobs to run independently, sit ... | 7,961 |
<p>I am using this example:</p>
<pre><code>char *myData[][2] =
{{"John", "j@usa.net"},
{"Erik", "erik@usa.net"},
{"Peter","peter@algonet.se"},
{"Rikard","rikard@algonet.se"},
{"Anders","anders@algonet.se"}};
char **tableData[6];
tableData[0] = myData[0];
tableData[1] = myData[1];
tableData[2] = myData[2];
tabl... | <p>The pointers in <code>myData[][]</code> as you have it initialized point to literal strings. That memory cannot be written to.</p>
<p>You can allocate new memory for your new strings and place the pointers to the new strings into <code>myData</code>. Or for what you seem to be doing, just store the pointers to th... | <p>Create you own local copy of the data and change the pointer in the list:</p>
<pre><code>char **newentry = malloc(sizeof(char*) * 2);
newentry[0] = strdup(myNewName);
newentry[1] = strdup(myNewEmail);
tableData[i] = newentry;
</code></pre>
<p>That's the easy part. The hard part is freeing the memory when you are f... | 49,760 |
<p>I administrate several Oracle Apps environment, and currently check profile options in lots of environments by loading up forms in each environment, and manually checking each variable, which requires a lot of time.</p>
<p>Is there a snippet of code which will list profile options and at what level and who they are... | <p>You'll want to query <code>APPLSYS.FND_PROFILE_OPTIONS</code> and <code>FND_PROFILE_OPTION_VALUES</code>.
For a comprehensive script that you can pick up the SQL from, look here:
<a href="http://tipsnscripts.com/?p=16" rel="nofollow noreferrer">http://tipsnscripts.com/?p=16</a></p>
| <p>Armed with the knowledge of which tables to get (thanks Sten) and a bit of judicious editing, I have come up with a query which serves my needs:</p>
<pre><code>SELECT SUBSTR(e.profile_option_name,1,30) PROFILE,
DECODE(a.level_id,10001,'Site',10002,'Application',10003,'Responsibility',10004,'User') L,
DECODE... | 9,618 |
<p>We just switched from TFS to SVN, and so far we're loving it. </p>
<p>However, it did introduce a few new issues.</p>
<p>One is the way project files (.vbproj specifically) are handled. The .vbproj file is of course always changing as files and references are changed, and if a few people are collaberating there w... | <p>In SVN the main problems with *proj files is when people move files around to different folders, and/or when they add and remove similarly named files simultaneously, usually at the start of the project.</p>
<p>Once filenames and project structure become more stable this won't happen as much anymore.</p>
<p>Also, ... | <p>You need a decent client like Toroise. You do occasionally get conflicts in the auto merge, but ive never had one with the .vbproj and they are very easilly rectified with the diff program.</p>
<p>id use _svn instead of .svn, for several reasons, i can't remember why now off the top of my head but the "." did cause... | 32,993 |
<p>Our company is looking into allowing third party sites to use our online checkout system.</p>
<p>A client has stated that they would like to be able to use a lightbox style popup to display the checkout. And they would like this to be available on every page of the site, therefore mostly unsecure pages. Our checkou... | <p>Yes, the iframe would be secure, but you're correct that the customer wouldn't actually be able to tell that it's secure. On the other hand, most users can't tell if a page is secure anyway - a few images of padlocks scattered around will convince most of them.</p>
<p>Could you, when they click to pop out the chec... | <p>I know this is an old question but I was planning to do the same thing. The work-around is either to do the paypal thing -> go to a secure site for payment -> return to return-url. Or you could set up your own website with a very generic, short name like shop.com (obviously taken) but one that is not taken.</p>
<p>... | 28,424 |
<p>Almost every Python web framework has a simple server that runs a wsgi application and automatically reloads the imported modules every time the source gets changed. I know I can look at the code and see how it's done, but that may take some time and I'm asking just out of curiosity. Does anyone have any idea how th... | <p>As the author of one of the reloader mechanisms (the one in werkzeug) I can tell you that it doesn't work. What all the reloaders do is forking one time and restarting the child process if a monitor thread notices that one module changed on the file system.</p>
<p>Inline <code>reload()</code>ing doesn't work becau... | <p>reload() does not work. "Reloading" is usually implemented by forking.</p>
<p>Implementing "real" reload() is extremely difficult and even the most serious attempt, <a href="http://twistedmatrix.com/documents/current/api/twisted.python.rebuild.html" rel="nofollow noreferrer">twisted.python.rebuild</a> isn't perfect... | 15,423 |
<p>How should I base64 encode a PDF file for transport over XML-RPC in Python?</p>
| <p>If you don't want to use the xmlrpclib's Binary class, you can just use the .encode() method of strings:</p>
<pre><code>a = open("pdf_reference.pdf", "rb").read().encode("base64")
</code></pre>
| <p>Looks like you might be able to use the <a href="http://docs.python.org/library/binascii.html" rel="nofollow noreferrer">binascii</a> module</p>
<blockquote>
<p>binascii.b2a_base64(data)</p>
<p>Convert binary data to a line of ASCII characters in base64 coding. The return value is the converted line, including a new... | 25,629 |
<p>I have a row of divs that must all be the same height, but I have no way of knowing what that height might be ahead of time (the content comes from an external source). I initially tried placing the divs in an enclosing div and floated them left. I then set their height to be "100%", but this had no perceptible effe... | <p>Here is one of those moments where you can get stuck between being idealistic or realistic. I understand that there is no semantic value to placing non-tabular data in a table strictly for formatting reasons but I don't want to see you bending over backwards to create a non-tabular solution to this problem simply f... | <p>Thanks for the answers, guys. I don't think the background image will work because the widths of the columns can also vary depending on how many columns there are (the user can change it). I guess I'll use tables :(</p>
| 48,409 |
<p>I'm programming in FORTRAN and C on an SGI running Irix 6.5, but this should be applicable to all Unix-like systems. How do I find which library I need to link to my program when I get an "unresolved text symbol" link error? Here's an example of what I'm seeing from the linker:</p>
<pre><code>ld32: ERROR 33 Unre... | <p>You can use the <code>nm</code> command to list the dynamic symbols from a shared library:</p>
<pre><code>nm -D /lib/libc.so.6
</code></pre>
<p>and then <code>grep</code> for the symbol you are looking for. Omit the -D for static libraries. You can use this in a loop or with xargs to scan multiple libraries.</p>... | <p>Using <code>nm</code> (as in <a href="https://stackoverflow.com/questions/290799/how-can-i-find-out-which-library-is-home-to-a-given-object#290815">Robert Gamble's answer</a>) is the correct answer to your question. The trick is in knowing where to look for the libraries. What does your program do? If there is a ... | 37,082 |
<p>At the moment, our application uses the Trident Win32 component, but we want to move away from that for a few reasons, chief among them being our desire to go cross-platform.</p>
<p>We're looking at <a href="http://webkit.org/" rel="noreferrer">WebKit</a> and <a href="http://developer.mozilla.org/en/Gecko" rel="nor... | <p>A little history might help in your decision. When Apple was considering which engine to use in making Safari they looked at Gecko, but decided to go with KHTML, fork it and called it WebKit. Their reasons for doing this was that Gecko had tons of legacy cruft still leftover from Netscape and was far more complicate... | <p>My understanding is Webkit is pretty good & smaller than Gecko. Gecko is supposed to have had a revamp recently which makes it fairly comparable, though.</p>
| 22,294 |
<p>What's the best way to format this for readability?</p>
<pre><code>if (strpos($file, '.jpg',1) && file_exists("$thumbsdir/$file") == false || strpos($file, '.gif',1) && file_exists("$thumbsdir/$file") == false || strpos($file, '.png',1) && file_exists("$thumbsdir/$file") == false) {
create... | <p>I'd extract the "is an image" logic into its own function, which makes the <code>if</code> more readable and also allows you to centralize the logic.</p>
<pre><code>function is_image($filename) {
$image_extensions = array('png', 'gif', 'jpg');
foreach ($image_extensions as $extension)
if (strrpos(... | <p>I would break it up like this, setting aside the redundancy issue:</p>
<pre><code>if (strpos($file, '.jpg',1) && file_exists("$thumbsdir/$file") == false
|| strpos($file, '.gif',1) && file_exists("$thumbsdir/$file") == false
|| strpos($file, '.png',1) && file_exists("$thumbsdir/$file") == ... | 26,752 |
<p>I recall hearing that the way Microsoft had to implement the JSON serialization for their AJAX framework was different than most other libraries out there. Is this true? And, if so, how is it different?</p>
| <p>I'm not sure about anything else, but I did read about some tinkering they had to do to make date/time work (see <a href="http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspx" rel="nofollow noreferrer">post</a>).</p>
| <p>As @Chris said, there isn't anything special other than how Dates are handled. the JSON specification does not have a native way in which dates are to be serialised.</p>
<p>If you do not have any dates being returned in your JSON string you can use what ever <em>deserializer</em> you wish. The MS AJAX one is nice a... | 22,247 |
<p>I'd like a dead simple explanation of policy injection for less-informed co-workers. Where is a good resource for this? I learned about policy injection from the entlib help files, which I'm sure aren't the best option.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/cc309370.aspx" rel="nofollow noreferrer">The MSDN documentation for Policy Injection</a> has a pretty clear explanation:</p>
<blockquote>
<p>Applications include a mix of business
logic and crosscutting concerns, and
the two are typically
intermingled—which c... | <p>What the EntLib calls Policy Injection, is really Aspect Oriented Programming. I wrote a post <a href="http://iridescence.no/post/Aspect-Oriented-Programming-A-Primer.aspx" rel="nofollow noreferrer">introducing the concepts of AOP on my blog</a> a while back, maybe it'll be helpful.</p>
| 9,917 |
<p>How to create a table with a timestamp column that defaults to <code>DATETIME('now')</code>?</p>
<p>Like this:</p>
<pre><code>CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
t TIMESTAMP DEFAULT DATETIME('now')
);
</code></pre>
<p>This gives an error.</p>
| <p>As of <a href="https://www.sqlite.org/releaselog/3_1_0.html" rel="noreferrer">version 3.1.0</a> you can use <code>CURRENT_TIMESTAMP</code> with the <a href="https://www.sqlite.org/lang_createtable.html#the_default_clause" rel="noreferrer">DEFAULT</a> clause:</p>
<blockquote>
<p>If the default value of a column is CU... | <p>(DEFAULT ( DATETIME('now') ) )</p>
<p>or</p>
<p>(DEFAULT ( DATETIME('now', 'Localtime' ) ) )</p>
| 24,428 |
<p>Does anyone know of an easy way to import a legacy project, whose "version control system" is a series of dated folders, into SVN, so that the history of the revisions is preserved?</p>
<p>The project I inherited was not under version control, and there are hundreds of folders, each dated like: 2006-11-26, 2006-11-... | <p>I think the shell script solution would not be too hard. Something like this:</p>
<pre><code>for d in 200*
do
cp -a $d/* svndir/
cd svndir
svn add *
svn commit
cd ..
done
</code></pre>
<p>Rather naive code I know, but I would think that something a bit like this would do the job (subject to the... | <p>I think the shell script solution would not be too hard. Something like this:</p>
<pre><code>for d in 200*
do
cp -a $d/* svndir/
cd svndir
svn add *
svn commit
cd ..
done
</code></pre>
<p>Rather naive code I know, but I would think that something a bit like this would do the job (subject to the... | 26,267 |
<p>I am curious as to why an implicit cast fails in...</p>
<pre><code>int? someValue = SomeCondition ? ResultOfSomeCalc() : null;
</code></pre>
<p>and why I have to perform an explicit cast instead</p>
<pre><code>int? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null;
</code></pre>
<p>It seems to me that ... | <p>The relevant section of the C# 3.0 spec is 7.13, the conditional operator:</p>
<p>The second and third operands of the ?: operator control the type of the conditional expression. Let X and Y be the types of the second and third operands. Then,</p>
<p>If X and Y are the same type, then this is the type of the condi... | <p>If your function ResultofSomeCalc() returns int? then this will work.</p>
<p>If your function returns int, then the compiler issues the warning:
Type of conditional expression cannot be determined because there is no implicit conversion between 'int' and ''<br>
I'm guessing that is what you are seeing. Both ex... | 27,121 |
<p>I'm very new to 3D printing. When my printer was new, I got loads of really good prints, however, now they're all failing.</p>
<p>I suspected that the nozzle was in bad shape, so I replaced it, but even now, the prints are still quite bad.</p>
<p>I suspect that the filament is not coming out properly. (extruding?)</... | <p>The CR-6 SE uses strain gauge based sensing for the auto leveling. This implies that the nozzle itself is the probe for the leveling procedure. It is important that there is no filament left on the nozzle and no debris is on the bed (of so, this causes incorrect measurement of the bed surface and results in a too la... | <p>It almost looks like that nozzle is too far away from the bed. Try releveling your bed.</p>
| 2,193 |
<p>This is kinda oddball, but I was poking around with the GNU assembler today (I want to be able to at least read the syntax), and was trying to get this little contrived example of mine to work. Namely I just want to go from 0 to 100, printing out numbers all the while. So a few minutes later I come up with this:</p>... | <p>You can't trust what any called procedure does to any of the registers.
Either push the registers onto the stack and pop them back off after calling printf or have the increment and end point values held in memory and read/written into registers as you need them. </p>
<p>I hope the following works. I'm assuming th... | <p>You could rewrite it so that you use registers that aren't suppose to change, for example <code>%ebp</code>. Just make sure you push them onto the stack at the beginning, and pop them off at the end of your routine.</p>
<pre><code># count.s: print the numbers from 0 to 100.
.text
string: .asciz "%d\n"
.glo... | 3,984 |
<p>I have a table that is dynamically created using DIVs. Each row of the table has two images. I want to set the height for the div (that represents a particular row) to the height of image that is greater of the two images being displayed in that particular row. The images to displayed will always change, and they ar... | <p>If you are trying to dynamically resize a couple of divs in a row within a table, you maybe better off using a html table instead and having each image within a td tag. This will make tr tag resize accordingly for the image in each cell.</p>
| <p>Pre-load them into javascript image objects then just reference the height and width.</p>
<p>Might take some clever devilry to work in all browsers...</p>
<pre><code>function getSize(imgSrc){
var aImg = new Image();
aImg.src = imgSrc;
aHeight = newImg.height;
aWidth = newImg.width;
}
</code></p... | 13,246 |
<p>I want to create a javascript badge that displays a list of links. We host the javascript on our domain. Other sites can put an empty div tag on their page and at the bottom a reference to our javascript that would render the content in the div tag. How do you implement something like this?</p>
| <p>I would give the SCRIPT tag an ID and replace the script tag itself with the DIV + contents, making it so they only have to include one line of code. Something along the lines of the following:</p>
<pre><code><script id="my-script" src="http://example.com/my-script.js"></script>
</code></pre>
<p>In you... | <p>Like @Owen said, except why not craft your javascript so that </p>
<pre><code><script type="text/javascript" src="http://yourdomain.com/mywidget.js"></script>
</code></pre>
<p>does the work of populating <code><div id="mywidget"></div></code> on its own, thus negating the need for them to c... | 30,859 |
<p>There is a field in my company's "Contacts" table. In that table, there is an XML type column. The column holds misc data about a particular contact. EG. </p>
<pre><code><contact>
<refno>123456</refno>
<special>a piece of custom data</special>
</contact>
</code></pre>
<p>The tag... | <p>I've found the msdn xml best practices helpful for working with xml blob columns, might provide some inspiration...
<a href="http://msdn.microsoft.com/en-us/library/ms345115.aspx#sql25xmlbp_topic4" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms345115.aspx#sql25xmlbp_topic4</a></p>
| <p>In addition to the page mentioned by @pauljette, this page has good performance optimization advice:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms345118.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms345118.aspx</a></p>
<p>There's a lot you can do to speed up the performance... | 7,532 |
<p>Is there a built-in way to escape user input in java using the <code>JDBC</code>? Something similar to the php version <code>mysql_real_escape()</code> function. What's the best way to validate input?</p>
| <p>If you mean how do you make sure user input can't be used in SQL injection attacks, the way to do this (and the way all SQL should be written in JDBC) is using Prepared Statements. JDBC will automatically handle any necessary escaping.</p>
<p><a href="http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.htm... | <p>Just to add to the suggestion by @skaffman, PreparedStatements solve the issue for the majority of applications. However, there are some applications where (parts of) SQL statements (as opposed to just parameter values) are taken from user input (for example, a URL parameter containing the ORDER BY clause). Just mak... | 17,566 |
<p>Reading about the <a href="http://en.wikipedia.org/wiki/G.729" rel="nofollow noreferrer">G.729 codec</a>, I found this interesting tidbit about "<a href="http://en.wikipedia.org/wiki/Comfort_noise" rel="nofollow noreferrer">Comfort Noise</a>":</p>
<blockquote>
<p>A comfort noise generator (CNG) is
also set up b... | <p>I think what you need to know varies depending upon the type of application you are trying to develop and the user environment it will be in.</p>
<p>From the enormous company/product perspective - it's wise to have an HMI/UI Style Guide that spells out the basic precepts developers should be using their interface d... | <p>Read the <a href="http://www.docstoc.com/docs/1039915/Apple-human-interface-guidelines" rel="nofollow noreferrer">Apple Human Interface Guideline</a>. It is not only a guide with patterns, but is based upon the psychology of the users attention.</p>
| 43,487 |
<p>I think the answer to this question is so obivous that noone has bothered writing about this, but its late and I really can't get my head around this.</p>
<p>I've been reading into IoC containers (Windsor in this case) and I'm missing how you talk to the container from the various parts of your code.</p>
<p>I get ... | <p>99% of the cases it's one container instance per app. Normally you initialize it in Application_Start (for a web app), <a href="https://github.com/castleproject/Castle.MonoRail-READONLY/blob/45ac205867396b1b7ad287a872e5b20afd0af837/src/TempWeb/Global.asax.cs" rel="nofollow noreferrer">like this</a>.</p>
<p>After th... | <p>I'm using an implementation of this interface:</p>
<pre><code>public interface IResolver
{
object Resolve(Type type);
object Resolve(string name);
T Resolve<T>() where T : class;
T Resolve<T>(string name) where T : class;
}
</code></pre>
<p>Which is actually wrapped in global static cl... | 47,923 |
<p>What is the best way to make the SSRS reporr fit in to PDF page.</p>
| <p>Next time please indicate what version of SSRS you are working with...</p>
<p>If you are careful to design your canvas to certain constraints your should be fine. Typically the PDF is going to emulate a 8.5" by 11" piece of paper - considering margins you should keep the width of your report to less than 7" but I t... | <pre><code>For PDF you have to change page settings while creating report check below steps for that :
if you have large data on page you should choose below option
->Right Click on report
->Click on Page Setup option
->Change page orientation Portrait to Landscape
->Click on OK
if you don't have large d... | 41,048 |
<p>Let's say I have a java program that makes an HTTP request on a server using HTTP 1.1 and doesn't close the connection. I make one request, and read all data returned from the input stream I have bound to the socket. However, upon making a second request, I get no response from the server (or there's a problem with... | <p>According to your code, the only time you'll even reach the statements dealing with sending the second request is when the server closes the output stream (your input stream) after receiving/responding to the first request.</p>
<p>The reason for that is that your code that is supposed to read only the first respon... | <p>Make sure you have a <code>Connection: keep-alive</code> in your request. This may be a moot point though.</p>
<p>What kind of response is the server returning? Are you using chunked transfer? If the server doesn't know the size of the response body, it can't provide a <code>Content-Length</code> header and has to ... | 22,171 |
<p>Can Visual Studio <strong>2005</strong> Team edition for Developer coexist peacefully with Visual Studio <strong>2008</strong> Database edition on my machine? Are they completely separate applications that won't interfere in any way with each other?</p>
<p><strong>Update:</strong>
What about Visual Studio 2008 Dev... | <p>2008 is side by side compatible with 2005. Also, be sure to apply 2008 SP1 as it will change the icon slightly so that you can tell the difference.</p>
| <p>yes.</p>
<p>I use Visual Studio 6, Visual Studio 2005 and Visual Studio 2008 concurrently without any issues. [That too with all of them integrated with VSS]</p>
| 22,710 |
<p>is there an alternative for <code>mysql_insert_id()</code> php function for PostgreSQL? Most of the frameworks are solving the problem partially by finding the current value of the sequence used in the ID. However, there are times that the primary key is not a serial column....</p>
| <p>From the PostgreSQL point of view, in pseudo-code:</p>
<pre><code> * $insert_id = INSERT...RETURNING foo_id;-- only works for PostgreSQL >= 8.2.
* INSERT...; $insert_id = SELECT lastval(); -- works for PostgreSQL >= 8.1
* $insert_id = SELECT nextval('foo_seq'); INSERT INTO table (foo...) values ($insert_... | <p>Check out the <a href="http://www.postgresql.org/docs/current/interactive/sql-insert.html" rel="nofollow noreferrer">RETURNING optional clause</a> for an INSERT statement. (Link to official PostgreSQL documentation)</p>
<p>But basically, you do:</p>
<pre><code>INSERT INTO table (col1, col2) VALUES (1, 2) RETURNING... | 7,980 |
<p>I was reading <a href="https://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage">this question</a> about how to parse URLs out of web pages and had a question about the <a href="https://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage#6183">acce... | <p>@<a href="https://stackoverflow.com/questions/13470/question-about-specific-regular-expression#13479">Rob</a>: I disagree. To enforce what you are asking for I think you would need to use negative-look-behind, which is possible but is certainly not related to use {1}. Neither version of the regexp address that par... | <p>I don't think it has any purpose. But because RegEx is almost impossible to understand/decompose, people rarely point out errors. That is probably why no one else pointed it out. </p>
| 3,439 |
<p>What's the quickest way to convert a date in one format, say </p>
<blockquote>
<p>2008-06-01</p>
</blockquote>
<p>to a date in another format, say </p>
<blockquote>
<p>Sun 1st June 2008</p>
</blockquote>
<p>The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other t... | <pre><code>$ date -d '2005-06-30' +'%a %F'
Thu 2005-06-30
</code></pre>
<p>See <code>man date</code> for other format options.</p>
<p>This option is available on Linux, but not on Darwin. In Darwin, you can use the following syntax instead:</p>
<pre><code>date -j -f "%Y-%m-%d" 2006-06-30 +"%a %F"
</code></pre>
<p>T... | <pre><code>date -d yyyy-mm-dd
</code></pre>
<p>If you want more control over formatting, you can also add it like this:</p>
<pre><code>date -d yyyy-mm-dd +%a
</code></pre>
<p>to just get the Sun part that you say you want.</p>
| 35,287 |
<p>I am working on a project that does a large amount of hashing, signing, and both asymmetric and symmetric encryption. Since these steps have a significant effect on our performance and available load, I was wondering if there is a hardware based solution to offloading the work. </p>
<p>I have done some surfing to f... | <pre><code>private Random gen = new Random();
DateTime RandomDay()
{
DateTime start = new DateTime(1995, 1, 1);
int range = (DateTime.Today - start).Days;
return start.AddDays(gen.Next(range));
}
</code></pre>
<p>For better performance if this will be called repeatedly, create the <code>start</c... | <p>Useful extension based of @Jeremy Thompson's solution</p>
<pre><code>public static class RandomExtensions
{
public static DateTime Next(this Random random, DateTime start, DateTime? end = null)
{
end ??= new DateTime();
int range = (end.Value - start).Days;
return start.AddDays(random... | 23,679 |
<p>I have a desktop application written in C#. It is trying to manage a socket connection and fails. The same application is successful if it is attached to the Visual Studio debugger. </p>
<p>How can it be debugged?</p>
| <p>I'd say timing issues too having the debugger attached will slow down the code slightly which might mean that a race condition isn't occuring.</p>
<p>To debug it try to add some logging code to your application, I personally use <a href="http://logging.apache.org/log4net/index.html" rel="nofollow noreferrer">log4ne... | <p>You might have variables whose default values are different when running under the compiler as opposed to standalone. Race conditions might be another idea if there are threads involved.</p>
<p>If you are allocating RAM via malloc or new, then make sure that the memory is initialized properly before using it.</p>... | 14,656 |
<p>Is there a SSCLI equivalent for .Net Framework 3.5?
Something that can be debugged and stepped through.</p>
| <p>If you are using Visual Studio 2008 (and especially VS2008 SP1) you should enable the ".NET Framework source stepping" debugger option.</p>
| <p>You need to download a patch for the source code of sscli and then you can build through VS 2008.</p>
| 41,073 |
<p>I'm writing a C Shell program that will be doing <code>su</code> or <code>sudo</code> or <code>ssh</code>. They all want their passwords in console input (the TTY) rather than stdin or the command line.</p>
<p>Does anybody know a solution?</p>
<p>Setting up password-less <code>sudo</code> is not an option.</p>
<p... | <p>For sudo there is a -S option for accepting the password from standard input. Here is the man entry:</p>
<pre><code> -S The -S (stdin) option causes sudo to read the password from
the standard input instead of the terminal device.
</code></pre>
<p>This will allow you to run a command li... | <p>You can provide password as parameter to expect script.</p>
| 28,868 |
<p>I have to migrate a table from MSSQL Server to MySql. The problem is that the table is quite big (65 millions records) and the whole process takes too much time. Does anyone have any idea how to speed things up ? Any useful tools that could improve this?</p>
| <p>Need to do it only once? Don't waste too much time optimizing, wait 'till it's through and move on.</p>
<p>Need to do it more often? Then elaborating what tools/techniques you use currently would be helpful.</p>
| <p>Make sure that the mysql tables initially have no indexes; add them once the loads are finished.</p>
| 28,412 |
<p>Does anyone have a good articles or tutorial on correctly using dispose and IDisposable. I am trying to explain this to some junior dev and wanted to get some extra material, examples, etc.</p>
| <p>A good place to start is this MSDN article by Shawn Farkas <a href="http://msdn.microsoft.com/en-us/magazine/cc163392.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163392.aspx</a>. The definitive article is by Joe Duffy at <a href="http://www.bluebytesoftware.com/blog/2005/04/08/DGUpdateDisposeFi... | <p>Here's my one. :-)</p>
<p><a href="http://www.blackwasp.co.uk/IDisposable.aspx" rel="nofollow noreferrer">http://www.blackwasp.co.uk/IDisposable.aspx</a></p>
| 28,164 |
<p>I have a client that want to have a web app I'm building for them display <a href="http://en.wikipedia.org/wiki/Heat_map" rel="nofollow noreferrer">heat maps</a> of the data.</p>
<p>I haven't worked with heat maps at all and I was wondering if anyone knew of some good tools for generating them.</p>
<p>Thanks.</p>
| <p>Heat maps are often used in place of a more conventional term: <a href="http://en.wikipedia.org/wiki/Kernel_density_estimation" rel="noreferrer">kernel density estimators</a>. If you need to compute these on the fly, consider <a href="http://grass.osgeo.org/" rel="noreferrer">GRASS GIS</a>- specifically, the <a href... | <p>Might I suggest my own jQuery plugin?</p>
<p><a href="https://github.com/DLarsen/jquery-hottie" rel="nofollow noreferrer">jQuery Hottie</a> makes it easy to take normal markup and add a background color like so:</p>
<p><img src="https://i.stack.imgur.com/N0ZR4.png" alt="enter image description here"></p>
<pre><co... | 46,646 |
<p>Is there a plugin for targetting .NET 1.1 with VS 2008?</p>
| <p>Try using ClearType, not Standard font smoothing. </p>
<p>It's in Display properties, Appearance, Effects.</p>
| <p>Could it be a problem with the color combination? Some fonts look really ugly on high contrast combinations with a black background.</p>
<p>Also, can you see the difference in the fonts in any other application?</p>
<p>Which font is it?</p>
| 6,648 |
<p>I'm working on a project which stores single images and text files in one place, like a time capsule. Now, most every project can be saved as one file, like DOC, PPT, and ODF. But complete web pages <em>can't</em> -- they're saved as a separate HTML file and data folder. <strong>I want to save a web page in a singl... | <p>My favourite is the ZIP format. Because:</p>
<ul>
<li>It is very well sutied for the purpose</li>
<li>It is well documented </li>
<li>There a a lot of implementations available for creating or reading them</li>
<li>A user can easily extract single files, change them and put them back in the archive</li>
<li>Almost ... | <p>The problem is that html is bottoms up not top down. Look at your file name which saved on my box as "What's the best "file format" for saving complete web pages (images, etc.) in a single archive? - Stack Overflow.html" </p>
<p>Just add a '|' and one has trouble doing copy and paste backups to a spare drive. In th... | 32,499 |
<p>I want to show a chromeless modal window with a close button in the upper right corner.
Is this possible?</p>
| <p>You'll pretty much have to roll your own Close button, but you can hide the window chrome completely using the WindowStyle attribute, like this:</p>
<pre><code><Window WindowStyle="None">
</code></pre>
<p>That will still have a resize border. If you want to make the window non-resizable then add ResizeMode="... | <pre><code><Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" WindowStyle="None" ResizeMode="NoResize">
<Button HorizontalAlignment="Right" Na... | 5,868 |
<p>Other than pasting a WDSL in the tech spec, what are the recommended ways to document a WCF web-service before you begin coding?</p>
| <p>We recently published a WCF based SOAP interface for third parties to integrate against. For each method we provided the following:</p>
<ul>
<li>Method name</li>
<li>Request example (wire format dump)</li>
<li>Request parameters explanation</li>
<li>Response example (wire format dump)</li>
<li>Request parameters e... | <p>Also, in case you're using MessageContracts document why you are using them... trust me, you'll wonder why you did it :)</p>
| 22,915 |
<p>Coming from a Classic ASP background, I'm used to multiple forms on a page, but this clearly limited in a ASP.NET page.</p>
<p>However, I have a situation where I have a form that gathers input from the user, saves the data to a DB, and afterwards I want to render (and tweak the values of) a special form that posts ... | <p>You can have multiple forms, it's just only one form may have the <code>runat="server"</code> attribute.</p>
<p>There are a bunch of answers to getting PayPal to work; but as it's a learning vehicle that may be cheating. In all honesty, I'd look at the full-blown PayPal API rather than use the method of the somewha... | <p>A workaround for this paypal is to use the <a href="http://www.spiderweblogic.com/Paypal-Integration-Code.aspx" rel="nofollow noreferrer">Paypal Integration Code</a> as Paypal is not always the most friendly to integrate. The hard work is basically done for you.</p>
| 11,675 |
<p>I've got a <a href="http://notebooks.readerville.com/" rel="noreferrer">site</a> that provides blog-friendly widgets via JavaScript. These work fine in most circumstances, including self-hosted Wordpress blogs. With blogs hosted at Wordpress.com, however, JavaScript isn't allowed in sidebar text modules. Has anyone ... | <p>you could always petition wp to add your widget to their 'approved' list, but who knows how long that would take. you're talking about a way to circumvent the rules they have in place about posting arbitrary script. myspace javascript exploits in particular have increased awareness of the possibility of such workaro... | <p>Just find a good site about XSS if You really need that js to work. But if it works for You it works for anybody, and You post a tutorian on how to do an XSS attack on Your page with posts or comments. </p>
<p>reference:
<a href="http://ha.ckers.org/xss.html" rel="nofollow noreferrer">http://ha.ckers.org/xss.html</... | 10,707 |
<p>I'm trying to make a water insulated 1 cm<sup>3</sup> (1 ml) transparent container and I bought some plexiglass, I cut and glued some pieces together but it looks really crappy and barely holds the water in. I was wondering, is there a transparent material (similar to plexiglass) that can order to 3D print... | <p>Yes. You'll probably want to use SLA or Polyjet printers with transparent resin. For example, here's <a href="https://www.shapeways.com/materials/sla-accura-60" rel="nofollow noreferrer">Shapeways' page on transparent SLA</a> and <a href="https://www.shapeways.com/materials/multi-color-polyjet" rel="nofollow norefer... | <p>You could order an sla or dlp printed part(which would probably be more expensive, but also quite durable and a little more transparent). Or you could order an fdm printed T-glase print, which would come out pretty clear and not be quite as strong as sla, but still pretty good for holding water.</p>
| 1,446 |
<p>I am writing an immutable DOM tree in Java, to simplify access from multiple threads.*</p>
<p>However, it does need to support inserts and updates as fast as possible. And since it is immutable, if I make a change to a node on the N'th level of the tree, I need to allocate at least N new nodes in order to return t... | <p>These days, object creation is pretty dang fast, and the concept of object pooling is kind of obsolete (at least in general; connection pooling is of course still valid).</p>
<p>Avoid premature optimization. Create your nodes when you need them when doing your copies, and then see if that becomes prohibitively slo... | <p>I'm a little confused about what you're trying to do in the first place. You want all of the nodes to be immutable AND you want to pool them? Aren't these 2 ideas mutually exclusive? When you pull an object out of the pool, won't you have to invoke a setter to link up the children?</p>
<p>I think that using immu... | 6,382 |
<p>I've inherited a large Java app that uses Struts, Spring, and Hibernate. The classes and interfaces I deal with daily are: Struts Actions, Struts ActionForms, Value Objects, Service Interfaces and Implementations, DAO Interfaces and Implementations, and Entities. I'm pretty clear on the how and why of most of these,... | <p>1.
Considering the DAO - VO transformation; whether this is usefull depends on how Hibernate is used. If the entire Web request handling is in a single Hibernate session you should not really need separate VO's. </p>
<p>If, however, your DAO layer opens a session to retrieve an object and closes the session before ... | <p>To answer your last part, use Spring MVC instead of Struts. Then you can just use the same Domain Objects at all layers - the Classes that bind to form parameters are also used in Hibernate, and contain real business logic.</p>
<p>For example, in an app I did using Spring MVC, I had a member class. The login, regis... | 20,185 |
<p>Does anyone know if Expression Web (and Blend, for that matter) has any form of direct integration with source control? </p>
<p>Right now that's about the only real downside we've discovered in a couple days of using it. But it's a <strong>big</strong> downside.</p>
<p>Quick edit:</p>
<p>Yes, we're currently usin... | <p>Yes, there is now TFS integreation available for Blend 3: <a href="http://blogs.msdn.com/unnir/archive/2009/03/17/team-foundation-server-support-in-blend-3.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/unnir/archive/2009/03/17/team-foundation-server-support-in-blend-3.aspx</a></p>
| <p>I tried to bear with you.....but I just can't do it! I think the time has probably come for you to unshackle yourselves from sourcesafe! </p>
<p>Install subversion, and life will be all good again.</p>
| 27,569 |
<p>I am planning on creating a small website for my personal book collection. To automate the process a little bit, I would like to create the following functionality:</p>
<p>The website will ask me for the ISBN number of the book and will then automatically fetch the title and add it to my database.</p>
<p>Although ... | <p>This is the LibraryThing founder. We have nothing to offer here, so I hope my comments will not seem self-serving.</p>
<p>First, the comment about Amazon, ASINs and ISBN numbers is wrong in a number of ways. In almost every circumstance where a book has an ISBN, the ASIN and the ISBN are the same. ISBNs are not now... | <p>As an alternative to isbndb (which seems like the perfect answer) I had the impression that you could pass an ISBN into an Amazon product URL to go straight to the Amazon page for the book. While this doesn't programmatically return the book title, it might have been a useful extra feature in case you wanted to link... | 6,277 |
<p>Way back when I was working in an Oracle shop I took the CONNECT_BY for granted. Now I'm stuck working with SQL Server 2005 and have some nasty object hierarchies. Specifically, we have a self referencing table where all child records have a column with their parent's id. Currently we have a view that maps childr... | <p>This creates your typical hierarchical table and uses a CTE to select the hierarchy structure and create a path for each item.</p>
<pre><code>CREATE TABLE tblHierarchy (ID int, ParentID int NULL, Name varchar(128));
INSERT INTO tblHierarchy VALUES (1, NULL, '1');
INSERT INTO tblHierarchy VALUES (2, NULL, '2');
INS... | <p>To traverse the Depth of the Hierarchy first then the next sibling level,
CTE can be used:</p>
<pre><code>declare @tempTable TABLE
(
ORGUID int,
ORGNAME nvarchar(100),
PARENTORGUID int,
ORGPATH nvarchar(max)
)
;WITH RECORG(ORGuid, ORGNAME, PARENTORGUID, ORGPATH)
as
(
select
org.UID,
... | 29,156 |
<p>Since upgrading to 2008 I and many people here have noticed that randomly VS will no longer step in to code or jump over breakpoints. Its got to the stage where debugging is becoming a real chore. We are running SP1 but noticed problem on 2008 basic too.</p>
<p>In ref to Robert's question: We host WCF and Remoting ... | <p><a href="http://blogs.msdn.com/jacdavis/archive/2008/11/14/debugger-qfe-for-vs-2008-sp1-released.aspx" rel="nofollow noreferrer" title="Here">Here</a> is a blog post with a link to the patch.</p>
| <p>We saw BP issues with SP1. We reported it to Conenct (<a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=363453" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=363453</a>) and MS has since sent us a DLL to fix it (seem... | 36,822 |
<p>I would like to set some initial variables (like <code>format compact</code> and the current directory) automatically on each startup of Matlab.<br>
How can I do that?</p>
| <p>Create a startup.m script file containing the commands to set up the state that you want. Next, from inside MATLAB, run the command</p>
<pre><code>>> userpath
</code></pre>
<p>This will give you a list of one or more user-specific directories (depending on what OS you are using); put your startup.m in any of... | <p>Create a <a href="http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/startup.html" rel="nofollow noreferrer">startup.m</a> file in the directory that you launch matlab from.</p>
| 26,343 |
<p>Related to <a href="https://stackoverflow.com/questions/139944/where-can-one-find-free-software-icons-images">https://stackoverflow.com/questions/139944/where-can-one-find-free-software-icons-images</a></p>
<p>I have a need for free weather-related icons. Specifically, I need icons that you might see in a ten-day f... | <p>Weather.com has a free xml service for which they provide an SDK. The SDK includes icons in 3 sizes (31x31, 61x61, and 93x93) for about 48 weather conditions. I cannot find anything in their agreement that forbids using the icons for anything but their service. (Nor does it specifically grant free redistribution)</p... | <p>Hi you can find some really great icons here</p>
<p><a href="http://tango.freedesktop.org/Tango_Desktop_Project" rel="nofollow noreferrer">http://tango.freedesktop.org/Tango_Desktop_Project</a></p>
<p>it's an openSource icon theme </p>
| 33,974 |
<p>I am wondering what is the best way to use workspaces in visual studio. We have 150+ webservices that are all part of the same team project $/MyTeamProject without being related at all. The reason for them all being part of the same team project as they are all maintained by the same group of people within our organ... | <p>You said that the webservices was not related at all. I then assume that they are released separately.</p>
<p>I can't see any reason to use multiple workspaces in your scenario.
I suggest that you remove the mapping from the top level project "MyTeamProject". Then you have flexibility to map the subfolders to whate... | <p>If you have one workspace per webservice then you will get 150*#releases workspaces. This will get really hard to manage for build versions, labelling etc. Fewer workspaces will mean less builds to manage.</p>
<p>I would recommend having a workspace per release. Generally you would probably only be working on one r... | 44,667 |
<p>Scenario: Document library in SharePoint with column x of "Person or Group" type. From within a VBA macro (or VSTO add-in) we're trying to access the MetaProperty on the document to set/get the user name. Any attempt to access the value via the ContentTypeProperties collection throws a </p>
<blockquote>
<p>Type... | <p>Are you executing the programs directly or going through the shell? If you always launch an external program by giving the full path name to the executable and leaving the shell out of the equation, then you aren't really susceptible to any kind of command line injection.</p>
<p>EDIT: DrFloyd, the shell is respons... | <p>Well, if you can invoke the tools programmatically without the command line, that would probably be your best option. Otherwise, you could potentially execute the command line tool via a user that has absolutely no access to do anything (except perhaps a single directory that they can't do any harm with)... though ... | 6,659 |
<p>I have an Excel worksheet with an image (logo).
If I <kbd>right-click</kbd> on the picture and select <code>Format Picture / Protection</code>, the <code>Locked</code> checkbox is checked.
I then protect the worksheet with a password.</p>
<p>Despite all of the above, the end user can still select and delete the ima... | <p>Protecting the sheet works for me. </p>
<p>Check that the option "Edit objects" (down the bottom of the list of things you can allow the user to do, in the protection dialog box) is NOT checked.</p>
| <p>Try protecting the WorkBOOK also.</p>
<p>Edit: Ugh -- that doesn't seem to work.</p>
<p>I Googled up this very ugly solution: <a href="http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.misc/2007-04/msg00755.html" rel="nofollow noreferrer">prevent an image from being deleted or replaced</a></p>
| 27,049 |
<p>I have written some CSS which targets elements using the parent > child selector. Specifically for tables so I can apply certain styles to the headers and footers like this</p>
<pre><code>table > thead > tr > th ...
table > tbody > tr > td ...
//there are other uses in the css as well
</code></pre... | <p>Usually you can just remove the '>' and it will work. It's a matter of how your CSS and HTML is written. I'd give it a shot. </p>
| <p>You could target them using JavaScript, but that hardly is a real solution since it would require javaScript for something that should be done by CSS. You could also modify your HTML to have specific classes, but that means modifying you HTML. I don't really think there are any 'nice' solutions, I would probably hac... | 48,734 |
<p>I'm learning objective-C and Cocoa and have come across this statement:</p>
<blockquote>
<p>The Cocoa frameworks expect that global string constants rather than string literals are used for dictionary keys, notification and exception names, and some method parameters that take strings.</p>
</blockquote>
<p>I've ... | <p>In Objective-C, the syntax <code>@"foo"</code> is an <strong>immutable</strong>, <strong>literal</strong> instance of <code>NSString</code>. It does not make a constant string from a string literal as Mike assume.</p>
<p>Objective-C compilers typically <em>do</em> intern literal strings within compilation units — ... | <p>Let's use C++, since my Objective C is totally non-existent.</p>
<p>If you stash a string into a constant variable:</p>
<pre><code>const std::string mystring = "my string";
</code></pre>
<p>Now when you call methods, you use my_string, you're using a string constant:</p>
<pre><code>someMethod(mystring);
</code><... | 4,532 |
<p>I want to know if I'm missing something.
Here's how I would do it:
For SPFolder I would change the associtaed item's permissions (SPFolder.Item).
So I suppose managing SPFolder permissions boils down to managing SPListItem permissions.
For SPListItem I would frist break role inheritance with <code>SPListItem.BreakRo... | <p>It's a slippery slope once you start initializing fields & generally setting up the context of your test <em>within</em> the test method itself. This leads to large test methods and really really unmanageable fixtures that don't explain themselves very well.</p>
<p>Instead, you should look at the BDD style nam... | <p>Personally, I use Setup and Teardown methods for two distinct reasons, although I assume that others will have different reasons.</p>
<ol>
<li>Use Setup and Teardown methods when there is common initiation logic that is used by all tests and a single instance of the object(s) created in the Setup are designed to be... | 38,811 |
<p>For example,
Look at the code that calculates the n-th Fibonacci number:</p>
<pre><code>fib(int n)
{
if(n==0 || n==1)
return 1;
return fib(n-1) + fib(n-2);
}
</code></pre>
<p>The problem with this code is that it will generate stack overflow error for any number greater than 15 (in most computers).... | <p>Yes your insight is correct.
This is called <a href="http://en.wikipedia.org/wiki/Dynamic_programming" rel="nofollow noreferrer">dynamic programming</a>. It is usually a common memory runtime trade-off.</p>
<p>In the case of fibo, you don't even need to cache everything :</p>
<p>[edit]
The author of the question s... | <p>If you're using a language with first-class functions like Scheme, you can add memoization without changing the initial algorithm:</p>
<pre><code>(define (memoize fn)
(letrec ((get (lambda (query) '(#f)))
(set (lambda (query value)
(let ((old-get get))
(set! get (l... | 4,375 |
<p>As the question states, should <a href="https://3dprinting.stackexchange.com/questions/tagged/bed" class="post-tag" title="show questions tagged 'bed'" rel="tag">bed</a> and <a href="https://3dprinting.stackexchange.com/questions/tagged/build-plate" class="post-tag" title="show questions tagged 'build-pl... | <p>It should not be about merging of tags, rather we should come up with a proper terminology to identify the correct parts of the "build platform".</p>
<p>Basically, every printer consists of a frame with some sort of guide rails<sup>1</sup> moving a carriage. On this carriage a build surface is attached whe... | <h1>Edit: I like Trish's suggestion best.</h1>
<p>I vote <strong>no</strong>. Our (Hyrel) printers have, on some models, a thick aluminum <a href="https://3dprinting.stackexchange.com/questions/tagged/bed" class="post-tag" title="show questions tagged 'bed'" rel="tag">bed</a> that can reach 200C, but we expect... | 74 |
<p>I have a string that has some Environment.Newline in it. I'd like to strip those from the string and instead, replace the Newline with something like a comma. </p>
<p>What would be, in your opinion, the best way to do this using C#.NET 2.0?</p>
| <p>Why not:</p>
<pre><code>string s = "foobar\ngork";
string v = s.Replace(Environment.NewLine,",");
System.Console.WriteLine(v);
</code></pre>
| <p>The best way is the builtin way: Use <code>string.Replace</code>. Why do you need alternatives?</p>
| 4,499 |
<p>On a site of mine in which a textarea is used for submission, I have code that can appear something along the lines of the following:</p>
<pre><code><textarea><p>text</p></textarea>
</code></pre>
<p>When validating (XHTML 1.0 Transitional), this error arises,</p>
<pre><code>line 88 column ... | <p>is there a reason you're trying to put a <code><p></code> within <code><textarea></code>? as you found out it's not valid. if it's for display purposes (ie, showing code) it should be translated:</p>
<pre><code><textarea>&lt;p&gt;text&lt;/p&gt;</textarea>
</code></pre>
<p>be... | <p>You can leave out the tags in the text area, and when you need new lines use \n Otherwise use <code>&lt;p&gt;</code> and <code>&lt;/p&gt;</code> in the place of your tags.</p>
| 23,830 |
<p>What is the difference between <code><% %></code> and <code><%= %></code> in ASP.NET MVC? And when to use which?</p>
| <p>See also <a href="https://stackoverflow.com/questions/115159">this question</a>. MVC hasn't changed how these bee-stings work, just how often they're used.</p>
<p>Basically:</p>
<ul>
<li><code><%</code> - execute code</li>
<li><code><%@</code> - page directive</li>
<li><code><%$</code> - resource access</... | <p><%= echos the statement out.</p>
<p><% just runs it.</p>
| 23,953 |
<p>I'm trying to see if anyone knows how to cluster some Lat/Long results, using a database, to reduce the number of results sent over the wire to the application.</p>
<p>There are a number of resources about how to cluster, either on the client side OR in the server (application) side .. but not in the database side ... | <p>I'd probably use a modified* version of <a href="http://en.wikipedia.org/wiki/K-means" rel="noreferrer"><em>k</em>-means clustering</a> using the cartesian (e.g. WGS-84 ECF) coordinates for your points. It's easy to implement & converges quickly, and adapts to your data no matter what it looks like. Plus, you ... | <p>I believe you can use <a href="http://www.microsoft.com/sqlserver/2008/en/us/spatial-data.aspx" rel="nofollow noreferrer">MSSQL's spatial data types</a>. If they are similar to other spatial data types I know, they will store your points in a tree of rectangles, and then you can go to the lower-resolution rectangles... | 42,760 |
<p>I have an XSD file that is encoded in UTF-8, and any text editor I run it through doesn't show any character at the beginning of the file, but when I pull it up in Visual Studio's debugger, I clearly see an empty box in front of the file. </p>
<p><img src="https://i294.photobucket.com/albums/mm93/geostock/bom3.jpg... | <p>It turns out, the answer is that what I'm seeing is a <a href="http://en.wikipedia.org/wiki/Byte_Order_Mark" rel="noreferrer">Byte Order Mark</a>, which is a character that tells whatever is loading the document what it is encoded in. In my case, it's encoded in utf-8, so the corresponding BOM was <code>EF BB BF</c... | <p>here's how you do it with vim:</p>
<pre><code># vim file.xml
:set nobomb
:wq
</code></pre>
| 37,171 |
<p>Having been a PHP developer on LAMP servers for quite a while, is there anything that I will need to take into consideration while preparing an application for <em>IIS</em> on windows.</p>
| <p>Make sure you get the FastCGI extension for IIS 6.0 or IIS 7.0. It is the single most important thing you can have when running PHP under IIS. Also this article should get you setup:</p>
<p><a href="http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/" rel="noreferrer">http://learn.... | <p>One of the major sticking points I've had with IIS is the lack of Apache's mod_rewrite. There are other work-arounds and work-alikes depending on what you're doing, but just keep in mind that you'll need to change things up a bit to work with IIS if you're using mod rewrite extensively.</p>
| 3,171 |
<p>Is there a way to get a list ordered by two fields, say last and first names?</p>
<p>I know <code>.listOrderByLastAndFirst</code> and <code>.list(sort:'last, first')</code> won't work.</p>
| <p><a href="https://stackoverflow.com/a/326152/2521769">Hates_</a> criteria answer didn't seem to work for me; putting <code>"last,first"</code> in order will only cause exceptions saying, <code>"Property 'last,first' not found"</code>. To order on two fields, you can do the following:</p>
<pre><code>def c = MyDomain... | <p>If you were sorting lists on the contents of their items, you would need to implement a comparator which would have some smarts to enable to you decide the sort order based on multiple properties. </p>
<p>Some examples of Groovy-style comparators are shown <a href="http://devambling.taragin.com/2008/11/groovy-sort-... | 42,239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.