Search Results

Search found 373 results on 15 pages for 'motivation'.

Page 9/15 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How can I define custom 'contentGroups' in a custom Flex 4 component?

    - by swidnikk
    The spark panel component for example can be written like this And its skin file will handle layout of the contentGroup, controlBarGroup, and titleDisplay. Notice, however that the contentGroup is doesn't appear in the code above and that the controlBarGroup accepts child mxml components. Now say I want to create a custom component that defines various required and non-required skinparts, such as 'headerGroup', 'navigationGroup', and 'accountPreferencesGroup'. I'd like to write this custom component like this The motivation here is that I can now create a couple different skin files to change the look and layout of those subgroups. Reading source of the spark panel, there are some calls within the mx_internal namespace such as getMXMLContent() which is a method of the spark group component, but which I have no access to. Does the description above make sense? How can I create custom 'contentGroups' in my custom Flex4 component that can use nested mxml child components? Should I approach this a different way?

    Read the article

  • SQLite3's dynamic typing

    - by Bradford Larsen
    SQLite3 uses dynamic typing rather than static typing, in contrast to other flavors of SQL. The SQLite website reads: Most SQL database engines (every SQL database engine other than SQLite, as far as we know) uses static, rigid typing. With static typing, the datatype of a value is determined by its container - the particular column in which the value is stored. SQLite uses a more general dynamic type system. In SQLite, the datatype of a value is associated with the value itself, not with its container. It seems to me that this is exactly what you don't want, as it lets you store, for example, strings in integer columns. The page continues: ...the dynamic typing in SQLite allows it to do things which are not possible in traditional rigidly typed databases. I have two questions: The use case question: What are some examples where sqlite3's dynamic typing is, in fact, beneficial? The historical/design question: What was the motivation for implementing sqlite with dynamic typing?

    Read the article

  • Tomcat cookies not working via my ProxyPass VirtualHost

    - by John
    Hi there. I'm having some issues with getting cookies to work when using a ProxyPass to redirect traffic on port 80 to a web-application hosted via Tomcat. My motivation for enabling cookies is to get rid of the "jsessionid=" parameter that is appended to the URLs. I've enabled cookies in my context.xml in META-INF/ for my web application. When I access the webapplication via http://url:8080/webapp it works as expected, the jsessionid parameter is not visible in the URL, instead it's stored in a cookie. When accessing my website via an apache2 virtualhost the cookies doesn't seem to work because now "jsessionid" is being appended to the URLs. How can I solve this issue? Here's my VHost configuration: <VirtualHost *:80 ServerName somedomain.no ServerAlias www.somedomain.no <Proxy * Order deny,allow Allow from all </Proxy ProxyPreserveHost Off ProxyPass / http://localhost:8080/webapp/ ProxyPassReverse / http://localhost:8080/webapp/ ErrorLog /var/log/apache2/somedomain.no.error.log CustomLog /var/log/apache2/somedomain.no.access.log combined </VirtualHost

    Read the article

  • Use python decorators on class methods and subclass methods

    - by AlexH
    Goal: Make it possible to decorate class methods. When a class method gets decorated, it gets stored in a dictionary so that other class methods can reference it by a string name. Motivation: I want to implement the equivalent of ASP.Net's WebMethods. I am building this on top of google app engine, but that does not affect the point of difficulty that I am having. How it Would look if it worked: class UsefulClass(WebmethodBaseClass): def someMethod(self, blah): print(blah) @webmethod def webby(self, blah): print(blah) # the implementation of this class could be completely different, it does not matter # the only important thing is having access to the web methods defined in sub classes class WebmethodBaseClass(): def post(self, methodName): webmethods[methodName]("kapow") ... a = UsefulClass() a.post("someMethod") # should error a.post("webby") # prints "kapow" There could be other ways to go about this. I am very open to suggestions

    Read the article

  • Confused about this factory, as it doesn't look like an Abstract Factory nor Factory Method

    - by Pin
    I'm looking into Guice and I've been reading its documentation recently. Reading the motivation section I don't understand the factories part, why they name it that way. To me that factory is just a wrapper for the implementing class they want it to return after calling getInstance(). public class CreditCardProcessorFactory { private static CreditCardProcessor instance; public static void setInstance(CreditCardProcessor creditCardProcessor) { instance = creditCardProcessor; } public static CreditCardProcessor getInstance() { if (instance == null) { throw new IllegalStateException("CreditCardProcessorFactory not initialized. " + "Did you forget to call CreditCardProcessor.setInstance() ?"); } return instance; } } Why do they call it factory as well if it is neither an abstract factory nor a factory method? Or am I missing something? Thanks.

    Read the article

  • Shared library linking and loading in BusyBox 0.61

    - by Alex Marshall
    Does anybody know how the dynamic linking and shared library loading works in BusyBox 0.61 ? I can't seem to find how this is done. There's no 'ld' present on the embedded system I'm dealing with, nor is there an LD_LIBRARY_PATH variable set anywhere. My motivation for this is to be able to create a symlink in the /lib directory to another directory on a different device (with considerably more storage space) for adding in more shared libraries, as the file system that contains /lib is a ramdisk that gets reloaded on startup and is within a few kb of being completely full (so we can't add more libraries to the image, nor can we obtain devices with more memory for the ramdisk)

    Read the article

  • Tooltips with infinite timeout?

    - by romkyns
    I'm thinking of setting the timeout on all my tooltips in a WinForms application to infinity (or an extremely large value). The motivation is that it's annoying for the user if the tooltip disappears while I'm still reading it, without providing any extra value whatsoever as far as I can tell. Normally I wouldn't ask something like this on StackOverflow, but the overwhelming majority of all software sets timeouts on tooltips, so it makes me wonder whether perhaps there is some important consideration I'm missing? Or is this just an old convention that nobody gives further thought to? If you would hate infinite timeout as opposed to a short timeout, please explain why. (If you just think tooltips are a bad idea altogether then that's a separate consideration; this question is specifically about the infinite timeout.)

    Read the article

  • Finding the time to program in your spare time?

    - by Omar Kooheji
    I've got about a dozen programming projects bouncing about my head, and I'd love to contribute to some open source projects, the problem I have is that having spent the entire day staring at Visual Studio and or Eclipse (Sometimes both at the same time...) the last thing I feel like doing when I go home is program. How do you build up the motivation/time to work on your own projects after work? I'm not saying that I don't enjoy programming, it's just that I enjoy other things to and it can be hard to even do something you enjoy if you've spent all day already doing it. I think that if I worked at a chocolate factory the last thing I'd want to see when I got home was a Wonka bar.... Related: How do you keep a balance between working, training, health and family?

    Read the article

  • Google App Engine - low-level datastore API flag?

    - by Keyur
    In my GAE-Java app, I'm using the low-level datastore API. Hence I don't need the GAE app instance to load any of the higher level data access libraries such as JPA, JDO, Data Nucleus, etc. Is there a flag that I can set to indicate that I don't want these libraries to be loaded? My motivation to do this is to reduce app instance startup time everywhere I can. Now I don't know if these libraries are loaded only on-demand or always. The dev environment logs messages related to data nucleus which seems to indicate that some of these libraries may be pre-loaded? I hope I'm wrong here. Thanks, Keyur

    Read the article

  • Match groups in Python

    - by Curd
    Is there a way in Python to access match groups without explicitely creating a match object (or another way to beautify the example below)? Here is an example to clarify my motivation for the question: Following perl code if ($statement =~ /I love (\w+)/) { print "He loves $1\n"; } elsif ($statement =~ /Ich liebe (\w+)/) { print "Er liebt $1\n"; } elsif ($statement =~ /Je t\'aime (\w+)/) { print "Il aime $1\n"; } translated into Python m = re.match("I love (\w+)", statement) if m: print "He loves",m.group(1) else: m = re.match("Ich liebe (\w+)", statement) if m: print "Er liebt",m.group(1) else: m = re.match("Je t'aime (\w+)", statement) if m: print "Il aime",m.group(1) looks very awkward (if-else-cascade, match object creation).

    Read the article

  • Code reading: where can i read great, modern, and well-documented C++ code?

    - by baol
    Reading code is one of the best ways to learn new idioms, tricks, and techniques. Sadly it's very common to find badly written C++ code. Some use C++ as it was C, others as if it was Java, some just shoot in their feet. I believe gtkmm is a good example of C++ design, but a binding could not be the better code to read (you need to know the C library behind that). Boost libraries (at least the one I read) tend to be less readable than I'd like. Can you mention open source projects (or other projects which source is freely readable) that are good example of readable, modern, well-documented, and auto-contained, C++ code to learn from? (I believe that one project per answer will be better, and I'd include the motivation that led you to selecting that one.)

    Read the article

  • Unicode identifiers in Python?

    - by viksit
    Hi all, I want to build a Python function that calculates, and would like to name my summation function S. In a similar fashion, would like to use ? for product, and so on. I was wondering if there was a way to name a python function in this fashion? def S (..): .. .. That is, does Python support unicode identifiers, and if so, could someone provide an example for it? Thanks! Original motivation for this was a piece of Clojure code I saw today that looks like, (defn entropy [X] (* -1 (S [i X] (* (p i) (log (p i)))))) where S is a macro defined as, (defmacro S ... ) and I thought that was pretty cool.

    Read the article

  • Access to selection in gmail message body with Google Apps Script

    - by Mike Ellis
    Can app scripts access the current selection in a gmail message? I frequently compose messages that include engineering calculations and make use of the Google Calc feature do the calculation or convert to the desired units, e.g. 4000 Btu/hr * 8 hrs in kWh It would be really convenient to be able to select the above, hit a mapped key (e.g. Ctrl-K) and have the inserted after the expression 4000 Btu/hr * 8 hrs in kWh = 0.9378 kWh instead of having to paste the expression into a search box and then copy and paste the answer. I could certainly write a solution using a keymapper and a small python script to grab the current selection, send it to the gcalc api, etc ..., but my real motivation is to get familiar with Apps Scripts's capabilities and limitations. I suppose the uber-question here is "what kinds of user actions and state information can App Script access in Gmail messages (and/or Google docs) that are being edited?"

    Read the article

  • Referring to this pointer in a static assert?

    - by Tyson Jacobs
    Is it possible to write a static assert referring to the 'this' pointer? I do not have c++11 available, and BOOST_STATIC_ASSERT doesn't work. struct blah { void func() {BOOST_STATIC_ASSERT(sizeof(*this));} }; Produces: error C2355: 'this' : can only be referenced inside non-static member functions error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE' In MSVC 2008. Motivation: #define CLASS_USES_SMALL_POOL() \ void __small_pool_check() {BOOST_STATIC_ASSERT(sizeof(*this) < SMALL_MALLOC_SIZE;} \ void* operator new(size_t) {return SmallMalloc();} \ void operator delete(void* p) {SmallFree(p);}

    Read the article

  • How to engineer features for machine learning

    - by Ivo Danihelka
    Do you have some advices or reading how to engineer features for a machine learning task? Good input features are important even for a neural network. The chosen features will affect the needed number of hidden neurons and the needed number of training examples. The following is an example problem, but I'm interested in feature engineering in general. A motivation example: What would be a good input when looking at a puzzle (e.g., 15-puzzle or Sokoban)? Would it be possible to recognize which of two states is closer to the goal?

    Read the article

  • Auto-Implemented Properties c#

    - by user311130
    Hi all, could someone explain me what's the idea behind using Auto-Implemented Properties c#? public class Customer { public int ID { get; set; } public string Name { get; set; } } I get the motivation to use properties for private field, so we can determine how one can access a private field. But here - it's just like defining the field to be public from the first place. no? Is there a difference between defining a field to be "public const" or define it to have a get-only property ? Thanks Elad

    Read the article

  • Unit testing UDP socket handling code

    - by JustJeff
    Are there any 'good' ways to cause a thread waiting on a recvfrom() call to become unblocked and return with an error? The motivation for this is to write unit tests for a system which includes a unit that reads UDP datagrams. One of the branches handles errors on the recvfrom call itself. The code isn't required to distinguish between different types of errors, it just has to set a flag. I've thought of closing the socket from another thread, or do a shutdown on it, to cause recvfrom to return with an error, but this seems a bit heavy handed. I've seen mention elsewhere that sending an over-sized packet would do it, and so set up an experiment where a 16K buffer was sent to a recvfrom waiting for just 4K, but that didn't result in an error. The recvfrom just return 4096, to indicate it had gotten that many bytes.

    Read the article

  • Simulating a cookie-enabled browser in PHP

    - by Itamar Benzaken
    How can I open a web-page and receive its cookies using PHP? The motivation: I am trying to use feed43 to create an RSS feed from the non-RSS-enabled HighLearn website (remote learning website). I found the web-page that contains the feed contents I need to parse, however, it requires to login first. Luckily, logging in can be done via a GET request so it's as easy as fopen()ing "http://highlearn.website/login_page.asp?userID=foo&password=bar" for example. But I still need to get the cookies generated when I logged in, pass the cookies to the real client (using setcookie() maybe?) and then redirect.

    Read the article

  • Assigning an @Annotation enum a value

    - by h2g2java
    I created enum Restrictions{ none, enumeration, fractionDigits, length, maxExclusive, maxInclusive, maxLength, minExclusive, minInclusive, minLength, pattern, totalDigits, whiteSpace; public Restrictions setValue(int value){ this.value = value; return this; } public int value; } So that I could happily do something like this, which is perfectly legal syntax. Restrictions r1 = Restrictions.maxLength.setValue(64); The reason being is, I am using enum to restrict the type of restriction that could be used, and be able to assign a value to that restriction. However, my actual motivation is to use that restriction in an @annotation. @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) public @interface Presentable { Restrictions[] restrictions() default Restrictions.none; } So that, I intended to do this: @Presentable(restrictions=Restrictions.maxLength.setValue(64)) public String userName; to which, the compiler croaks The value for annotation enum attribute must be an enum constant expression. Is there a way to accomplish what I wish to accomplish

    Read the article

  • From .NET to Delphi, an ERP on Delphi

    - by emray
    I have learned programming on .NET. It's been 4 years since I have started (serious) programming, I gained experience in VBA, JavaScript but mainly C#. I have spent a lot of time trying to grasp the good coding practices, object orientation etc. Now finally I have a job. The job is fixing/upgrading an ERP on a daily basis. Creating reports and maybe sometimes new stuff. I have absolutely no experience in Delphi, and no motivation to learn it especially when people are moving to .NEt from Delphi not in the reverse direction sa my manager expects :) The question is that are there any tools that I write C# code and compile into this object pascal or whatever it is. Thanks in advance.

    Read the article

  • non-servlet JSP

    - by h2g2java
    I realise there are EL and near EL frameworks like StringTemplate, JUEL, Velocity, etc. However, I am not asking for list of alternatives to JSTL/EL. I came across a package more than a year ago, someone who wrote a util that emulates the functionality of JSP for non-servlet env, i.e., JSP composition which does not need a "servlet container" to function. I ignored it and now I think it would be helpful to me and I need help to recall what it is. My actual motivation is similar to what StringTemplate, JUEL, Velocity would offer to help me compose SQL blocks, HTML blocks but I am thinking that JSPs are precompiled into bytecode and JSPs are more run-time efficient since run-time parsing is done no more than once. So actually, recommendation for alternatives would be acceptable as long as the templates are precompiled into bytecode. But I still prefer the JSP emulator.

    Read the article

  • How do I get Mathematica to thread a 2-variable function over two lists, using functional programmin

    - by Leah Wrenn Berman
    Lets say I have a function f[x_, y_], and two lists l1, l2. I'd like to evaluate f[x,y] where x runs over the list l1 and y runs over the list l2, and I'd like to do it without having to make all pairs of the form {l1[[i]],l2[[j]]}. (Motivation: I'm trying to implement some basic Haskell programs in Mathematica. In particular, I'd like to be able to code the Haskell program isMatroid::[[Int]]->Bool isMatroid b =and[or[sort(union(xs\\[x])[y]'elem'b|y<-ys]|xs<-b,ys<-b, xs<-x] I think I can do the rest of it, if I can figure out the original question, but I'd like the code to be Haskell-like. Any suggestions for implementing Haskell-like code in Mathematica would be appreciated.)

    Read the article

  • C++0x rvalue references - lvalues-rvalue binding

    - by Doug
    This is a follow-on question to http://stackoverflow.com/questions/2748866/c0x-rvalue-references-and-temporaries In the previous question, I asked how this code should work: void f(const std::string &); //less efficient void f(std::string &&); //more efficient void g(const char * arg) { f(arg); } It seems that the move overload should probably be called because of the implicit temporary, and this happens in GCC but not MSVC (or the EDG front-end used in MSVC's Intellisense). What about this code? void f(std::string &&); //NB: No const string & overload supplied void g1(const char * arg) { f(arg); } void g2(const std::string & arg) { f(arg); } It seems that, based on the answers to my previous question that function g1 is legal (and is accepted by GCC 4.3-4.5, but not by MSVC). However, GCC and MSVC both reject g2 because of clause 13.3.3.1.4/3, which prohibits lvalues from binding to rvalue ref arguments. I understand the rationale behind this - it is explained in N2831 "Fixing a safety problem with rvalue references". I also think that GCC is probably implementing this clause as intended by the authors of that paper, because the original patch to GCC was written by one of the authors (Doug Gregor). However, I don't this is quite intuitive. To me, (a) a const string & is conceptually closer to a string && than a const char *, and (b) the compiler could create a temporary string in g2, as if it were written like this: void g2(const std::string & arg) { f(std::string(arg)); } Indeed, sometimes the copy constructor is considered to be an implicit conversion operator. Syntactically, this is suggested by the form of a copy constructor, and the standard even mentions this specifically in clause 13.3.3.1.2/4, where the copy constructor for derived-base conversions is given a higher conversion rank than other implicit conversions: A conversion of an expression of class type to the same class type is given Exact Match rank, and a conversion of an expression of class type to a base class of that type is given Conversion rank, in spite of the fact that a copy/move constructor (i.e., a user-defined conversion function) is called for those cases. (I assume this is used when passing a derived class to a function like void h(Base), which takes a base class by value.) Motivation My motivation for asking this is something like the question asked in http://stackoverflow.com/questions/2696156/how-to-reduce-redundant-code-when-adding-new-c0x-rvalue-reference-operator-over ("How to reduce redundant code when adding new c++0x rvalue reference operator overloads"). If you have a function that accepts a number of potentially-moveable arguments, and would move them if it can (e.g. a factory function/constructor: Object create_object(string, vector<string>, string) or the like), and want to move or copy each argument as appropriate, you quickly start writing a lot of code. If the argument types are movable, then one could just write one version that accepts the arguments by value, as above. But if the arguments are (legacy) non-movable-but-swappable classes a la C++03, and you can't change them, then writing rvalue reference overloads is more efficient. So if lvalues did bind to rvalues via an implicit copy, then you could write just one overload like create_object(legacy_string &&, legacy_vector<legacy_string> &&, legacy_string &&) and it would more or less work like providing all the combinations of rvalue/lvalue reference overloads - actual arguments that were lvalues would get copied and then bound to the arguments, actual arguments that were rvalues would get directly bound. Questions My questions are then: Is this a valid interpretation of the standard? It seems that it's not the conventional or intended one, at any rate. Does it make intuitive sense? Is there a problem with this idea that I"m not seeing? It seems like you could get copies being quietly created when that's not exactly expected, but that's the status quo in places in C++03 anyway. Also, it would make some overloads viable when they're currently not, but I don't see it being a problem in practice. Is this a significant enough improvement that it would be worth making e.g. an experimental patch for GCC?

    Read the article

  • visual-studio-2008 versioninfo for all files updated from one place

    - by ravenspoint
    The version information, displayed when the mouse cursor hovers over the file in windows explorer, is set for a file built by visual studio in the VERSION resource. I would like to set the version in one place for all the files built by a solution, preferably when I change the version in the install properties. Is there a way to do this? The motivation for this is that if the version is not updated for a file, then the installer will leave previous versions of files instead of replacing them with new files. This happens even when the 'RemovePreviousVersions' property is set. In order to save the tedious and error prone task of updating the version in every file built and installed, I remove the version resource from all files - which is not elegant.

    Read the article

  • Can a signed Java Applet/Web Start manipulate content in a cross-site IFRAME?

    - by etoleb
    Is it possible for a signed Java Applet or Web Start app to write to the DOM of an IFRAME under a different domain? Does the fact that they're a signed applet/javaws allow them to ignore browsers' standard cross-browser security? If this does work, how well is it supported across the major browsers? Thanks! EDIT: My motivation is to add a browser plugin-like tool to third-party websites I don't control. It's not required that I use Java at all---any ideas or suggestions are encouraged.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >