Tuesday, February 8, 2011

How to create reverse index for full text search in Common Lisp ?

What is the best way to create reverse index for full text search in Common Lisp ? Is there any proven and (relatively) bug-free open library for SBCL or LispWorks ?

I managed to create my own library on top of AllegroCache - it was fairly easy to create, reliable and fast, but lacks advanced search options (phrases, wildcarded words in phrases, etc).

Is there any open library that can be used with SBCL or LispWorks so I don't have to reinvent the wheel by writing my own ?

  • I know you're asking about Common Lisp, but there are a number of inverted text search service oriented applications. One well known and respected on is Lucene.

    Could a solution be to use that search engine, but interface your Common Lisp code via a web-service API? (xml-rpc, xml over http or just text over http)?

    Is there a further reason why you'd like it to be in Common Lisp? Packages like Lucene may cover all the search related features you need, while using a remote api may still allow you to perform your more complex logic in Common Lisp.

  • montezuma is the same thing as lucene, but written in lisp.

    i don't think anyone uses this actively, nor that it's heavily tested... but it's a good start if you want to work on the thing itself. it already has the most used features. read the google-group archive to get a feel...

    skypher : I do use Montezuma actively and know two other people using it in their projects. It's got a pretty large test suite, too.

Source Safe 6.0d and Visual Studio 2005 project tree problems

Whenever I try to add a new project to my SourceSafe repository it creates 3 folders with the same name nested within each other. There is only one folder on my drive yet in Sourcesafe there are 3??

Can anyone suggest what may be causing this?

Thanks

  • Try creating the project in VS2005 disconnected from source control, then creating the project folder in VSS, set the working folder correctly, add the files to sourcesafe from VSS, then lastly edit the source control bindings in VS2005 and check the bound project into source control.

    A little kludgey but this is how I do it.

    From Nick
  • If you drag and rop a new project folder into VSS and do a recursive add then that's just how it works. Otherwise you have to create your own root project folder in VSS and add each file one at a time to VSS by hand.

    From Booji Boy
  • well, that problem comes due to visual studio. because visual stuio by default save solution file in the my documents/...../.../vs 2008/projects/ location and that address is also saved in the .sln file.

    that's why every time you get latest within visual stuio it try to creat same strucute and make another copy with in the main project folder.

    Solution, well i still trying to figure out how to tackle it.

    cheers, Genious

What is the best way to encrypt a very short string in PHP?

I would like to encrypt strings which could potentially only be about three or four characters but run to about twenty characters. A hashing function (md5, sha1, crypt etc) is not suitable as I would like to be able to decrypt the information as well. The mcrypt extension has a thoroughly daunting array of possibilities.

Does anyone have any ideas about the best way to safely encrypt short strings and why? Does anyone have any links to any material introducing a casual programmer to practical encryption scenarios?

  • Does it matter if anybody can decrypt it? If you're just trying to obfuscate it a little, use ROT13. Its old school.

    Rich Bradshaw : Did you honestly just suggest ROT13 in a crypto post?
    Will : Holy crap, dude. Can you read? "Does it matter if anybody can decrypt it?" ROT13 is a valid encryption. Its trivial to break, but that doesn't necessarily matter always. I was clear enough about that, wasn't I?
    From Will
  • Any one-way encryption algorithm such as Blowfish will do, I guess. Blowfish is fast and open. You can use Blowfish through the crypt() function. AFAIK there are no encryption algorithm that work especially well on small strings. One thing to be aware of though is that brute-forcing such small strings will be very easy. Maybe you should encrypt the string along with a 'secret' salt value for additional security.

    Roel : Correction: the crypt() version isn't suitable because it doesn't have a way to decrypt. Use something like http://pear.php.net/package/Crypt_Blowfish. That'll give you the added advantage of not having to worry about installing an extra extension.
    From Roel
  • I like to use GnuPG for anything that needs to be encrypted on a server and then possibly decrypted either on the server or on another server (which is usually my case). This allows for an extra level of security since in my scenario the encrypting server doesn't have the key to decrypt the data. It also allows for easier manual decryption. There are a few good wrappers available for various languages (another advantage), one for PHP is GnuPGP PHP Class.

    From pdavis
  • If you want to encrypt and decrypt data within an application, you most likely want to use a symmetric key cipher. AES, which is the symmetric block encryption algorithm certified by the NSA for securing top secret data, is your best choice. There is a pure-PHP implementation available at www.phpaes.com

    For your use it sounds like AES128 is sufficient. You will want to use CBC mode with a random initialization vector, or else the same data will always produce the same ciphertext.

    Choosing the right encryption algorithm is a good first step, but there are many factors to a secure system which are hard to get right, such as key management. There are good resources out there, such as Applied Cryptography by Bruce Schneier, and Security Engineering by Ross Anderson (available for free online).

    From Chris Kite
  • mcrypt is linked into most builds of PHP by default. It contains all the primitives you're likely to need. Without knowing more about what you're encrypting, what your threat model is, etc, it's hard to give concrete recommendations on what algorithm, mode of operation, etc to use.

    One thing I can say for certain: With short text strings, it's more vital than ever that you MUST use a unique, random Initialization Vector. Otherwise, it's trivial for someone to mount a variety of attacks against the encrypted data.

  • I agree with Chris Kite - just use AES 128, this is far sufficient.

    I don't know exactly your environment, but I guess you're transmitting the data somehow through the internet.

    Don't use ECB, this will always produce the same result for the same plain text.

    CBC mode is the way to go and don't forget a random initialization vector. This vector has to be communicated with the cipher text and can be sent in the clear.

    Regarding your data, since AES is a block cipher, the outcome is always a multiple of the block size. If you don't want to let the observer know if your data is short or long, add some padding to extend it up to the maximum expected size.

    From Oli
  • I highly recommend the suggestions of Chris Kite. Without knowing more about what you're doing, why, and the threats you anticipate needing to protect against AES-128 is likely sufficient. The ability to use symmetric encryption is great for a standalone app that will be both the decryptor and encryptor of data. As both Chris Kite and Arachnid said, due to the small size of your data it's advised that you pad the data and use a random Initialization Vector.

    Update: As for why.... if the data is small enough, and the IV can be predicted, it's possible to brute force the plain-text by generating cipher-text for every combination of plain-text with the known IV and matching it up to the captured cipher-text. In short, this is how rainbow tables work.

    Now if you're going to encrypt on one server and decrypt on another I'd go with the suggestions of pdavis. By using an asymmetric method you're able to separate the encryption keys from the decryption keys. This way if the server that encrypts data is compromised, the attacker is still unable to decrypt the data.

    If you're able to, it'd help the community to know more about your use case for the encryption. As I mentioned above, having a proper understanding of plausible threats is key when evaluating security controls.

    From randy

C++ union in C#

I'm translating a library written in C++ to C#, and the keyword 'union' exists once. In a struct.

What's the correct way of translating it into C#? And what does it do? It looks something like this;

struct Foo {
    float bar;

    union {
        int killroy;
        float fubar;
    } as;
}
  • You can use explicit field layouts for that:

    [StructLayout(LayoutKind.Explicit)] 
    public struct SampleUnion
    {
        [FieldOffset(0)] public float bar;
        [FieldOffset(4)] public int killroy;
        [FieldOffset(4)] public float fubar;
    }
    

    Untested. The idea is that two variables have the same position in your struct. You can of course only use one of them.

    More informations about unions in struct tutorial

    Khoth : Note that this will work only if the types involved are primitive types (like int and float). Once objects are involved, it won't let you.
    Taylor Leese : Does it work with value types (like enum) or just primitive types?
  • In C/C++ union is used to overlay different members in the same memory location, so if you have a union of an int and a flat they both use the same 4 bytes of memory, obviously writing to one corrupts the other (since int and float have different bit layout).

    In .net MS went with the safer choice and didn't include this feature.

    EDIT: except for interop

    tloach : that could be because .NET is higher-level and you probably don't have to worry about explicitly serializing data and transferring between little-endian and big-endian machines. Unions provide a nice way to convert, using the trick a previous comment noted.
    From Nir
  • Personally, I would ignore the UNION all together and implement Killroy and Fubar as separate fields

    public struct Foo
    {
        float bar;
        int Kilroy;
        float Fubar;
    }
    

    Using a UNION saves 32 bits of memory allocated by the int....not going to make or break an app these days.

    KPexEA : this might not work depending on how it is accessed by other parts of the library, in some instances you can write to one instance and read from the other to get the same data but in a slightly different format, that functionality will be broken if you split it into two distinct variables
    From ckramer
  • You can't really decide how to deal with this without knowing something about how it is used. If it is merely being used to save space, then you can ignore it and just use a struct.

    However that is not usually why unions are used. There two common reasons to use them. One is to provide 2 or more ways to access the same data. For instance, a union of an int and an array of 4 bytes is one (of many) ways to separate out the bytes of a 32 bit integer.

    The other is when the data in the struct came from an external source such as a network data packet. Usually one element of the struct enclosing the union is an ID that tells you which flavor of the union is in effect.

    In neither of these cases can you blindly ignore the union and convert it to a strucet where the two (or more) fields do not coincide.

  • It might be safer but when you're interacting with C libraries that provide these sorts of data structures this decision in C# breaks even the rudimentary encapsulation of your C/C++ structures.

    I'm trying to deal with something like this:

    struct LibrarySType {
    AnotherType *anotherTypeBuff;
    int oneSetOfFlags;
    int anotherSetOfFlags;
    union {
      struct {
        int structMember1;
        ...
      } oneUseOfThisLibraryType;
      struct {
        char *structMember2;
        ...
      } anotherUseOfThisLibraryType;
      ...
    } u;
    int64 *moreStuff;
    ... you get the idea
    

    }

    Now I didn't invent this clever data structure, but it's part of a vendor API I need interface with it. Having to count the field offsets for each member is ridiculous. That's why compilers were invented.

    From Steve Wart

How do you evaluate third party controls?

What criteria do you use when evaluating and comparing third party controls? Do you have standard integration and functionality tests?

  • Depends on what the third party control is being used for. But generically I would say:

    • Ease of use and compatibility with environment
    • Documentation
    • Company stability (Not going out of business)
    • Licensing model
  • First we evaluate them on non-technical criteria:

    • Is there a community (at least a forum) ?
    • Is is an active project ?
    • Is there a clear documentation ?

    Then, the main criteria is how well it fits in the encapsulation of our specific features needing to call some 'third party services'.

    That means, we have a clear set of features with empty implementations, needing for a third library to be implemented. If that library forces us to rethink that encapsulation, it is usually not a good sign.

    Finally, we unit-test that encapsulation, not the third party library itself (since it is not our job to support and test outside application!).
    If we do have to evaluate a similar third-party library, all we need in theory is to re-run those unit-test against our features (which call that new library).

    From VonC
  • Another important thing:

    Make sure you can get a copy of the source code, if not free, then at additional cost. If they go out of business and it's an important component to your product, you are officially hosed if you discover a bug.

Multiple ModificationForms in Sharepoint Workflow

Hello everybody,

i am working on a Sharepoint Server 2007 Statemachine Workflow. Until now i have a few states and an custom Association/InitiationForm which i created with InfoPath 2007. At the moment i have a Problem with Modification forms. The modification link in the state page of my workflow is shown and leads on click to my InfoPath form. If i click the "Submit" button the form is closed. Everything works fine. Now i tried to add a second ModificationForm to my workflow. So i created a new InfoPath form and added it in the same way to the workflow as the first one. The workflow has no errors in the building or deploying-process. But if i now try to click the second Modification link in the state page the form is not shown. Instead of my form the text: "The form has been closed." is shown.

I looked in the central administration and the InfoPath form is know under "Manage form templates". I gave every Modification in the Workflow.xml his own Guid. I used the following ModificationUrl: ModificationUrl="_layouts/ModWrkflIP.aspx"

Does anybody know step by step how to use two or more ModificationForms in my workflow?

Thank you in advance.

  • Look in your ULS logs for the error message. It will be listed there 100%. The category is "Forms Services" - the logs are located under the 12 hive in LOGS\

    Oisin

    From x0n
  • Thank you very much. I found the following Error Message in the Logfile:

    "Form load failed with a validation error"

    I searched in the web for solutions for this problem and fount this site:

    http://social.msdn.microsoft.com/forums/en-US/sharepointworkflow/thread/83264f93-ebe3-49ec-bd6b-95ee02df4d8a/

    I had two sceme files and i just schould use one for both forms. So i had to use the same data source. That was all. Thank you for the hint.

    Greets Stefan

    From

What does either Java GUI editor offer for rapid development and maintainability (i.e., Eclipse/SWT and Netbeans/Matisse)?

