instruction stringlengths 0 30k ⌀ |
|---|
Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username notation at the same time.
If the target is a directory, it might be possible to chdir() into the directory and then call getcwd(), but I really want to do this from a shell script rather than writing a C helper. Unfortunately, shells have a tendency to try to hide the existence of symlinks from the user (this is bash on OS X):
$ ls -ld foo bar
drwxr-xr-x 2 greg greg 68 Aug 11 22:36 bar
lrwxr-xr-x 1 greg greg 3 Aug 11 22:36 foo -> bar
$ cd foo
$ pwd
/Users/greg/tmp/foo
$
What I want is a function resolve() such that when executed from the tmp directory in the above example, resolve("foo") == "/Users/greg/tmp/bar". |
|shell|scripting|symlink| |
What namespace implements |
|c#|namespace|.net| |
both Context.Handler and Server.Transfer?
I think one may include both and my hunt on MSDN returned null.
Thank you. |
|c#|namespace|.net|candidatefortitleediting| |
|c#|namespace|.net|candidate-for-title-edit| |
|c#|namespace|.net|candidate-for-title-edit|httpserverutility| |
@graham
> You could run it through PGP and store it encrypted in memory and unencrypt it as needed. Massive performance hit.
Then you'd have to hold the key in memory. That would make it a little harder, but definitely not impossible. Anyone motivated will still manage to get the data from memory. |
Stop beating on VC6. It's old. The STL was updated in 1996 from HP code written in 1994. C++ was ratified in 1998.
What is the code doing when you are breaking? Can you reduce the situation into a simple test. When I try that I usually find the cause. If you can do that so it still happens then I'll take a look at it for you. I too am unfortunate enough to use VC6 for my day to day work.
Visual C++ Express 2008 can't be used in certain situations. |
What's in your .procmailrc |
|unix|email|procmail|.procmailrc| |
Are there any handy general items you put in your .procmailrc file? |
In your route, get rid of the {paramName} part of the URL. It should be:
TestController.mvc/TestAction
As that is the URL you want the request to route to. Your form will then post to that URL.
Posted form values are mapped to parameters of an action method automatically, so don't worry about not having that data passed to your action method. |
Shelve in TortoiseSVN? |
|svn|tortoisesvn| |
I've moved from TFS to SVN (TortoiseSVN) with my current company. I really miss the "Shelve" feature of TFS. I've read various articles on how to "Shelve" with SVN, but I've read nothing that gives a very simple experience to "shelve" work.
Ideally, I'd like extra items added to the TortoiseSVN context menu - "Shelve" & "Unshelve".
"Shelve" would remove the current shelve-set, and upload the working directory under a suitable path defined by user options. "Unshelve" would merge the set with the working copy.
Does something like this exist? Can anyone suggest any ways to "hack" this feature in the GUI?
Note: The following links don't really make it as easy as I'd like:<br />
[http://geekswithblogs.net/flanakin/archive/2005/12/02/61929.aspx][1]<br />
[http://mikemason.ca/2005/03/30/][2]
[1]: http://geekswithblogs.net/flanakin/archive/2005/12/02/61929.aspx
[2]: http://mikemason.ca/2005/03/30/ |
I've moved from TFS to SVN (TortoiseSVN) with my current company. I really miss the "Shelve" feature of TFS. I've read various articles on how to "Shelve" with SVN, but I've read nothing that gives a very simple experience to "shelve" work.
Ideally, I'd like extra items added to the TortoiseSVN context menu - "Shelve" & "Unshelve".
"Shelve" would remove the current shelve-set, and upload the working directory under a suitable path defined by user options. "Unshelve" would merge the set with the working copy.
Does something like this exist? Can anyone suggest any ways to "hack" this feature in the GUI?
Note: The following links don't really achieve the user experience I was looking for:
[http://geekswithblogs.net/flanakin/archive/2005/12/02/61929.aspx][1]<br />
[http://mikemason.ca/2005/03/30/][2]
One of the greatest things about TFS Shelve is how easy it is to use...
[1]: http://geekswithblogs.net/flanakin/archive/2005/12/02/61929.aspx
[2]: http://mikemason.ca/2005/03/30/ |
In my opinion:
1. Table names should be plural.
2. Column names should be singular.
3. No.
4. Either CamelCase (my preferred) or underscore_separated for both table names and column names.
However, like it has been mentioned, any convention is better than no convention. No matter how you choose to do it, document it so that future modifications follow the same conventions. |
This is more of a comment than an answer, but wouldn't:
XmlDocument doc = new XmlDocument();
doc.Load("path");
Read the entire file at once? Just thought I should raise the point since from the look of Thomas' question, he is concerned about reading large files and wants to break the process down.. |
My first thought on this is "how generate N vectors in a space that maximize distance from each other." You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at [Hypercube Point Picking][1], and the like from Wolfram's [Random Point Picking][2]. Hope this is a good start for you!
[1]: http://mathworld.wolfram.com/HypercubePointPicking.html
[2]: http://mathworld.wolfram.com/topics/RandomPointPicking.html |
My first thought on this is "how generate N vectors in a space that maximize distance from each other." You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at [Random Point Picking][1]. Hope this is a good start for you! Once you have a set of vectors that are maximized a part, you can save them in a hash table or something for later, and just perform random rotations on them to get all the colors you desire that are maximally apart from each other!
[1]: http://mathworld.wolfram.com/topics/RandomPointPicking.html |
My first thought on this is "how generate N vectors in a space that maximize distance from each other." You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at [Random Point Picking][1]. Hope this is a good start for you! Once you have a set of vectors that are maximized a part, you can save them in a hash table or something for later, and just perform random rotations on them to get all the colors you desire that are maximally apart from each other!
**Edit:** Thinking about this problem more, it would be better to map the colors in a linear manor, possibly (0,0,0) --> (255,255,255) lexicographically, and then distribute them evenly. I really don't know how well this will work, but it should since, lets say:
n = 10
we know we have 16777216 colors (256*256*256). We can use [buckles algorithm 515][2] to find the lexicographically indexed color:
16777216 / 10 * 0 = 0 = (0,0,0)
16777216 / 10 * 1 = 1677721 =
16777216 / 10 * 2 = 3355442 =
16777216 / 10 * 3 = 5033163 =
16777216 / 10 * 4 = 6710884 =
16777216 / 10 * 5 = 8388605 =
16777216 / 10 * 6 = 10066326 =
16777216 / 10 * 7 = 11744047 =
16777216 / 10 * 8 = 13421768 =
16777216 / 10 * 9 = 15099489 =
(I'm going to fill these in at work tomorrow)
[1]: http://mathworld.wolfram.com/topics/RandomPointPicking.html
[2]: http://stackoverflow.com/questions/561/using-combinations-of-sets-as-test-data#794 |
My first thought on this is "how generate N vectors in a space that maximize distance from each other." You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at [Random Point Picking][1]. Hope this is a good start for you! Once you have a set of vectors that are maximized a part, you can save them in a hash table or something for later, and just perform random rotations on them to get all the colors you desire that are maximally apart from each other!
**Edit:** Thinking about this problem more, it would be better to map the colors in a linear manor, possibly (0,0,0) --> (255,255,255) lexicographically, and then distribute them evenly. I really don't know how well this will work, but it should since, lets say:
n = 10
we know we have 16777216 colors (256^3). We can use [buckles algorithm 515][2] to find the lexicographically indexed color.![\frac {\binom {256^3} {3}} {n} * i][3]. You'll probably have to edit the algorithm to avoid overflow and probably add some minor speed improvements.
[1]: http://mathworld.wolfram.com/topics/RandomPointPicking.html
[2]: http://stackoverflow.com/questions/561/using-combinations-of-sets-as-test-data#794
[3]: http://www.codecogs.com/eq.latex?\frac%20{\binom%20{256^3}%20{3}}%20{n}%20*%20i |
They were saying they were getting 1.5 million downloads per day back in March 2008, and that was before the Olympics and the Democratic National Convention. So, unless my math is off, that's more than 4 people.
I'd expect to see it show up as a recommended Windows update, and possible included with IE8 or something in the future. |
They really got a huge bump with the Olympics as far as getting it installed on machines. It will be interesting to see how much developer buy in they can gather. It's a tough sell for front end web people because it's a complete toolset change. I know the midteir/WPF people like it because it's closer to their normal .NET toolset, but they're not **usually** the ones doing web design.
IMHO, things like HTML5 and Gears are where many people are going to go. |
Probably not. CTE's are especially good at querying data for tree structures. |
No, they aren't (or at least you can't assume they are). Having said that, there are some tricks to do this atomically, but they typically aren't portable (see [Compare-and-swap][1]).
[1]: http://en.wikipedia.org/wiki/Compare-and-swap |
Most .NET developers I work with have been shying away from Silverlight. Right now it seems more like a novelty than a development platform. |
How to implement Repository pattern withe LinqToEntities? |
|.net|.net-3.5|linq-to-entities| |
How to implement Repository pattern withe LinqToEntities
how to implement the interface |
Yes, you need to synchronize accesses. In C++0x it will be a data race, and undefined behaviour. With POSIX threads it's already undefined behaviour.
In practice, you might get bad values if the data type is larger than the native word size. Also, another thread might never see the value written due to optimizations moving the read and/or write. |
I would make a copy and strip out the comments first, then search the string the regular way. |
You don't want to use "overall popularity" unless you have no information about the user. Instead, you want to align this user with similar users and weight accordingly.
This is exactly what [Bayesian Inference][1] does. In English, it means adjusting the overall probability you'll like something (the average rating) with ratings from other people *who generally vote your way as well*.
Another piece of advice, but this time ad hoc: I find that there are people where if they like something I will almost assuredly *not* like it. I don't know if this effect is real or imagined, but it might be fun to build in a kind of "negative effect" instead of just clumping people by similarity.
Finally there's a company specializing in exactly this called [SenseArray][4]. The owner ([Ian Clarke][2] of [freenet fame][3]) is very approachable. You can use my name if you call him up.
[1]: http://en.wikipedia.org/wiki/Bayesian_inference
[2]: http://en.wikipedia.org/wiki/Ian_Clarke_(computer_scientist)
[3]: http://freenetproject.org/
[4]: http://sensearray.com/ |
Soap logging in .net |
Parsing XML Elements & Attributes with Perk |
|perl|xml|amazon| |
So I wrote some perl that would parse results returned from the Amazon Web Services. I am using the XML::Simple package. For the most part, everything worked when I pulled out an element. However, the problem I ran into was when an element had an attribute as well. Then I get an error that the item is a Hash.
Here's what I did if I wanted to get the Running Time for a DVD. I just created an item to hold the specific info for this one-off item.
// XML
<ProductGroup>DVD</ProductGroup>
<RunningTime Units="minutes">90</RunningTime>
// Perl to parse XML
my $item = $xml->XMLin($content, KeyAttr => { Item => 'ASIN'}, ForceArray => ['ASIN']);
$ProductGroup = $item->{Items}->{Item}->{ItemAttributes}->{ProductGroup};
if(ref($item->{Items}->{Item}->{ItemAttributes}->{RunningTime}) eq 'HASH'){
$RunningTimeXML = $xml->XMLin($content, KeyAttr => { Item => 'ASIN'}, NoAttr => 1);
$RunningTime = $RunningTimeXML->{Items}->{Item}->{ItemAttributes}->{RunningTime};
}
Is there a way I can access both elements and attributes from one item?
|
Parsing XML Elements & Attributes with Perl |
|xml|perl|amazon| |
|xml|perl|amazon|amazon-web-services| |
An HTTP 200 Response Code does not indicate an error. It indicates that everything was OK. You should not use a 200 response code for an error.
Internet Explorer shows its "Friendly Errors" page if the response is less than 512 bytes. Here's more on this issue: [http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx][1],
[1]: http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx |
I'm going to "split the fence" and say use the database for all of your analysis/archiving log entries (such as your Telnet communications). This will grant you the benefits of full text searching, columns, and easy ways to search out the data.
Use a flat file (or XML format since the file shouldn't be too big) for any of your debug/critical error type logs.
If you have a broken database connection, or something has gone wacky with your table structure, logging to the DB will be meaningless.
Come to think of it, if you are looking for a slightly more "lightweight" solution, you could use SQLite to log all your telnet traffic so that you can leverage the advantage of the DB structure, but also have the availability of the file.
With another nod to log4net, you could easily accomplish this with the ADO appender they have. |
If you are using databind in asp.net handle the databinding event and just don't set the NavigateUrl if that users is disabled. |
If if the number is negative, you'll have to do this:
$x = abs($x) - floor(abs($x)); |
Have you tried just **not** setting the NavigateUrl property? If this isn't set, it may just render as a span. |
most likely just using margins. float the first column left then set the margin to the width of the first column. |
You could try signal averaging, i.e. for each point, average the value with the surrounding 3 or more points. If the noise blips are huge, then even this may not help.
I realise that this was language agnostic, but guessing that you are using LabView, there are lots of pre-packaged signal processing VIs that come with LabView that you can use to do smoothing and noise reduction. The [NI forums][1] are a great place to get more specialised help on this sort of thing.
[1]: http://forums.ni.com/ |
HTML 4.01. There is absolutely **no reason** to use XHTML for anything but experimental or academic problems that you only want to run on the 'obscure' web browsers.
XHTML Transitional is completely pointless even to _those_ browsers, so I'm not sure why anyone would aim for that. It's actually pretty alarming that a number of people would recommend that.
I'd say aiming for HTML 4.01 is the most predictable, but Teifion is right really, "anything that renders your page will do". |
Let's say I have the following class:
public class Test<E> {
public boolean sameClassAs(Object o) {
// TODO halp!
}
}
How would I check that `o` is the same class as `E`?
Test<String> test = new Test<String>();
test.sameClassAs("a string"); // returns true;
test.sameClassAs(4); // returns false;
I can't change the method signature from `(Object o)` as I'm overridding a superclass and so don't get to choose my method signature.
I would also rather not go down the road of attempting a cast and then catching the resulting exception if it fails. |
Accessing non-generic members of a generic object |
|c#|.net|generics| |
Is there a way to collect (e.g. in a List) multiple 'generic' objects that don't share a common super class? If so, how can I access their common properties?
For example:
class MyObject<T>
{
public T Value { get; set; }
public string Name { get; set; }
public MyObject(string name, T value)
{
Name = name;
Value = value;
}
}
var fst = new MyObject<int>("fst", 42);
var snd = new MyObject<bool>("snd", true);
List<MyObject<?>> list = new List<MyObject<?>>(){fst, snd};
foreach (MyObject<?> o in list)
Console.WriteLine(o.Name);
Obviously, this is pseudo code, this doesn't work.
Also I don't need to access the .Value property (since that wouldn't be type-safe).
**EDIT:** Now that I've been thinking about this, It would be possible to use sub-classes for this. However, I think that would mean I'd have to write a new subclass for every new type. |
Integration Services: Multiple-step OLE DB operation generated errors |
|sql-server|ssis| |
I'm attempting to make a DTS package to transfer data between two databases on the same server and I'm getting the following errors. Iv read that the Multiple-step OLE DB operation generated error can occur when you are transferring between different database types and there is loss of precision, but this is not that case here. How do I examine the column meta data?
> Error: 0xC0202009 at Data Flow Task,
> piTech [183]: An OLE DB error has
> occurred. Error code: 0x80040E21. An
> OLE DB record is available. Source:
> "Microsoft SQL Native Client"
> Hresult: 0x80040E21 Description:
> "Multiple-step OLE DB operation
> generated errors. Check each OLE DB
> status value, if available. No work
> was done.".
>
> Error: 0xC0202025 at Data Flow Task,
> piTech [183]: Cannot create an OLE DB
> accessor. Verify that the column
> metadata is valid.
>
> Error: 0xC004701A at Data Flow Task,
> DTS.Pipeline: component "piTech" (183)
> failed the pre-execute phase and
> returned error code 0xC0202025. |
Safe mode UID check is used to prevent users from accessing other peoples files. GID is used to prevent a GROUP of users from accessing other GROUPS files. |
As DannySmurf touches on here, it is all about the structure of the xml document.<br />
If you only two huge "top level" tags, it will be extremely hard to be able to split it in a way that makes it possible to both merge it back together and read it piece by piece as valid xml.
<br />
<br />
Given a document with a lot of seperate pieces like the ones in DannySmurfs example, it should be fairly easy.<br />
Some rough code in Pseudo C# :
int nrOfPieces = 5;
XmlDocument xmlOriginal = some input parameter..
// construct the list we need, and fill it with XmlDocuments..
var xmlList = new List<XmlDocument>();
for (int i = 0; i < nrOfPieces ; i++)
{
var xmlDoc = new XmlDocument();
xmlDoc.ChildNodes.Add(new XmlNode(xmlOriginal.FistNode.Name));
xmlList.Add(xmlDoc);
}
var nodeList = xmlOriginal.GetElementsByTagName("Piece")M
// Copy the nodes from the original into the pieces..
for (int i = 0; i < nodeList .Count; i++)
{
var xmlDoc = xmlList[i % nrOfPieces];
var nodeToCopy = nodeList[i].Clone();
xmlDoc.FirstNode.ChildNodes.Add(nodeToCopy);
}
This should give you n docs with correct xml and the possibility to merge them back together.<br />
But again, it depends on the xml file. |
It would read the entire file at once. In my experience, though, if you're just reading the file, doing some processing (ie, breaking it up) and then continuing on with your work, the XmlDocument is going to go through it's create/read/collect cycle so quickly that it likely won't matter.
Of course, that depends on what a "large" file is. If it's a 30MB XML file (which I would consider large for an XML file), it probably won't make any difference. If it's a 500MB XML file, using XmlDocument will become extremely problematic on systems without a significant amount of RAM (in that case, however, I'd argue that the time to manually pick through the file with a XmlReader would be the more significant impediment). |
Here's another technique for autosizing a textarea.
- Uses pixel height instead of line height: more accurate handling of line wrap if a proportional font is used.
- Accepts either ID or element as input
- Accepts an optional max height param - useful if you'd rather not let the text area grow beyond a certain size (keep it all on-screen, avoid breaking layout, etc.)
- Tested on Firefox 3 and IE6
**Code:**
(plain vanilla Javascript)
function FitToContent(id, maxHeight)
{
var text = id && id.style ? id : document.getElementById(id);
if ( !text )
return;
var adjustedHeight = text.clientHeight;
if ( !maxHeight || maxHeight > adjustedHeight )
{
adjustedHeight = Math.max(text.scrollHeight, adjustedHeight);
if ( maxHeight )
adjustedHeight = Math.min(maxHeight, adjustedHeight);
if ( adjustedHeight > text.clientHeight )
text.style.height = adjustedHeight + "px";
}
}
**Demo:**
(uses jQuery, targets on the textarea i'm typing into right now - if you have Firebug installed, paste both samples into the console and test on this page)
$("#post-text").keyup(function()
{
FitToContent(this, document.documentElement.clientHeight)
}); |
|c#|namespace|.net|candidate-for-title-edit|httpcontext| |
|c#|namespace|.net|candidate-for-title-edit|holy-crap-is-that-a-girl| |
|c#|namespace|.net|candidate-for-title-edit| |
Namespace with Context.Handler and Server.Transfer? |
|c#|.net|namespace| |
What .NET namespace or class includes both Context.Handler and Server.Transfer?
I think one may include both and my hunt on MSDN returned null.
Thank you. |
|c#|.net|namespaces| |
Anyone Using Executable Requirements? |
|automation|process|test|executablerequirements| |
In my limited experience with them executable requirements (i.e. specifying all requirements as broken automated tests) have proven to be amazingly successful. I've worked on one project in which we placed a heavy emphasis on creating high-level automated tests which exercised all the functionality of a given use case/user story. It was really amazing to me how much easier development became after we began this practice. Implementing features became so much easier after writing a test and we were able to make major architectural changes to the system with all the confidence in the world that everything still worked the same as it did yesterday.
The biggest problem we ran into was that the tools for managing these types of tests aren't very good. We used Fitnesse quite a bit and as a result I now hate the Fit framework.
I'd like to know 1) if anyone else has experience developing using this type of test-driven requirement definition and 2) what tools you all used to facilitate this. |
|testing|automation|process|executablerequirements| |
|testing|automation|process| |
|testing|automation|processes| |
query all public folders for forms used |
|exchange-server|publicfolders|script|reporting| |
Does anyone have a script or can anyone point me in the right direction to query an Exchange (2003) public folder tree to determine all forms being used? I need an output of form object/display name and count for each form type in each folder. |
|exchange-server|script|reporting| |
In Exchange (2003) how do I list the forms used in the public folder tree ? |
Does anyone have a script or can anyone point me in the right direction to query an Exchange (2003) public folder tree to determine all the forms being used ?
I need an output of form object/display name and count for each form type in each folder. |
In the context of a programming forum, we don't usually think of the programmer also needing the application portion of the database. Normally a _programmer_ wants to use their own development environment for the business logic and front end, and just use the datastore capabilities of the database.
If you really want all those other things, then you're talking about a much larger and more complicated run time environment. You're not going to find anything that's 'lightweight' any more. That doesn't mean you won't find anything, but it's not likely to have the same level of maturity as access, especially since the underlying access engine is already baked into Windows. |
In the context of a programming forum, we don't usually think of the programmer also needing the application portion of the database. Normally a _programmer_ wants to use their own development environment for the business logic and front end, and just use the store and retrieval capabilities of the database.
If you really want all those other things, then you're talking about a much larger and more complicated run time environment. You're not going to find anything that's 'lightweight' any more. That doesn't mean you won't find anything, but it's not likely to have the same level of maturity as access, especially since the underlying access engine is already baked into Windows. |
TopMost = true;
.Activate() ?
Either of those any good?
Splitting it out into its own thread is a bit evil as it wont work properly if you don't call it with Application.Run and that will swallow up the thread. In the worst case scenario I guess you could separate it out into a different process and communicate via the disk or WCF. |
It worked like that:
(defun filterBig (x xs)
(remove-if (lambda (item) (> item x)) xs))
What was the '#' for? It didn't compile with it. |
Check out the AS3Crypto package at http://code.google.com/p/as3crypto/. I haven't tried it, but this package claims to (partially) support the TLS 1.0 protocol.
TLS will provide a secure tunnel between your Flash application and the server.
http://en.wikipedia.org/wiki/Secure_Sockets_Layer |
Check out the AS3Crypto package at http://code.google.com/p/as3crypto/. I haven't tried it, but this package claims to (partially) support the TLS 1.0 protocol.
TLS will provide a secure tunnel between your Flash application and the server.
http://en.wikipedia.org/wiki/Secure_Sockets_Layer
@jcnnghm
You normally don't want to use public key encryption (RSA, DSA) for the bulk data encryption due to its' large computational time. Public key encryption should be used in the handshaking and key agreement phases in a security protocol, but the bulk data encryption should be handled by a symmetric cipher such as AES and TDES. The TLS and SSL protocols work this way. |
If you start with the idea that you need something *like* a packet sniffer, you'll want to look at [http://netresearch.ics.uci.edu/kfujii/jpcap/doc/][1].
[1]: http://netresearch.ics.uci.edu/kfujii/jpcap/doc/ |
htmlentities vs htmlspecialchars |
|php| |
Use [DeviceIoControl](http://msdn.microsoft.com/en-us/library/aa363216%28VS.85%29.aspx) with control code [IOCTL_DISK_GET_DRIVE_GEOMETRY](http://msdn.microsoft.com/en-us/library/aa365169%28VS.85%29.aspx) or [IOCTL_DISK_GET_DRIVE_GEOMETRY_EX](http://msdn.microsoft.com/en-us/library/aa365171%28VS.85%29.aspx).
There's sample code in MSDN to do this [here](http://msdn.microsoft.com/en-us/library/aa363147%28VS.85%29.aspx). |
Message passing in a plug-in framework problem |
|c#|plugins|message-passing| |
First off, there's a bit of background to this issue available on my blog:
* <http://www.alastairsmith.me.uk/coding/2008/06/25/message-passing-a-plug-framework.html>
* <http://www.alastairsmith.me.uk/coding/2008/07/31/message-passing-2.html>
I'm aware that the descriptions aren't hugely clear, so I'll try to summarise what I'm attempting as best I can here. The application is a personal finance program. Further background on the framework itself is available at the end of this post.
There are a number of different types of plug-in that the framework can handle (e.g., accounts, export, reporting, etc.). However, I'm focussing on one particular class of plug-in, so-called data plug-ins, as it is this class that is causing me problems. I have one class of data plug-in for accounts, one for transactions, etc.
I'm midway through a vast re-factoring that has left me with the following architecture for data plug-ins:
* The data plug-in object (implementing intialisation, installation and plug-in metadata) [implements `IDataPlugin<FactoryType>`]
* The data object (such as an account) [implements, e.g., `IAccount`]
* A factory to create instances of the data object [implements, e.g., `IAccountFactory`]
Previously the data object and the plug-in object were combined into one, but this meant that a new transaction plug-in had to be instantiated for each transaction recorded in the account which caused a number of problems. Unfortunately, that re-factoring has broken my message passing. The data object implements `INotifyPropertyChanged`, and so I've hit a new problem, and one that I'm not sure how to work around: the plug-in object is registering events with the message broker, but it's the data objects that actually fires the events. This means that <strong>the subscribing plug-in currently has to subscribe to each created account, transaction, etc.!</strong> This is clearly not scalable.
As far as I can tell at the moment I have two possible solutions:
1. Make the data plug-in object a go-between for the data-objects and message broker, possibly batching change notifications. I don't like this because it adds another layer of complexity to the messaging system that I feel I should be able to do without.
2. Junk the current event-based implementation and use something else that's more easily manageable (in-memory WCF?!)
So I guess I'm really asking:
1. how would you solve this problem?
2. what potential solutions do you think I've overlooked?
3. is my approach even vaguely on-track/sensible?! :-)
Many thanks in advance for the time and effort you put into your responses. As you will be able to tell from the dates of the blog posts, some variant of this problem has been taxing me for quite a long time now! As such, any and all responses will be greatly appreciated.
The background to the framework itself is as follows:
> My plug-in framework consists of three main components: a plug-in broker, a preferences' manager and a message broker. The plug-in broker does the bread-and-butter plug-in stuff: discovering and creating plug-ins. The preferences' manager manages user preferences for the framework and individual plug-ins, such as which plug-ins are enabled, where data should be saved, etc. Communication is via publish/subscribe, with the message broker sitting in the middle, gathering all published message types and managing subscriptions. The publish/subscribe is currently implemented via the .NET `INotifyPropertyChanged` interface, which provides one event called `PropertyChanged`; the message broker builds a list of all plug-ins implementing `INotifyPropertyChanged` and subscribes other plug-ins this event. The purpose of the message passing is to allow the account and transaction plug-ins to notify the storage plug-ins that data has changed so that it may be saved. |
|c#|web-services|soap| |
I have an internal enterprise app that currently consumes 10 different web services. They're consumed via old style "Web References" instead of using WCF.
The problem I'm having is trying to work with the other teams in the company who are authoring the services I'm consuming. I found I needed to capture the exact SOAP messages that I'm sending and receiving. I did this by creating a new attribute that extends SoapExtensionAttribute. I then just add that attribute to the service method in the generated Reference.cs file. This works, but is painful for two reasons. First, it's a generated file so anything I do in there can be overwritten. Second, I have to remember to remove the attribute before checking in the file.
**Is There a better way to capture the exact SOAP messages that I am sending and receiving?**
Thanks! |
AJAX XMLHttpRequest object limt |
|ajax| |
Is there a security limit to the number of AJAX XMLHttpRequest objects you can create on a single page? If so, does this vary from one browser to another? |
I think that it will grow, but MSFT will need to do more deals like they did with the Olympics. Hooking up with CBS/NCAA on the March Madness broadcasts would be worth whatever millions they could throw at it. |
The ASP.NET Sitemap feature is built for that and works well in a lot of cases. If you get in a spot where you want your [Menu to look different from your Sitemap, here are some workarounds][1].
[1]: http://weblogs.asp.net/jgalloway/archive/2008/01/26/asp-net-menu-and-sitemap-security-trimming-plus-a-trick-for-when-your-menu-and-security-don-t-match-up.aspx |