instruction stringlengths 0 30k ⌀ |
|---|
There is at least one special case where for and foreach have been optimized to not generate the whole list at once. And that is the range operator. So you have the option of saying:
for my $i (0..$#list) {
my $item = some_function($list[$i]);
...
}
and this will iterate through the array... |
I see the underlying problem now. It is deeper than I first thought. Basically the solution is to modify the expression tree before serializing it, by replacing all subtrees that do not depend on the parameters with constant nodes. This is apparently called "funcletization".
There is an explanation of it [here][1].
... |
A colleague of mine has also posted some [interesting thoughts][1] on this.
[1]: http://www.dcmanges.com/blog/rails-performance-tuning-workflow |
I came across the following in my blog reading. It's not really limitations in jQuery but common mistakes made when using ASP.NET developers using jQuery:
http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/ |
I think Dan Bartels' blog post about
[Replacing Old Classic ASP COM Componenets With .NET Assemblies][1] is the right starting point for you.
Implementing the details described in the blog post, you should be able to instantiate your objects in classic asp and execute code like this:
Dim myObject
Set ... |
Just make another closure...
Say, something like:
var prepend = "OLD:";
Func<string, Func<string, string>> makePrepender = x => y => (x + y);
Func<string, string> oldPrepend = makePrepender(prepend);
prepend = "NEW:";
Console.WriteLine(oldPrepend("Brownie"));
Havn't tested it yet ... |
What source control to use really depends on your environment, your corporate culture and the general situation of how projects are handled in your company. The newer "Visual Source Safe" in Team Foundation is hands down better than the piece of crud that VSS used to be. and is good in a Microsoft shop with one or fe... |
I think in this case the documentation is misleading when it marks the parameter as [out]. You have to pass a valid LPMESSAGE to the method, and that's why is not a double pointer. So i would go with [in] on your idl definition. |
Just getting tools installed is not enough. You need to understand how the particular technology works (like SVN) and how the whole source tree supposed to work: best structure, tagging, branching, merging and so fourth. Since we use SVN I recommend [Subversion Book][1]. It has some good explanations of source control ... |
If you are working with a middleware environment like Torque or Unity3D, they include a GUI framework to build on. Flash is an ideal tool, but to use in anything other than a Flash or Shockwave3d game you need to purchase ScaleForm too, which is expensive and isn't easy to get hold of for indie developers. WPF and Silv... |
Python/Perl/Ruby/PowerShell are great supplements to C#/VB.NET. If your boss hands you a text file and says insert it into the database once or twice, then any of Perl/Python/Ruby (I'm not sure about powershell but I imagine it is not that much more difficult) should be fine to parse it. Either way, for your main app... |
In our project have a standard auto-generated designer.cs file, linked to a DBML file, that contains all our object classes that map onto our database tables.
We want to pass these objects directly through a WCF Service and so they need decorating with the [DataContract] and [DataMember] attributes where appropriate... |
If you're using .NET, this seems easier and more straightforward using build-in .NET functionality:
[The Weekly Source Code 31- Single Instance WinForms and Microsoft.VisualBasic.dll](http://www.hanselman.com/blog/TheWeeklySourceCode31SingleInstanceWinFormsAndMicrosoftVisualBasicdll.aspx) |
Regex patterns should do the trick. |
The command <code>svn up -r 4</code> only updates your _local_ copy to revision 4.
The server still has all versions 1 through to whatever.
What you want to do, is create a _new_ revision, revision number 5, which is identical to revision number 2.
cd /repo
svn up -r 2
cp /repo/file /tmp/fil... |
Surely the switch on String would compile down to a String comparison (one per case) which is slower than a type comparison (and far slower than the typical integer compare that is used for switch/case)? |
- Setup a room with several terminals
running your application
- Prepare a list of tasks to be
completed
- Bring in volunteers to run through
the tasks
- Monitor the actions of the
volunteers either through taping or
a one way mirror
Rinse and Repeat! |
If you want to extend the session beyond 20 minutes, you change the default using the IIS admin or you can set it in the web.config file. For example, to set the timeout to 60 minutes in web.config:
<configuration>
<system.web>
<sessionState timeout="60" />
... other elements omitted ...... |
It also isn't just a security feature in php but more of how many MVC based PHP sites function. If for example in SugarCRM you were to call a module file directly the page load would fail because the controller, view and model were not previously loaded and you'd have no db config/connection information either, so to m... |
["Isolated applications"][1] is a mechanism for embedding an XML manifest that describes the DLL dependencies.
[1]: http://msdn.microsoft.com/en-us/library/aa375190(VS.85).aspx |
I am a fan of GWT, however I am very familiar with Java. I found it to be intuitive, and surprisingly easy to get good results quickly. If you are to use GWT, then you'll definitely want to use the free, and immensely powerful [Eclipse][1] IDE.
One disadvantage of GWT is that it *requires* Javascript to be support... |
What Fortran compilers are there? |
|compiler-construction|fortran| |
What Fortran compilers are there in this day and age, and which would you recommend? Please list the version of Fortran it supports, the platform it works on (e.g. *nix / Windows), and whether it cost money.
(Standard OS one per answer etc.) |
This is an easier but similar method than what [rp][1] has suggested:
function submit(button) {
Page_ClientValidate();
if(Page_IsValid)
{
button.disabled = true;
}
}
<asp:Button runat="server" ID="btnSubmit" OnClick="btnSubmit... |
Thats a very good question.
I know nowadays that most app development that im aware of is web apps.
But with languages such as flex , i wouldnt be suprised if the desktop apps came back again. |
You can do all this in a single stored procedure with a single parameter.
|
You can do all this in a single stored procedure with a single parameter.
I have to run out, but I'll try to write one up for you and add it here as soon as I get back from my errand.
|
I emit a 404 page, not as a serious security measure but only because I don't like leaking information about the internals of a site, even the names of internal files.
But if the file just contains functions then there's no real harm in omitting the check. |
The main downside of using a compound primary key, is that you will confuse the hell out of typical ORM code generators. |
GFortran - part of GCC is free and works wherever GCC does. |
We have evaluate a large list of frameworks and have decide us for [Echo2][1].
- You need only to code in Java. Javascript you need only if you want write your own components.
- There are no startup performance problems with large projects like GWT.
- You can use the full range of Java in your client code b... |
Multithreaded Debugger |
|debugging|pthreads| |
GDB has severe issues when debugging with multiple threads (pthreads).
Are there any other good multi-threaded debuggers for C/C++ on *nix?
|
|c++|c|debugging|gdb|pthreads| |
I might not understand you correctly but check this out...
http://www.ayende.com/projects/rhino-mocks.aspx
|
See C++ FAQ sections [17.2][1] and [17.4][2].
In general, I have found that code that is easier to port and maintain results if constructors are written so they do not fail, and code that can fail is placed in a separate method that returns an error code and leaves the object in an inert state.
[1]: http://ww... |
Try CPAN::Mini
http://search.cpan.org/~rjbs/CPAN-Mini-0.571/
|
I agree with Iulian Șerbănoiu: **Code::Blocks is a very good solution**, usable both from Linux (it will use g++/gcc) and from Windows (it will use either the MS compiler or gcc)
Note that you should at least once or twice try to compile using a good old makefile, if only to understand the logic behind headers, sour... |
Definitely BBEdit... I code, therefore I eat... and BBEdit is what I use to code. |
How to get progress from XMLHttpRequest |
|javascript|ajax| |
Is it possible to get the progress of an XMLHttpRequest (bytes uploaded, bytes downloaded)?
This would be useful to show a progress bar when the user is uploading a large file. The standard API doesn't seem to support it, but maybe there's some non-standard extension in any of the browsers out there? It seems like ... |
Is it possible to get the progress of an XMLHttpRequest (bytes uploaded, bytes downloaded)?
This would be useful to show a progress bar when the user is uploading a large file. The standard API doesn't seem to support it, but maybe there's some non-standard extension in any of the browsers out there? It seems like ... |
From: http://us3.php.net/manual/en/mysqli.close.php
> "Open connections (and similar resources) are automatically destroyed at the end of script execution. However, you should still close or free all connections, result sets and statement handles as soon as they are no longer required. This will help return resources ... |
Prevent a PostBack from showing up in the History |
|asp.net|vb.net|.net-2.0| |
I have a page where I submit some data, and return to the original form with a "Save Successful" message. However, the user would like the ability to return to the previous page they were at (which contains search results) by clicking the browser's Back button. However, due to the postback, when they click the Back b... |
I have a page where I submit some data, and return to the original form with a "Save Successful" message. However, the user would like the ability to return to the previous page they were at (which contains search results) by clicking the browser's Back button. However, due to the postback, when they click the Back b... |
|asp.net|vb.net|.net-2.0| |
I have a page where I submit some data, and return to the original form with a "Save Successful" message. However, the user would like the ability to return to the previous page they were at (which contains search results) by clicking the browser's Back button. However, due to the postback, when they click the Back b... |
You can make the root form (by which I assume you mean JFrame) be your own subclass of JFrame, and put standard functionality in its constructor, such as:
this.setIconImage(STANDARD_ICON);
You can bundle other standard stuff in here too, such as memorizing the frame's window metrics as a user preference, ma... |
Here is a link with code dumper and a demo project that shows you how to use it. [Download it here][1].
[1]: http://www.codeguru.com/csharp/csharp/cs_syntax/reflection/article.php/c5885 |
This isn't technically possible for security purposes, so the user cannot be misled.
However, there are a couple of workarounds, although these require working with the raw HTML rather than the .NET server control - take a look at http://www.quirksmode.org/dom/inputfile.html for one example. |
string s = "...<tab>...";
s = s.Replace("<tab>", "\t"); |
using System.Text.RegularExpressions;
Regex.Replace(s, "TAB", "\t");//s is your string and TAB is a tab. |
If your at the point of worrying about trigger orders then you really should take a step backwards and consider what you are trying to do and is there a better way of doing it. The fact that this isn't an easy thing to change should be telling you something.
Triggers always look like a real neat solution, and in th... |
calculate elapsed time in flash |
|time|elapsed| |
I am building a quiz and i need to calculate the total time taken to do the quiz.
and i need to display the time taken in HH::MM::SS..any pointers? |
I use it every time. It's more information that I can use to quickly figure out what is going on when I revisit the code in a year and I've forgotten what I was thinking the first time.
|
Eclipse by itself is pretty bloated, and the more plugins you add only exacerbates the situation. It's still my favorite IDE, as it certainly isn't short on functionality, but if you're looking for a lightweight IDE then I'd suggest ditching Eclipse; it's pretty normal to run up half a gig of memory if you leave it ru... |
Ah, sounds like a job for SQL Profiler.
http://msdn.microsoft.com/en-us/library/ms181091(SQL.90).aspx |
Distributed python |
|dsitributed|python| |
what is the best python framework to make distributed apps? For example to build a P2P app.
Thanks |
|python|distributed| |
You could download the source of BitTorrent for starters and see how they did it.
http://download.bittorrent.com/dl/
|
I always use the tag. It is a simple compile-time flag to catch little mistakes that I might make.
It will catch things like <code>tostring()</code> instead of <code>toString()</code>
The little things help in large projects. |
I have a rather weak understanding of any of oracle's more advanced functionality but this should I think be possible.
Say I have a table with the following schema:
MyTable
Id INTEGER,
Col1 VARCHAR2(100),
Col2 VARCHAR2(100)
I would like to write an sproc with the following
PROC... |
I have a rather weak understanding of any of oracle's more advanced functionality but this should I think be possible.
Say I have a table with the following schema:
MyTable
Id INTEGER,
Col1 VARCHAR2(100),
Col2 VARCHAR2(100)
I would like to write an sproc with the following
PROC... |
As the previous answer suggested, I would break your table into several.
BoxItemActions, containing a list of actions that the work flow needs to go through, created each time a BoxItem is created. In this table, you can track the detailed dates \ times \ users of when each task was completed.
With this type of ... |
I have Delphi 7 working fine on my Vista development box. Yes there was a few issues during installation, but no more than other applications and these issues have been resolved in subsequent versions of Delphi.
None of this should cause problems with apps developed by D7 for Vista. We use Delphi as our primary deve... |
User Defined Fields with NHibernate |
|c#|nhibernate|user-defined-fields| |
I need to add a user defined fields feature to an asp.net c# application that uses NHibernate.
The user must be able to add and remove fields from several objects in the system "on the fly", preferably without any system downtime.
One important constraint is that the database schema can't be changed by the user -... |
I need to add a user defined fields feature to an asp.net c# application that uses NHibernate.
The user must be able to add and remove fields from several objects in the system "on the fly", preferably without any system downtime.
One important constraint is that the database schema can't be changed by the user -... |
Go to IIS administration -> <Web Site> -> Properties -> HTTP Headers tab -> click Enable Content Expiration, and set it to whatever you want. |
IoC, Where do you put the container? |
|inversion-of-control|di|castle-windsor|oop| |
I'm using castle windsor for a pet-project I'm working on. I'm starting to notice that I need to call the IoC container in different places in my code to create new objects. This dependency on the container makes my code harder to maintain.
There are two solutions I've used to solve this problem
I tried to create... |
Trouble running insert queries with varray variables |
|sql|oracle-database|plsql| |
I'm using sql*plus 9.2 on Oracle 10g enterprise. I have created some scripts that do basic inserts using parameters that I pass through the command prompt. It seemed logical that I should be able to run a bunch of inserts in a loop. So I tried the following:
--begin
DECLARE
TYPE va_orgs IS TABLE OF nbr.lien_it... |
What's the best way to set up data access for an ASP.NET MVC project? |
|asp.net|asp.net-mvc|c#|visual-studio-2008|visual-studio| |
I am starting a new ASP.NET MVC project to learn with, and am wondering what's the optimal way to set up the project(s) to connect to a SQL server for the data. For example lets pretend we have a Product table and a product object I want to use to populate data in my view.
I know somewhere in here I should have an ... |
I am starting a new ASP.NET MVC project to learn with, and am wondering what's the optimal way to set up the project(s) to connect to a SQL server for the data. For example lets pretend we have a Product table and a product object I want to use to populate data in my view.
I know somewhere in here I should have an ... |
|c#|asp.net|visual-studio|asp.net-mvc|visual-studio-2008| |
I am starting a new ASP.NET MVC project to learn with, and am wondering what's the optimal way to set up the project(s) to connect to a SQL server for the data. For example lets pretend we have a Product table and a product object I want to use to populate data in my view.
I know somewhere in here I should have an ... |
This isn't the fastest or shortest way, but I think it is very readable. So I would do something like this:
bool is_power_of_2(int n)
int bitCounter=0;
while(n) {
if ((n & 1) == 1) {
++bitCounter;
}
n >>= 1;
}
return (bitCounter == 1);
}
... |
[Intel Fortran.][1] Works on Windows and Linux. Not free for commercial applications.
[1]: http://www.intel.com/cd/software/products/asmo-na/eng/compilers/278834.htm |
There isn't a purpose. Just don't use it except for setting the model
ViewPage<Model>
See [this][1] blogpost for more info.
[1]: http://stevesmithblog.com/blog/codebehind-files-in-asp-net-mvc-are-evil/
|
Code behind in ASP.NET MVC |
|asp.net-mvc| |
What is the purpose of the code behind view file in ASP.NET MVC besides setting of the generic parameter for ViewData? |
What is the purpose of the code behind view file in ASP.NET MVC besides setting of the generic parameter of ViewPage ? |
Intel Fortran Compiler - works on Linux, Windows and Mac. It costs money but the Linux version can be used for personal use for free. It produces the fastest code of any Fortran compiler in many circumstances and supports all versions of Fortran including much of the 2003 standard.
A great comparison between vario... |
To be well versed you should do both. Skills in one area may or may not translate into the other very well. The lack of state for example trips up lots of desktop developers when they start building web apps. Of course, your experience may vary |