Between Eclipse/SWT or Netbeans/Matisse, what does either Java GUI editor give you in terms of rapid development and maintainability?

  • This is definitely subjective -- we use both, Eclipse and Netbeans. I think it comes down to a matter of preference.

    From Ian P
  • No one can tell you which is better. This is completely subject to change per developer. Here's a google search for "Eclipse vs Netbeans" and you can look at some pros and cons which others have poured their thoughts into already. Eclipse vs. NetBeans

  • I think you should put more research into whether you want the resulting application to be SWT or Swing-based. Which IDE to use should be the least important factor.

    I'm personally an Eclipse user, but I heard very good things about Matisse, so I would probably consider it if I had to build a Swing UI. BTW, if you buy MyEclipse, it integrates Matisse.

  • You are really asking two different questions: SWT vs Swing, and Eclipse GUI Editor vs Netbeans GUI Editor (Matisse).

    First, the difference between SWT and Swing is that they are two fundamentally different GUI libraries. This akin to asking the difference between Tk and Win32, or Java Swing vs .NET Forms (not to say that SWT is .NET). There are a lot of discussions out there discussing SWT vs Swing--I don't know enough about SWT to summarize the differences.

    First, let me say my bias is in favor of Netbeans and I have spent 10 years learning the IDE from its days as Forte.

    As far as the GUI editor, Eclipse and Netbeans have functionally similar products, but implement the code in very different ways.

    My observation is that Matisse behaves, functions, and produces code that's reminiscent of Visual Studio .NET code. There are clear initialziation sections and custom behaviors for certain objects (such as the JTable). You can "Customize" an object and add your own arbitrary code via the GUI editor very easily for everything from initialization to setting individual properties. For event handling, it defaults to replicating "delegates" in .NET by using anonymous inner classes and invoking a stand-alone method. The GUI editor itself provides detailed access to the form object model and has a rich set of customizations. You also have the freedom to drop non-GUI beans into the form for use by GUI components, such as models (tablemodel, listmodel, etc), JPA-related objects, Workers, etc. What used to take a week to produce with hand-coded SWING takes a day with Matisse (though you have to really learn Matisse to do this). If you've been hand-coding swing for many years, then relearning to use a GUI editor effectively is going to be a long, hard lession.

    The code is highly maintainable from within Matisse; it is NOT intended to be edited outside of Matisse, but the code is suitable for editing if you needed to (many folks I know use Netbeans GUI and then copy the source into Eclipse).

    The Eclipse GUI editor is a very different creature. The GUI editor(s) are roughly the same in terms of overall capability, but I have found them to be less polished. The layout capabilities are about equal, though errors are a bit less forgiving at times. Some customizations required me to go to the source file and edit the file directly, rather than getting access to code customizations through the GUI. The code produced is very different than Matisse. GUI Components are added and initialized through "getters" and is scattered throughout the file; this good because each component is isolated/grouped into a single function, but troublesome when you need to diagnose bad interactions between component initialization. The same goes with the event handlers--very different than matisse.

    Eclipse also did not provide any protections from me editing/breaking/tampering with the produced GUI file where as Netbeans was almost obnoxious with its protections. As far as maintainability, the Eclipse code is probably a little closer to the way a human would produce Java code... personally, I find the code it produces harder to maintain, but I've been looking at Matisse generated code since the first beta so my opinion is hardly objective on this issue.

    Netbeans also has the capability of using the same editor for building Swing framework applications, Netbeans RCP, etc... I am unsure if Eclipse does the same.

  • Some may contend that the end product you want to use actually depends on how easy it is to use - which is hinted at in the question.

    This article suggests that the Netbeans/Matisse editor is easier to use - and so you should use it on your projects. http://cld.blog-city.com/netbeans_matisse_versus_eclipses_visual_editor__no_contest.htm

    From hawkeye

C# 3.0 - Object initializer

Hello,

I'm having a little problem and I don't see why, it's easy to go around it, but still I want to understand.

I have the following class :

public class AccountStatement : IAccountStatement
{
     public IList<IAccountStatementCharge> StatementCharges { get; set; }

    public AccountStatement()
    {
        new AccountStatement(new Period(new NullDate().DateTime,newNullDate().DateTime), 0);
    }

    public AccountStatement(IPeriod period, int accountID)
    {
        StatementCharges = new List<IAccountStatementCharge>();
        StartDate = new Date(period.PeriodStartDate);
        EndDate = new Date(period.PeriodEndDate);
        AccountID = accountID;
    }

     public void AddStatementCharge(IAccountStatementCharge charge)
    {
        StatementCharges.Add(charge);
    }

}

(note startdate,enddate,accountID are automatic property to...)

If I use it this way :

var accountStatement = new AccountStatement{
                                              StartDate = new Date(2007, 1, 1),
                                              EndDate = new Date(2007, 1, 31),
                                              StartingBalance = 125.05m
                                           };

When I try to use the method "AddStatementCharge: I end up with a "null" StatementCharges list... In step-by-step I clearly see that my list get a value, but as soon as I quit de instantiation line, my list become "null"

