instruction stringlengths 0 30k ⌀ |
|---|
Make sudo run a shell, like this:
sudo sh -c "echo foo > ~root/out"
|
All the features are supported both in the XML and in annotations.
You will still be able to override your annotations with xml declaration.
As for the effort, i think it is worth it as you will be able to see all in one place and not switch between your code and the xml file (unless of-course you are using two mon... |
Whenever I have to do something like this I just become root:
# sudo -s
# ls -hal /root/ > /root/test.out
# exit
It's probably not the best way, but it works. |
> The only thing you'll gain from using
> annotations
I would probably argue that this is **the** thing you want to gain from using annotations. Because you don't get compile time safety with NHibernate this is the next best thing. |
Try this:
1. Create a new Calculated column
2. In the Forumla box, enter something like this:
=TEXT([existing date column]+30,"yyyy-mm-dd")
You can use any date format string you like instead of "yyyy-mm-dd"
3. Make the data type "Date and Time"
4. Make the date and time format "Date Only"
|
Does it work with just:
SELECT t.foo, t.bar, t.problemcolumn
FROM problemtable t
WHERE t.problemcolumn = 'x'
|
Did you take a look at RSpec?
http://rspec.info/
|
Placing Share Documents subfolder as a webpart in SharePoint |
|sharepoint| |
Also, keep in mind that you really shouldn't use sun.misc.* classes in your code. This could break in other VMs as these are not public APIs. Apache Commons Codecs (among others) have implementations of Base64 that don't bear this problem.
I'm not really sure why single DES would ever use multiple keys. Even if y... |
Also just something to note, you can use pointers in C# (as opposed to normal references) by marking a block of code as unsafe. Then you can run around changing memory addresses directly and do pointer arithmetic and all that fun stuff. It's great for very fast image manipulation (the only place I personally have use... |
Object-Oriented Modeling refers to the process where you are designing how the code will look like. You will use a modeling language like UML to do Object-Oriented Modeling. Object-Oriented Programming refers to a programming paradigm where you use objects. These objects have been designed during the desing phase using... |
What's wrong with the following, which doesn't rely on obscure language behaviour?
Private Function IsLetter(ByVal ch As String) As Boolean
IsLetter = (ch >= "A" and ch <= "Z") or (ch >= "a" and ch <= "z")
End Function |
How to protect yourself against shell DLLs loaded into your process? |
|winapi|shell|dll| |
When you use a standard Windows "file open" dialog using GetOpenFileName(), the shell will load various DLLs that it requires to display the file list, including custom ones.
In my application, I found that the DLL that TortoiseCVS uses to draw overlays on the icons was calling GdiPlusShutdown(), and so some time af... |
I just found this:
> Object-oriented modeling is a formal
> way of representing something in the
> real world. It draws from traditional
> set theory and classification theory.
> object-oriented modeling is not
> limited to computer-related elements.
> One may use object-oriented modeling
> to represent many ... |
The things you are looking for may be in environment variables. You need to be careful about what shell you are using when you check environment variables. bash uses "UID" while tcsh uses "uid" and in *nix case matters. I've also found that tcsh sets "gid" but I wasn't able to find a matching variable in bash. |
A checklist for fixing .Net apps to sql-server timeout problems and improve execution time |
A checklist for improving execution time between .Net code and sql-server.
Anything from the basic to weird solutions is appreciated.
|
|c#|.net|sql-server|vb.net|timeout| |
A checklist for improving execution time between .Net code and sql-server.
Anything from the basic to weird solutions is appreciated.
**Code:**
Change default timeout in command and connection by [avgbody](http://stackoverflow.com/questions/67366/a-checklist-for-fixing-net-apps-to-sql-server-timeout-problems-and... |
You have to think about what you want out of it, as it's a hobby project I'm assuming that "learning stuff" will be a major part of the experience so avoid picking up something that hides things from you and does stuff behind the scenes as this will only give you a fraction of the picture.
I'd go with Direct3D be... |
I don't know exact figures, but for Japanese Shift_JIS averages fewer bytes per character then UTF-8, and so does EUC-JP. However, they don't cover the same space of code points as Unicode, so they might not be correct answers to your question.
Note that for transport, the encoding doesn't matter much if you can zip... |
I don't know exact figures, but for Japanese Shift_JIS averages fewer bytes per character than UTF-8, and so does EUC-JP, since they're optimised for Japanese text. However, they don't cover the same space of code points as Unicode, so they might not be correct answers to your question.
UTF-16 is better than UTF-8 ... |
I'll probably get voted down for this answer, because it's not really an answer, but there are legitmate reasons that STL might be avoided. When working in fixed environemnts where memory or speed is a premium, it's sometimes difficult to tell what is going on under the hood with STL. Yes, you can write your own memo... |
How do I specify multiple data sets to an XY-scatter plot using the Google Chart API? |
|google-visualization| |
Why doesn't this Google Chart API URL render both data sets on this XY scatter plot?
http://chart.apis.google.com/chart?cht=lxy&chd=t:10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200|0.10,0.23,0.33,0.44,0.56,0.66,0.79,0.90,0.99,1.12,1.22,1.33,1.44,1.56,1.68,1.79,1.90,2.02,2.12,2.22|0.28,0... |
I assume you are making this available via a website. So you could just ask people to give you their email address in order to get the download link for the installer. Then you can track how many people add themselves to your email list each month/week/etc. It also means you can email them all when you make a new relea... |
I think that your answer is going to have to be based on a pub/sub architecture. I am assuming that you have reliable messaging between your data centers so that you can rely on published updates being received eventually. If all of your access to the data repositories is via service you can add an event notification t... |
I think the most important requirement is a good language that has native constructs that support parallelism or one that can automatically generate parallel code. There are quite a few languages that fit that description, but none of them is popular enough to really be considered for mainstream use. That, in turn is c... |
You might want to check the <a href="http://search.cpan.org/~sbeck/Date-Manip-5.54/lib/Date/Manip.pod">Date::Manip</a> Perl module on CPAN. |
You can use [antiword][1] or [AbiWord][2] to pull the text out and feed it to your favorite full-text indexer. AbiWord is probably more effective for your purposes because it can convert into RTF, PDF and other formats (yes, it's a GUI word processor, but it also supports command-line usage).
[1]: http://www.wi... |
I want to place a Webpart on a page that holds a subfolder of the Document Library in SharePoint, but somehow, the only thing I get is the root folder of the document library.
Is there a Webpart that fills this need? |
As much as I like to move on to new and potentially better things I need to remember to not mess with things that aren't broken. So if having the hibernate mappings in a separate file is working for you now I wouldn't change it. |
You would use a nested class to create a (small) helper class that's required to implement the main class. Or for example, to define an interface (a class with abstract methods).
In this case, the main disadvantage of nested classes is that this makes it harder to re-use them. Perhaps you'd like to use your VideoDec... |
I've noticed that in Process Explorer more and more of my desktop apps are being highlighted in yellow (meaning they're .Net). As mentioned above, ATI's Catalyst is, Windows Live Mesh, many games have .Net update or config engines, as well as most of the bits I write that haven't quite made it into the public arena ye... |
Check the html that is emitted on production and make sure that it has the __doPostback() and that there are no global methods watching click and canceling the event. Other than that if you think it could be related to validation you could try adding CausesValidation or whatever to false and see if that helps. Otherw... |
=> operator interprets its left side as a "string", the way qw() does.
Try using
my %x = ( X, 'X'); |
\#2 is good for distribution, where several variation will be packaged in the same folder/zip file together. However, you probably don't want all that information in the file name itself, as it make it difficult to vary those via parameters to your makefile/csproj/nant script etc. It would be easier to have several ... |
One way is to encapsulate X as (X):
my %x ( (X) => 1 );
Another option is to do away with '=>' and use ',' instead:
my %x ( X, 1 );
|
I have that exact line in in /etc/apt/sources.list.d/rpmforge.list .
When I run check-update, I get:
<pre>
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* epel: mirror.unl.edu
* rpmforge: fr2.rpmfind.net
* base: mirrors.portafixe.com
* updates: mi... |
**C++**:
int overflow(int n)
{
return overflow(1);
} |
Did you try this one: [QRCode .NET Compact Framework Package][1] ?
[1]: http://webscripts.softpedia.com/script/E-Commerce/QRCode-NET-Compact-Framework-Package--30802.html |
Your discussions will start with what consitutes a bug and evolve into what workflow to apply and end up with a massive argument about how to manage software engineering projects. Do you really want that? :-) Nah, thought not - go and buy one! |
I usually use a Utility class to get a Dictionary<int,string> from an Enum and then I bind that to Controls
public static class Utilities
{
public static Dictionary<int, string> GetEnumPairs(Type type)
{
if (type == null)
throw new ArgumentN... |
Use a Utility class to get a Dictionary<int,string> from an Enum and then bind that to a bindable Control
public static class Utilities
{
public static Dictionary<int, string> GetEnumPairs(Type type)
{
if (type == null)
throw new ArgumentNul... |
C#:
public int Foo { get { return Foo; } } |
You could base your Linq query on a stored proc that only returns x number of rows using a TOP statement. Remember just because you can do all your DB code in Linq doesn't mean you should. Plus, you can tell Linq to use the same return type for the stored proc as the normal table, so all your binding will still work, a... |
I like the Right BICEP acronym from the aforementioned [Pragmatic Unit Testing][1] book:
- **Right**: Are the results **right**?
- **B**: Are all the **b**oundary conditions correct?
- **I**: Can we check **i**nverse relationships?
- **C**: Can we **c**ross-check results using other means?
- **E**: Ca... |
I'll probably get voted down for this answer, because it's not really an answer, but there are legitmate reasons that STL might be avoided. When working in fixed environemnts where memory or speed is a premium, it's sometimes difficult to tell what is going on under the hood with STL. Yes, you can write your own memo... |
select substring(ColumnName, patindex('%[^0]%',ColumnName), 10) |
You might do a daily full build, and leave the build on check-in as is. Also, for deployment builds, it is probably a good idea to always use a clean complete build. |
There is no generic interface or set of methods for getting cut/copy/paste information from a windows forms control.
I suggest your best approach would be to create a wrapper class for each type of control. Then when you want to update the menu state you get the current control with focus and create the appropriate... |
Based on some comments, it sounds like the OP really wants to do [code generation](http://en.wikipedia.org/wiki/Code_generation_(compiler\)) -- to convert the AST into a lower-level sequence of instructions based on basic blocks and jump points.
Code generation is very language-specific, and a lot of work has been p... |
Based on some comments, it sounds like the OP really wants to do [code generation](http://en.wikipedia.org/wiki/Code_generation_(compiler\)) -- to convert the AST into a lower-level sequence of instructions based on basic blocks and jump points.
Code generation is very language-specific, and a lot of work has been p... |
javac, which compiles from Java source to bytecodes, does almost no optimisation. Indeed optimisation would often make code actually run slower by being harder to analyse for later optimisation.
The only significant difference between generated code for 1.5 and 1.6 is that with -target 1.6 extra information is added... |
Obtaining client IP address in WCF 3.0 |
|wcf| |
Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how? |
How large is the list of items for the inner loop?
Switching to an array <em>might</em> be faster if there is a significantly large number of items.
I have implemented this alongside x0n's suggestions...
<cfset dllPath="C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.DirectoryServices.dll" />
... |
VB 9 doesn't support this yet. However, VB 10 [will](http://www.panopticoncentral.net/archive/2008/05/05/23212.aspx). |
You could use discriminator column inheritance on the table, ie. a DeletedUsers table and ActiveUsers table where the discriminator column says which goes to which. Then in your code, just reference the ActiveUsers, which will never include anything deleted. |
You could use discriminator column inheritance on the table, ie. a DeletedUsers table and ActiveUsers table where the discriminator column says which goes to which. Then in your code, just reference the Users.OfType ActiveUsers, which will never include anything deleted.
As a side note, how the heck do you do this ... |
This is possible, I've had to implement a similar pattern when I designed a custom entity framework solution for working with ObjectDataSource:
public interface IPrimaryKey<T> where T : IPrimaryKey<T>
{
int Id { get; }
}
public static class IPrimaryKeyTExtension
{
public ... |
Edit: [Konrad][1]'s solution is better because its far simpler. The below solution works but is only required in situations similar to ObjectDataSource where a method of a class is retrieved through reflection without walking up the inheritance hierarchy. Obviously that's not happening here.
This is possible, I've... |
The way I've accomplished something similar in the past is by using direct binding ports in the orchestrations and letting the MsgBox do the dirty work for me. Basically, it goes something like this:
1. Make the callable orchestrations use a direct-bound port attached to your activating receive shape.
2. Set up a... |
Just **Ctrl+Backspace**... |
Strings are fundamental to C (and other related languages). When programming in C, **you** must manage your memory. You don't just say "okay, I'll need a bunch of strings"; you need to think about the data structure. How much memory do you need? When will you allocate it? When will you free it? Let's say you want... |
This can be changed in your my.ini file (located in program files, mysql, mysql Server) under the server section, for example:
[mysqld]
max_allowed_packet = 10M
|
OK I had to reinstall the tool chain, so that the missing files were then included. It seems strange since it should have found it on the gcc path. The main problem I guess was that I had 15 or so different crti.o files on my computer and wasn't point to the correct one. Still doesn't make since but it works now :-) Th... |
Use a `max_allowed_packet` variable issuing a command like
`mysql --max_allowed_packet=32M
-u root -p database < dump.sql` |
What kind of Rule engine you looking for? For styling practices? If so, go check out [StyleCop][1]. Not the answer, but there might already be something out there for you.
[1]: http://http://spoiledtechie.com/post/StyleCop-was-just-released!.aspx |
One factor is that, if strings were mutable, objects storing strings would have to be careful to store copies, lest their internal data change without notice. Given that strings are a fairly primitive type like numbers, it is nice when one can treat them as if they were passed by value, even if they are passed by refer... |
Though it doesn't look just like the documentation's example code, I found the following solution to work for what I'm trying to accomplish. Thanks gbjbaanb for making me retest my input combinations to SQLBindParameter.
SQLINTEGER length;
RETCODE retcode = SQLBindParameter( StatementHandle,
... |
Though it doesn't look just like the documentation's example code, I found the following solution to work for what I'm trying to accomplish. Thanks gbjbaanb for making me retest my input combinations to SQLBindParameter.
SQLINTEGER length;
RETCODE retcode = SQLBindParameter( StatementHandle,
... |
Clean builds in continuous integration |
|cruisecontrol.net|nant|svn| |
We use a CruiseControl.Net/NAnt/Subversion stack for CI. Doing a fresh checkout for every build is way too time-consuming, so currently we just do an update on a working copy. However, this leaves the possibility that orphaned files may remain in the working copy, after being deleted in source control. We have tried us... |
|svn|cruisecontrol.net|nant| |
We use a CruiseControl.Net/NAnt/Subversion stack for CI. Doing a fresh checkout for every build is way too time-consuming, so currently we just do an update on a working copy. However, this leaves the possibility that orphaned files may remain in the working copy, after being deleted in source control. We have tried us... |
The only way I can think of is having two copies on the build server. First you update on the first location. You delete the second location. Copy first to second and then build in the second location. That way you always start from a clean build.
You might want to look at why your checkout is taking so long. I've u... |
I dont know C# but you just need to do the equivalent of this:
out.write((len >>> 24) & 0xFF);
out.write((len >>> 16) & 0xFF);
out.write((len >>> 8) & 0xFF);
out.write((len >>> 0) & 0xFF);
|
If you do just 'update', SVN will delete all the files that were deleted in the source control. However files that were created during build process might still be there and might interfere with new build. I'm not sure if SVN has a command to delete them but I guess you could do that with a little script, SVN definitel... |
My suggestion is, use FireFox together with FireBug and use the built-in Debug/Trace objects. They are a charm.
|
Write a web app, likely in [Django](http://www.djangoproject.com/) - the [docs](http://docs.djangoproject.com/) will teach you a lot of good Python style.
Use some of the popular libraries like [Pygments](http://pygments.org/) or the [Universal Feed Parser](http://www.feedparser.org/). Both of these make extremely u... |
Try deleting your .user and .suo files - these are the user options files that VS creates. You get a .user file for each project and a .suo file for your solution. When they get corrupted, odd things happen. Deleting them will make you lose little things like which project is selected as the startup project when you st... |
Using the Java API:
String[] f(String[] first, String[] second) {
List<String> both = new ArrayList<String>();
Collections.addAll(both, first);
Collections.addAll(both, second);
return both.toArray(new String[] {});
} |
Have you tried using Microsoft ActiveSync to uninstall it? |
It's not like you're writing a poker program that will be used for an actual online gambling site. An ability for someone to cheat at the program isn't a big deal when you're teaching people how to program.
Leave a note saying that this is a poor model of the real world (with a reference to it as a possible security... |
You've not given us much detail, like the device you're using or the printer type you want to print to (local, lan, serial, network, etc), however I'll see if I can at least point you in the right direction.
The de-facto standard for CF printing is [PrinterCE from Field Software][1]. [PrintBoy from Bachmann Softwar... |
Use $hash{CONSTANT()} or $hash{+CONSTANT} to prevent the bareword quoting mechanism from kicking in.
From: http://perldoc.perl.org/constant.html |
Most commonly, if Visual Studio is crashing repeatedly, your .suo or .ncb file has become corrupted. Close your project, delete those files, and reopen. This may resolve your problem. |
Bitmap image1 = ...
Bitmap image2 = ...
Bitmap combined = new Bitmap(image1.Width, image1.Height);
using (Graphics g = Graphics.FromImage(combined)) {
g.DrawImage(image1, new Point(0, 0));
g.DrawImage(image2, new Point(0, 0);
}
imageList.Add(combined); |
You may have a custom authentication in use for Reporting Services defined in your
web.config. Check if that is the case, remove the custom authentication and try again. |
ILMerge Best Practices |
|c#|deployment|ilmerge| |
Do you use ILMerge?
Do you use ILMerge to merge multiple assemblies to ease deployment of dll's?
Have you found problems with deployment/versioning in production after ILMerging assemblies together?
I'm looking for some advice in regards to using ILMerge to reduce deployment friction, if that is even possible.
... |
We use log4net, and normally write both to log files and the database. However, when we've been tracking down a particularly difficult problem, we've enabled the email appender, so that critical log messages went straight to a developer's email account. This allowed us to figure out what was happening more immediately.... |