instruction
stringlengths
0
30k
My colleague has found himself in an "interesting" situation. He is working on a Silverlight (2.0) prototype that needs to call existing web services in the enterprise and bind the returned data to data-display controls. The thing is, the web services return .NET DataSets (they are not about to change existing implemen...
It really depends on your needs and experience. I have worked with both (though have to say that the last Delphi version I really worked with was Delphi 6, and I'm currently working with Qt 4.4). **The language** C++ pros: - C++ is more "standard", e.g. you will find more code, libraries, examples etc., and...
Can you pop in the debugger and see if the correct value is indeed being passed on that connection string? It would quickly help you idenfity which side the problem is on. Also make sure that none of the connection code has static properties for connection or user, or one user may have their connection replaced w...
As far as I know it is a bug in Subversion 1.5 and not directly related with maven. However a workaround the fixed it for me is to update the local svn repository and run the release:prepare goal again.
Running Javascript after control's selected value has been set
|asp.net|javascript|
Simple asp.net application. I have two drop down controls, on the first drop down I have a javascript onChange event. The javascript enables the second drop down and removes a value from it (the value selected in the first drop down). If they click the blank first value of the dropdown, then the second drop down wil...
I think any construct that is intuitive AND reduces the lines of code is a big plus. Those kinds of features are what makes languages like Ruby so powerful (that and dynamic features, which also help reduce excess code). Ruby has had this all along as: attr_accessor :my_property attr_reader :my_getter...
If the second dropdown is initially enabled through javascript (I'm assuming this is during a javascript onchange, since you didn't specify), then clicking the back button to reload the previous postback will never enable it. Mixing ASP.NET with classic javascript can be hairy. You might want to have a look at ASP....
The assembly that contains MyApp.Controls.SortableListView isn't installed in the GAC by any chance is it?
To detect changed files, you could try fam (file alteration monitor) or inotify. The latter is linux-specific, fam has a bsd port which might work on OS X. Both have userspace tools that could be used in a script together with rsync.
You can also create a free function in a namespace: In BitParser.h namespace BitParser { bool getBitAt(int buffer, int bitIndex); } In BitParser.cpp namespace BitParser { bool getBitAt(int buffer, int bitIndex) { //get the bit :) } ...
The syntax can be a little clumsy, but if you're only trying to get to grips with unit testing, then there will be no harm in using the built-in stuff
This was part of the code posted by [rpetrich][1] in response to a [question][2] by [Joel Spolsky][3]. I felt it needed a post specific to the problem it solves. It really is brilliant. Private Function IsLetter(ByVal character As String) As Boolean IsLetter = UCase$(character) <> LCase$(character) ...
I believe you can switch between frames the same way you switch between applications. On Windows I use Alt-TAB, on Unix I have my machine setup to use Ctrl-Alt-TAB
If you want an Emacs-centric method, try C-x 5 o.
Nowadays, you can use the Boost/TR1 shared_ptr<> smart pointer to keep your reference counted references. Works great; no fuss, no muss. The shared_ptr<> class takes care of all the locking needed on the refcount.
There are a couple of links to additional tools/references you can use to help troubleshoot this problem on the References link for this video: [Managing SQL Server 2005 and 2008 Log Files][1] That said, the information in log_reuse_wait should be accurate. You likely just had a stalled or orphaned transaction th...
Here is the complete code for the Page Partial Class DynamicLoad Inherits System.Web.UI.Page Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init If IsPostBack Then If Not (Session("ctl") Is Nothing) Then ...
Learning a new language is a long-term process. In a couple of days you'll learn the basics, yes. But! As you probably know, the real practical applicability of any language is tied to the standard library and other available components. Learning how to use the efficiently requires a lot of hands-on experience. Per...
function something_cool(text, callback){ alert(text); if(typeof(callback)=='function'){ callback(); }; }
My guess is that the designer is smart and remembers the settings for the component as you have it in the designer and thus sees it as the default.
If you want to do something like this you will need to use preprocessor commands and conditional compilation symbols. I would use symbols that clearly indicate the version of .NET you are targeting (say NET11 and NET20) and then wrap the relevant code like this: #if NET11 // .NET 1.1 code #elif NET2...
I think you're looking for the 'type' command. It'll tell you whether something is a function, built-in function, external command, or just not defined. Example: batzel@batzel-laptop:~$ type foo bash: type: foo: not found batzel@batzel-laptop:~$ type ls ls is aliased to `ls --color=auto' batz...
In one of my (web) applications, i use a ThreadLocal logger that captures logging information into a StringBuilder. The logger object is initialized in the HttpServlet#service method, if a trace parameter is set (if it is not set, there is a very fast null-logger). The resulting output is either dumped as a HTML commen...
Why not loop through all elements on the page which have an onXYZ function defined and then add the trace to them: var allElements = document.all; // is this right? anyway you get the idea for (var i in allElements) { if (typeof allElements[i].onblur == "function") { var oldFunc = al...
It's because you haven't increased the version number - 1.0.2 already exists in your Subversion repo. Either increment your version or just remove the /repos/june/tags/foo-1.0.2 tag from your repo.
No, I don't test POJOs because: 1.- If the POJO contains buseness logic, I extract it from the POJO and, of course, I test it. But that test is already out of the POJO. 2.- If the POJO doesn't containt it, i.e. simple/getters/setters methods, I generate it dynamically, at build-time or at runtime. So I test my co...
No, I don't test POJOs because: 1.- If the POJO contains buseness logic, I extract it from the POJO and, of course, I test it. But that test is already out of the POJO. 2.- If the POJO doesn't containt it, i.e. simple/getters/setters methods, I generate it dynamically, at build-time or at runtime ([CGLIB](http://...
"Greedy" <Delete> and <Backspace> in Visual Studio
|visual-studio|keyboard|
Is there the way to apply "greedy" behavior to <Delete> and <Backspace> keys in Visual Studio? By "greedy" I mean such behavior when all whitespace between cursor position and next word bound can be deleted using one keystroke.
Good point about the header always being first and the footer last! But I might want to move my advertising DIV from along the top, to down the right. The other thing I've heard about is putting the content DIV first, so Google pays you more attention (relevant keywords near the top of the page score higher)...or is...
If you have a fairly recent ejb container, the cheapest ans easiest should be to expose your beans as web services and call it from VB/C#. This doesn't require any extra tool or library.
If you have a fairly recent ejb container, the cheapest and easiest should be to expose your beans as web services and call it from VB/C#. This doesn't require any extra tool or library.
Create an array for each enable/disable group. Add the controls to the array (of course it has to be of the correct type such as Object or Any, etc. depends on the programming language you are using). Then to enable, disable just loop through the array and invoke the enable/disable method or function for each control....
The dangers and general nastyness of Datasets eh. I would use a generic proxy that is responsible for consuming the webmethod and transforming the dataset into xml/json
It looks like the discussion [here](http://stackoverflow.com/questions/92869/nunit-vs-visual-studio-2008s-test-projects-for-unit-testing) can answer your question.
From [manual][1] the answer is "C-x 5 o" (but read the fine print at the and - about variable *focus-follows-mouse*) [1]: http://www.gnu.org/software/emacs/manual/html_node/emacs/Frame-Commands.html
Here is a standalone solution: $(window).load(function() { $('img').each(function() { if (!this.complete || (typeof this.naturalWidth == "undefined" ||this.naturalWidth == 0)) { // image was broken, replace with your new image this.src = 'http://www.tranism.com/weblog/images...
Here is a standalone solution: $(window).load(function() { $('img').each(function() { if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { // image was broken, replace with your new image this.src = 'http://www.tranism.com/weblog/images/...
Strictly speaking, you'll need to wait until C++0x to be able to write thread-safe code in pure C++. For now, you can use Posix, or create your own platform independent wrappers around compare and swap and/or interlocked increment/decrement.
There's been a lot of new improvements and optimization in the new java virtual machine. So the main part you'll see improved performance is while running java with the version 6 jvm. Compiling old java code using the Java 6 JDK will probably yield more efficient code, but the main improvements lie in the virtual ma...
In VC++, you can use [_InterlockedCompareExchange](http://msdn.microsoft.com/en-us/library/ttk2z1ws.aspx). do read the count perform mathematical operation interlockedcompareexchange( destination, updated count, old count) until the interlockedcompareexchange returns the success code...
I'd say the modeling precludes the programing, where the modeling is the physical design, before the programming is implemented. http://en.wikipedia.org/wiki/Object-Oriented_Modeling http://en.wikipedia.org/wiki/Object_oriented_programming
I have not heard about improvements in the compiler, but extensive information has been published on the runtime performance improvements. **Migration guide:** [http://java.sun.com/javase/6/webnotes/adoption/adoptionguide.html] **Performance whitepaper:** [http://java.sun.com/performance/reference/whitepape...
they're both going to be stored independently, however if you want to make it clear to other developers you might want to wrap them up in namespaces.
There are at least two reasons. **First - security** http://www.javafaq.nu/java-article1060.html > The main reason why String made > immutable was security. Look at this > example: We have a file open method > with login check. We pass a String to > this method to process authentication > which is necessary ...
This doesn't sound usual. Right clicking on the solution and hitting "Clean Solution" might help (it will delete all dlls and executables from each project's bin directory, which forces fresh builds to occur) You might also want to check your build order sequence.
ksort($_GET); foreach ($_GET as $key => $value) { echo $key.' - '.$value.'<br/>'; }
To get a natural sort by key: function knatsort(&$karr){ $kkeyarr = array_keys($karr); natsort($kkeyarr); $ksortedarr = array(); foreach($kkeyarr as $kcurrkey){ $ksortedarr[$kcurrkey] = $karr[$kcurrkey]; } $karr = $ksortedarr; return tru...
Do you have any working repositories in this instance of eclipse? I've had problems in the past with the default Subclipse subversion client on Windows, you need to make sure the native subversion client is installed and correctly configured ('ve got TortoiseSVN to work in the past). On a recent install I tried t...
Do you have any working repositories in this instance of eclipse? I've had problems in the past with the default Subclipse subversion client on Windows, you need to make sure the native subversion client is installed and correctly configured (I've got TortoiseSVN to work in the past) if you want to use the default c...
I'd recommend using the power of the date library and the semantics of the range module of ruby. A recurring event is really a time, a date range (a start & end) and usually a single day of the week. Using date & range you can answer any question: #!/usr/bin/ruby require 'date' start_date = Dat...
From the PHP5 documentation: > The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed **or in any order in shutdown sequence.** >[PHP documentation][1] (emphasis mine) What is probably happening is that your script does no...
.NET? Create an ASMX Web Service and set it up on your web site. Then add the service reference to your app.
.NET? Create an ASMX Web Service and set it up on your web site. Then add the service reference to your app. EDIT/CLARIFICATION: Your Web Service can then store passed data into a database, instead of relying on Web Logs: Installation Id, Install Date, Number of times run, etc.
Getting PHP to read .doc files on Linux
|php|database|
I'm trying to read a .doc file into a database so that I can index it's contents. Is there an easy way for PHP on Linux to read .doc files? Failing that is it possible to convert .doc files to rtf, pdf or some other 'open' format that is easy to read? Note, I am not interested in .docx files.
Ruby has excellent support, actually. Check out [this page][1]. Really great support for turning strings into dates, dates into strings, doing math on dates, parsing "natural language" strings like "3 months ago this friday at 3:45pm" into an actual date, turning dates into strings so you can do stuff like "Sam last ...
How to do hierarchical build with rake?
|build|rake|
I recently started using Rake to build some of my (non-ruby) packages. Rake is nice, but what I found missing is a way to do hierarchical builds (aggregate Rakefiles in subdirectories). Since this is a common feature in most other build tools, I'm wondering if someone more familiar with Rake has a good solution.
If you store a string, don't partially reinvent ISO 8601 standard which covers the case you describe and more: http://en.wikipedia.org/wiki/ISO_8601
For Java, I highly recommend the [Joda Date/Time library][1]. [1]: http://joda-time.sourceforge.net/
I've used [pdftk][1] to great effect. It's an external application that you'll have to run from your java app. [1]: http://www.accesspdf.com/pdftk/
If you're not a developer (or you want to shortcut the development process), another possible solution is to utilize the auto_nodetitle module. Auto nodetitle will let you create rules for generating the title of the node. These can be programmatic rules, tokens that are replaced, or simply static text. Worth a look ...
`grep -R SuperException *` in the base of your project (get `grep` from somewhere first) just to be sure.
It seems like perhaps you're solving the wrong problem. If you're trying to edit files on a remote computer then you might try using something like the ftp plugin for jedit. <http://plugins.jedit.org/plugins/?FTP> This ensures that you have only one version of the file so it can't ever be out of sync.
Programatically select multiple files in windows explorer
|windows|shell|explorer|
I can display and select a single file in windows explorer like this: explorer.exe /select, "c:\path\to\file.txt" However, I can't work out how to select more than one file. None of the permutations of select I've tried work. Help! Note: I looked at these pages for docs, neither helped. <http://support....
The ASCII table is set of characters, arguable the first standardized set of characters back in the days when you could only spare 1 byte per character. [http://asciitable.com/][1] But I did some looking around at the extended character set of ASCII and it appears that the character you are referencing is an ASCII ch...
What you're after is the [ID3][1] module. It's very simple and will give you exactly what you need. Just copy the ID3.py file into your site-packages directory and you'll be able to do something like the following: from ID3 import * try: id3info = ID3('file.mp3') print id3info # Chang...
it cannot be done through explorer.exe
Custom handler to generate the sitemap.
ICE Faces fileInput file path and file name properties
|java|ajax|jsf|icefaces|
I'd like to utilize an ICE Faces fileInput control to fill in the file path & file name for the input to an input field on a web page based on file that the user selects. How can I capture these properties without actually performing any file transfer operations?
We get a bunch of email/pager alerts from an older host/app/network monitoring environment that get gradually more abusive depending on severity of the problem/time taken to respond. Fortunately we all have thick skins and very broad senses of humour. :)
This is where tools like [Resharper][1] really pay off -- a simple Find Usages usually tells me of such "ghost dependencies" several times. Maybe you could go to your definition of the SuperException class and try to Find All References(). You might also want to investigate if the assembly SuperException is has a *c...
I think some of the suggestions above don't take into account that there are other tags in the HTML between two pages which would be textually different, but the resulting HTML markup is functionally equivalent. Danimal lists control IDs as an example. The following two markups are functionlly identical, but would ...
If there are orphaned files left in your working copy having done an svn update then there's a bug in your Subversion version.
Programming in languages like C and C++ you are much closer to the "metal". Pointers hold a memory location where your variables, data, functions etc. live. You can pass a pointer around instead of passing by value (copying your variables and data). There are two things that are difficult with pointers: 1. Poin...
To prevent errors from displaying you can - Write in a .htaccess: _php\_flag display\_errors 0_ - Split your code in separate modules where the main (parent) php-file only sets the error_logging and then include() the other files.
@[nickf] - I'm pretty sure document.all is an IE specific extension. You need to attach an event handler, there's no way to just 'watch' the events. A framework like jQuery of Microsoft AJAX library will easily give you methods to add the event handlers. jQuery is nice because of its selector framework. Then I u...
Use ResourceBundle and property files.
With Floating, and with position absolute, you can pull some pretty good positioning magic to change some of the order of the page. For instance, with StackOverflow, if the markup was setup right, the title, and main body content could be the first 2 things in the markup, and then the navigation/search, and finally ...
The "real benefit" that an employer could see is a better programmer who can implement solutions faster; however, you will not be able to provide any hard numbers to justify the expense and an employer will most likely have you work on what makes money now as opposed to having you work on things that make the future be...
My preference would be for single exit unless it really complicates things. I have found that in some cases, multiple exist points can mask other more significant design problems: public void DoStuff(Foo foo) { if (foo == null) return; } On seeing this code, I would immediately ask: ...
A check list for fixing C#/VB.Net apps to sql-server timeout problems
|c#|sql-server|vb.net|timeout|
I have run into this problem of users complaining either about very slow responses and/or timeout errors when using some applications in the past due to many reasons. What type of solutions from basic to weird have you used to fix this problem in the past?
How do I use the same field type in multiple lists on SharePoint?
|sharepoint|
I have a SharePoint site with multiple lists, some of which have the same fields - a choice of products or countries. How can I build the lists in a way that I configure the choice field once and use it in multiple lists, so that in the future, if I add a value to the choice, I add it only once?
"If it ain't broke - don't fix it!" I'm an old fashioned POJO/POCO kind of guy anyway, but why change to annotations just to be cool? To the best of my knowledge you can do most of the stuff as annotations, but the more complex mappings are sometimes expressed more clearly as XML.
(?ms)^((?:\d+(?!\.\*)\.)+)(\d+)?(\.\*)?$|^(\d+)\.\*$|^(\*|\d+)$ Does exactly match your 6 first examples, and rejects the 4 others - group 1: major or major.minor or '*' - group 2 if exists: minor or * - group 3 if exists: * You can remove '(?ms)' I used it to indicate to this regexp to be applied on ...
If you want the Logger to be per-instance then yes, you would want to make it transient if you're going to serialize your objects. Log4J Loggers aren't serializable, not in the version of Log4J that I'm using anyway, so if you don't make your Logger fields transient you'll get exceptions on serialization.