Thank you!

  • This code:

    public AccountStatement()
    {
        new AccountStatement(new Period(new NullDate().DateTime,newNullDate().DateTime), 0);
    }
    

    is undoubtedly not what you wanted. That makes a second instance of AccountStatement and does nothing with it.

    I think what you meant was this instead:

    public AccountStatement() : this(new Period(new NullDate().DateTime, new NullDate().DateTime), 0)
    {
    }
    
  • Your parameter-less constructor creates a new instance of itself, but doesn't assign it to anything.

  • Use

    public AccountStatement() : this(new Period(new NullDate().DateTime,newNullDate().DateTime), 0) { }
    

    insetad of

    public AccountStatement()
        {
            new AccountStatement(new Period(new NullDate().DateTime,newNullDate().DateTime), 0);
        }
    
    From TcKs
  • Stupid, still sleeping I guess! Thanks all for the fast answer!

    From pmlarocque
  • You are calling a parameter-less constructor so AddStatementCharge is never initialized. Use something like:

    var accountStatement = new AccountStatement(period, accountId) {
                                              StartDate = new Date(2007, 1, 1),
                                              EndDate = new Date(2007, 1, 31),
                                              StartingBalance = 125.05m
                                           };
    
    pmlarocque : cannot my parameter less constructor was calling the other one, and I don't have the accountID so can't call it directly. Must use the :this like stated previously. or simply put a return in front of my new in the parameter-less ctor. Thanks!
    From Borek

Mouse Scroll Wheel and IFRAME

I have an IFRAME with a vertical scroll bar on a page with a vertical scrollbar. I would like to be able to scroll the IFRAME with the scroll wheel, but in IE7 and FF3, when I click the IFRAME and scroll, both the IFRAME content and Page scrolls, not just the IFRAME. Eventually, the IFRAME is no longer under the mouse

Has anyone had to deal with this and have some ideas about what I could do?

(because I know this will come up -- I have to have the IFRAME with scrollbar and I don't control the outer page with the scrollbar)

Edit: there was a comment that it wasn't reproducible. I have divs with images in them in the IFRAME, if that makes a difference.

In this IFRAME sample site:

http://www.samisite.com/test-csb2nf/id43.htm

If you go in IE7, and use the mouse scroll, you will see that it will start to scroll the page once the IFRAME is fully scrolled. In FF3, if you move the mouse a little, it will start to have the same behavior. In mine, I get this even when the scroll isn't done or the mouse isn't moved.

I am working on a sample.

Edit: Ok, I figured it out. There was a div over the iframe that was getting the scroll events. The behavior on that IFRAME sample is also not what I was hoping for in IE7 -- so if anyone has ideas about it -- when the IFRAME is done scrolling, the page should not scroll -- it would be appreciated.

  • I am unable to duplicate the behaviour you describe in either FF3 or IE7.

    edit: They still work as expected on your example site.

    Lou Franco : wow -- really. I will try to post an example. Can you post yours?
    From ceejayoz

Dump CCWs and RCWs in a mixed managed/unmanaged process

I have a mixed managed/unmanaged environment (Visual Studio and ReSharper) and I suspect CCW or RCW leak. Is there any way to dump all currently allocated wrappers and identify their source/target? I have WinDbg, SOS & SOSEx, so I can see total number of RCWs and CCWs with !syncblk command. I just want to see objects, so I can call !gcroot on them and otherwise examine suspects.

  • You should be able to use !dumpheap to do this. !dumpheap -stat would let you find the type names (if you don't already know them) and then !dumpheap -type {typename} would give you the individual object addresses which can be passed to !gcroot.

    Ilya Ryzhenkov : I do know how to use !dumpheap, I was asking about CCW & RCW, not about all managed objects. How would I distinguish CCW or RCW from other objects in the dumpheap output?
    Curt Hagenlocher : Use their type names. It's been a long time since I used these, but you should be able to use their type names to restrict the output from !dumpheap by using the -type option -- which also supports wild cards. If you're not sure what their type names are, use -stat to list all types.
    Ilya Ryzhenkov : @Curt, CCWs are not represented as managed object. All RCWs has type of __ComObject.
    Sunny : Ilya, not all RCW has __ComObject in the name. They may have a "normal" name, if some interop assembly is used (created by VS.Net when you reference the COM object).

Using Blitz implementation of JavaSpaces

I have great doubts about this forum, but I am willing to be pleasantly surprised ;) Kudos and great karma to those who get me back on track.

I am attempting to use the blitz implementation of JavaSpaces (http://www.dancres.org/blitz/blitz_js.html) to implement the ComputeFarm example provided at http://today.java.net/pub/a/today/2005/04/21/farm.html

The in memory example works fine, but whenever I attempt to use the blitz out-of-box implementation i get the following error:

(yes com.sun.jini.mahalo.TxnMgrProxy is in the class path)

2008-09-24 09:57:37.316 ERROR [Thread-4] JavaSpaceComputeSpace 155     - Exception while taking task.
java.rmi.ServerException: RemoteException in server thread; nested exception is: 
    java.rmi.UnmarshalException: unmarshalling method/arguments; nested exception is: 
    java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy
    at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:644)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597)
    at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568)
    at com.sun.jini.start.AggregatePolicyProvider$6.run(AggregatePolicyProvider.java:527)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778)
    at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148)
    at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244)
    at com.sun.jini.start.AggregatePolicyProvider$5.run(AggregatePolicyProvider.java:513)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241)
    at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136)
    at java.lang.Thread.run(Thread.java:595)
    at com.sun.jini.jeri.internal.runtime.Util.__________EXCEPTION_RECEIVED_FROM_SERVER__________(Util.java:108)
    at com.sun.jini.jeri.internal.runtime.Util.exceptionReceivedFromServer(Util.java:101)
    at net.jini.jeri.BasicInvocationHandler.unmarshalThrow(BasicInvocationHandler.java:1303)
    at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:832)
    at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:659)
    at net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528)
    at $Proxy0.take(Unknown Source)
    at org.dancres.blitz.remote.BlitzProxy.take(BlitzProxy.java:157)
    at compute.impl.javaspaces.JavaSpaceComputeSpace.take(JavaSpaceComputeSpace.java:138)
    at example.squares.SquaresJob.collectResults(SquaresJob.java:47)
    at compute.impl.AbstractJobRunner$CollectThread.run(AbstractJobRunner.java:28)
