instruction stringlengths 0 30k ⌀ |
|---|
I had this same issue. The way I got round this was to use the Selecting event on the LinqDataSource and return the result manually.
e.g.
protected void lnqRecentOrder_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
DataClassesDataContext dx = new DataClassesDataContext();
e... |
Would you bother to mock StreamReader object ? |
|.net|mocking| |
I use a stream reader to import some data and at the moment I hardcode a small sample file in the test to do the job.
Is it sensible to use Mock Objects with this and how ?
|
[DateTime.UtcNow][1] tells you the date and time as it would be in Coordinated Universal Time, which is also called the Greenwich Mean Time time zone - basically like it would be if you were in London England, but not during the summer. [DateTime.Now][2] gives the date and time as it would appear to someone in your cur... |
I had the same error recently.
Here's how I fixed it (I hope it works for you too):
-Open your project properties, go to the references section.
-Remove the reference to System in the upper section.
I think it's referencing System twice but it's only showing once. Hence the ambigous references.
|
You should take a look at [Joda Time](http://joda-time.sourceforge.net/). It is a much better date/time API than the one included with Java |
We've done everything except small releases and it's been great. I can't imagine working any other way. From my experience, the tenets I value most are:
- Continuous integration (with a solid test suite).
- Collective code ownership.
- TDD
- Team empowerment and decision making.
- Coding standards.
- Refactor... |
As @Vaibhav noted, you actually need to download the symbols and configure windbg to use them.
Also note the following:
!sym noisy -- Activates noisy symbol loading
lm v -- Use with "m" parameter to look at information for a loaded module.
lme D sm - List all modules w/o symbols.
|
Try an open-source OLAP server called 'Mondrian'. IIRC the XMLA API on this is sufficiently compatible with AS to fool Pivot Table Services, which would allow you to use it with ProClarity or Excel.
IIRC it was originally designed to work over Oracle - it is a HOLAP architecture using base tables in the underlying ... |
As others have noted, The myBox TextBox can not be found by calling FindName on the ListView. However, you can get the ListViewItem that is currently selected, and use the VisualTreeHelper class to get the TextBox from the ListViewItem. To do so looks something like this:
private void myList_SelectionChanged(o... |
Try the following change:
DATA SEGMENT 'DATA'
ERROR_MSG DB 'DS:DX is wrong'
MSG DB 0AH, 0DH, 'Hello, Adam', '$'
CHAR DB 00H
DATA ENDS
If the error-message displays then DS:DX is wrong, so either DS doesn't point to the DATA segment, or 'OFFSET MSG' is wrong for some reason...my... |
I use Rhino Mocks for this, when I just need a simple stub.
http://www.ayende.com/wiki/Rhino+Mocks+-+Stubs.ashx
|
I'm currently using [FEST][1]. It works with JUnit and will also take screenshots of failed tests.
It has default component hunting methods which look for the name of the component being tested (which need to be set manually), but you can also generate the testers for a given component by passing it the component.
... |
mysql\_real\_escape\_string() has the added benefit of escaping text input correctly with respect to the character set of a database through the optional *link\_identifier* parameter.
Character set awareness is a critical distinction. addslashes() will add a slash before every eight bit binary representation of each... |
Well, it would certainly be easier to check if a given object supported an entire interface, instead of just *not crashing* when you call the one or two methods you use in the initial method, for instance to add an object to an internal list.
Duck typing has some of the benefits of interfaces, that is, easy of use e... |
Consider using a portability library like [glib][1] or the [apache portable runtime][2]. These usually provide safe, portable alternatives to calls like these. It's a good thing too, because these insecure calls are deprecated in most modern environments.
[1]:http://www.gtk.org/
[2]:http://apr.apache.org/ |
PHP equivalent of Perl's 'use strict' (to require variables to be initialzied before use) |
|php|php5| |
Python's convention is that variables are created by first assignment, and trying to read their value before one has been assigned raises an exception. PHP by contrast implicitly creates a variable when it is read, with a null value. This means it is easy to do this in PHP:
function mymodule_important_calculatio... |
I'd definitely go for the separate table - certainly the best relational view of data. If you have indexes on both UserID and GroupID you have a quick way of getting users per group and groups per user. |
There are two issues: importation of encryption software, and exportation of encryption software.
Some countries (China, Russia, Iran, Iraq, Myanmar, etc.) restrict the use of cryptography by their citizens. It is illegal to *import* encryption software to those countries.
To enable unlimited encryption strength ... |
Probably there is some javascript involved. The form is submitted as a result of an onclick event in an anchor with: href="..." onclick="..form.submit()" |
Ugh. Perhaps you could open a shell in Emacs and exec sudo emacs.
The problem is that you presumably don't just want to open the file. You want to be able to save it later. Thus you need your root privs to persist, not just exist for opening the file.
Sounds like you want Emacs to become your window manager. It'... |
You can't create an index on just the date part. Is there a reason you have to?
Even if you could create an index on just the date part, the optimiser would probably still not use it for the above query.
I think you'll find that
SELECT * FROM transactionlist WHERE TranDateTime BETWEEN '2008-08-17' AND '2... |
This is a bug in Firefox 3. This happens when the response to the POST contains an image tag with an empty source attribute. eg <code><img src=""/></code> |
Personally, since almost all of my web development is in PHP, I use PHP's session handlers.
Sessions are the most flexible, in my experience: they're normally faster than db accesses, and the cookies they generate die when the browser closes (by default). |
I would just say it's a matter of money - buying a finished product you know is good for you (and sometimes not even buying if it's free) is better than having to go and develop one on your own. It's a simple game of **pay now** vs. **pay later**. |
It's really quite simple, so I think it depends what your audience is and where they live.
If you don't use Utc, you *must* know the timezone of the person you're displaying dates and times to -- otherwise you will tell them something happened at 3 PM in system or server time, when it really happened at 5 PM where t... |
Does anyone have a handy visulization widget that I can use for a web project? |
|visualization| |
What I want is lots of nodes which can expand making a a map.
I'd ideally like to be able to navigate around the map fluidly.
Thanks,
Alex. |
What I want is lots of nodes which can expand making a mind map.
I'd ideally like to expand and collapse nodes. I would like to be able to navigate by either dragging around the page, or by following expanded nodes.
Thanks,
Alex. |
DateTime.Now vs. DateTime.UtcNow |
|date|.net|c#| |
I've been wondering what exactly are the principles of how the two properties work. I know the second one is universal and basically doesn't deal with time zones, but can someone explain in detail how they work and which one should be used in what scenario? |
|.net|date|language-features| |
If you're trying to change the root element of a document, you don't really need to-- just throw out the existing document and replace it. Alternatively, just wrap your <root> element in a more proper root element (you shouldn't be editing the root node anyway) and you'd be set.
Of course, that doesn't answer your q... |
When you need a local time for the machine your application runs at (like CEST for Europe), use Now. If you want a universal time - UtcNow. It's just matter of your preferences - probably making a local website / standalone application you'd want to use the time user has - so affected by his/her timezone setting - Date... |
I think of it more as a level of convenience. If you have a function which takes a "file-like" object and only calls a read() method on it, then it's inconvenient - even limiting - to force the user to implement some sort of File interface. It's just as easy to check if the object has a read method.
But if your func... |
I don't know of any I've personally used with a C API, but [wxWidgets][1] is C++. It runs on Windows, Linux, and Mac OS X. And if you're looking for easy, [wxPython][2] is a Python wrapper around wxWidgets and it is *extremely* easy to use.
[1]: http://www.wxwidgets.org/
[2]: http://www.wxpython.org/ |
When people talk about scaling a website with 'shards', what do they mean? |
|web|scaling| |
I have heard the 'shard' technique mentioned several times with regard to solving scaling problems for large websites. What is this 'shard' technique and why is it so good? |
How do you manage .NET app.config files for large applications? |
|.net|c#|configuration|settings| |
Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblies has settings or configuration information. Our team tends to like the VS set... |
|.net|c#|configuration| |
|c#|.net|configuration| |
Suppose a large composite application built on several foundation components packaged in their own assemblies: (database reading, protocol handlers, etc.). For some deployments, this can include over 20 assemblies. Each of these assemblies has settings or configuration information. Our team tends to like the VS set... |
How can I catch AWT thread exceptions in Java? |
|java|swing|exception|awt| |
We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console. |
I don't see any obvious problem in the code.
"SELECT .. INTO" is weak kung-fu. Try explicitly creating the temp table definition:
CREATE TABLE #newMatches
(
CompanyID int PRIMARY KEY,
DunsID int
)
When you're done with #newMatches, you should get rid of it so you can create it agai... |
Try these links
[Migrating from ASP][1]
[Key Considerations][2]
[Converting ASP to ASP.NET][3]
[ASP to ASP.NET Migration Guide][4]
[1]: http://msdn2.microsoft.com/en-us/asp.net/aa336573.aspx
[2]: http://msdn2.microsoft.com/en-us/library/Aa479019.aspx
[3]: http://msdn2.microsoft.com/en-... |
Where do you define this Properties? Directly in the as*x file or in the codeBehind? (I don't think that can be a reason, but if the build-Target is .NET 3.5 I can't see anything else) |
The general rule of thumb is that you only catch an exception if you can actually do something about it. So at the Business or Data layer, you would only catch the exception in situation's like this:
try
{
this.Persist(trans);
}
catch(Exception ex)
{
trans.Rollback();
throw... |
What is the easiest way to convert from asp classic to asp.net? |
|asp.net|asp-classic| |
I am a .Net developer that has been tasked with upgrading a classic asp website to asp.net. The website is currently running on luck and bubble gum but there is not enough time or money to stop progress and do a full rewrite. Of course I will still need to be able to deliver new features while I am upgrading.
What s... |
Be careful, and do not believe that ADO is taking care of the problem. Universal SQL date format is 'YYYYMMDD', while both SQL and ACCESS are influenced by the regional settings of the machine in the way they display dates and convert them in character strings.
Do not forget that Date separator is # in Access, while... |
This isn't a browser issue, it's an HTTP issue. You appear to be serving dynamic files without specifying that they shouldn't be cached. Use the `Cache-Control: no-cache` HTTP header to indicate this. `Pragma: no-cache` is the ancient HTTP 1.0 way, you can include it, but alone it is unlikely to be 100% effective.
|
Additional Reason to use Foreign Keys:
- Allows greater reuse of a database
Additional Reason to NOT use Foreign Keys:
- You are trying to lock-in a customer into your tool by reducing reuse. |
metamail has the tool metasend
metasend -f mysqlbackup.sql.gz -t backup@email.com -s Backup -m application/x-gzip -b
|
Think of a thingy. Any thingy, a thingy you want to do stuff to. Say, a breakfast.
(All code is pseudocode, any resemblance to any language living, dead, or being clinically abused in the banking industry is entirely coincidental and nothing to do with your post being tagged PHP)
So you define a template for how ... |
I currently do this exact thing.
If the document isn't very big, doesn't contain images and such, then I store it as an RTF with #MergeFields# in it and simply replace them with content, sending the result down to the user as an RTF.
For larger documents, including images and dynamically inserted images, I save... |
DateTime has no idea what time zones are. It always assumes you're at your local time. *UtcNow* only means "Subtract my timezone from the time".
If you want to use timezone-aware dates, use **DateTimeOffset**, which represents a date/time with a timezone. I had to learn that the hard way. |
I would want to turn the question around. WHY on earth would you want to build your own?
If you need some extra fields, go with an existing package that can be modified.
Special report? Tap into the database and make it.
Believing that it isn't difficult? Try then. Spec it up, and see the list of features an... |
I'd say one of the biggest stumbling blocks would be agonising over the data model / workflow. I predict this will take a **long** time and involve many arguments about what should happen to a bug under certain circumstances, what really constitutes a bug, etc. Rather than spend months arguing to-and-fro, if you were t... |
@yoavf - I think the OP is interested in server-side aspects of streaming on-demand h.264 inside of FLV files. Reuse of existing players would be nice for him, I think. Or maybe that is my own needs coming out? <:S
From yoavf's second link, there is another link to Tinic Uro's [What just happened to video on the ... |
I personally prefer the Dictionary<Type, other> approach the most... I can even provide you another example: <a href="http://www.timvw.be/presenting-namevaluecollectionhelper/">http://www.timvw.be/presenting-namevaluecollectionhelper/</a>
In case you insist on writing a switch-case statement you could use the ... |
There is no way to make it fail as far as I know, but with E_NOTICE in error_reporting settings you can make it throw a warning (well, a notice :-) But still a string you can search for ). |
Clustered indexes are stored physically on the table. This means they are the fastest and you can only have on clustered index per table.
Non-clustered indexes are stored separately, and you can have as many as you want.
The best option is to set your clustered index on the most used unique column, usually the P... |
Is there any point for interfaces in dynamic languages? |
|interface|duck-typing|dynamic-languages|php|python| |
In static languages like Java you need interfaces because
otherwise the type system just won't let you do certain things.
But in dynamic languages like PHP and Python you just take
advantage of *duck-typing*.
PHP and Python both support interfaces.
Ruby and many others doesn't have them.
So you can clearly live... |
|python|php|interface|dynamic-languages|duck-typing| |
In static languages like Java you need interfaces because
otherwise the type system just won't let you do certain things.
But in dynamic languages like PHP and Python you just take
advantage of *duck-typing*.
PHP supports interfaces.
Ruby and Python don't have them.
So you can clearly live happily without them.... |
C++ strings without <string> and STL. |
|c++|string|list|help| |
I've not used C++ very much in the past, and have recently been doing a lot of C#, and I'm really struggling to get back into the basics of C++ again. This is particularly tricky as work mandates that none of the most handy C++ constructs can be used, so all strings must be char *'s, and there is no provision for STL l... |
I am a .Net developer that has been tasked with upgrading a classic asp website to asp.net. The website is currently running on luck and bubble gum but there is not enough time or money to stop progress and do a full rewrite. Of course I will still need to be able to deliver new features while I am upgrading.
What s... |
Subversion Error: "Working copy [directory] not locked" |
|svn| |
I am trying to merge a directory in subversion, but I get the following error when I do so:
svn: Working copy '[directory name]' not locked'
Does anyone know how to fix this?
In this instance, the parent directory has the same name as the sub directory. I don't know if this has anything to do with the erro... |
I am trying to merge a directory in subversion, but I get the following error when I do so:
svn: Working copy '[directory name]' not locked'
I tried deleting the working directory and doing a fresh update, but that did not solve the issue. Does anyone know how to fix this?
In this instance, the parent dire... |
I am trying to merge a directory in subversion, but I get the following error when I do so:
svn: Working copy '[directory name]' not locked'
I tried deleting the working directory and doing a fresh update, but that did not solve the issue. I also did a cleanup on the directory.
Does anyone know how to fix... |
You might want to read [What Every Computer Scientist Should Know about Floating Point Arithmetic][1].
You'll have to specify some precision by multiplying by a large number:
3.141592 * 1000000 = 3141592
then you can make a fraction:
3 + (141592 / 1000000)
and reduce via GCD...
3 + (17699 ... |
Here's a link explaining the math behind converting a decimal to a fraction:
http://www.webmath.com/dec2fract.html
And here's an example function for how to actually do it using VB (from www.freevbcode.com/ShowCode.asp?ID=582):
Public Function Dec2Frac(ByVal f As Double) As String
Dim df As D... |
I recomend only BMP format. Do not use ActiveDesctop, because you PC will work slowly after that. |
Do you expect to work for this company forever? If you're ever out on the job market, pehaps some prospective employers will be aware of the [Python paradox][1].
[1]: http://www.paulgraham.com/pypar.html |
You are right, integer promotions aren't applied to the operand of <code>sizeof</code>:
> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the shift operators, as specified ... |
Let me turn your question on its head by asking what use it is to an American English speaker to learn another language?
The languages we speak (and those we program in) inform the way we think. This can happen on a fundamental level, such as c++ versus javascript versus lisp, or on an implementation level, in which... |
Use Subversion. It's free and is the preferred source control system for the vast majority of open source projects.
SVN uses shallow copies, so when you have large files in a repository and you branch, a full file copy isn't done... just a pointer to the original. As for text files (code) only diffs are stored.
... |
You will need an SMS gateway, googling "SMS gateway" will reveal many. I have used http://www.clickatell.com/products/sms_gateway.php with great success.
I do not know of any open source implementations, but will be monitoring this thread in case someone else does!
|
Open your project, then open the Project Settings screen (Project → Settings or ALT-F7). Alternatively, right click on a file in the FileView and select Settings.
From the Project Settings screen, go to the General tab and check "Always use custom build step". This means that the file you just chose will be a... |
When testing code that depends on streams, streamreaders and streamwriters I usually use the memorystream object for testing. No mocking framework needed here. |
I don't see any points to mock StreamReader unless you're making StreamReader derived class. If you need to provide test input via StreamReader, just read some predefined data from any suitable source. |
Using a rounded rectangle and a VideoBrush doesn't lose you any features/control over using a displayed MediaElement - since the element has to be in the Xaml anyway, you can control it using the usual Play/Pause/Stop methods, except that the playback happens in your rectangle. Using a clip region is a little unwieldy ... |
Programmers like to build their own ticket system because, having seen and used dozens of them, they know everything about it. That way they can stay in the comfort zone.
It's like checking out a new restaurant: it might be rewarding, but it carries a risk. Better to do order pizza again.
There's also a great fa... |