instruction stringlengths 0 30k ⌀ |
|---|
I would say it would be incredibly unwise to decide arbitrarily against multiple exit points as I have found the technique to be useful in practice *over and over again*, in fact I have often *refactored existing code* to multiple exit points for clarity. We can compare the two approaches thus:-
void string fooB... |
This article on MSDN should be a good starting points: [Overriding Event Handlers with Visual Basic .NET][1]. Take a look at the *How the Handles Clause Can Cause Problems in the Derived Class* section.
[1]: http://msdn.microsoft.com/en-us/library/aa290043(VS.71).aspx |
Best way to really grok Java for a C# guy |
|c#|java|migration| |
I've recently started developing applications for the Blackberry. Consequently, I've had to jump to Java and learn that and its associated tools. The syntax is easy, but I keep having issues with various gotchas and the environment.
For instance, something that surprised me and wasted a lot of time is absence of... |
Word frequency algorithm for natural language processing |
|algorithm|design-patterns|nlp|english| |
Without getting a degree in information retrieval, I'd like to know if there exists any algorithms for counting the frequency that words occur in a given body of text. The goal is to get a "general feel" of what people are saying over a set of textual comments. Along the lines of [Wordle][1].
What I'd like:
* i... |
This might be counter-intuitive for some, but we use the dreaded Hungarian notation for UI elements.
The logic is simple: for any given data object you may have two or more controls associated with it. For example, you have a control that indicates a birth date on a text box, you will have:
- the text box
- ... |
Running xinc on OpenBSD's Apache Server |
|php|continuous-integration|openbsd|xinc| |
Has anyone been able to get xinc to run correctly under OpenBSD's chrooted default Apache? I'd like to keep our development server running fully chrooted just like our Production server so that we make sure our code runs just fine chrooted. |
Hungarian notation or not, I'm more curious if people prepend m_ or _ or whatever they use for standard private member variables. |
> this must be a common need.
Some small percentage of software developers develop for .NET <br>
Some very small percentage of that group develop for mono <br>
Some small percentage of that group wants to provide .debs instead of just a zip <br>
Some very small percentage of that group wants to build their linux ... |
I think the main difference with the 2.5G phones and the new 3G phones is that while 2.5G phones used their own browsers, browsers on 3G phones have become much more similar/accurate in their rendering capabilities.
On the other hand, you can use CSS to render the same HTML in either a large screen format or a small... |
> Hungarian notation or not, I'm more
> curious if people prepend m_ or _ or
> whatever they use for standard private
> member variables.
Luke,
I use _ prefix for my class library objects. I use Hungarian notation exclusively for the UI, for the reason I stated. |
[Mootools][1] is another great JavaScript framework which is fairly easy to use, and like RedWolves said with [jQuery][2] you can can just keep chucking as many handlers as you want.
For every *.js file I include I just wrap the code in a function.
window.addEvent('domready', function(){
alert('Just... |
My approach was
1. Write some libraries and interfaces to serialize your objects into REST-compatible XML.
You can't neccessarily just use the built-in serializers, because your service may not accept the same kind of XML that .NET wants to give you.
Example: When passing booleans to a Rails REST service, `"tru... |
Use WScript.Echo instead of MsgBox. And, run the script using CSCRIPT instead of WSCRIPT. |
There is no way of including rules from another .drl file from within a .drl file.
You can however add two .drl files to the same ruleBase and they will work as if they were in the same file.
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getRe... |
Are there any warnings when you compile?
Have you turned **ALL** warnings on for this particular test (since it is not working)?
Make sure first to solve the warnings. |
Let's take an example. the parameterized query looks like that:
Select Tbl_Country.* From Tbl_Country WHERE id_Country = _
[?enter ISO code of the country]
and you'd like to be able to get this value (the [?enter ... country] one) from a form, where you have your controls and some data in it. Well...... |
How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm? |
|graph-theory|ai|a-star|dijkstra|15-puzzle| |
I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle".
Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms? |
|ai|graph-theory|a-star|15-puzzle|dijkstra| |
Scrum because it shows where the slackers are. It also identifies much faster that the business unit usually doesn't have a clue what they really want delivered |
git also makes branching and merging really easy. Subversion 1.5 just added merge tracking but git is still better. With git branching is very fast and cheap. It makes creating a branch for each new feature more feasible. Oh and git repos are very efficient with storage space as compared to Subversion. |
If you you use [session_set_save_handler()][1] you can set your own session handler. For example you could store your sessions in the database. Refer to the php.net comments for examples of a database session handler.
DB sessions are also good if you have multiple servers otherwise if you are using file based sessio... |
I've been involved with quite a few organisations which claimed to work in an 'agile' way, and their processed usually seemed to be base on XP (extreme programming), but none of them ever followed anywhere near all the practices.
That said, I can probably comment on a few of the XP practices
- **Unit testing** ... |
Objective-C uses [Reference Counting](http://en.wikipedia.org/wiki/Reference_counting), which means each Object has a reference count. When an object is created, it has a reference count of "1". Simply speaking, when an object is referred to (ie, stored somewhere), it gets "retained" which means its reference count is ... |
Yor can use the FileSystemWatcher in System.Diagnostics.
From MSDN:
public class Watcher
{
public static void Main()
{
Run();
}
[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
public static void Run()
{
string[] args = System.Environment.GetCommandLineArgs(... |
- [Tail for Win32][1]
- [Apache Chainsaw][2]
[1]: http://tailforwin32.sourceforge.net/
[2]: http://logging.apache.org/chainsaw/index.html |
- [Tail for Win32][1]
- [Apache Chainsaw][2] - used this with [log4net logs][3], may require file to be in a certain format
[1]: http://tailforwin32.sourceforge.net/
[2]: http://logging.apache.org/chainsaw/index.html
[3]: http://logging.apache.org/log4net/release/howto/chainsaw.html |
You can use [Thunderbird][1] to [access Exchange e-mail and contact lists][2].
[1]: http://www.mozilla.com/en-US/thunderbird/
[2]: http://www.downloadsquad.com/2007/03/30/howto-thunderbird-and-ms-exchange-server/ |
You can use [Thunderbird][1] to [access Exchange e-mail and contact lists][2].
Edit - Oops, this uses IMAP, didn't answer the question.
[1]: http://www.mozilla.com/en-US/thunderbird/
[2]: http://www.downloadsquad.com/2007/03/30/howto-thunderbird-and-ms-exchange-server/ |
Another advantage of 64 bit:
All the registers associated with the microprocessors are 64-bit. This enables High- precision computations and 64-bit arithmetic to be performed in fewer clock-cycles as compared to 32-bit microprocessors. In certain cases like 64-bit multiplication, it is twice as fast. |
|sql-server|visual-studio|reporting-services| |
The DBAs here maintain all SQL Server and SQL Reporting servers. I have a custom developed SQL Reporting 2005 project in Visual Studio that runs fine on my local SQL Database and Reporting instances. I need to deploy to a production server, so I had a folder created on a SQL Reporting 2005 server with permissions to ... |
You should also consider learning a functional programming language like Scala. It has many of the advantages of Ruby, including a concise syntax, and powerful features like closures. But it compiles to Java class files and and integrate seamlessly into a Java stack, which may make it much easier for your employer to... |
Stored procedures should expose business rules which don't change depending on the application using them. This lets the rules be stored and updated once instead of every place they are used, which is a nightmare. |
Error handling reporting methods with ASP.NET 2.0 / C# |
|c#|asp.net| |
Does anyone know of an open source module or a good method for handling application errors and e-mailing them to an admin and/or saving to a database? |
We use HostingPlayground. For $6 per month we get multiple Subversion repositories and an instance of Trac. Can't beat it. And since its a service its available immediately. |
Look into sp_mergedummyupdate |
I've always thought /bin/false was the standard. Some ISPs use a little menu system that lets them change their password / contact / finger info, check usages, etc. Whatever you use, you may want to add it to your /etc/shells file as well if you want the user to be able to use FTP for instance, as some services will b... |
Perforce!
It's extremely fast compared to most other source control systems. It works great remotely. (SSH tunnels, in my case)
The VS plugins are quite decent... I haven't tried the Eclipse one that much yet.
If you can get by with two users with 5 workspaces each, then you can use it for free. (I do, curr... |
I would recommend using htmlentities($input, ENT\_QUOTES) instead of mysql\_real\_escape\_string as this will also prevent any accidental outputting of actual HTML code. Of course, you could use mysql\_real\_escape\_string and htmlentities, but why would you? |
Flashdeveloper has been mentioned as a free tool to develop flex applications. I just want to add a free tool to design applications (create an MXML file using a designer): [designview][1]. It's available directly on the adobe website, it's an air application that is basic but that give the possibility to take a look f... |
Create Web Client Solution dialog closes on click or tab out of default field without messages |
|wcsf|web-client-software-fact| |
I installed Web Client Software Factory February 2008 release on Visual Studio Team System 2008 Development Edition (without SP1). When I first installed that, I tried out the software factory as I've never used one before and it worked fine. That was two months ago.
Recently I needed to learn how to use the softwar... |
As you said before, you cannot use the boundary of the HttpRequest, but you can understand what is a "HttpRequest" in your desktop application.
Let me explain. Usually your HttpRequest will be a controller for an action and you will limit your session to that specific action. Now in your desktop application the "con... |
Here is an interesting Ruby version. On my laptop it will find 30000! in under a second. (It takes longer for Ruby to format it for printing than to calculate it.) This is significantly faster than the naive solution of just multiplying the numbers in order.
def factorial (n)
return multiply_range(1, n... |
I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle".
Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms?
If ... |
From a Software Engineering perspective you are right, delegates are much like function interfaces in that they prototype a function interface.
They can also be used much in the same kind of way: instead of passing a whole class in that contains the method you need you can pass in just a delegate. This saves a whole... |
From a Software Engineering perspective you are right, delegates are much like function interfaces in that they prototype a function interface.
They can also be used much in the same kind of way: instead of passing a whole class in that contains the method you need you can pass in just a delegate. This saves a whole... |
##Simple C++ Model
In most modules I saw, by default, it was assumed that receiving pointers was **not** receiving ownership. In fact, functions/methods abandoning ownership of a pointer were both very rare and explicitly expressed that fact in their documentation.
**This model assumes that the user is owner only o... |
We use ILMerge on quite a few projects. The [Web Service Software Factory][1], for example produces something like 8 assemblies as its output. We merge all of those DLLs into a single DLL so that the service host will only have to reference one DLL.
It makes life somewhat easier, but it's not a big deal either.
... |
I'm using post-commit hooks (I think it's this one - http://lincolnloop.com/blog/2007/may/04/basecamp-svn-integration/) to post a message to a forum on Basecamp for each commit. Two advantages:
1. As the lead developer, I get a roll-up of commits every morning (via the RSS feed from that basecamp forum) and can see... |
I'm using post-commit hooks ([I think it's this one][1]) to post a message to a forum on Basecamp for each commit. Two advantages:
1. As the lead developer, I get a roll-up of commits every morning (via the RSS feed from that basecamp forum) and can see what my team has been up to pretty quickly.
2. Our Trac/SV... |
There's a lot of ways this can fall apart. Are you adding the control to the page dynamically in code behind? If so alot of times your UniqueID can be off - even though the client id's are equal. Do you have a code sample that might demonstrate what you're doing? |
I personally prefix private objects with _
Form controls are always prefixed with the type, the _only_ reason I do this is because of intellisense. With large forms it becomes easier to "get a labels value" by just typing _lbl_ and selecting it from the list ^_^ It also follows the [logic stated by Jon Limjap](http:... |
How do I make Visual Studio auto generate braces for a function block? |
|c#|visual-studio| |
I could swear I've seen people typing function headers and then hitting some key combination to auto-create function braces and insert the cursor between them like so:
void foo()_
to
void foo()
{
_
}
Is this a built-in feature? |
I have been thinking about this more, and it occurs to me that I could probably write my own JSTL function that takes a message key and a variable number of parameters:
<h:outputText value="#{my:message('label.widget.count', widgetCount)}"/>
and if my message function HTML-encodes the result before output, I ... |
They've denounced *frameworks*?
That's nuts. If you don't use an off-the-shelf framework, then you create your own. It's still a framework. |
This is a parsing problem, so neither regex not split() are the "good" solution. Use a parser generator instead.
I would look closely at [pyparsing][1]. There have also been some decent articles about pyparsing in the [Python Magazine][2].
[1]: http://pyparsing.wikispaces.com/
[2]: http://pymag.phparch.com... |
How do I check if the scanner is plugged in (C#, .NET TWAIN) |
|c#|twain| |
I use .NET TWAIN from [http://www.codeproject.com/KB/dotnet/twaindotnet.aspx?msg=1007385#xx1007385xx][1] in my application.
When i try to scan image when scanner is not plugged in, application freeze.
How to check is any device plugged in from TWAIN driver?
Thanks.
[1]: http://www.codeproject.com/KB/dotn... |
There also is [**setAllowLeadingWildcard**][1]
But be **careful**. This could get very performance expensive (thats why it is disabled by default). Maybe in some cases this would be an easy solution, but I would prefer a custom Tokenizer as stated by [Judah Himango][2], too.
[1]: http://lucene.apache.org/java... |
Silverlight does not have any capability to directly access database servers. What you can do is to expose your database operations through web services (ASMX or WCF, even non-.NET!) and use Silverlight to access those services. |
Sounds like a job for SimpleXML.
I would suggest a slightly different XML structure..
And wonder why you need to convert from an array -> XML and back.. If you can modify the array structure as you said why not just generate XML instead? If some piece of code already exists that takes that array configuration... |
Of course I googled already and found the PngBitmapDecoder class, but it doesn't seem to be available in .Net 2.0?
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.pngbitmapdecoder.aspx
The above link mentions it's in the PresentationCore assembly which I don't seem to have included with .Net... |
Coincidentally I saw this on MS Channel 9 this morning - Babylon.NET http://www.redpin.eu/
Sadly I can't vouch for it as I haven't used it, but looks like a reasonable alternative to Passolo (well, at least it's cheaper). |
I was going to recommend this: http://code.google.com/hosting/takenDown?project=nelly2pcm¬ice=7281.
But its been taken down. Glad I got a copy first :-) |
It seems that you are referring to x86 processor family that is not built with real-time systems in mind, so there is no real guarantee for constant time execution (CPU may reorder micro-instructions, than there is branch prediction and instruction prefetch queue which is flushed each time when CPU wrongly predicts con... |
This is caused by a bug/feature in Terminal Services clipboard (and possible other things) and the .NET implementation of the clipboard. A delay in opening the clipboard causes the error, which usually passes within a few milliseconds.
The solution is to try multiple times within a loop and sleep in between.
for ... |
no offense, but from your description it would appear that you're not really qualified for a 'real' OO programming job. Academic classes are a good introduction to a language but no substitute for solving real problems with fluctuating deadlines, finicky users, cholicky managers, et al ;-)
this leaves three options:... |
Understand your worst case runtime for complex operations and use timers. |
One preferred way of navigating when I'm using multiple directories in widely separate places in a tree hierarchy is to use acf_func.sh (listed below). Once defined, you can do
cd --
to see a list of recent directories, with a numerical menu
cd -2
to go to the second-most recent directory.
Very easy to ... |
Be careful what state you store client side (query strings, form fields, cookies). Anything security-related should not be stored client-side, except maybe a session identifier if it is reasonably obscured and hard to guess. There are too many websites that have settings like "authenticated=true" and store those in a c... |
You can package InfoPath forms in SharePoint solutions (WSP files). These can be deployed by making use of STSADM. For more information:
- http://blogs.importchaos.com/alonsorobles/2008/06/04/creating-a-sharepoint-solution-for-an-infopath-form-template-deployment/#comments
- http://www.crsw.com/mark/Lists/Posts/P... |
REDUX: How to overcome an incompatibility between the ksh on Linux vs. that installed on AIX/Solaris/HPUX? |
|linux|solaris|ksh|aix|hp-ux| |
I have uncovered another problem in the effort that we are making to port several hundreds of ksh scripts from AIX, Solaris and HPUX to Linux. See [here](http://stackoverflow.com/questions/74372/how-to-overcome-an-incompatibility-between-the-ksh-on-linux-vs-that-installed-o) for the previous problem.
This code:
... |
I found the following here (http://forums.devarticles.com/microsoft-access-development-49/pass-parameters-from-vba-to-query-62367.html):
'Ed. Start - for completion of the example
dim qryStartDate as date
dim qryEndDate as date
qryStartDate = #2001-01-01#
qryEndDate = #2010-01-01#
'E... |
Sorry I can't add this as a comment to a previous answer but I don't have the rep. Doing some quick and dirty testing I also found that exec("identify -ping... is about 20 times faster than without the -ping. But getimagesize() appears to be about 200 times faster still.
So I would say getimagesize() is the faster... |
This is pretty cool. Upcoming [ASP.NET][1] feature source is available.
[1]: http://www.codeplex.com/aspnet |
One way is using the [CoreAudio][1] DefaultOutputUnit.
You can configure it with parameters such as output sampling rate, resolution, and output sample format. Then you can programmatically create a raw sound wave and provide this to the output unit.
Take a look at this example on your machine at /Developer/Exam... |
Why not declare the method as virtual in the parent class and then you can override it in the derived classes to add extra functionality? |
you could try putting the images in the background.
<table>
<tr>
<td style="background: url(myImg.jpg) no-repeat; vertical-align: middle; text-align: center">
Here is my text
</td>
</tr>
</table>
You'll just need to set the height and width on ... |
i can't believe nobody has mentioned css adapters. many of the common controls used in asp.net (gridview and treeview for example) can be processed through an adapter to change the resulting html that is outputted to the browser.
if going the mvc route isn't a viable option, it is possible to write your own adapter... |
First: you have to store indexes somewhere. So a data<something> file will be needed unless you want memory only indexes.
To index generic items, I can recommend you sqlite: <http://www.sqlite.org/>. I even use it in memory only mode when I have a bunch of data and I need to handle it with multiple indexes. |
The short answer is - it's going to be annoying, but not difficult.
Java and C# have all the same underlying concepts, and a lot of the libraries are very close in style, but you're going to keep bumping your head across various differences.
If you're talking about class properties, Java has those. The syntax is ... |
This is a particularly cool site for visualizing how everything in the math world fits together:
<http://www.math.niu.edu/~rusin/known-math/>
It's also got short summaries of many subfields you've probably never heard of, which is fun. |
I would set the images as the cells' background via CSS, set the cells' size to the proper fixed value (again via CSS), and then insert the text label as the cell content. By default, the content of table cells is centered vertically, so I think you don't have to worry about it. Again, vertical and horizontal alignment... |