Daily Archives

Articles indexed Wednesday April 14 2010

Page 2/122 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Google App Engine : PolyModel + SelfReferenceProperty

    - by rvandervort
    Is a PolyModel-based class able to be used as a SelfReferenceProperty ? I have the below code : class BaseClass(polymodel.PolyModel): attribute1 = db.IntegerProperty() attribute2 = db.StringProperty() class ParentClass(BaseClass): attribute3 = db.StringProperty() class ChildClass(BaseClass): parent = SelfReferenceProperty(collection_name = 'children') p = ParentClass() p.attribute1 = 1 p.attribute2 = "Parent Description" p.attribute3 = "Parent additional data" p.put() c = ChildClass() c.attribute1 = 5 c.attribute2 = "Child Description" c.parent = p.key() c.put() I execute this code and check the datastore via the development server's admin interface. The parent instance is saved to the datastore class = 'BaseClass,ParentClass', but the child is not. There is no error output to the browser (debug is turned on) and nothing in the launcher's log for my app. Is this possible to do ?

    Read the article

  • Is it valid for Hibernate list() to return duplicates?

    - by skaffman
    Is anyone aware of the validity of Hibernate's Criteria.list() and Query.list() methods returning multiple occurrences of the same entity? Occasionally I find when using the Criteria API, that changing the default fetch strategy in my class mapping definition (from "select" to "join") can sometimes affect how many references to the same entity can appear in the resulting output of list(), and I'm unsure whether to treat this as a bug or not. The javadoc does not define it, it simply says "The list of matched query results." (thanks guys). If this is expected and normal behaviour, then I can de-dup the list myself, that's not a problem, but if it's a bug, then I would prefer to avoid it, rather than de-dup the results and try to ignore it. Anyone got any experience of this?

    Read the article

  • Functions registered with ExternalInterface.addCallback not available in Javascript

    - by Selene
    I'm working on a Flash game that needs to call some Javascript on the page and get data back from it. Calling Javascript from Flash works. Calling the Flash functions from Javascript (often) doesn't. I'm using the Gaia framework. What happens: The swf is loaded in with SWFObject There's a button in the Flash file. On click, it uses ExternalInterface.call() to call a Javascript function. This works. The Javascript function calls a Flash function that was exposed with ExternalInterface.addCallback(). Sometimes, the Javascript produces the following error: TypeError: myFlash.testCallback is not a function. When the error happens, it affects all functions registered with addCallback(). Gaia and some of its included libraries use addCallback(), and calling those functions from Javascript also produces the TypeError. Waiting a long time before pressing the button in Flash doesn't solve the error. Having Flash re-try addCallback() periodically doesn't solve the error When the error occurs, ExternalInterface.available = true and ExternalInterface.objectID contains the correct name for the Flash embed object. When the error occurs, document.getElementById('myflashcontent') correctly returns the Flash embed object. From my Page class: public class MyPage extends AbstractPage { // declarations of stage instances and class variables // other functions override public function transitionIn():void { send_button.addEventListener(MouseEvent.MOUSE_UP, callJS); exposeCallbacks(); super.transitionIn(); } private function exposeCallbacks():void { trace("exposeCallbacks()"); if (ExternalInterface.available) { trace("ExternalInterface.objectID: " + ExternalInterface.objectID); try { ExternalInterface.addCallback("testCallback", simpleTestCallback); trace("called ExternalInterface.addCallback"); } catch (error:SecurityError) { trace("A SecurityError occurred: " + error.message + "\n"); } catch (error:Error) { trace("An Error occurred: " + error.message + "\n"); } } else { trace("exposeCallbacks() - ExternalInterface not available"); } } private function simpleTestCallback(str:String):void { trace("simpleTestCallback(str=\"" + str + "\")"); } private function callJS(e:Event):void { if (ExternalInterface.available) { ExternalInterface.call("sendTest", "name", "url"); } else { trace("callJS() - ExternalInterface not available"); } } } My Javascript: function sendTest(text, url) { var myFlash = document.getElementById("myflashcontent"); var callbackStatus = ""; callbackStatus += '\nmyFlash[testCallback]: ' + myFlash['testCallback']; //console.log(callbackStatus); var errors = false; try { myFlash.testCallback("test string"); } catch (err) { alert("Error: " + err.toString()); error = true; } if (!error) { alert("Success"); } } var params = { quality: "high", scale: "noscale", wmode: "transparent", allowscriptaccess: "always", bgcolor: "#000000" }; var flashVars = { siteXML: "xml/site.xml" }; var attributes = { id: "myflashcontent", name: "myflashcontent" }; // load the flash movie. swfobject.embedSWF("http://myurl.com/main.swf?v2", "myflashcontent", "728", "676", "10.0.0", serverRoot + "expressInstall.swf", flashVars, params, attributes, function(returnObj) { console.log('Returned ' + returnObj.success); if (returnObj.success) { returnObj.ref.focus(); } });

    Read the article

  • cannot override sys.excepthook

    - by Mert Nuhoglu
    I try to customize behavior of sys.excepthook as described by the recipe. in ipython: :import pdb, sys, traceback :def info(type, value, tb): : traceback.print_exception(type, value, tb) : pdb.pm() :sys.excepthook = info :-- >>> x[10] = 5 ------------------------------------------------- Traceback (most recent call last): File "<ipython console>", line 1, in <module> NameError: name 'x' is not defined >>> pdb.pm() is not being called. It seems that sys.excepthook = info doesn't work in my python 2.5 installation. What should I look into? Any suggestion? Thank you

    Read the article

  • include line numbers in stack trace without pdb?

    - by JoelFan
    We are currently distributing a WinForms app without .pdb files to conserve space on client machines and download bandwidth. When we get stack traces, we are getting method names but not line numbers. Is there any way to get the line numbers without resorting to distributing the .pdb files?

    Read the article

  • How do I set sys.excepthook to invoke pdb globally in python?

    - by saffsd
    From Python docs: sys.excepthook(type, value, traceback)¶ This function prints out a given traceback and exception to sys.stderr. When an exception is raised and uncaught, the interpreter calls sys.excepthook with three arguments, the exception class, exception instance, and a traceback object. In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by assigning another three-argument function to sys.excepthook. http://docs.python.org/library/sys.html How do I modify this globally so the default action is to always invoke pdb? Is there a configuration file I can change? I don't want to wrap my code to do this.

    Read the article

  • How can I inject Javascript (including Prototype.js) in other sites without cluttering the global na

    - by Daniel Magliola
    I'm currently on a project that is a big site that uses the Prototype library, and there is already a humongous amount of Javascript code. We're now working on a piece of code that will get "injected" into other people's sites (picture people adding a <script> tag in their sites) which will then run our code and add a bunch of DOM elements and functionality to their site. This will have new pieces of code, and will also reuse a lot of the code that we use on our main site. The problem I have is that it's of course not cool to just add a <script> that will include Prototype in people's pages. If we do that in a page that's already using ANY framework, we're guaranteed to screw everything up. jQuery gives us the option to "rename" the $ object, so it could handle this situation decently, except obviously for the fact that we're not using jQuery, so we'd have to migrate everything. Right now i'm contemplating a number of ugly choices, and I'm not sure what's best... Rewrite everything to use jQuery, with a renamed $ object everywhere. Creating a "new" Prototype library with only the subset we'd be using in "injected" code, and renaming $ to something else. Then again I'd have to adapt the parts of my code that would be shared somehow. Not using a library at all in injected code, to keep it as clean as possible, and rewriting the shared code to use no library at all. This would obviously degenerate into us creating our own frankenstein of a library, which is probably the worst case scenario ever. I'm wondering what you guys think I could do, and also whether there's some magic option that would solve all my problems... For example, do you think I could use something like Caja / Cajita to sandbox my own code and isolate it from the rest of the site, and have Prototype inside of there? Or am I completely missing the point with that? I also read once about a technique for bookmarklets, were you add your code like this: (function() { /* your code */ })(); And then your code is all inside your anonymous function and you haven't touched the global namespace at all. Do you think I could make one file containing: (function() { /* Full Code of the Prototype file here */ /* All my code that will run in the "other" site */ InitializeStuff_CreateDOMElements_AttachEventHandlers(); })(); Would that work? Would it accomplish the objective of not cluttering the global namespace, and not killing the functionality on a site that uses jQuery, for example? Or is Prototype too complex somehow to isolate it like that? (NOTE: I think I know that that would create closures everywhere and that's slower, but I don't care too much about performance, my code is not doing anything that complex)

    Read the article

  • Windows 7 Stopped Using hosts file for DNS Resolution

    - by AJ
    I am running Windows 7 Home Premium 64-bit. Starting today, I noticed that DNS resolution is not reading my %SYSTEMROOT%\System32\drivers\etc\hosts file. I say this because I added two new entries to the file and when I run 'nslookup' on the command line, they don't resolve. Further, just trying to resolve 'localhost' results in my primary DNS server being queried. I've read several threads that suggest that the file might have been corrupted and to move it aside and create a new one. I've done that, and no improvement. Is there some sort of registry key that controls the sequence of resources used for DNS resolution (similar to nsswitch.conf on UNIX)? What else could be causing this? Thanks in advance.

    Read the article

  • ActivePerl 5.12

    With Perl 5.12 completed, ActiveState releases business and community editions of its software ActiveState - Perl - Languages - Programming - Win32

    Read the article

  • Rewrite rules for subfolders

    - by pg
    This may seem like a silly question but I can't figure it out. let's say I have a public_html folder with various folders like: Albatross, Blackbirds, Crows and Faqs. I want to make it so that any traffic to Albatross/faqs.php, Blackbirds/faqs.php, Crows/faqs.php etc will see the file that is at faqs/faqs.php?bird=albatross or faqs/faqs.php?bird=crows or what have you. If I go into the Albatross folder's .htaccess file I can do this RewriteRule faqs.php$ /faqs/faqs.php?cat=albatross[QSA] Which works fine, but I want to put something in the top level .htacces that works for all of them, so tried: RewriteRule faqs.php$ /faqs/faqs.php?cat=albatross[QSA] RewriteRule /(.*)/faqs.php$ /faqs/faqs.php?cat=$1 [QSA] and even RewriteRule /albatross/faqs.php$ /faqs/faqs.php?cat=albatross [QSA] and various others but nothing seems to work, when I go to http://www.birdsandwhatnot.com/albatross/faqs.php I see the same file the same way it's always been. Does the presence of an .htaccess file in the subfolder conflict with the higher up .htaccess file? Am I missing something?

    Read the article

  • How much information does pdb files contain? (C# / .NET)

    - by Silver Dragon
    Is is wise to redistribute the pdb files along with a commercial application? Occasionally, I'm using the stack trace to get a more detailed error reporting logs from the deployed applications; can this functionality be achieved without relying to those files? Also, how much hints of the original source code does these files contain? Would it be easier to reverse-engineer my application using it?

    Read the article

  • No filenames in pdb program database.

    - by Nick
    I have a .pdb program database from a C++ application compiled in debug on Windows VS2005. I use the DIA SDK to find function names but I can't seem to retrieve the filenames for the symbols. Is there some switch I need to turn on? Does this work?!

    Read the article

  • Extracting fields from a define-type object in Scheme

    - by Mike
    Hi, I am trying to extract the field 'name' or 'named-expr' from the following object: (bind 'x (num 5)) ;; note that this is not a list, but a type Binding With the Binding definition: (define-type Binding (bind (name symbol?) (named-expr WAE?))) I have tried, but received the error "reference to an identifier before its definition: Binding-name." Here is what I tried typing: (begin (Binding-name (bind 'x (num 5)))) (begin (define x (bind 'x (num 5))) (Binding-name x)) Thank you!

    Read the article

  • Efficient JSON encoding for data that may be binary, but is often text

    - by Evgeny
    I need to send a JSON packet across the wire with the contents of an arbitrary file. This may be a binary file (like a ZIP file), but most often it will be plain ASCII text. I'm currently using base64 encoding, which handles all files, but it increases the size of the data significantly - even if the file is ASCII to begin with. Is there a more efficient way I can encode the data, other than manually checking for any non-ASCII characters and then deciding whether or not to base64-encode it? I'm currently writing this in Python, but will probably need to do the same in Java, C# and C++, so an easily portable solution would be preferable.

    Read the article

  • Are all the system's floating points operations the same?

    - by Jj
    We're making this web app in PHP and when working in the reports we have Excel files to compare our results to make sure our coding is doing the right operations. Now we're running into some differences due floating point arithmetics. We're doing the same divisions and multiplications and running into slightly different numbers, that add up to a notable difference. My question is if Excel is delegating it's floating point arithmetic to the CPU and PHP is also relying in the CPU for it's operations. Or does each application implements its own set of math algorithms?

    Read the article

  • How to get stack trace information for logging in production when using the GAC

    - by Jonathan Parker
    I would like to get stack trace (file name and line number) information for logging exceptions etc. in a production environment. The DLLs are installed in the GAC. Is there any way to do this? This article says about putting PDB files in the GAC: You can spot these easily because they will say you need to copy the debug symbols (.pdb file) to the GAC. In and of itself, that will not work. I know this article refers to debugging with VS but I thought it might apply to logging the stacktrace also. I've followed the instructions for the answer to this question except for unchecking Optimize code which they said was optional. I copied the dlls and pdbs into the GAC but I'm still not getting the stack trace information. Here's what I get in the log file for the stack trace: OnAuthenticate at offset 161 in file:line:column <filename unknown>:0:0 ValidateUser at offset 427 in file:line:column <filename unknown>:0:0 LogException at offset 218 in file:line:column <filename unknown>:0:0 I'm using NLog. My NLog layout is: layout="${date:format=s}|${level}|${callsite}|${identity}|${message}|${stacktrace:format=Raw}" ${stacktrace:format=Raw} being the relevant part.

    Read the article

  • show definition (browse) in *.pdb of *.dll file

    - by ala
    I have built a Library project (DLL) in .NET. And sometimes I use the DLL along with its PDB file as a reference in some other projects. Now in the new project, I cant browse through the code of the DLL to debug. I can only see the definitions of class/methods/variables. That's by using "show definition" by browsing through the "class view" However, only in case of an exception I the contents of the DLL opens and I could see the entire code of the DLL from the new project. How could I see the contents (code) of the DLL before an exception occur?

    Read the article

  • Visual Studio 2008 - Add Reference

    - by James Sun
    When adding a DLL as a reference to an ASP.Net project, VS2008 adds several files to the bin directory. If the DLL is called foo.dll, VS2008 adds foo.dll.refresh, foo.pdb and foo.xml. I know what foo.dll is :-), why does VS2008 add the other three files? What do those three files do? Can I delete them? Do they need to be added in source control?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >