instruction stringlengths 0 30k ⌀ |
|---|
How do I implement an A* pathfinding algorithm, with movement costs for every programming language? |
|astar|a|path-finding|pathfinder|every| |
**Can we get people to post code of simple, optimized implementations of the A* pathfinding algorithm, in every single language?**
This is mostly for fun and to play with what stackoverflow itself is capable of... although I actually am interested in getting an ActionScript 3 version of this.
But the idea is tha... |
Very simple and useful snippet:
; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
; create new folder
;
^!n::Send !fwf
; create new text file
;
^!t::Send !fwt
; open 'cmd' i... |
Alternatives to Live/GamerServices for XNA projects? |
|xna|networking| |
Using the GamerServices component for XNA to access Xbox/GfW Live for networking purposes requires developers and players each to have a US$100/year subscription to Microsoft's Creators Club. That's not much of an issue for Xbox360 XNA projects as you need the subscription anyway to be able to put your game on the 360.... |
|networking|xna| |
Using the GamerServices component for XNA to access Xbox/GfW Live for networking purposes requires developers and players each to have a US$100/year subscription to Microsoft's Creators Club. That's not much of an issue for Xbox360 XNA projects as you need the subscription anyway to be able to put your game on the 360.... |
Press the F8 key to cycle through search results. (Shift+F8 for reverse direction)
Hit F12 to go to definition of variable.
Shift + alt + arrow keys = Block select! |
In my opinion, the main goal of having each variable on a separate line would be to facilitate the job of Version Control tools.
If several variables are on the same line you risk having conflicts for unrelated modifications by different developers. |
Can we see the whole stack trace? Where does it think String#stringify_keys! is being called?
Also, params looks odd to me. Is tasks.build() expecting input like this: `["new_tasks_attribute", {"name" => "paint fence"}]` ?
If not, maybe you actually want Hash#each_key() instead of Hash#each()?
Need more data. ... |
I found a number of people asking the same question starting around 2005, but here is the first google result - also discusses silverlight.
http://software.clempaul.me.uk/articles/clickonce/
<edit - hit post too quickly>
As far as I can tell, however, the only thing you would need to worry about would be setting... |
You can use the AddComponentWithProperties method of the IWindsorContainer interface to register a service with extended properties.
Below is a 'working' sample of doing this with an NUnit Unit Test.
namespace WindsorSample
{
public class MyComponent : IMyComponent
{
public... |
My first attempt would involve using a regex to parse the two parts of the declaration (where the second part is only used for variably sized types.) Make sure that you convert the type-name to lower case when you've parsed it.
You could make an enum with all the various types in it (lower-cased), then use Enum.Par... |
Does AES (128 or 256) encryption expand the data? If so, by how much? |
|encryption|compression|aes| |
I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate. |
Since Java 1.5, it is possible to set the read timeout in milliseconds on the underlying socket via the 'setReadTimeout(int timeout)' method on the URLConnection class.
Note that there is also the 'setConnectTimeout(int timeout)' which will do the same thing for the initial connection to the remote server, so it i... |
Check the size of IntPtr with Marshal.SizeOf. 32 bit = 4 bytes, 64 bit = 8 bytes.
Edit: I am not sure this is what you are looking for after reading the question again. |
System.Reflection.PropertyInfo aProp = typeof(ListView).GetProperty(
"DoubleBuffered", System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
aProp.SetValue(ListView1, true, null);
|
System.Reflection.PropertyInfo aProp = typeof(System.Windows.Forms.Control)
.GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
aProp.SetValue(ListView1, true, null);
[Anonymousstackoverflowuser](http://stackoverflow.com/quest... |
[iText PdfCopy][1]
[1]: http://itextdocs.lowagie.com/tutorial/general/copystamp/index.php |
Base your service on this [MSDN article][1] and create two service hosts.
But instead of acctually calling each service host directly you can break it out to as many classes you want which defines each service you want to run:
internal class MyWCFService1
{
internal static System.ServiceMod... |
arp -a
That gets everything the current machine knows about on the network.
(I'm putting this up there as a second option, since nmap isn't universally installed). |
Here is a good artikel about this topic: [http://msdn.microsoft.com/en-us/library/aa192490.aspx][1]
You can download VB2008-Express for free at: [http://www.microsoft.com/express/default.aspx][2]
[1]: http://msdn.microsoft.com/en-us/library/aa192490.aspx
[2]: http://www.microsoft.com/express/default.aspx |
I ended up not having to use it, but I found what I think is the best answer. Basically you load an XmlReader, create an XmlDocument from the reader, then select a list of nodes from the document into an XmnLodeList, which you can use in a ForEach statement. Here is some sample code:
System.Xml.XmlReader sqlXMLR... |
In priciple everytime there is no overhead for the caller to wait in a queue.
|
How do I visualise clusters of users? |
|cluster-analysis|data-visualization| |
I have an application in which users interact with each-other. I want to visualize these interactions so that I can determine whether clusters of users exist (within which interactions are more frequent).
I've assigned a 2D point to each user (where each coordinate is between 0 and 1). My idea is that two users' p... |
I have an application in which users interact with each-other. I want to visualize these interactions so that I can determine whether clusters of users exist (within which interactions are more frequent).
I've assigned a 2D point to each user (where each coordinate is between 0 and 1). My idea is that two users' p... |
How can you run Javascript using Rhino for Java in a sandbox? |
|java|javascript|rhino| |
Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly).
My question is how can I setup the execution of these scripts to make sure scripting errors don't have a major negati... |
|a-star|path-finding|pathfinder|artificial-intelligence|a| |
|artificial-intelligence|a-star|pathfinder|path-finding| |
My answer to this is clearly [eclim](http://eclim.sf.net). It exports Eclipse functionality to Vim, enabling me to use several awesome features of Eclipse, like auto-completion, autobuild and error-markup in the source file (using locations in Vim), auto-formatting, automatic imports, JavaDoc search, Source code Search... |
I don't have a specific answer, but I would look at the .NET [Terrarium][1] project. All participants are user loaded DLLs. They have done a lot of neat stuff to prevent unsafe and cheater code from loading/executing.
Justin Rogers has [written extensively][2] on Terrarium implementation details.
[1]: http://... |
The `@media` rule in CSS can be used to define alternate rules for print.This is often used to hide navigation and change the style to fit print better:
@media print {
.sidebar { display: none; }
}
You can also link a seperate stylesheet for print:
<link rel="stylesheet" href="print.css" ty... |
Build a class which reads the XML file in, and provides properties/methods/etc based upon the data in that file. When the class writes the XML file back out, have it format in the manner needed for the new version.
So, basically, the class will be able to read in the current version, plus all the older versions, but... |
I'm not sure if it helps, but I've been working on some code recently which uses a bunch of projects compiled using NMake. For those, there's an option if you right-click on the project and select the NMake option (I guess you might have a web form option in there?). I found intellisense often wouldn't pick everything ... |
You can define css rules that are specific to a media type. The following is a css example (copied from http://www.w3.org/TR/CSS2/media.html, section 7.2.1) that specifies different font sizes what gets displayed on a web page and what gets printed.
@media print {
BODY { font-size: 10pt }
}
... |
There was a sample on an MSDN blog for the Microsoft.Xna.Framework.Matrix, I think it was. I later made my own, but it was still good. |
Agree with edg, and also because it is more readable and easy for maintenance to have each variable on separate line. You immediately see the type, scope and other modifiers and when you change a modifier it applies only to the variable you want - that avoids errors. |
Note that, currently, loaded RSLs must be compiled against the very same version of the Flex framework.. if you plan for a "binary" plugin system, probably you want to wait for the [Marshall plan][1] feature to be implemented, in the next Flex version.
[1]: http://opensource.adobe.com/wiki/display/flexsdk/Marshall... |
See this example from <a href="http://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage#13446">StackOverflow: Regular expression for parsing links from a webpage?</a>
Using <a href="http://www.codeplex.com/htmlagilitypack">The HTML Agility Pack</a> you can parse the html, and extra... |
The translate behavior is another of CakePHP's very useful but poorly documented features. I've implemented it a couple of times with reasonable success in multi-lingual websites along the following lines.
Firstly, the translate behavior will only internationalize the database content of your site. If you've any mor... |
Assembly names and versions |
|c#|assembly|naming| |
I am wondering what is considered as best practice when it comes to assemblies and releases. I would like to be able to reference multiple versions of the same library - solution contains multiple projects that depend on different versions of a commonutils.dll library we build ourselves.
As all dependencies are copi... |
You could use spl_autoload_register() or __autoload() to create whatever rules you need for including the files that you need for classes, however autoload introduces its own performance overheads. You'll need to make sure whatever you use is prepended to all gui pages using a php.ini setting or an apache config.
F... |
Your question is a little difficult to understand. Are you trying to generate the RSS for others to consume, or are you trying to consume someone else's RSS?
If you are trying to generate your RSS feed for others to consume you will need to read the spec:
http://cyber.law.harvard.edu/rss/rss.html
If you are tr... |
Practical Alternative for Windows Scheduled Tasks (small shop) |
|windows|scheduling| |
Greetings,
I work in a very small shop (2 people), and since I started a few months back we have been relying on Windows Scheduled tasks. Finally, I've decided I've had enough grief with some of its inabilities such as
1. No logs that I can find except on a domain level (inaccessible to machine admins who aren'... |
I like developing against Firefox first, often using Yahoo's YUI for reset (and grids for basic structure of the page), and using IE conditional directives to override formats that IE, in all its–_a-hem_–wisdom, handles differently.
**index.html**
>`<head>
<link rel="stylesheet" type="text/css" media... |
['readline' module][1] 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.
import readline
Since I am running IDLE on Windows it is unfortunately not an option for ... |
You're probably best off going through each entry and creating a new associative array out of it.
foreach($submission_info as $elem) {
$newarray[$elem["field_name"]] = $elem["content"];
}
Then you can just find the form fields by getting the value from $newarray[_<field you're filling in>_... |
You need other languages on the JVM for the same reason you need multiple programming languages in general: Different languages are better as solving different problems ... static typing vs. dynamic typing, strict vs. lazy ... Declarative, Imperative, Object Oriented ... etc.
In general, writing a "compiler" for an... |
Running multiple sites from a single Python web framework |
|python|frameworks| |
What are come good (or at least clever) ways of running multiple sites from a single, common Python web framework (ie: Pylons, TurboGears, etc)? I know you can do redirection based on the domain or path to rewrite the URI to point at a site-specific location and I've also seen some brutish "`if site == 'site1' / elseif... |
Yet another option is to have a hidden IFRAME that you call iframe.contentWindow.print() on. That will allow you to create an invisible layout that prints exactly as you want it to.
Of course, an even better solution is to export the file to a PDF and let the user print it out that way. PDFs produce the highest qual... |
Try [OpenRowSet][1]. This can be used to import Excel stuff. Excel can open CSV files, so you only need to figure out the correct [ConnectionString][2].
[1]: http://support.microsoft.com/kb/321686
[2]: Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\txtFilesFolder\;Extensions=asc,csv,tab,txt; |
How to associated the cn in an ssl cert of pyOpenSSL verify_cb to a generated socket |
|python|pyopenssl| |
I am a little new to pyOpenSSL. I am trying to figure out how to associate the generated socket to an ssl cert. verify_cb gets called which give me access to the cert and a conn but how do I associate those things when this happens:
cli,addr = self.server.accept()
|
John Resig's [Processing.js][1] is a nice framework for that.
[1]: http://ejohn.org/blog/processingjs/ |
Depending on how cross-browser you need to be and your goal of doing the output, you might look into the Canvas element and the related javascript.
[Canvas](http://en.wikipedia.org/wiki/Canvas_(HTML_element)) |
- Project Management (dotProject)
- Generic Testing Servers (IIS, PHP, etc)
Do you plan to get rid of those old machines any time soon? No
And which server products do you use? MS Virtual Server |
There's no substiture for practicing.
It's easy to read through a book or listen to a lecture and feel like you're following what's going on.
What I would recommend is taking some of the code examples (I assume you have them on disk somewhere), compile them and run them, then try to change them to do something di... |
You can use **Ctrl+Shift+Arrow** keys to make the selection and then just hit Delete. You may need to hit the arrow key while still pressing **Ctrl+Shift** combination but because the fingers are in the same position is very fast. This works also for selecting words incrementally. |
You can use **Ctrl+Shift+Arrow** keys to make the selection and then just hit Delete. You may need to hit the arrow key more than once while still pressing **Ctrl+Shift** combination but because the fingers are in the same position is very fast. This works also for selecting words incrementally. |
Looks like you can grab the SqlConnection of your DataContext and turn on statistics.
One of the statistics is "bytes returned".
[MSDN Reference Link][1]
[1]: http://msdn.microsoft.com/en-us/library/7h2ahss8(VS.80).aspx |
You aren't going to be able to have your site as non-SSL, with a login box on every page, and then submit the username and password via SSL.
The only way to really accomplish this is to use frames of some sort. This way your entire page could be non-SSL, but the login frame would have to be SSL.
The usual ways o... |
I use IM to communicate with colleagues in other offices when it replaces a face-to-face chat. I turn off notifications in all my comms apps at work though, because they distract me otherwise. |
Are the processes parallel? Is performance a real concern? Are there multiple 'threads' of execution like on a web server? I don't think there is a finite answer. |
What argument are you using for the parent?
You may have better luck if you use the parent of the Applet.
javax.swing.SwingUtilities.getWindowAncestor(theApplet)
Using the getWindowAncestor will skip the applet parents (getRoot(component) will return applets). In at least some versions of Java there was a... |
A sample for jQuery based WYSIWYG Editor |
|jquery|wysiwyg|rtf|fckeditor| |
Want a good example to illustrate how to use jQuery to built OOP javascript component.
It is so good you guys use markdown... Would be a heaven if users would love such thing too |
A sample for jQuery based WYSIWYG Editor demonstrate OOP javascript |
|javascript|jquery|wysiwyg|rtf|fckeditor| |
Want a WYSIWYG jQuery Editor as an example to illustrate how to use jQuery to built OOP javascript component.
P.S.
It is so good stackoverflow can use markdown... Would be a heaven if users would love such thing too |
I found this page on IBM's site: [IA94: IBM Message Service Client for C/C++][1]. On it there is a link to a [readme.txt file][2] which, under "Supported environments" lists "Windows 2003 Server x64 edition - Microsoft Visual C++ .NET 2005 Service Pack1".
Hope that helps!
[1]: http://www-01.ibm.com/support/docv... |
public static bool IsReservedKeyWord(string identifier)
{
Microsoft.CSharp.CSharpCodeProvider csharpProvider = new Microsoft.CSharp.CSharpCodeProvider();
return csharpProvider.IsValidIdentifier(identifier);
}
|
For routing issues like this, you should try out my [Route Debugger][1] assembly (use only in testing). It can help figure out these types of issues.
[1]: http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx
P.S. If you're trying to secure the Pages controller, make sure to use the [Authorize] attrib... |
I telecommute from California to Colorado and never have used chat. We do have daily SCRUM meetings and constant email threads. When I first started working remotely, we did try it but it seemed intrusive to several co-workers so we stopped using it, that was 4 years ago, I probably should give it another try. |
You could use a shortcut library to handle the browser specific stuff.
http://www.openjs.com/scripts/events/keyboard_shortcuts/#
shortcut.add("Ctrl+S",function() {
alert("Hi there!");
}); |
It's been my experience with the Commerce Starter Kit and MVC Storefront (and other sites I've built) that no matter what you think now, information about user interactions with your "products" is paramount to the business guys. There's so many metrics to capture - it's nuts.
I'll save you all the stuff I've been th... |
Most of the other folks have answered your questioned well. Taken together, these create a very full explanation of the problem and recommended workarounds. The problem is that the Perl pragma "use constant" really creates a subroutine in your current package whose name is the the first argument of the pragma and who... |
P-Invoke is your friend.
[DllImport("Shlwapi.dll", CharSet = CharSet.Unicode)]
private static extern int StrCmpLogicalW(string psz1, string psz2);
Then you could use it as your own comparer.
For example (in VS2005),
Array.Sort(tringArray, delegate(string left, string right)
{
retu... |
A deployment project from Visual Studio allows you to install a SQL Server Express instance with ease.
We have the same kind of scenario for our applications and it means you do need seperate installations for the client and server.
Our server installation deals with either installing a new SQL Server or upgradin... |
With separate lines, you have the opportunity to add a comment on each line describing the use of the variable (if it isn't clear from its name). |
Regex to match all HTML tags except <p> and </p> |
|regex|regexp|perl| |
I need to match and remove all tags using a regular expression in Perl. I have the following:
<\\??(?!p).+?>
But this still matches with the closing `</p>` tag. Any hint on how to match with the closing tag as well? |
|regex|perl| |
I need to match and remove all tags using a regular expression in Perl. I have the following:
<\\??(?!p).+?>
But this still matches with the closing `</p>` tag. Any hint on how to match with the closing tag as well?
Note, this is being performed on xhtml. |