Search Results

Search found 9520 results on 381 pages for 'progress bar'.

Page 79/381 | < Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >

  • Generate URL for File

    - by Don
    The default output of File.toURL() is file:/c:/foo/bar These don't appear to work on windows, and need to be changed to file:///c:/foo/bar Does the format file:/c:/foo/bar work correctly on Unix (I don't have a Unix machine to test on)? Is there a library that can take care of generating a URL from a File that is in the correct format for the current environment?

    Read the article

  • Java: using generic wildcards with subclassing

    - by gibberish
    Say I have a class Foo, a class A and some subclass B of A. Foo accepts A and its sublclasses as the generic type. A and B both require a Foo instance in their constructor. I want A's Foo to be of type A , and B's Foo to be of type B or a superclass of B. So in effect, So I only want this: Foo<X> bar = new Foo<X>; new B(bar); to be possible if X is either A, B, or a both subclass of A and superclass of B. So far this is what I have: class Foo<? extends A>{ //construct } class A(Foo<A> bar){ //construct } class B(Foo<? super B> bar){ super(bar); //construct } The call to super(...) doesn't work, because <A> is stricter than <? super B>. Is it somehow possible to use the constructor (or avoid code duplication by another means) while enforcing these types? Edit: Foo keeps a collection of elements of the generic parameter type, and these elements and Foo have a bidirectional link. It should therefore not be possible to link an A to a Foo.

    Read the article

  • Parse XML with XPath & namespaces in Java

    - by ripper234
    Can you help me adjust this code so it manages to parse the XML? If I drop the XML namespace it works: String webXmlContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<foo xmlns=\"http://foo.bar/boo\"><bar>baz</bar></foo>"; DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); org.w3c.dom.Document doc = builder.parse(new StringInputStream(webXmlContent)); NamespaceContextImpl namespaceContext = new NamespaceContextImpl(); namespaceContext.startPrefixMapping("foo", "http://www.w3.org/2001/XMLSchema-instance"); XPath xpath = XPathFactory.newInstance().newXPath(); xpath.setNamespaceContext(namespaceContext); XPathExpression expr = xpath.compile("/foo/bar"); Object result = expr.evaluate(doc, XPathConstants.NODESET); NodeList nodes = (NodeList) result; System.out.println("Got " + nodes.getLength() + " nodes");

    Read the article

  • Why does Python sometimes upgrade a string to unicode and sometimes not?

    - by samtregar
    I'm confused. Consider this code working the way I expect: >>> foo = u'Émilie and Juañ are turncoats.' >>> bar = "foo is %s" % foo >>> bar u'foo is \xc3\x89milie and Jua\xc3\xb1 are turncoats.' And this code not at all working the way I expect: >>> try: ... raise Exception(foo) ... except Exception as e: ... foo2 = e ... >>> bar = "foo2 is %s" % foo2 ------------------------------------------------------------ Traceback (most recent call last): File "<ipython console>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) Can someone explain what's going on here? Why does it matter whether the unicode data is in a plain unicode string or stored in an Exception object? And why does this fix it: >>> bar = u"foo2 is %s" % foo2 >>> bar u'foo2 is \xc3\x89milie and Jua\xc3\xb1 are turncoats.' I am quite confused! Thanks for the help! UPDATE: My coding buddy Randall has added to my confusion in an attempt to help me! Send in the reinforcements to explain how this is supposed to make sense: >>> class A: ... def __str__(self): return "string" ... def __unicode__(self): return "unicode" ... >>> "%s %s" % (u'niño', A()) u'ni\xc3\xb1o unicode' >>> "%s %s" % (A(), u'niño') u'string ni\xc3\xb1o' Note that the order of the arguments here determines which method is called!

    Read the article

  • Validate number of nested attributes

    - by Damien MATHIEU
    Hello, I have a model with nested attributes : class Foo < ActiveRecord::Base has_many :bar accepts_nested_attributes_for :bar end It works fine. However I'd want to be sure that for every Foo, I have at least two Bar. I can't access the bar_attributes in my validations so it seems I can't validate it. Is there any clean way to do so ?

    Read the article

  • WFP Validation & IDataErrorInfo

    - by Jefim
    A note - the classes I have are EntityObject classes! I have the following class: public class Foo { public Bar Bar { get; set; } } public class Bar : IDataErrorInfo { public string Name { get; set; } #region IDataErrorInfo Members string IDataErrorInfo.Error { get { return null; } } string IDataErrorInfo.this[string columnName] { get { if (columnName == "Name") { return "Hello error!"; } Console.WriteLine("Validate: " + columnName); return null; } } #endregion } XAML goes as follows: <StackPanel Orientation="Horizontal" DataContext="{Binding Foo.Bar}"> <TextBox Text="{Binding Path=Name, ValidatesOnDataErrors=true}"/> </StackPanel> I put a breakpoint and a Console.Writeline on the validation there - I get no breaks. The validation is not executed. Can anybody just press me against the place where my error lies?

    Read the article

  • lookahead and group

    - by Istao
    Hi, In Java, on a text like foo <on> bar </on> thing <on> again</on> now, I should want a regex with groups wich give me with a find "foo", "bar", empty string, then "thing", "again", "now". If I do (.*?)<on>(.*?)</on>(?!<on>), I get only two group (foo bar, thing again, and I've not the end "now"). if I do (.*?)<on>(.*?)</on>((?!<on>)) I get foo bar empty string, then thing again and empty string (here I should want "now"). Please what is the magical formula ? Thanks.

    Read the article

  • What's the correct way to pass parameters from VBScript to COM interface implemented in C#?

    - by nopopem
    I'm trying to expose a fairly simple C# class to COM which should be usable from VBScript (among others). Some objects need to be created via COM calls and will be used in furter calls later on. The definition of the exposed classes and interfaces looks like this: namespace Test { [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IComInterface { IFoo CreateFoo(); void UseFoo(int x, IFoo f); } [ClassInterface(ClassInterfaceType.None)] public sealed class CComInterface : IComInterface { public CComInterface() {} public IFoo CreateFoo() { return new Foo(); } public void UseFoo(int x, IFoo f) { f.Bar(); } } [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IFoo { void Bar(); } [ClassInterface(ClassInterfaceType.None)] public class Foo : IFoo { internal Foo() {} public void Bar() {} } } The simplest thinkable COM client in VBScript does this: Dim ci Set ci = WScript.CreateObject("Test.CComInterface") Dim foo Set foo = ci.CreateFoo foo.Bar ci.UseFoo 0, foo While the call to Bar succeeds, calling UseFoo fails with "Error 5: invalid procedure call or invalid argument" The generated IDL seems ok to me: dispinterface IComInterface { properties: methods: [id(0x60020003)] IFoo* CreateFoo(); [id(0x60020004)] void UseFoo( [in] long x, [in] IFoo* f); }; The vbs call succeeds when I wrap the second parameter in parentheses like this: ci.UseFoo 0, (foo) As far as I understand (I'm no VBScript expert however) this forces the reference to foo to be passed by value, i.e. a copy of the reference is being made. How can I change the interface so that it can be called with the foo reference directly? Since this will be a public interface used by customers I don't like the idea of having to explain why all the objects created need to be passed back in an extra pair of parentheses...

    Read the article

  • is there a way to add a variable/property to a DOM element (eg, an element returned by a jQuery sele

    - by bt
    Hi there, I am looking for an alternative to using an object/variable in global scope -- I would like to associate key/value pairs with specific DOM elements (eg, a DIV), so that I can use them as input for logic that processes other elements (eg, child elements of said DIV). I tried something naive like: $('[foo=bar]').key='value' , and $('[foo=bar]')[key]='value', but it puked. Doing something like: var foobar = $('[foo=bar]'); foobar.key = 'value' -- works, but the new property/value only affects the new object (ie, foobar, not $('[foo=bar]')) Most likely there's something terribly basic I am overlooking. Any help is appreciated, thanks!

    Read the article

  • inspect the parameters to "use", and pass on the rest?

    - by JoelFan
    I have a Perl module and I'd like to be able to pick out the parameters that my my module's user passed in the "use" call. Whichever ones I don't recognize I'd like to pass on. I tried to do this by overriding the "import" method but I'm not having much luck. EDIT: To clarify, as it is, I can use my module like this: use MyModule qw/foo bar/; which will import the foo and bar methods of MyModule. But I want to be able to say: use MyModule qw/foo doSpecialStuff bar/; and look for doSpecialStuff to check if I need to do some special stuff at the beginning of the program, then pass qw/foo bar/ to the Exporter's import

    Read the article

  • How do you get SQLAlchemy to override MySQL "on update CURRENT_TIMESTAMP"

    - by nocola
    I've inherited an older database that was setup with a "on update CURRENT_TIMESTAMP" put on a field that should only describe an item's creation. With PHP I have been using "timestamp=timestamp" on UPDATE clauses, but in SQLAlchemy I can't seem to force the system to use the set timestamp. Do I have no choice and need to update the MySQL table (millions of rows)? foo = session.query(f).get(int(1)) ts = foo.timestamp setattr(foo, 'timestamp', ts) setattr(foo, 'bar', bar) www_model.www_Session.commit() I have also tried: foo = session.query(f).get(int(1)) setattr(foo, 'timestamp', foo.timestamp) setattr(foo, 'bar', bar) www_model.www_Session.commit()

    Read the article

  • Instant file sharing between users in PHP

    - by Skyfe
    Hi there, Working on a rather complex system in which users can directly exchange files with eachother from the website. However is any of these things possible: EITHER * Have another user download a file which is still being uploaded by another user ( in progress ) OR * Make a user automaticly ( instant ) download a file from another users PC through our website OR * Make a user automaticly (instant) download a file from our server ( so it's directly downloaded to the users pc and the progress shown on our website of the download progress, without the normal internet explorer dialog downloading the file or firefox ). Thank you very much in advanced, Best Regards, Webcodez.net. UPDATE: an example would be MSN's file sharing but then through a website instead of application.

    Read the article

  • How to test routes that don't include controller?

    - by Darren Green
    I'm using minitest in Rails to do testing, but I'm running into a problem that I hope a more seasoned tester can help me out with because I've tried looking everywhere for the answer, but it doesn't seem that anyone has run into this problem or if they have, they opted for an integration test. Let's say I have a controller called Foo and action in it called bar. So the foo_controller.rb file looks like this: class FooController < ApplicationController def bar render 'bar', :layout => 'application' end end The thing is that I don't want people to access the "foo/bar" route directly. So I have a route that is get 'baz' => 'foo#bar'. Now I want to test the FooController: require 'minitest_helper' class FooControllerTest < ActionController::TestCase def test_should_get_index get '/baz' end end But the test results in an error that No route matches {:controller=>"foo", :action=>"/baz"}. How do I specify the controller for the GET request? Sorry if this is a dumb question. It's been very hard for me to find the answer.

    Read the article

  • FRIEND_TEST in Google Test - possible circular dependency?

    - by Mihaela
    I am trying to figure out how FRIEND_TEST works in Google Tests. http://code.google.com/p/googletest/wiki/AdvancedGuide#Private_Class_Members I am looking at the following item, trying to implement it in my code: // foo.h #include "gtest/gtest_prod.h" // Defines FRIEND_TEST. class Foo { ... private: FRIEND_TEST(FooTest, BarReturnsZeroOnNull); int Bar(void* x); }; // foo_test.cc ... TEST(FooTest, BarReturnsZeroOnNull) { Foo foo; EXPECT_EQ(0, foo.Bar(NULL)); // Uses Foo's private member Bar(). } In the code above, the piece that I can't see, is that foo_test.cc must include foo.h, in order to have access to Foo and Bar(). [Perhaps it works differently for Google ? in my code, I must include it] That will result in circular dependency... Am I missing something ?

    Read the article

  • Mapping over multiple Seq in Scala

    - by bsdfish
    Suppose I have val foo : Seq[Double] = ... val bar : Seq[Double] = ... and I wish to produce a seq where the baz(i) = foo(i) + bar(i). One way I can think of to do this is val baz : Seq[Double] = (foo.toList zip bar.toList) map ((f: Double, b : Double) => f+b) However, this feels both ugly and inefficient -- I have to convert both seqs to lists (which explodes with lazy lists), create this temporary list of tuples, only to map over it and let it be GCed. Maybe streams solve the lazy problem, but in any case, this feels like unnecessarily ugly. In lisp, the map function would map over multiple sequences. I would write (mapcar (lambda (f b) (+ f b)) foo bar) And no temporary lists would get created anywhere. Is there a map-over-multiple-lists function in Scala, or is zip combined with destructuring really the 'right' way to do this?

    Read the article

  • Get/Set nested property values

    - by Daniel Deer
    I'll try to be more descriptive here. A Few Q's: using: var foo = new Foo() { Bar = new Bar() { Value = "Value" } }; var value = DataBinder.Eval(foo, "Bar.Value"); Or: This one It is possible to retrieve an internal nested property using property path syntax. Is there a way to set/trigger a nested property (a regular property not DependencyProperty) easily with some kind of simple mechanisms as described here? I want to acheive something like: string newValue = "Hello World!"; DataBinder.EvalSet(foo, "Bar.Value", NewValue); Is there any mechanism that support both property path (for nested objects) and XPATHs (if the objects are XPATH navigable of course) ? again, that supports get and set options. Thanks, DD

    Read the article

  • Accessing property of object vs variable in javascript

    - by Samuel
    Why when I try to access a variable that don't exist, javascript throw an exception but when I try to access a property that don't exist in an object, javascript returns an undefined object? For example, this case returns an undefined object: function Foo(){ console.log(this.bar); } Foo(); But, in this other example, javascript throw an exception: function Foo(){ console.log(bar); } Foo(); ReferenceError: bar is not defined

    Read the article

  • CSS3 selector to find the 2nd div of the same class

    - by mpeters
    I need a CSS selector that can find the 2nd div of 2 that has the same class. I've looked at nth-child() but it's not what I want since I can't see a way to further clarify what class I want. These 2 divs will be siblings in the document if that helps. My HTML looks something like this: <div class="foo">...</div> <div class="bar">...</div> <div class="baz">...</div> <div class="bar">...</div> And I want the 2nd div.bar (or the last div.bar would work too).

    Read the article

  • Hibernate one-to-one: getId() without fetching entire object

    - by Rob
    I want to fetch the id of a one-to-one relationship without loading the entire object. I thought I could do this using lazy loading as follows: class Foo { @OneToOne(fetch = FetchType.LAZY, optional = false) private Bar bar; } Foo f = session.get(Foo.class, fooId); // Hibernate fetches Foo f.getBar(); // Hibernate fetches full Bar object f.getBar().getId(); // No further fetch, returns id I want f.getBar() to not trigger another fetch. I want hibernate to give me a proxy object that allows me to call .getId() without actually fetching the Bar object. What am I doing wrong?

    Read the article

  • Can you simulate a boolean flag in XSLT?

    - by R.C.
    Hey guys, I'd like to simulate a flag in an xslt script. The idea is for template foo to set a flag (or a counter variable, or anything), so that it can be accessed from template bar. Bar isn't called from foo, but from a common parent template (otherwise I would pass a parameter to it). The structure is like this: <xsl:template match="bla"> <xsl:apply-templates select="foo"/> <!-- depending on the contents of foo... --> <xsl:apply-templates select="bar"/> <!-- ... different things should happen in bar --> </xsl:template> Any tricks are much appreciated.

    Read the article

< Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >