instruction
stringlengths
0
30k
I wondered whether anybody knows how to obtain membership of local groups on a remote server programmatically via C#. Would this require administrator permissions? And if so is there any way to confirm the currently logged in user's membership (or not) of these groups?
I wondered whether anybody knows how to obtain membership of local groups on a remote server programmatically via C#. Would this require administrator permissions? And if so is there any way to confirm the currently logged in user's membership (or not) of these groups?
It appears there is a new Assembly in .net 3.5 called System.DirectoryServices.AccountManagement which gives a cleaner implementation than System.DirectoryServices. [Dominick Baier blogs about](http://www.leastprivilege.com/SystemDirectoryServicesAccountManagement.aspx) a couple of simple operations including checking...
I have a view that has a list of jobs in it, with data like who they're assigned to and the stage they are in. I need to write a stored procedure that returns how many jobs each person has at each stage. So far I have this (simplified): DECLARE @ResultTable table ( StaffName nvarchar(100), ...
|sql-server|sql|t-sql|
|sql|sql-server|t-sql|
I have a view that has a list of jobs in it, with data like who they're assigned to and the stage they are in. I need to write a stored procedure that returns how many jobs each person has at each stage. So far I have this (simplified): DECLARE @ResultTable table ( StaffName nvarchar(100), ...
If this is to parse command line I would suggest using [Commons Cli]( http://commons.apache.org/cli/).
If this is to parse command lines I would suggest using [Commons Cli]( http://commons.apache.org/cli/). > The Apache Commons CLI library provides an API for processing command line interfaces.
OK, I know you're mainly talking about windows but... I used to develop on windows for deployment on *nix servers. Sure there were *lots* of gotchas with this way of working, but you just kind of get used to it. In October 2005 I switched to Linux, initially as an experiment, but I never went back. There was a s...
How do I send mail from a Ruby program ?
|ruby|email|
I want to send email from a Ruby application. Is there a call in the core language to do this or is there a library I should use ? What's the best way to do this ?
XMLStarlet is a command line toolkit to query/edit/check/transform XML documents (for more information see http://xmlstar.sourceforge.net/) No files to write, just pipe your file to xmlstarlet and apply an xpath filter. cat file.xml | xml sel -t -m 'xpathExpression' -v 'elemName' 'literal' -v 'elname' -n -m...
What you need is this: h = Math.sqrt(x*x + y*y); z = Math.atan2(y, x); That should give you the angle in radians, you might need to swap x/y and possibly add or remove 90 degrees but it should do the trick! I use multiplication instead of Math.pow() just because Math is pretty slow, you can do: ...
What you need is this: h = Math.sqrt(x*x + y*y); z = Math.atan2(y, x); That should give you the angle in radians, you might need to swap x/y and possibly add or remove 90 degrees but it should do the trick! (Note that you don't even need **h** to get **z** when you're using atan2) I use multiplication...
What you need is this: var h:Number = Math.sqrt(x*x + y*y); var z:Number = Math.atan2(y, x); That should give you the angle in radians, you might need to swap x/y and possibly add or remove 90 degrees but it should do the trick! (Note that you don't even need **h** to get **z** when you're using atan2) ...
I use the [Net::SMTP](http://www.ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/index.html) library
I have cygwin installed, so I can run bash shell scripts for my automatization needs. Besides, when I need stuff running moreless natively on Windows, I use a combination of batch + jscript (runs on cmdline if you have Visual Studio.Net installed, just call "cscript XXX.js").
I suppose you can do something like: SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT 1 OFFSET 1 or SELECT * FROM Table ORDER BY NumericalColumn DESC LIMIT (1, 1) depending on your database server. Hint: SQL Server doesn't do LIMIT.
Most modern languages have native support for some of the design patterns. It has been argued that languages are better the more patterns they support natively without the need to implement them explicitly, and that Lisp is excellent in this regard. Jeff had [something to say](http://www.codinghorror.com/blog/archives/...
SELECT MAX( col ) FROM table WHERE col < ( SELECT MAX( col ) FROM table )
select top 1 MyIntColumn from MyTable<br> where MyIntColumn <> (select top 1 MyIntColumn from MyTable order by MyIntColumn desc) order by MyIntColumn desc
This works in MS SQL: select max([COLUMN_NAME]) from [TABLE_NAME] where [COLUMN_NAME] < ( select max([COLUMN_NAME]) from [TABLE_NAME] )
Something like this? I haven't tested it, though: select top 1 x from ( select top 2 distinct x from y order by x desc ) z order by x
Two recommendations. **First:** for real logging, use a modern logging package like log4j or java's own built in logging. Don't worry about performance so much, the logging level check is on the order of nanoseconds. (it's an integer comparison). And if you have more than a single log statement, guard the whole ...
procmail lockfile utility and NFS
|unix|nfs|procmail|lockfile|
G'day, Has anyone used the lockfile utility that ships with procmail in conjunction with NFS mounted directories? The lockfile man page states that "Lockfile is NFS-resistant and eight-bit clean." cheers, Rob
As Greg mentioned it is still important today (perhaps more so in some ways) and compilers usually take care of the alignment based on the target of the architecture. In managed environments, the JIT compiler can optimize the alignment based on the runtime architecture. You may see pragma directives (in C/C++) that ...
C# - SQLClient - Simplest INSERT
|sql|t-sql|query|sql-server|c#|
Before someone gets in a tizzy because this was answered elsewhere (not sure if it was,but...), the 5 "related questions" shown right now do not match what I'm looking for, and I searched the string "sql insert" and did not find quite what I was looking for. So I'm basically trying to figure out the simplest way to ...
|c#|sql-server|sql|query|t-sql|
|c#|sql|sql-server|t-sql|query|
Trigger without a transaction?
|sql-server|triggers|t-sql|
Is it possible to create a Trigger that will not be in a transaction? I want to update data on a linked server with a trigger but due to firewall issues we can't create a distributed transaction between the two servers.
|sql-server|t-sql|triggers|
|sql-server|t-sql|triggers|
SQL Server PIVOT examples?
|t-sql|pivot|
Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I have a query returning the following. Action1 VIEW Action1 EDIT Action2 VIEW Action3 VIEW Action3 EDIT I would...
|t-sql|pivot|
What Url rewriter do you use for ASP.Net?
|asp.net|iis|url-rewriting|urlrewriter|urlrewriting|
I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why. Here are the ones that I have used or looked at: - [ThunderMain URLRewriter][1]: used in a previous project, didn't quite have the flexibility/performance we were looking for - [Ewal UrlMapper][2]: u...
Getting Good Google PageRank
|seo|pagerank|
In SEO people talk a lot about Google [PageRank][1]. It's kind of a catch 22 because until your site is actually big and you don't really need search engines as much, it's unlikely that big sites will link to you and increase your PageRank! I've been told that it's easiest to simply get a couple high quality links t...
With emma why is a method call shown as not covered when the code within the method is covered with emma?
|unit-testing|junit|code-coverage|emma|
I am writing a unit test to check that a private method will close a stream. The unit test calls methodB and the variable something is null The unit test doesn't mock the class on test The private method is within a public method that I am calling. Using emma in eclipse (via the eclemma plugin) the method c...
I am writing a unit test to check that a private method will close a stream. The unit test calls methodB and the variable something is null The unit test doesn't mock the class on test The private method is within a public method that I am calling. Using emma in eclipse (via the eclemma plugin) the method c...
Why is a method call shown as not covered when the code within the method is covered with emma?
Google doesn't want you to have to engineer your site specifically to get a good PageRank. Having popular content and a well designed website should naturally get you the results you want.
1. Emacs nxml-mode can work on presented format, but you'll have to split the lines. 2. For longer files that simply isn't worth it. Run this stylesheet (ideally with Saxon which IMHO gets the line indents about right) against longer files to get a nice pretty print. For any elements where you want to retain white s...
I was bored so i modified some stuff i wrote. It try's to encapsulate the parsing in an OO manner whle cutting down on the amount of iterations through the file, it only iterates once at the top foreach. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I...
VB is full of things like that trying to make it both "like english" and comfortable for people who are used to languages that use () and {} a lot. For example, on the "like english"side...VB has the "[Ain't][1]" keyword...and no, I'm not joking. And on the other side, as you already probably know most of the time yo...
It depends on the number of images you are going to store and also their sizes. I have used databases to store images in the past and my experience has been fairly good. IMO, Pros of using database to store images are, A. You don't need FS structure to hold your images<br> B. Database indexes perform better tha...
Simplest way to change listview and treeview colours
|c++|winapi|wtl|
I'm trying to find a simple way to change the colour of the text and background in listview and treeview controls in WTL or plain Win32 code. I really don't want to have to implement full owner drawing for these controls, simply change the colours used. I want to make sure that the images are still drawn with proper tr...
***[This webpage][1]*** provides details on how to implement Single Sign-on between DotNetNuke and Moodle. [1]: http://dotnetnuke.montreat.edu/SingleSignon/tabid/727/Default.aspx
[According to Wikipedia][1]: >**Selectors are unable to ascend** >>CSS offers no way to select a parent or ancestor of element that satisfies certain criteria. A more advanced selector scheme (such as XPath) would enable more sophisticated stylesheets. However, the major reasons for the CSS Working Group rejecting...
You should *never* use an exception if you don't have to - the overhead is horrible. The variations on TryParse solve the problem - if you want to get creative (to make your code look more elegant) you could probably do something with an extension method in 3.5 but the code would be more or less the same.
You're trying to import a C-style function from your .NET dll - this doesn't really have anything to do with COM interop. COM interop allows you to activate your .NET objects as COM objects, it doesn't expose them as C/C++ exported functions/types. If your function doesn't need to return any data, why not make a sim...
You're trying to import a C-style function from your .NET dll - this doesn't really have anything to do with COM interop. COM interop allows you to activate your .NET objects as COM objects, it doesn't expose them as C/C++ exported functions/types. If your function doesn't need to return any data, why not make a sim...
Tortoise SVN with Ankhsvn for VS 2005
Tortoise SVN with Ankhsvn for VS 2005 ![alt text][1] [1]: http://wiki.aston.ac.uk/twiki/pub/NcrgMain/AnkhSVN/AnkhExample.JPG
Inheritance in database?
|sql|database|inheritance|
Is there any way to use inheritance in database (Specifically in SQL Server 2005)? Suppose I have few field like **CreatedOn**, **CreatedBy** which I want to add on all of my entities. I looking for an alternative way instead of adding these fields to every table.
You could create a template in the template pane in Management Studio. And then use that template every time you want to create a new table. Failing that, you could store the CreatedOn and CreatedBy fields in an Audit trail table referencing the original table and id. Failing that, do it manually.
PostgreSQL has this feature. Just add this to the end of your table definition: INHERITS FROM (tablename[, othertable...]) The child table will have all the columns of its parent, and changes to the parent table will change the child. Also, everything in the child table will come up in queries to the parent t...
I'm leaning towards the "Is Nothing" alternative, primarily because it seems more OO. Surely Visual Basic [ain't][1] got the Ain't keyword. [1]: http://msdn.microsoft.com/en-us/library/ksh7h19t(VS.71).aspx "ain't"
Why can't you simply install a subversion server? If you download [VisualSVN Server](http://www.visualsvn.com/server/), which is free, you get a http server for your source code and can thus use the FogBugz scripts for integrating the two. The reason I'm asking is because all scripts and documentation so far assumes...
This probably is not exactly what you want, but you can take a look at <a href="http://sourceforge.net/projects/console/">Console2</a> I have it configured so that shift+select auto copies and middle click pastes, really handy, internally it uses same old cmd.exe so you are not really getting a different shell. ...
There is no such thing as inheritance between tables in SQL Server 2005, and as noted by the others, you can get as far as getting help adding the necessary columns to the tables when you create them, but it won't be inheritance as you know it. Think of it more like a template for your source code files. As GateK...
// But is this reliable? Does it work with every process and every distribution? Yes, it should work on any Linux distribution. Be aware that /proc is not easily available on Unix based systems, though (FreeBSD, OSX).
ASPSmartUpload v3.2
|asp-classic|
I have the unfortunate task of fixing a legacy ASP site that was migrated to Windows Server 2003, and I know nothing about ASP. The main issue appears to be with ASPSmartUpload, of which I have version 2.3 installed. According to [http://foradvice.net/smart_upload_faq.htm][1]: > FAQ: does aspSmartUpload work on >...
Get month and year from a datetime in sql server 2005
|sql|sql-server|
Ok, this should be an easy question to answer. I need the month+year from the datetime in sql server like 'Jan 2008'. I'm grouping the query by month,year. I've searched and found functions like datepart, convert etc. but none of them seem useful for this. Am I missing something here? Is there a function for this?
Oops, my bad, it's been too long since I've read pascal! So, if you need to get the value then there are a couple of possibilities: 1. Write the functionality in C/C++ and export the function, that's definitely supported. 2. Use a Managed C++ dll to shim to your .NET dll, and expose the call as a C interface point ...
There's lots of good discussion already here, and I'm a little late to the party, but I wanted to add a few points myself. - The Garbage collecter will never directly execute a Dispose method for you. - The GC _will_ execute finalizers when it feels like it. - One common pattern that is used for objects that...
Yesterday I could have repaired this for you ;) > What all are the tools/languages for > windows shell scripting? Would read better as > What tools and languages are available > for windows shell scripting?
I think the canonical answer is: "Don't". What you should probably do instead is unravel the thing in your *view* code, so it's just a matter of iterating over (in|de)dents in the template. I think I'd do it by appending indents and dedents to a list while recursing through the tree and then sending that "travelogue...
Batch files are the most portable, but doing complicated things can get hard (very hard). Powershell is incredibly - um - powerful, but the installed domain at the moment is only slightly more than those people who like using powershell and servers they administer. If you control the machines you're scripting on an...
If you need to count and then loop you may be better off with a list. If you're using count to check for members you can use `Any()` to avoid enumerating the entire collection.
If you're concerned about this, it may be worthwhile to set the case to all upper or all lower before you check. For instance, in Perl: $x = "abbCCDGBAdgfabv"; (lc $x) =~ /bad/; May in some cases be better than $x = "abbCCDGBAdgfabv"; $x =~ /bad/i;
The answer depends on what the native definitions are that you are trying to marshal too. You haven't provided enough information for anyone to be able to really help. A common thing that trips people up when marshalling strings in native arrays is that native arrays often use a fixed-size buffer for the string tha...
If your using java you may want to look at [tagsoup](http://tagsoup.info), which is a SAX-compliant parser for "[parsing] HTML as it is found in the wild".
Why can't SQL Server run on a Novell server?
|sql-server|novell|
I'm not sure whether I'm asking the question correctly, but I've been told SQL Server cannot run on a Novell server. Is this true? If yes, why not?
Scripting is a blast. Personally I like to write some evil little batch files. You can find a command line program to do just about anything. I prefer Batch files mostly because they are portable from one machine to another with at most a zip with a few unix tools (SSED, GREP, GAWK). there is a commandline REG.Exe...
I do not know of any way to get a local variable name. But, you can use the `instance_variables` method, this will return an array of all the instance variable names in the object. Simple call: object.instance_variables or self.instance_variables to get an array of all instance variable names.