instruction stringlengths 0 30k ⌀ |
|---|
In a loop get mantissa and exponent of each number as integers. You can use frexp for exponent, but I think bit mask will be required for mantissa. Find minimal exponent. Find most significant digits in mantissa (loop through bits looking for last "1") - or simply use predefined number of significant digits.
Your mult... |
C++ iterators are a generalization of the pointer concept; they make it applicable to a wider range of situations. It means that they can be used to do such things as define arbitrary ranges.
Java iterators are relatively dumb enumerators (though not so bad as C#'s; at least Java has ListIterator and can be used to... |
There are a number of obvious differences outlined in that article @lars posted, but short answer is:
- L2S is tightly coupled - object property to specific field of database or more correctly object mapping to a specific database schema
- L2S will only work with SQL Server (as far as I know)
- EF allows mapping a... |
> I have version 2 selected in IIS and I
Well, surely that's your problem? Select 3.5. |
> I have version 2 selected in IIS and I
Well, surely that's your problem? Select 3.5.
Actually, here's the real info:
http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx
|
Kevin, you work off a solid absolute base (i.e. a date / time), not a relative time period. You then convert to the relative time periods. So, for example, by default, if you were showing a calendar, you'd work from todays date.
int strtotime ( string $time [, int $now ] )
You can see in the function def... |
Python comes bundled with a python compiler written in Python. You can see the source code, and it includes all phases, from parsing, abstract syntax tree, emitting code, etc.
Hack it. |
User Control Property Designer Properties |
|c#|windows-mobile|user-controls| |
For a C# UserControl on Windows Mobile (though please answer if you know it for full Windows...it might work) how do you change what shows up in the Designer Properties window for one of the Control's public Properties. For example:
private Color blah = Color.Black;
public Color Blah
{
... |
how to use xpath in python |
|python|xml|xpath| |
Is there a full implementation? How is the library used, where is its website? |
Perhaps the [Microsoft UI Automation][1] for WPF can help out ? Its a framework for automating your UI, perhaps it can be used to log stuff for you...
We use the Automation Framework for auto-testing our UI in WPF.
[1]: http://msdn.microsoft.com/en-us/library/ms747327.aspx |
The plus in the breakpoints window is there when one user-supplied breakpoint binds in multiple places. This can happen when a single file is loaded multiple times in the same debugging session, for example. The + lets you look at each of the places it bound.
@Joel: modifying breakpoints during a debugging session... |
Default Integer type in ASP.Net from a Stored Procedure |
|asp.net|sql-server|stored-procedures|parameters| |
I have a web page that has I'm hooking up a stored procedure on. In this SQL Data Source, I have a parameter that I'm passing back to the SP of type int.
ASP seems to want to default to int32 but the number won't get higher than 6. Is it ok to override the ASP default and put in 16 or will there be a conflict so... |
Could you put the DataGrids inside panels that have their visibility set to false, then call a client-side javascript function from the body's onload event that calls a server side function that sets the visibility of the panels to true?
If you combined this with an asp:updateProgress control and wrapped the whole t... |
I think Pex as an exploratory testing tool is really intriguing. In that regard, I see it as something I'd want to hand off to QA to use.
As a TDD tool, it needs some work, as TDD is a design activity. However, I do like the direction that Peli is heading. THere's something to be said for automated assisted design. ... |
How to setup a RAILS integration test for XML mehtods |
|ruby|xml|integration-testing| |
Given a controller method like:
def show
@model = Model.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => model }
end
end
What's the best way to write an integration test that asserts that the return... |
**Entry Level**
- Property Change NOtification
(INotifyPropertyChange and
ObservableCollection)
- ResourceDictionary
- UserControls
**Mid Level**
- Blend/Cider
- animations and storyboarding
- ClickOnce Deployment
**Senior**
- WPF 3D
- Differences between Silverlight 2
... |
The short answer to your question is that no, you will probably not run into trouble attempting to do that. Outside the context of a UDF (even still inside a CFC), an un-scoped set statement implies the variables scope.
In addition, in a CFC, the Variables scope is available to all of its functions; it is sort of th... |
Just a random thought that might help with debugging. Try changing your shell script to:
#!/bin/sh
echo /usr/bin/mono $1/hooks/post-commit.exe "$@"
Check and see if the line it prints matches the command you're expecting it to run. It's possible your command line argument handling in the shell script i... |
> It holds onto the copy cached in the browser, even though the web server has a newer version.
This is probably because the HTTP Expires / Cache-Control headers are set.
http://developer.yahoo.com/performance/rules.html#expires
I wrote about this here:
http://www.codinghorror.com/blog/archives/000932.html
... |
Some very useful techniques in [here][1] even if you are not planning to use powershell to automate deployment.
[1]: http://www.codeproject.com/KB/install/DeploySite.aspx |
In the database, there are two options:
* bytea. Stores the data in a column, exported as part of a backup. Uses standard database functions to save and retrieve. Recommended for your needs.
* blobs. Stores the data externally, not normally exported as part of a backup. Requires special database functions to... |
The <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/program_options.html">boost::program_options</a> library is nice if you're in C++ and have the luxury of using Boost. |
When finding the x,y coordinates to use for lining up your new text with the pre-printed gaps, the default settings for the graphics object's Draw____() functions are 100 pixels per inch. That might be subject to change based on your printer, but in my (very limited) experience that's always been the case. |
|c#|syntax|repository| |
|c#|syntax|repository| |
API Yahoo India Maps |
|api|map|yahoo| |
Yahoo has separate map for India ( which has more details than the regular maps.yahoo.com) at http://in.maps.yahoo.com/ . But when I use the API it goes to default map. How do I get API access to YMaps India? |
|api|maps|yahoo| |
There's a plugin out there called "mysql tasks", just google for it. It's just a rakefile -- I've found it very easy to use. |
A quick search found [IISState][1] - it relies on the [Windows debugging tools][2] and needs to be running when a crash occurs, but given the circumstances you've described, this shouldn't be a problem,
[1]: http://www.iisfaq.com/default.aspx?view=P197
[2]: http://www.microsoft.com/whdc/devtools/debugging/def... |
I am not sure if I follow you.. You don't want to test the PInvoke yourself (you didn't write it) so you want to test that the wrapper class is performing as expected right?
So, just create your interface in the wrapper class and test against that?
In terms of needing to set up users etc, I think that would be a ... |
Painful but if you had to use one..
I'd recommend the [DevPartner BoundsChecker][1] suite.. that's what people at my workplace use for this purpose. Paid n proprietary.. not freeware.
[1]: http://www.compuware.com/products/devpartner/visualc.htm |
Is it possible to unit test p/invoke calls? |
|c#|unit-testing|impersonation|unmanaged| |
I want to wrap a piece of code that uses the Windows Impersonation API into a neat little helper class, and as usual, I'm looking for a way to go test-first. However, while WindowsIdentity is a managed class, the LogonUser call that is required to actually perform the logging in as another user is an unmanaged function... |
Is it possible to unit test a class that makes P/Invoke calls? |
|c#|unit-testing|unmanaged|impersonation| |
I'd check out [SQLAlchemy][1]
It's really easy to use and the models you wrok with aren't bad at all.
Django uses sqlalchemy for it's ORM but using it by itself lets you use it's full power
here's a small example on creating and selecting orm objects
>>> ed_user = User('ed', 'Ed Jones', 'edspassword')
... |
Getting EXIF data from a JPEG image involves :
1.)Seeking to the JPEG markers which mentions the beginning of the EXIF data,. e.g. normally oxFFE1 is the marker inserted while encoding EXIF data, which is a APPlication segment, where EXIF data goes.
2.) Parse all the data from say 0xFFE1 to 0xFFE2 . This data would b... |
Getting EXIF data from a JPEG image involves :
1. Seeking to the JPEG markers which mentions the beginning of the EXIF data,. e.g. normally oxFFE1 is the marker inserted while encoding EXIF data, which is a APPlication segment, where EXIF data goes.
2. Parse all the data from say 0xFFE1 to 0xFFE2 . This data wo... |
Hippie expand/Word Complete, afaik inspired by Emacs: will autocomplete any word in any editor based on other words in that file. Autocomplete inside String literals in Java code, in xml files, everywhere.
Alt + / |
Quoted printable expands 8 bit characters to "={HEX-Code}", thus making the messages longer. Maybe you are just hitting this limit?
Have you tried to break the message at, say, 70 characters? That should provide space for a couple of characters per line.
Or you just encode the email with Base64 - all mail client ... |
Image class has PropertyItems and PropertyIdList properties. You can use them. |
Windows CDROM Eject |
|winapi|windows| |
Does anyone know a method to problematically close the CD tray on Windows 2000 or higher?
Open CD tray exists, but I can't seem to make it close especially under W2k.
I am especially looking for a method to do this from a batch file, if possible, but API calls would be OK. |
|windows|winapi| |
Does anyone know a method to programmatically close the CD tray on Windows 2000 or higher?
Open CD tray exists, but I can't seem to make it close especially under W2k.
I am especially looking for a method to do this from a batch file, if possible, but API calls would be OK. |
The editor of [SharpDevelop][1] is good and it's open source too.
[1]: http://sharpdevelop.net/OpenSource/SD/ |
[Nircmd][1] is a very handy freeware command line utility with various options, including opening and closing the CD tray.
[1]: http://www.nirsoft.net/utils/nircmd.html |
You could also look at the source code for [Scintilla][1].
[1]: http://www.scintilla.org/ |
Did you download a zip file from the internet and then extract it using the standard explorer tools. I think this marks the directory as untrusted and Visual studio detects this. |
.NET namespaces |
|.net|organizing| |
My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at working with .NET. I have been able to transfer much of my Java experience into working with .NET (specifically C#), but the only thing that has reall... |
My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at working with .NET. I have been able to transfer much of my Java experience into working with .NET (specifically C#), but the only thing that has reall... |
|.net|namespaces|organizing| |
How often should you use git-gc? |
|git| |
How often should you use git-gc?
The [manual page](http://www.kernel.org/pub/software/scm/git/docs/git-gc.html) simply says:
>Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.
Are there some commands to get ... |
I wrote a utility for dumping all of the relevant parts of my db into a directory structure that I use SVN on. I never got around to trying to incorporate it into the Manager but, if you're interested, it's here: http://www.reluctantdba.com/dbas-and-programmers/sqltools/svnforsql2005.aspx |
Are you sure you want to do
<pre><code>/usr/bin/mono $1/hooks/post-commit.exe "$@"</code></pre>
$@ expands to ALL arguments. "$@" expands to all arguments join by spaces. I suspect you shell script is incorrect. You didn't state exactly what you wanted the script to do, so that does limit our possibilities to make su... |
How can I indicate that multiple versions of a dependent assembly are okay? |
|.net|versioning| |
Assemblies A and B are privately deployed and strongly named. Assembly A contains references to Assembly B. There are two versions of Assembly B: B1 and B2. I want to be able to indicate for Assembly A that it may bind to either B1 or B2 -- ideally, by incorporating this information into the assembly itself. What a... |
No, there's currently built-in quicker way.
I would suggest not modifying the existing solution and create a new solution with new projects that duplicate (e.g. rename and edit) the projects you want to work on. If you find that the solution with the hundreds of projects is an issue for you then you'll likely just ... |
How about:
select * from sys.types
where is_user_defined = 1 |
Types and UDTs don't appear in sys.objects.
You should be able to get what you're looking for with the following:
select * from sys.types
where is_user_defined = 1 |
You can set version policy in your app.config file. Alternatively you can manually load these assemblies with a call to Assembly.LoadFrom(..) when this is done assembly version is not considered. |
Disabling the back button seems kind of a "brute force" approach.
Another option would be that you could jump out to a modal dialog that doesn't have command buttons, walk users through the workflow, and close the dialog when the process is complete. |
Could you move the comment to the previous page and make it a required field there?
Disabling the back button **will not work.** |
The problem with your query is that when using a GROUP BY clause (which you essentially do by using distinct) you can only use columns that you group by or aggregate functions. You cannot use the column id because there are potentially different values. In your case there is always only one value because of the HAVING ... |
Do you have access to the server-side source code? If so, you can put a check on the first page that redirects to the second page if the information has been submitted already (you'll need to use sessions for this, obviously). At a former job, this is how we handled multi-step applications (application as in applicatio... |
Assuming the scenario 1 JVM, multiple threads then indeed java.util.concurrent is the place to look, specifically the various Queue implementations. However an abstraction on top of that may be nice and there [Jetlang][1] looks very interesting, lightweight Java message passing.
[1]: http://code.google.com/p/jet... |
Tagging is a very cheap operation in subversion. Tag your code when you start refactoring and at regular stages while you go along. That way it's easy to still access the old (but functional code) as a reference for your shiny new (but broken code). :-) |
I don't agree that gmail is an effective backup for business data.
Why trust your business information to a provider who makes no guarantees of service, or over who you have no control whatsoever?
Makes no sense to me.
Depending on how frequently you need to access this information, I'd say go with the filesys... |
All code becomes 'legacy' one day, why seperate it at all? Source control is by project/branch or project/platform/branch and that type of hierarchy. Who cares how long in the tooth it is? |
I like to put blank lines around blocks to make control flow more obvious. For example:
if foo:
bar = baz
while bar not biz:
bar = i_am_going_to_find_you_biz_i_swear_on_my_life()
did_i_not_warn_you_biz()
my_father_is_avenged() |
Another option (depending on the email content) is to not save the email, but make sure you can *recreate* the email by archiving the original content that went into generating the email. |
I've only recently started looking into this type of thing, but i have found that memory profilers can give quite detailed information regarding instances of objects within your application.
Here are a couple that are worth trying:
- [ANTS Profiler][1]
- [.NET Memory Profiler][2]
[1]: http://www.red-g... |
We save the email to a database table. It really doesn't get that big that quickly. We've a table with 32,000 emails in it (they're biggish emails too @ 50kb per email) and with compression, the file only uses 16MB.
If you're sending a shed load of email, then know that GMail(free) currently only allows 7GB of data... |
You've tagged this post with **c++**, so I'm assuming that's the language in question. If that's the only thing that's in the repository then it shouldn't be too hard to grep all files in the repository for each filename to give you a good starting point. If the repository contains other files (metadata, support files,... |
Some more anecdotal evidence. I've worked on a few performance critical real-time trading financial applications. I agree with Frank, nearly every time your problem is not the lack of being compiled, it is your algorithm or data structure. Modern hot-spot compilers are very good with the right code, for example the [CE... |
The short answer to your question is that no, you will probably not run into trouble attempting to do that. Outside the context of a UDF (even still inside a CFC), an un-scoped set statement implies the variables scope.
In addition, in a CFC, the Variables scope is available to all of its functions; it is sort of th... |
For Python, I would like to suggest ['A Byte of Python'](http://www.swaroopch.com/notes/Python).
Disclosure: I'm the author of this book, but the user feedback on the main page and the book should hopefully speak for itself :) |
I would recommend using a recognized algorithm such as PBKDF2 defined in [PKCS #5 version 2.0][1] to generate a key from your password. It's similar to the algorithm you outline, but is capable of generating longer symmetric keys for use with AES. You should be able to find an open-source library that implements PBE ke... |
C++ objects can be declared to be const:
const A obj = new A();
When an object is const, the only member functions that can be called on that object are functions declared to be const. Making an object const can be interpreted as making the object readonly. A const object cannot be changed, i.e. no data mem... |
While not *really* a distribution, there is a virtual machine available for [Tomcat](http://virtualappliances.net/products/tomcat.php). It could be adapted pretty easily for other Java based deployments (available for several virtualization technologies).
There are also several Java App Server VMs available from ... |
Because you can't pass arrays as function parameters in C. You're actually passing a pointer to it; the brackets are just syntactic sugar. There are no guarantees the array you're pointing to has size 8, since you could pass in any character pointer you want.
// These all do the same thing
void foo(char c... |
If all you have is the X and Y position, (and you can't track mouse movement like you mentioned) then you will have to traverse the DOM, looping through every DIV. For each DIV you will need to compare its X and Y coordinates against those you have. This is an expensive operation, but it is the only way. I suggest you ... |
Type-inferred constants can only be scalar values - i.e. things like integers, doubles, etc. For these kinds of constants, the compiler does indeed replace the constant's symbol with the constant's value whenever it meets them in expressions.
Typed constants, on the other hand, can be structured values - arrays and ... |