instruction
stringlengths
0
30k
I wouldn't have phone number as a class at all as it does not have any behavior, it's just a data element.
I have various typo corrections in aliases alias mkae=make alias mroe=less
What is the best way and recommended practices for interacting with Lotus Notes from C#
|c#|interop|lotus-notes|
In particular, I have to extract all the messages and attachments from Lotus Notes files in the fastest and most reliable way. Another point that may be relevant is that I need to do this from a secondary thread.
In particular, I have to extract all the messages and attachments from Lotus Notes files in the fastest and most reliable way. Another point that may be relevant is that I need to do this from a secondary thread. **Edit** Thanks for the answers - both of which are good. I should provide more background informatio...
Unless you are going to change the exception, you should only log at the level where you are going to handle the error and not rethrow it. Otherwise your log just has a bunch of "noise", 3 or more of the same message logged, once at each layer. My best practice is: 1. Only try/catch in public methods (in genera...
I guess it depends on where you want to store the text, if you need things like transactions etc. Databases like SQL Server have a type that can store long text fields. In SQL Server 2005 this would primarily be nvarchar(max) for long unicode text strings. By using a database you can benefit from transactions and ea...
There are various ways of computing quantiles when you give it a vector, and don't have a known CDF. Consider the question of what to do when your observations don't fall on quantiles exactly. The "types" are just determining how to do that. So, the methods say, "use a linear interpolation between the k-th orde...
Use your own exceptions to wrap inbuild exception. This way you can distinct between known and unknown errors when catching exception. This is usefull if you have a method that calls other methods that are likely throwing excpetions to react upon expected and unexpected failures
XNA File Load
|xna|
In XNA, how do I load in a texture or mesh from a file without using the content pipeline?
If you're required to log all exceptions, then it's a fantastic idea. That said, logging all exceptions without another reason isn't such a good idea.
SELECT 'DROP TABLE "' + TABLE_NAME + '"' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '[prefix]%' This will generate a script...
There was a screencast series a year or so ago on Polymorphic Podcast that did a pretty good intro walkthrough of an MVP implementation in ASP.NET. Implemented this way, unit tests fall into place much more naturally. <http://polymorphicpodcast.com/shows/mv-patterns/>
[Xenph Yan][1]'s answe was far cleaner than mine but here is mine all the same. declare @startStr as Varchar (20) set @startStr = 'tableName' declare @startStrLen as int select @startStrLen = LEN(@startStr) select 'DROP TALBE ' + name from sysobjects where type = 'U' and left(name...
You may need to modify the query to include the owner if there's more than one in the database. <pre> declare @cmd varchar(4000) declare cmds cursor for Select 'drop table [' + Table_Name + ']' From INFORMATION_SCHEMA.TABLES Where Table_Name like 'prefix%' open cmds while 1=1 begin fetch cmds into...
You can use relative paths...try **__FILE__**. This is a PHP constant which always returns the path/filename of the script it is in. So in soap.php you could do: include dirname(__FILE__).'../inc/include.php'; > The full path and filename of the > file. If used inside an include, the > name of the include...
Some things to think about when choosing between these mechanisms are: 1. Do you just want stdout or do you need stderr as well? or even separated out? 2. How big is your output? Do you want to hold the entire result in memory? 3. Do you want to read some of your output while the subprocess...
Keep in mind that TempData stores the form collection in session. If you don't like that behavior, you can implement the new ITempDataProvider interface and use some other mechanism for storing temp data. I wouldn't do that unless you know for a fact (via measurement and profiling) that the use of Session state is hurt...
Have you thought about creating a [test double][1]? [1]: http://xunitpatterns.com/Test%20Double.html
Keystrokes won't have an effect until the page has loaded, javascript has been processed and the text field is then focused. Basically what you are really asking is; **how do I speed up a web application to increase response times?** Your anwser is AJAX! Carefully think about the most common actions in the appli...
Keystrokes won't have an effect until the page has loaded, javascript has been processed and the text field is then focused. Basically what you are really asking is; **how do I speed up a web application to increase response times?** Your anwser is AJAX! Carefully think about the most common actions in the appli...
1. It's worth taking speed into account if you're optimizing code. You should generally know why you're optimizing code (as in: a specific task in your existing codebase is taking too long, not "I heard PHP is slower than Python"). It's *not* worth taking speed into account if you don't actually plan on switching lang...
Well, you can use the "time" command to help: you@yourmachine:~$ time echo "hello world" hello world real 0m0.000s user 0m0.000s sys 0m0.000s you@yourmachine:~$ And this will get around timing outside of the environment. As for whether you need to actually time that extra work.....
__doPostBack is not working in firefox
|c#|asp.net|
The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event <asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you...
The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event <asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you...
The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event <asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you...
Other people have posted huge lists, but as a practical matter, speaking as someone who does mostly systems programming, the features I miss most when using the express edition are 1. the thread-aware parts of the debugger,and 2. the ability to open files with the built-in binary viewer. If I did MFC progr...
For after work work, for freelance jobs...:) and final to be programming literate as possible as...;)
What is companies_contactInfo_updateTerritories? The actual reference mentions procedure "companies_contactInfo_updateTerritories" but I do not see it in the code given. Also I do not see where it is being called. Unless it is from your application that is calling the SQL and hence irrelevant.... If you tested ...
You may want to log at the highest level, which is usually your UI or web service code. Logging multiple times is sort of a waste. Also, you want to know the whole story when you are looking at the log. In one of our applications, all of our pages are derived from a BasePage object, and this object handles the exc...
The MVP was talking about having your code and project run from your user folder for example c:\users\yourname\appdata or something under that path. Do not disable UAC to fix this problem otherwise your application will not run on another machine unless it to has UAC turned off. It is a very bad practice. Your appli...
It looks like this is a Gallio problem. It appears to only support the version of MSTest that comes with VS2k8. The XML format for vsmdi has changed between versions.
I'm not completely sure why you're trying to do, but modifying the resource files manually probably isn't a good idea. I believe general practice for VC++ for globally-accessible values is to define them in stdafx.h (at least that's how I've seen it done), or to create something like a "globals.h" header file and in...
If you're not an admin, then you probably don't have permission to execute programs in C:\Dev.
If that's the only thing it does, i think is better to remove the try/catch's from those classes and let the exception be raised to the class that is responsible on handling them. That way you get only one log per exception giving you more clear logs and even you can log the stacktrace so you wont miss from where the e...
As @Forge Ferreira already said put your repository definitions in the pom.xml. Use [profiles](http://maven.apache.org/pom.html#Profiles) adittionally to select the repository to use via command line: mvn deploy -P MyRepo2 mvn deploy -P MyRepo1
As @Jorge Ferreira already said put your repository definitions in the pom.xml. Use [profiles](http://maven.apache.org/pom.html#Profiles) adittionally to select the repository to use via command line: mvn deploy -P MyRepo2 mvn deploy -P MyRepo1
What does Class::MethodMaker exactly do?
|perl|
I want to know what exactly is the sequence of calls when a getter/setter created through Class::MethodMaker is called? How costlier are getter/setters defined by MethodMaker than the native ones(overwritten in the module)?
I think the with-statement can come in handy when converting a template language into javvascript. For example [JST][1] in [base2][2], but I've seen it more often. I agree one can program this without the with-statement. But because it doesn't give any problems it is a legitimate use. [1]: http://code.googl...
@Rob: You are right from your point of view. From my point of view it is my test project to check some things. If it is working in any way, that fits to me. I haven't found any similair problem on the net, so it can be something else, absolutely not related to ASP.NET. However I'm open, so that next time I also c...
Flexible compiler pipeline definitions...
|compiler-construction|workflow|pipeline|
I'm developing a compiler framework for .NET and want a flexible way of defining pipelines. I've considered the following options: - WWF - Custom XML pipeline description - Custom pipeline description in code (using Nemerle's macros to define syntax for it) - Other code-based description Requirements: ...
ctrl+L will usually clear the screen. Works from the bash prompt (obviously) and in gdb, and a lot of other prompts.
If you don't want to add an extra extension the following code should work with jQuery. $('a[href=#target]'). click(function(){ var target = $('a[name=target]'); if (target.length) { var top = target.offset().top; $('html,body').animate({scrol...
I finally realized what was wrong: Class B was subclassing from DisplayObject which I now see is an abstract class. Class B did not implement the abstract members, thus the error. I'll probably change class B to subclass from Sprite instead. This seems like a problem that should have been caught by the compiler. Doe...
Thanks leddt. Doing that yielded the error: > The type 'TModel' must be a reference > type in order to use it as parameter > 'TModel' in the generic type or method which pointed me to [this page][1], which yielded this solution: namespace System.Web.Mvc { public static class ViewPageExtens...
Thanks leddt. Doing that yielded the error: > The type 'TModel' must be a reference > type in order to use it as parameter > 'TModel' in the generic type or method which pointed me to [this page][1], which yielded this solution: namespace System.Web.Mvc { public static class ViewPageExtens...
gcc implements an extension to the C language to support sequential ranges: switch (value) { case 1...3: //Do Something break; case 4...6: //Do Something break; default: //Do the Default break; } <B>Edit</B>: J...
Create a custom JSP tag handler. You can then retrieve the bean from session scope, and then initialize it on the fly. See this [tutorial][1] for more details. [1]: http://java.sun.com/products/jsp/tutorial/TagLibrariesTOC.html
Two possibilities: Disable the cache entirely. The application will run slower, but without any variability. Pre-load the code in the cache and "lock it in". Most processors provide a mechanism to do this.
Depending on the scale of the project, look at .NET compact framework. If you're familiar at all Visual Studio then it's pretty easy to get started. Of course MSDN is the place for resources. Running managed code on a mobile device does take a big performance hit, but for a small personal project it's pretty good. ...
Put [Jad][1] on your system path. Install [JadClipse][2] plugin for Eclipse. Use the force, read the decompiled source. :-) [1]: http://www.kpdus.com/jad.html [2]: http://jadclipse.sourceforge.net/
[Here's comparison chart of editions][1] [1]: http://msdn.microsoft.com/en-us/vs2005/aa700921.aspx
[Here's comparison chart of editions][1] Edit: didn't realize this was for 2005, not 2008 [1]: http://msdn.microsoft.com/en-us/vs2005/aa700921.aspx
WCSF Random assembly manifest definition does not match assembly ref in .NET 2.0
|enterprise-library|wcsf|
I'm running WCSF Feb 2008 along with Enterprise Library 3.1 and noticed that randomly I get the "fun" *Could not load file or assembly Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, Public ... The located assembly's manifest definition does not match the assembly reference.* Usua...
Take a look at the image filters at [http://www.jhlabs.com/ip/filters/index.html][1]. The [QuantizeFilter][2] seems to do what you want. [1]: http://www.jhlabs.com/ip/filters/index.html [2]: http://www.jhlabs.com/ip/filters/QuantizeFilter.html
Make sure to balance the risk that fresh statistics cause undesirable changes to query plans against the risk that stale statistics can themselves cause query plans to change. Imagine you have a bug database with a table ISSUE and a column CREATE_DATE where the values in the column increase more or less monotonica...
[GLib][1] is a portability/utility library for C which forms the basis of the GTK+ graphical toolkit. It can be used as a standalone library. It contains portable wrappers for managing directories. See [Glib File Utilities][2] documentation for details. Personally, I wouldn't even consider writing large amounts o...
if ls tmp/* >/dev/null 2>&1 ; then echo "huzzah"; fi;
if ls /some/dir/* >/dev/null 2>&1 ; then echo "huzzah"; fi;
[Eucalyptus][1] [http://eucalyptus.cs.ucsb.edu/][1] > EUCALYPTUS - Elastic Utility Computing > Architecture for Linking Your Programs > To Useful Systems - is an open-source > software infrastructure for > implementing "cloud computing" on > clusters. The current interface to > EUCALYPTUS is compatible with Am...
AFAIK there is no built-in converter in .NET for converting a SqlDbType to a System.Type. But knowing the mapping you can easily roll your own converter ranging from a simple dictionary to more advanced (XML based for extensability) solutions. The mapping can be found here: http://www.carlprothman.net/Default.aspx?...
AFAIK there is no built-in converter in .NET for converting a SqlDbType to a System.Type. But knowing the mapping you can easily roll your own converter ranging from a simple dictionary to more advanced (XML based for extensability) solutions. The mapping can be found here: http://www.carlprothman.net/Default.aspx?...
You can write a simple recursive function to do the job.
You can write a simple recursive function to do the job. My MSSQL is a little bit rusty, but it would look like this: CREATE FUNCTION CALC ( @node integer, ) returns ( @total integer ) as begin select @total = (select node_value from yourtable where node_i...
The environment inspects the file contents to determine if it is an Ant file (if it isn't called "build.xml"). Add the following to the XML file: <?xml version="1.0" encoding="UTF-8"?> <project name="myproject" default="t1"> <target name="t1"></target> </project> You should now see the "...
The solutions so far use `ls`. Here's an all bash solution: shopt -s nullglob shopt -s dotglob # To include hidden files files=(/some/dir/*) if [ ${#files[@]} -gt 0 ]; then echo "huzzah"; fi
As an alternative to using regex you could do it in Sets: from sets import Set allowed_chars = Set('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-') if Set(my_little_sting).issubset(allowed_chars): # your action print True
I always did: perl -wlne'eval;print$@if$@' With 5.10, I've switched to: perl -wnE'say eval()//$@'
OK then, not bad. To be more specific, the current query is doing something like: <pre> $sql1 = "TRUNCATE TABLE fubar"; $sql2 = "CREATE TEMPORARY TABLE IF NOT EXISTS fubar SELECT id, name FROM barfu"; </pre> The first time the method containing this is run, it generates an error message on the truncate since ...
Hm, tricky. Could it be that the question it self to sys.databases is causing the ACTIVE_TRANSACTION? In that case though, it should be in the MASTER and not the TEMPDB.
How to migrate SVN with history to a new Git repository?
|git|svn|version-control|
I read git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like: SVN repository in: svn://myserver/path/to/svn/repos Git repository in: git://myserver/path/to/git/repos git-do-the-magic-svn-import-with-history svn://myserver/path/to/svn/...
|version-control|svn|git|git-svn|
If it were not for the dashes and underscores, the easiest solution would be my_little_string.isalnum() (Section [3.6.1][1] of the Phython Library Reference) [1]: http://docs.python.org/lib/string-methods.html
Some comments about the deparse above: First, don't use B::Terse, it's obsolete. B::Concise gives you much better information once you are used to it. Second, you've run it used the literal code given, so condition was taken as a bareword that happens to be true, so the boolean check was optimized away in both c...
Some comments about the deparse above: First, don't use B::Terse, it's obsolete. B::Concise gives you much better information once you are used to it. Second, you've run it using the literal code given, so condition was taken as a bareword that happens to be true, so the boolean check was optimized away in both ...
Where can I get the Windows Workflow "wca.exe" application?
|windows|workflow|sdk|
I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't find that file. I thought it would be in the latest .NET 3....
Where can I get the Windows Workflow "wca.exe" application?
|windows|workflow|sdk|
A workaround is to install <http://apserver.sourceforge.net> on your local machine, configure it and run gems through this proxy. * Install: Just download apserver 097 (and not the experimental 098!) and unpack. * Configure: Edit the server.cfg file and put the values for your MS proxy in PARENT_PROXY and PARENT_PR...
ConfigurationManager.AppSettings Performance Concerns
|c#|.net|configuration|performance|
I plan to be storing all my config settings in my application's app.config section (using the ConfigurationManager.AppSettings class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be writing those changes out to the AppSettings. At the same time, while t...
I plan to be storing all my config settings in my application's app.config section (using the ConfigurationManager.AppSettings class). As the user changes settings using the app's UI (clicking checkboxes, choosing radio buttons, etc.), I plan to be writing those changes out to the AppSettings. At the same time, while t...
Top 10 commands again (like [ctcherry][1]'s post, only shorter): history | awk '{ print $2 }' | sort | uniq -c |sort -rn | head [1]: http://stackoverflow.com/questions/68372/what-are-some-of-your-favorite-command-line-tricks-using-bash#68390
SLIME for EMACS is a wonderful tool for LISP programming. The best part is sending code written in your editor straight to a live LISP session. You can get similar behavior out of Vim using the tips here: [http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/][1] I adjusted my own script so that I can...