instruction stringlengths 0 30k ⌀ |
|---|
I need to specify a date value in a sybase where clause. For example:
select *
from data
where dateVal < [THE DATE]
|
All WCF configuration can be done programatically. So it's possible to create both servers and clients without a config file.
I recommend the book "Programming WCF Services" by Juval Lowy, which contains many examples of programmatic configuration.
|
I recommend you do this a very simple way and don't do it in code. It will allow your CMS code to do what the CMS code should do and will keep it as simple as possible.
Use a product such as [HTTrack][1]. It calls itself a "website copier". It crawls a site and creates html output. It is fast and free. You can ... |
@morechilli:
The asvn wrapper from my earlier post and the blog in the OP's post seems to do what you're suggesting. Though it stores the permissions in the corresponding files' repository properties as opposed to a single external file. |
Use the convert function, for example:
select * from data
where dateVal < convert(datetime, '01/01/2008', 103)
Where the convert style (103) determines the date format to use.
|
Is it your intent to test the view which generates the deltas, or to test that your code correctly adds, deletes and updates in response to the view?
If you want to test the view, you could use a tool like [DBUnit][1] to populate your feed and data tables with various data whose delta you've manually calculated. Th... |
@Sean That was already answered by Brian
return isset($input) ? $input : $default; |
NullReferenceException on instanciated object ?? |
|c#|asp.net|yellow-screen-of-death| |
This is a segment of code from an app I've inherited, a user got a Yellow screen of death "Object reference not set to an instance of an object" on the *bool l_Success* ... line. Now I'm 95% sure the faulty argument is *ref l_Monitor* which is very weird considering the object is instanciated a few lines before. Anyone... |
I don't think you realize jusy **how serious** this error might be. These errors pop up under severe conditions like buffer overflows, null pointer dereferences, division by zero errors, etc. Given that you mentioned that this runs on a server, you potentially (depending on your situation) have a **network facing, easi... |
Sean, you could do:
$result = ($func_result = doLargeIntenseFunction()) ? $func_result : 'no result';
EDIT:
> I'm sure there could be a great
> discussion on ternary operators vrs
> function calls. But the point of this
> question was to see if we can create a
> function that won't throw an error if
>... |
|vb.net|reporting-services| |
my <b>SSRS DataSet</b> returns a field with HTML, e.g.
<b>blah blah </b><i> blah </i>.
how do i strip all the HTML tags? has to be done with <b>inline</b> VB.NET
Changing the data in the table is not an option.
thank you
p.s. solution found ... = System.Text.RegularExpressions.Regex.Replace(StringWit... |
my <b>SSRS DataSet</b> returns a field with HTML, e.g.
<b>blah blah </b><i> blah </i>.
how do i strip all the HTML tags? has to be done with <b>inline</b> VB.NET
Changing the data in the table is not an option.
thank you
**Solution found** ... = System.Text.RegularExpressions.Regex.Replace(StringWith... |
Strip HTML from string in SSRS 2005 (VB.NET) |
If you just want a yes or no answer this syntax should give you the best performance.
<pre><code lang="sql">select if(exists (select url from urls where url = 'http://asdf.com'), 1, 0) from dual</code></pre> |
Like the others, my personal projects always have:
* A Final Goal
* A Task List
* Small usable units
* Source control
As an additional motivator, I try to use a technology that I have never used before. Learning something new generally becomes the largest motivator for me.
|
1. Turn on quickedit mode (but selection is still rectangular instead of word-wrapped)
2. Resizing by dragging works for me
3. You can change the buffer size which will impact when scrollbars appear
4. pushd \\\\server\\share
Even with those, cmd.exe isn't a great console. See all the other replies and the earli... |
If you don't want to have duplicates you can do following:
- add uniqueness constraint
- use "[REPLACE][1]" or "[INSERT ... ON DUPLICATE KEY UPDATE][2]" syntax
If multiple users can insert data to DB, method suggested by @Jeremy Ruten, can **lead to an error**: after you performed check some one can insert s... |
If you don't want to have duplicates you can do following:
- add uniqueness constraint
- use "[REPLACE][1]" or "[INSERT ... ON DUPLICATE KEY UPDATE][2]" syntax
If multiple users can insert data to DB, method suggested by @Jeremy Ruten, can **lead to an error**: after you performed a check someone can insert ... |
If you just want to make sure there are no duplicates then add an unique index to the url field, that way there is no need to explicitly check if the url exists, just insert as normal, and if it is already there then the insert will fail with a duplicate key error. |
WalloWizard is correct that you should only use the minimum permissions necessary for the script to function.
However, let me be more specific, assuming that you're running on a Unix-based system such as Linux or BSD or Mac OSX. Your web server usually runs as an unprivileged user such as "nobody" and your scripts ... |
A couple of tidbits about working with cc.net and msbuild. If you are building C/C+= projects, msbuild is, um, unreliable at least with VS 2005 (and perhaps earlier). I have not tested with VS 2008. We found that sometimes msbuild would work properly, sometimes not. In trying to solve the problem, we found vcbuild.... |
Windows XP (might also work on 2000) BATCH script:
@echo off
call :is_palindrome %1
if %ERRORLEVEL% == 0 (
echo %1 is a palindrome
) else (
echo %1 is NOT a palindrome
)
exit /B 0
:is_palindrome
set word=%~1
set reverse=
call :reverse... |
Windows XP (might also work on 2000) or later BATCH script:
@echo off
call :is_palindrome %1
if %ERRORLEVEL% == 0 (
echo %1 is a palindrome
) else (
echo %1 is NOT a palindrome
)
exit /B 0
:is_palindrome
set word=%~1
set reverse=
call... |
[Dependency Walker][1] is what you need. Or maybe [Depends.Net][2]
[1]: http://www.dependencywalker.com
[2]: http://www.netomatix.com/Development/DependsNet.aspx |
Interesting question. I don't see any real viable alternative to manually copying the collection since _CopyTo_ will only allow you to get the values (and not the keys).
I think [HollyStyles' Hack][1] would work (although I would be nervous about putting a Replace in a QueryString - obv. dependant on use case), but ... |
Interesting question. I don't see any real viable alternative to manually copying the collection since _CopyTo_ will only allow you to get the values (and not the keys).
I think [HollyStyles' Hack][1] would work (although I would be nervous about putting a Replace in a QueryString - obv. dependant on use case), but ... |
There are some [downsides][1] with developing a site completely in Flash / Silverlight, but if those downsides won't matter to you or won't have an impact then there is nothing stopping you. Choose whatever tool you think meets your needs more fully. I wouldn't be put off creating a site purely in Silverlight based on ... |
Calling the `Render` method is still pretty simple. Just create an instance of your page, create a stub `WebContext` along with the `WebRequest` object, and call the `Render` method of the page. You are then free to do whatever you want with the results.
Alternatively, write a little `curl` or `wget` script to downl... |
Calling the `Render` method is still pretty simple. Just create an instance of your page, create a stub `WebContext` along with the `WebRequest` object, and call the `Render` method of the page. You are then free to do whatever you want with the results.
Alternatively, write a little `curl` or `wget` script to downl... |
The first zip file you mention has a .war file as part of the zip. The second one is just the source code and it needs to be built into a .war file. It looks like it is setup to have that done in Eclipse. Try the File|Export option and select War file as the export type. |
ReSharper Code Cleanup/Reformat Code feature vs Versioning Control Systems |
|c#|version-control|resharper| |
ReSharper Code cleanup feature (with "[reorder members](http://www.jetbrains.com/resharper/features/code_formatting.html#Reordering_Type_Members_C#_only)" and "[reformat code](http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Style_Configuration_and_Sharing)" enabled) is really great. You define a l... |
Tnilsson, I agree that YXJuLnphcnQ solution is arguably faster, but the idee is the same. I forgot to add, that the language is optional in the first problem, as well as int the second.
You're right, that calculationg zeroes, and the product int the same loop is better. Maybe that was the thing. |
Using Silverlight for an entire website? |
|asp.net|architecture|silverlight| |
We need to build an administration portal website to support our client/server application. Since we're a .Net shop the obvious traditional way would be to do that in ASP.Net. But Silverlight 2 will be coming out of beta a good while before our release date. Should we consider building the whole website in silverlight ... |
If you're using SQL Server it would be hard to beat Data Dude (aka the Database Edition of Visual Studio). Once you get the hang of it, doing a schema compare between your source controlled version of the database and the version in production is a breeze. And with a click you can generate your diff DDL.
There's an... |
true, in some situations it wouldn't make since to use the function, but if there's something like a function call:
$result = doLargeIntenseFunction() ? doLargeIntenseFunction() : 'no result';
$result = defaultValue(doLargeIntenseFunction(), 'no result');
It only has to call the function once.
I'm sure there ... |
I'm sure there could be a great discussion on ternary operators vrs function calls. But the point of this question was to see if we can create a function that won't throw an error if a non existent value is passed in without using the '@'
|
You sure that one of the properties trying to be accessed on the l_Monitor instance isn't null? |
Database engines Comparison - Windows Mobile.. |
|windows-mobile|pocketpc|sql-server-mobile| |
What are the different database options on Windows Mobile available?
I have used CEDB and EDB for linear dataset needs.
I have heard of SQL server 2005 Mobile edition. But what are the advantages over others (if there is any) |
Ok, I've got something working.
First, I created a new Library symbol and called it "VideoWrapper". I then added a single Video object to that with an ID of "video".
Now, any time I need to dynamically add a Video to my state I can use MovieClip.attachMovie() to add a new copy of the Video object.
To make thi... |
Sprinkle in a few variables for all the property-queries on that (loooooongg) line temporarily. Run the debugger, Check values and Corner the little bug. |
Here's a nice, clean way:
class Parser
{
public:
typedef double matrix[4][4];
// ...
const matrix& getMatrix() const
{
return matrix_;
}
// ...
private:
matrix matrix_;
};
Now you're working with a de... |
If this is for XML serialization and NHibernate, where you want the parameterless constructor to be accessible (as is the case in the [example][1] you referenced), then use a private or protected parameterless constructor for serialization, or a protected constructor for NHibernate. With the protected version, you are... |
If you can't modify the structures then you have no alternative to writing a manual conversion function because overloading conversion operators only works within the class body. There's no other way. |
Not sure how sensible this is, but how about something like this:
class R
{
public:
R(const rectangle& r) { ... };
R(const Rect& r) { ... };
operator rectangle() const { return ...; }
operator Rect() const { return ...; }
private:
...
};
The... |
should websites expand on window resize? |
|html|css|usability| |
I'm asking this question purely from a usability standpoint: Should a website expand/stretch to fill the viewing area when you resize a browser window?
I know for sure there are the obvious cons:
- Wide columns of text are hard to read
- Writing html/css using percents can be a pain
- It makes you vulnerable... |
|html|css|usability| |
I'm asking this question purely from a usability standpoint: Should a website expand/stretch to fill the viewing area when you resize a browser window?
I know for sure there are the obvious cons:
- Wide columns of text are hard to read
- Writing html/css using percents can be a pain
- It makes you vulnerable... |
You could use an object database. |
You may want to check out
http://alducente.wordpress.com/2007/10/27/web-service-in-as3-release-10/
|
What is the best source for information on COM error codes? |
|windows|com| |
I'm at a loss for where to get the best information about the meaning, likely causes, and possible solutions to resolve COM errors when all you have is the HRESULT.
Searching google for terms like '80004027' is just about useless as it sends you to random discussion groups where 90% of the time, the question 'What d... |
At the very least, hopefully you can turn off ViewState on the GridViews. |
When I have private methods in a class that is sufficiently complicated that I feel the need to test the private methods directly, that is a code smell: my class is too complicated.
My usual approach to addressing it is to tease out a new class that contains the interesting bits. Often, this method and the fields... |
When I have private methods in a class that is sufficiently complicated that I feel the need to test the private methods directly, that is a code smell: my class is too complicated.
My usual approach to addressing it is to tease out a new class that contains the interesting bits. Often, this method and the fields... |
<H2>[Structure of COM Error Code][1]</H2>
2nd in google results for COM Error Code
[1]: http://msdn.microsoft.com/en-us/library/ms690088.aspx |
Check out [JGraphT][1] for a very simple and powerful Java graph library that is pretty well done and, to allay any confusion, **is different than JGraph**. Some [sample code][2]:
UndirectedGraph<String, DefaultEdge> g =
new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);
String v1 ... |
We need to build an administration portal website to support our client/server application. Since we're a .Net shop the obvious traditional way would be to do that in ASP.Net. But Silverlight 2 will be coming out of beta a good while before our release date. Should we consider building the whole website in silverlight ... |
You can pass ranges of revisions using the .. (and ...) operator.
git diff 6d0918...HEAD
instead of giving (abbreviated) SHA hashes, you can also denote revisions relative to branches and tags:
git diff HEAD~4 # shows the diff from the last four commits to the current one
Have a look at the chapter ... |
Tnilsson, I've also uset the Fisher-Yates shuffle :). I'm very interested dough, about the testing part :) |
Reset screen point to the top of screen in Windows & Linux console |
|c|console| |
I have a little routine that's run under Linux and Windows written in C and displays output on the console. I'm not linking in any form of curses or anything like that.
Currently I clear the screen using
#ifdef __WIN32
system( "cls" );
#else
system( "clear" );
#endif
Then I have a b... |
Team System get-latest-version on checkout |
|visual-studio-team-system| |
We used to use SourceSafe, and one thing I liked about it was that when you checked out a file, it automatically got you its latest version.
Now we work with Team System 2005, and it doesn't work that way - you have to "get latest version" before you start working on a file that you've checked out.
Is there a way... |
It sounds like your problem is that you need a rich-client admin application. Why not use click-once? |
There's a Visual Studio Add-in for this that someone wrote:
<http://blogs.microsoft.co.il/blogs/srlteam/archive/2007/03/24/TFS-GetLatest-version-on-check_2D00_out-Add_2D00_In.aspx> |
Not with VMWare, but QEMU can emulate a 64bit processor.
From [this](http://blog.xwings.net/?p=47) blog post:
>
>
$ cd /path/to/vmware/guestos
$ for i in \`ls *[0-9].vmdk\`; do qemu-img convert -f vmdk $i -O raw {i/vmdk/raw};done
$ cat *.raw >> guestos.img
>
> To run it,
>
qemu -m 256... |
To guarantee uniqueness you need to add a unique constraint. Assuming your table name is "urls" and the column name is "url", you can add the unique constraint with this alter table command:
alter table urls add constraint unique_url unique (url);
The alter table will probably fail (who really knows with MyS... |
Foreign keys are the best way to ensure referential integrity of a database. Avoiding cascades due to being magic is like writing everything in assembly because you don't trust the magic behind compilers.
What is bad is the wrong use of foreign keys, like creating them backwards, for example.
Juan Manuel's exampl... |
Foreign keys are the best way to ensure referential integrity of a database. Avoiding cascades due to being magic is like writing everything in assembly because you don't trust the magic behind compilers.
What is bad is the wrong use of foreign keys, like creating them backwards, for example.
Juan Manuel's exampl... |
Foreign keys are the best way to ensure referential integrity of a database. Avoiding cascades due to being magic is like writing everything in assembly because you don't trust the magic behind compilers.
What is bad is the wrong use of foreign keys, like creating them backwards, for example.
Juan Manuel's exampl... |
A variation of the one I've been using for quite some time is:
CREATE FUNCTION [widget].[properCase](@string varchar(8000)) RETURNS varchar(8000) AS
BEGIN
SET @string = LOWER(@string)
DECLARE @i INT
SET @i = ASCII('a')
WHILE @i <= ASCII('z')
BEGIN
SET @string = REPLACE(... |
Sorry about the delay - it's a busy week for me.
I tried my solution from setting the following directives in .htaccess:
RewriteEngine on
RewriteRule ^static/.+\.(js|ico|gif|jpg|jpeg|png|css|swf)$ compress.php [NC]
It's required that your provider allows you to override `mod_rewrite` options in `.htac... |
Sorry about the delay - it's a busy week for me.
Assumptions:
- `.htaccess` is in the same file as `compress.php`
- static files to be compressed are in `static` subdirectory
I started my solution from setting the following directives in .htaccess:
RewriteEngine on
RewriteRule ^static/.+\.(js|... |
Edit control on stack overflow |
|c#|.net|asp.net|text-editor| |
Is the edit control I'm typing in now, with all its buttons and rules freely available for use?
My web project is also .Net based. |
|.net|asp.net|text-editor| |
Inversion of Control Container for PHP? |
|php|frameworks| |
I am trying to code TDD style in PHP and one of my biggest stumbling blocks (other than lack of a decent IDE) is that I have to make my own hacked together IoC container just to inject all my mock objects properly.
Has anyone used an Ioc container in php? All I've been able to find is [PHP IOC on the ever-annoying ... |
boolean isPalindrome(String str1) {
return str1.equalsIgnoreCase((new StringBuilder(str1)).reverse().toString());
}
Java version |
boolean isPalindrome(String str1) {
//first strip out punctuation and spaces
String stripped = str1.replaceAll("[^a-zA-Z0-9]", "");
return stripped.equalsIgnoreCase((new StringBuilder(stripped)).reverse().toString());
}
Java version |
Continuous Integration |
|visual-studio|svn|continuous-integration| |
We are currently evaluating different applications that interface with Visual Studio and Subversion to do automated builds of our core libraries. We are hoping to have nightly builds performed and either email the list of changes made to each developer or have the latest versions be pushed to each workstation. What h... |
We are currently evaluating different applications that interface with Visual Studio 2008 (C#) and Subversion to do automated builds of our core libraries. We are hoping to have nightly builds performed and either email the list of changes made to each developer or have the latest versions be pushed to each workstatio... |