Caused by: java.rmi.UnmarshalException: unmarshalling method/arguments; nested exception is: 
    java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy
    at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:619)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597)
    at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568)
    at com.sun.jini.start.AggregatePolicyProvider$6.run(AggregatePolicyProvider.java:527)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540)
    at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778)
    at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148)
    at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244)
    at com.sun.jini.start.AggregatePolicyProvider$5.run(AggregatePolicyProvider.java:513)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241)
    at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136)
    at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at net.jini.loader.pref.PreferredClassLoader.loadClass(PreferredClassLoader.java:922)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at net.jini.loader.pref.PreferredClassProvider.loadClass(PreferredClassProvider.java:613)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at net.jini.loader.ClassLoading.loadClass(ClassLoading.java:138)
    at net.jini.io.MarshalInputStream.resolveClass(MarshalInputStream.java:296)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    at com.sun.jini.jeri.internal.runtime.Util.unmarshalValue(Util.java:221)
    at net.jini.jeri.BasicInvocationDispatcher.unmarshalArguments(BasicInvocationDispatcher.java:1049)
    at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:599)
    ... 17 more
  • Well, your java spaces server does not seem to find the class:

    com.sun.jini.mahalo.TxnMgrProxy.

    So I guess you just have to add Mahalo (should be included in the blitz distribution according to this: http://www.dancres.org/blitz/blitz_inst.html page) to your classpath when starting the server.

    Please post some more information about how you are starting your server, if this advice does not help.

    From jiriki
  • Please note my original post:yes com.sun.jini.mahalo.TxnMgrProxy is in the class path

    if you are familiar with javap -- if you specify a fully qualified class name it will determine whether or not it is on the class path.

    this is the result that I get when running javap com.sum.jini.mahalo.TxnMgrProxy:

    C:\dev\jini\blitz>javap com.sun.jini.mahalo.TxnMgrProxy
    Compiled from "TxnMgrProxy.java"
    class com.sun.jini.mahalo.TxnMgrProxy extends java.lang.Object implements net.jini.core.transaction.server.TransactionManager,net.jini.admin.Admi
    nistrable,java.io.Serializable,net.jini.id.ReferentUuid{
        final com.sun.jini.mahalo.TxnManager backend;
        final net.jini.id.Uuid proxyID;
        static com.sun.jini.mahalo.TxnMgrProxy create(com.sun.jini.mahalo.TxnManager, net.jini.id.Uuid);
        public net.jini.core.transaction.server.TransactionManager$Created create(long)       throws net.jini.core.lease.LeaseDeniedException, java.r
    mi.RemoteException;
        public void join(long, net.jini.core.transaction.server.TransactionParticipant, long)       throws net.jini.core.transaction.UnknownTransacti
    onException, net.jini.core.transaction.CannotJoinException, net.jini.core.transaction.server.CrashCountException, java.rmi.RemoteException;
        public int getState(long)       throws net.jini.core.transaction.UnknownTransactionException, java.rmi.RemoteException;
        public void commit(long)       throws net.jini.core.transaction.UnknownTransactionException, net.jini.core.transaction.CannotCommitException,
     java.rmi.RemoteException;
        public void commit(long, long)       throws net.jini.core.transaction.UnknownTransactionException, net.jini.core.transaction.CannotCommitExce
    ption, net.jini.core.transaction.TimeoutExpiredException, java.rmi.RemoteException;
        public void abort(long)       throws net.jini.core.transaction.UnknownTransactionException, net.jini.core.transaction.CannotAbortException, j
    ava.rmi.RemoteException;
        public void abort(long, long)       throws net.jini.core.transaction.UnknownTransactionException, net.jini.core.transaction.CannotAbortExcept
    ion, net.jini.core.transaction.TimeoutExpiredException, java.rmi.RemoteException;
        public java.lang.Object getAdmin()       throws java.rmi.RemoteException;
        public net.jini.id.Uuid getReferentUuid();
        public int hashCode();
        public boolean equals(java.lang.Object);
        com.sun.jini.mahalo.TxnMgrProxy(com.sun.jini.mahalo.TxnManager, net.jini.id.Uuid, com.sun.jini.mahalo.TxnMgrProxy$1);
    }
    
    From DeltaVee
  • So com.sun.jini.mahalo.TxnMgrProxy is contained in some jar, that is contained in your CLASSPATH environment variable.

    But probably your are using some script to start the server. And this most probably starts java by specifying a "-classpath" commandline switch which takes precendence over your environment CLASSPATH variable.

    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html

    You can simulate this by executing:

    javap -classpath someUnknownJar.jar com.sun.jini.mahalo.TxnMgrProxy

    ... and suddenly the class cannot be found anymore. So can you please try and find out the way the java VM of the client and server are started and provide the complete command line. (If you are using some kind of script just add an "echo ..." in front of the java command and paste the output in here).

    From jiriki
  • Make sure that you specify -Djava.security.policy=/wherever/policy.all and -Djava.security.manager= You may also have to have the RMI code server running.

  • This looks like an RMI classloading issue. It appears that the server process is trying to unmarshal the TxnMgrProxy object that is getting passed to it (I don't know the specifics of the example, I'm kind of guessing from the stack trace). That object needs to be annotated with a codebase where the class definition can be found. You probably need to make sure that Mahalo is started with the java.rmi.server.codebase property pointing to a URL where mahalo-dl.jar (or some JAR holding the class definition) can be downloaded.

    Even if the JAR is available locally, it might not be enough. The PreferredClassProvider (it's buried in the stack trace) usurps the normal Java classloader delegation scheme, so even if the class is there locally, it'll still want to pull the definition through the codebase.

    These are tough problems to figure out. Hope I hit on something close to the answer. Good luck.

    From shockwave
  • I'm having the same problem... Did you ever get it working?

What methods for measuring progress during a release sprint are effective

EDIT TO IMPROVE CLARITY

Scrum suggests that you split your development into a number of sprints. Each sprint being a fixed duration. At the end of each sprint you ask the client if you should release the software. If they say yes, you perform a Release Sprint, during which you do all the tasks that you woud like to do contineously, but are too expensive, such as external user testing, performance load testing and sign off, burning CDs (if relevent), writing user centered documentation and so on

In my current project we have just performend our first release sprint. We found we lost a lot of the advantages of scrum such as the burndown (as a lot of things were fixing minor tweaks or temporaraly removing security from the site so the load testing could happen), a clear goal as to how much work was to be done next etc. Basically the relase tasks were too close to firefighting to be easaly trackable via normal scrum tools.

What methods have other people used for during a release sprint, and what pitfalls did you find that should be avoided?

  • We're using a kanban board with scrum. Each product item is represented by a post-it note on the whiteboard. Its really obvious during the daily standups where everyone is with each of their tasks, and we can see how many tickets we have queued up in the 'pending' area on the board compared to the 'done' area at the other end.

    Laurie Young : This does not address the difference between release and development sprints
  • Actually, I prefer this tool. It does task-tracking, burndowns, burn-ups, and is useful for project notes.

    But to answer the question, tracking hours-remaining on a burndown should still work. It'll still tell you whether you're going to get all your release-sprint tasks (bugs/tweaks) done in time for launch. If the answer is "not all of them", then it's time to get the product owner in to do some prioritisation, and kick some of the tasks out of the sprint.

    Laurie Young : Can you kick tasks out of a release sprint?
  • Your goal should be to get to a point where you don't need a release sprint to deploy to production:) But with that said, what are you doing in your release sprint? There are still tasks to be done, but they are even more predictable than developing code. I've never seen a difference in how the burndown/planning works other than it usually involves adding people to the team from ops. That of course can be its own problem. Maybe you could give a quick idea of what a release sprint looks like in your organization.

Where can you find the C# Language Specifications?

Where can I find the specifications for the various C# languages?

(EDIT: it appears people voted down because you could 'google' this, however, my original intent was to put an answer with information not found on google. I've accepted the answer with the best google results, as they are relevant to people who haven't paid for VS)

How do you deploy a WAR that's inside an EAR as the root (/) context in Glassfish?

I have an EAR file that contains two WARs, war1.war and war2.war. My application.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
  <display-name>MyEAR</display-name>
  <module>
    <web>
      <web-uri>war1.war</web-uri>
      <context-root>/</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>war2.war</web-uri>
      <context-root>/war2location</context-root>
    </web>
  </module>
</application>

This results in war2.war being available on http://localhost:8080/war2location, which is correct, but war1.war is on http://localhost:8080// -- note the two slashes.

What am I doing wrong?

Note that the WARs' sun-web.xml files get ignored when contained in an EAR.

  • http://localhost:8080// should still be a valid URL that is equivalent to http://localhost:8080/

    I'd experiment with leaving the context-root of war1 blank (though I'm not sure if that's allowed). Or changing it to <context-root>.</context-root>.

    Otherwise I'd have to say the generated URI is a bug on glassfish's part since I've never seen that using sun's.

    Marius Marais : It's not unfortunately. http://localhost:8080/ gives Glassfish's default welcome srceen. An empty context-root uses the WAR name and a . simply does not work. :(
  • This seems to me as a bug in the glassfish application server. It should work as it is already defined your application.xml file.

    Maybe you could try the following:

    <context-root>ROOT</context-root>
    
    Marius Marais : Tried it; WAR available on /ROOT :)
  • This does seem to be a bug / feature.

    You can set Glassfish to use a certain web application as the root application, ie. when no other context matches, but the application then still thinks it's running on the original context and not on the root.

    My solution is to run the first WAR on /w and use Apache to redirect /whatever to /w/whatever using a RedirectMatch. Not very pretty, but it solves the problem (kinda).

    RewriteEngine On
    RedirectMatch ^/(w[^/].*) /w/$1
    RedirectMatch ^/([^w].*) /w/$1
    
  • Have you given it another try on a more recent version of Glassfish? (3.0.1 just came out).

    I've been able to get a -single- WAR in an exploded EAR to deploy to http://localhost/ using Glassfish 3.0.1. Like you mentioned, sun-web.xml seems to be ignored (inside of exploded ears at least).

    From Jon
  • In Glassfish 3.0.1 you can define the default web application in the administration console: "Configuration\Virtual Servers\server\Default Web Module". The drop-down box contains all deployed war modules.

    The default web module is then accessible from http://localhost:8080/.

    From jiriki
  • Thanks jiriki. The Perfect answer! Works in Galssfish 2.1.1 too!

    Configuration> HTTP Service> Virtual Servers> server

    or change default-web-module parameter in domain.xml

    From Greeno

Debug XP application on Vista computer

I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?

When using remote debugging I assume that all executable and library files must be in my Vista virtual machine. But I can seem to copy the MFC debug DLLs to the Vista VM, and as a result I keep getting side-by-side configuration errors.

I would prefer to remote debug the application without having to copy any files, how can I do that? And if I can't, how can I install the MFC DLLs without having to install Visual Studio on the Vista machine?

Note: I have Vista installed on a virtual machine using Virtual PC. I just don't know how to run the debug version of my application there.

  • You can install VirtualPC (or other virtualization software) and install Vista as virtual system, so you don't need two computers. For this part of the debugging, it probably better that you explicitly do not install visual studio to make sure there's not some hidden dependency in your program that visual studio provides. At this point you want to be testing the fully-deployed version of the app.

    The biggest rule I've found so far for developing for vista is making sure that you never write anything to the same folder where the program is installed. Write to the Application Data folder instead. This was a rule for XP, too, but it's much more strictly enforced in vista.

  • If you have Visual Studio Pro or Team, you can give remote debugging a shot. There's just a tiny stub that gets installed on the remote computer.

    If you want to run a debug build of your application, you will need to install the debug runtime files on the virtual PC as well.

    From Eclipse

Can anyone explain this PHP code using json_encode and json_decode?

  $a = '{ "tag": "<b></b>" }';
  echo json_encode( json_decode($a) );

This outputs:

{"tag":"<b><\/b>"}

when you would think it would output exactly the input. For some reason json_encode adds an extra slash.

  • Because it's part of the JSON standard

    http://json.org/

    char

    any-Unicode-character-
        except-"-or-\-or-
        control-character
    \"
    \\
    \/ <---- see here?
    \b
    \f
    \n
    \r
    \t
    \u four-hex-digits
    
  • That's probably a security-feature. The escaped version (Eg. the output) would be parsed as similar to the unescaped-version, by Javascript (Eg. \/ becomes /). Having escaped the slash like that, there is a lesser chance of the browser misinterpreting the Javascript-string as HTML. Of course, if you treat the data correct, this shouldn't be needed, so it's more a safeguard against a clueless programmer messing things up for himself.

    From troelskn
  • Your input is not valid JSON, but PHP's JSON parser (like most JSON parsers) will parse it anyway.

    John Millikin : What's invalid about it?