Search Results

Search found 223 results on 9 pages for 'locals'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • globals and locals in python exec()

    - by hawkettc
    Hi, I'm trying to run a piece of python code using exec. my_code = """ class A(object): pass print 'locals: %s' % locals() print 'A: %s' % A class B(object): a_ref = A """ global_env = {} local_env = {} my_code_AST = compile(my_code, "My Code", "exec") exec(my_code_AST, global_env, local_env) print local_env which results in the following output locals: {'A': <class 'A'>} A: <class 'A'> Traceback (most recent call last): File "python_test.py", line 16, in <module> exec(my_code_AST, global_env, local_env) File "My Code", line 8, in <module> File "My Code", line 9, in B NameError: name 'A' is not defined However, if I change the code to this - my_code = """ class A(object): pass print 'locals: %s' % locals() print 'A: %s' % A class B(A): pass """ global_env = {} local_env = {} my_code_AST = compile(my_code, "My Code", "exec") exec(my_code_AST, global_env, local_env) print local_env then it works fine - giving the following output - locals: {'A': <class 'A'>} A: <class 'A'> {'A': <class 'A'>, 'B': <class 'B'>} Clearly A is present and accessible - what's going wrong in the first piece of code? I'm using 2.6.5, cheers, Colin * UPDATE 1 * If I check the locals() inside the class - my_code = """ class A(object): pass print 'locals: %s' % locals() print 'A: %s' % A class B(object): print locals() a_ref = A """ global_env = {} local_env = {} my_code_AST = compile(my_code, "My Code", "exec") exec(my_code_AST, global_env, local_env) print local_env Then it becomes clear that locals() is not the same in both places - locals: {'A': <class 'A'>} A: <class 'A'> {'__module__': '__builtin__'} Traceback (most recent call last): File "python_test.py", line 16, in <module> exec(my_code_AST, global_env, local_env) File "My Code", line 8, in <module> File "My Code", line 10, in B NameError: name 'A' is not defined However, if I do this, there is no problem - def f(): class A(object): pass class B(object): a_ref = A f() print 'Finished OK' * UPDATE 2 * ok, so the docs here - http://docs.python.org/reference/executionmodel.html 'A class definition is an executable statement that may use and define names. These references follow the normal rules for name resolution. The namespace of the class definition becomes the attribute dictionary of the class. Names defined at the class scope are not visible in methods.' It seems to me that 'A' should be made available as a free variable within the executable statement that is the definition of B, and this happens when we call f(), but not when we use exec(). This can be more easily shown with the following - my_code = """ class A(object): pass print 'locals in body: %s' % locals() print 'A: %s' % A def f(): print 'A in f: %s' % A f() class B(object): a_ref = A """ which outputs locals in body: {'A': <class 'A'>} A: <class 'A'> Traceback (most recent call last): File "python_test.py", line 20, in <module> exec(my_code_AST, global_env, local_env) File "My Code", line 11, in <module> File "My Code", line 9, in f NameError: global name 'A' is not defined So I guess the new question is - why aren't those locals being exposed as free variables in functions and class definitions - it seems like a pretty standard closure scenario.

    Read the article

  • ExpressJS: What is the difference between app.local and res.local?

    - by aeyang
    I'm trying to learn Express and in my app I have middleware that passes the session object from the Request object to my Response object so that I can access it in my views: app.use((req, res, next) -> res.locals.session = req.session next() ) But app.locals is available to the view as well right? So is it the same if I do app.locals.session = req.session? Is there a convention for the types of things app.locals and res.locals are used for? I was also confused on what the difference is between res.render() and res.redirect()? When should each be used? Thanks for reading. Any help related to Express is appreciated!

    Read the article

  • windbg dv cmd fail - Private symbols (symbols.pri) are required for locals

    - by leif
    i have a C++ application compiled with VS 2008 with pdb file enabled. After i tried to use dv command to display local vars, it shows the following message: Unable to enumerate locals, HRESULT0x80004005 Private symbols (symbols.pri) are required for locals. Type ".hh dbgerr005" for details. Note that: i've run the "dv" command on the correct frame which has the symbol file. i can use "dt" command successfully. i've included the symbol path and the pdb file has been loaded successfully as following: start end module name 00400000 0043f000 helloworld (private pdb symbols) c:\test... Does anyone know the cause? Is there any configuration i missed to enable local var watch? Or VS 2008 pdb is not supported by windbg (i'm using the latest windbg version)?

    Read the article

  • Passing value from :locals to link_remote_to

    - by Teef L
    In my edit.haml file, I have =render :partial => 'old_question_tags', :locals => {:current_question => @question.id}. I'd like to pass the value in :current_question to a link_to_remote call in _old_question_tags.haml: #{link_to_remote image_tag('red-x.png', {:alt => "Remove #{t.name} tag"}), :url => {:action => 'remove_old_tag_from_question', :tag_remove => t.id, :current_question => current_question}} But I get this error on the link_to_remote line: ActionView::TemplateError (undefined local variable or method `current_question' for #<ActionView::Base:0xdb2fec8>) In _old_question_tags.haml, if I just print current_question (using =current_question), it prints the number without any problems. How do I properly pass that value to the partial so that I can pass it to the link_to_remote call?

    Read the article

  • Are returned locals automatically xvalues

    - by mark
    Following on from a comment I made on this: passing std::vector to constructor and move semantics Is the std::move necessary in the following code, to ensure that the returned value is a xvalue? std::vector<string> buildVector() { std::vector<string> local; // .... build a vector return std::move(local); } It is my understanding that this is required. I have often seen this used when returning a std::unique_ptr from a function, however GManNickG made the following comment: It is my understanding that in a return statement all local variables are automatically xvalues (expiring values) and will be moved, but I'm unsure if that only applies to the returned object itself. So OP should go ahead and put that in there until I'm more confident it shouldn't have to be. :) Can anyone clarify if the std::move is necessary? Is the behaviour compiler dependent?

    Read the article

  • Windows XP Ubuntu Installer (version 11.10) error dialog - Permission Denied

    - by MacGyver
    When installing Ubuntu 11.10 on Windows XP (2nd option in installer), the install failed with popup. How can I fix this? Here is the contents of file "C:\Documents and Settings\Keith\Local Settings\Temp\wubi-11.10-rev241.log". I only pasted the last few lines because of the question size limit. \Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp is a valid Kubuntu CD 03-25 22:29 DEBUG Distro: does not contain C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp is a valid Kubuntu CD 03-25 22:29 DEBUG Distro: does not contain C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp is a valid Xubuntu CD 03-25 22:29 DEBUG Distro: does not contain C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp is a valid Xubuntu CD 03-25 22:29 DEBUG Distro: does not contain C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp is a valid Mythbuntu CD 03-25 22:29 DEBUG Distro: does not contain C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp is a valid Mythbuntu CD 03-25 22:29 DEBUG Distro: does not contain C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Ubuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Ubuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Kubuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Kubuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Xubuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Xubuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Mythbuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether D:\ is a valid Mythbuntu CD 03-25 22:29 DEBUG Distro: does not contain D:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Ubuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Ubuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Kubuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Kubuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Xubuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Xubuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Mythbuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether E:\ is a valid Mythbuntu CD 03-25 22:29 DEBUG Distro: does not contain E:\casper\filesystem.squashfs 03-25 22:29 DEBUG Distro: checking whether Y:\ is a valid Ubuntu CD 03-25 22:29 INFO Distro: Found a valid CD for Ubuntu: Y:\ 03-25 22:29 INFO root: Running the installer... 03-25 22:29 INFO WinuiPage: appname=wubi, localedir=C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\translations, languages=['en_US', 'en'] 03-25 22:29 INFO WinuiPage: appname=wubi, localedir=C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\translations, languages=['en_US', 'en'] 03-25 22:29 DEBUG WinuiInstallationPage: target_drive=C:, installation_size=18000MB, distro_name=Ubuntu, language=en_US, locale=en_US.UTF-8, username=keith 03-25 22:29 INFO root: Received settings 03-25 22:29 INFO WinuiPage: appname=wubi, localedir=C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\translations, languages=['en_US', 'en'] 03-25 22:29 DEBUG TaskList: # Running tasklist... 03-25 22:29 DEBUG TaskList: ## Running select_target_dir... 03-25 22:29 INFO WindowsBackend: Installing into C:\ubuntu 03-25 22:29 DEBUG TaskList: ## Finished select_target_dir 03-25 22:29 DEBUG TaskList: ## Running create_dir_structure... 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu\disks 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu\install 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu\install\boot 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu\disks\boot 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu\disks\boot\grub 03-25 22:29 DEBUG CommonBackend: Creating dir C:\ubuntu\install\boot\grub 03-25 22:29 DEBUG TaskList: ## Finished create_dir_structure 03-25 22:29 DEBUG TaskList: ## Running uncompress_target_dir... 03-25 22:29 DEBUG TaskList: ## Finished uncompress_target_dir 03-25 22:29 DEBUG TaskList: ## Running create_uninstaller... 03-25 22:29 DEBUG WindowsBackend: Copying uninstaller Y:\wubi.exe -> C:\ubuntu\uninstall-wubi.exe 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi UninstallString C:\ubuntu\uninstall-wubi.exe 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi InstallationDir C:\ubuntu 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi DisplayName Ubuntu 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi DisplayIcon C:\ubuntu\Ubuntu.ico 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi DisplayVersion 11.10-rev241 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi Publisher Ubuntu 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi URLInfoAbout http://www.ubuntu.com 03-25 22:29 DEBUG registry: Setting registry key -2147483646 Software\Microsoft\Windows\CurrentVersion\Uninstall\Wubi HelpLink http://www.ubuntu.com/support 03-25 22:29 DEBUG TaskList: ## Finished create_uninstaller 03-25 22:29 DEBUG TaskList: ## Running copy_installation_files... 03-25 22:29 DEBUG WindowsBackend: Copying C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\data\custom-installation -> C:\ubuntu\install\custom-installation 03-25 22:29 DEBUG WindowsBackend: Copying C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\winboot -> C:\ubuntu\winboot 03-25 22:29 DEBUG WindowsBackend: Copying C:\DOCUME~1\Keith\LOCALS~1\Temp\pyl1.tmp\data\images\Ubuntu.ico -> C:\ubuntu\Ubuntu.ico 03-25 22:29 DEBUG TaskList: ## Finished copy_installation_files 03-25 22:29 DEBUG TaskList: ## Running get_iso... 03-25 22:29 DEBUG TaskList: New task copy_file 03-25 22:29 DEBUG TaskList: ### Running copy_file... 03-25 22:32 ERROR TaskList: [Errno 13] Permission denied Traceback (most recent call last): File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\utils.py", line 202, in copy_file IOError: [Errno 13] Permission denied 03-25 22:32 DEBUG TaskList: # Cancelling tasklist 03-25 22:32 DEBUG TaskList: New task check_iso 03-25 22:32 ERROR root: [Errno 13] Permission denied Traceback (most recent call last): File "\lib\wubi\application.py", line 58, in run File "\lib\wubi\application.py", line 130, in select_task File "\lib\wubi\application.py", line 205, in run_cd_menu File "\lib\wubi\application.py", line 120, in select_task File "\lib\wubi\application.py", line 158, in run_installer File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\utils.py", line 202, in copy_file IOError: [Errno 13] Permission denied 03-25 22:32 ERROR TaskList: 'WindowsBackend' object has no attribute 'iso_path' Traceback (most recent call last): File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\backend.py", line 579, in get_iso File "\lib\wubi\backends\common\backend.py", line 565, in use_iso AttributeError: 'WindowsBackend' object has no attribute 'iso_path' 03-25 22:32 DEBUG TaskList: # Cancelling tasklist 03-25 22:32 DEBUG TaskList: # Finished tasklist

    Read the article

  • Trying to convert simple midlet application to Android application but running into problems.

    - by chobo2
    Hi I am trying to do some threading in Android so I took an old threading assignment I had done fora midlet and took out the midlet code and replaced it with android code(such as textview). package com.assignment1; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class Threading extends Activity { private TextView tortose; private TextView hare; private Thread hareThread; private Thread torotoseThread; private int num = 0; private int num2 = 0; public Threading() { } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tortose = (TextView) findViewById(R.id.TextView01); hare = (TextView) findViewById(R.id.TextView02); Hare newHare = new Hare(); hareThread = new Thread(newHare); hareThread.start(); Torotose newTortose = new Torotose(); torotoseThread = new Thread(newTortose); torotoseThread.start(); //updateDisplay(); } private synchronized void check(int value1, int value2) { if((value1-value2) >= 10) { try { wait(); } catch(Exception ex) { System.out.println(ex); } } } private synchronized void getGoing(int value1, int value2) { if((value1-value2) == 0) { try { notify(); } catch(Exception ex) { System.out.println(ex); } } } private class Hare extends Thread { public void run() { while(true) { num++; hare.setText(Integer.toString(num)); check(num, num2); try { // are threads different in andriod apps? Thread.sleep(100); // hareThread.sleep(100); } catch(Exception ex) { System.out.println(ex); } } } } private class Torotose extends Thread { public void run() { while(true) { num2++; tortose.setText(Integer.toString(num2)); getGoing(num,num2); try { Thread.sleep(200); //torotoseThread.sleep(200); } catch(Exception ex) { System.out.println(ex); } } } } } First it wanted me to change my threads to like static threads.So is this just how Android does it? Next when I run this code it just crashes with some unexpected error. I am not sure what the error is but when I try to debug it and goes to like to create a new "hare" object it shows me this. // Compiled from ClassLoader.java (version 1.5 : 49.0, super bit) public abstract class java.lang.ClassLoader { // Method descriptor #8 ()V // Stack: 3, Locals: 1 protected ClassLoader(); 0 aload_0 [this] 1 invokespecial java.lang.Object() [1] 4 new java.lang.RuntimeException [2] 7 dup 8 ldc <String "Stub!"> [3] 10 invokespecial java.lang.RuntimeException(java.lang.String) [4] 13 athrow Line numbers: [pc: 0, line: 4] Local variable table: [pc: 0, pc: 14] local: this index: 0 type: java.lang.ClassLoader // Method descriptor #14 (Ljava/lang/ClassLoader;)V // Stack: 3, Locals: 2 protected ClassLoader(java.lang.ClassLoader parentLoader); 0 aload_0 [this] 1 invokespecial java.lang.Object() [1] 4 new java.lang.RuntimeException [2] 7 dup 8 ldc <String "Stub!"> [3] 10 invokespecial java.lang.RuntimeException(java.lang.String) [4] 13 athrow Line numbers: [pc: 0, line: 5] Local variable table: [pc: 0, pc: 14] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 14] local: parentLoader index: 1 type: java.lang.ClassLoader // Method descriptor #17 ()Ljava/lang/ClassLoader; // Stack: 3, Locals: 0 public static java.lang.ClassLoader getSystemClassLoader(); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 6] // Method descriptor #19 (Ljava/lang/String;)Ljava/net/URL; // Stack: 3, Locals: 1 public static java.net.URL getSystemResource(java.lang.String resName); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 7] Local variable table: [pc: 0, pc: 10] local: resName index: 0 type: java.lang.String // Method descriptor #23 (Ljava/lang/String;)Ljava/util/Enumeration; // Signature: (Ljava/lang/String;)Ljava/util/Enumeration<Ljava/net/URL;>; // Stack: 3, Locals: 1 public static java.util.Enumeration getSystemResources(java.lang.String resName) throws java.io.IOException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 8] Local variable table: [pc: 0, pc: 10] local: resName index: 0 type: java.lang.String // Method descriptor #29 (Ljava/lang/String;)Ljava/io/InputStream; // Stack: 3, Locals: 1 public static java.io.InputStream getSystemResourceAsStream(java.lang.String resName); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 9] Local variable table: [pc: 0, pc: 10] local: resName index: 0 type: java.lang.String // Method descriptor #31 ([BII)Ljava/lang/Class; // Signature: ([BII)Ljava/lang/Class<*>; // Stack: 3, Locals: 4 protected final java.lang.Class defineClass(byte[] classRep, int offset, int length) throws java.lang.ClassFormatError; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 10] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: classRep index: 1 type: byte[] [pc: 0, pc: 10] local: offset index: 2 type: int [pc: 0, pc: 10] local: length index: 3 type: int // Method descriptor #39 (Ljava/lang/String;[BII)Ljava/lang/Class; // Signature: (Ljava/lang/String;[BII)Ljava/lang/Class<*>; // Stack: 3, Locals: 5 protected final java.lang.Class defineClass(java.lang.String className, byte[] classRep, int offset, int length) throws java.lang.ClassFormatError; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 11] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String [pc: 0, pc: 10] local: classRep index: 2 type: byte[] [pc: 0, pc: 10] local: offset index: 3 type: int [pc: 0, pc: 10] local: length index: 4 type: int // Method descriptor #42 (Ljava/lang/String;[BIILjava/security/ProtectionDomain;)Ljava/lang/Class; // Signature: (Ljava/lang/String;[BIILjava/security/ProtectionDomain;)Ljava/lang/Class<*>; // Stack: 3, Locals: 6 protected final java.lang.Class defineClass(java.lang.String className, byte[] classRep, int offset, int length, java.security.ProtectionDomain protectionDomain) throws java.lang.ClassFormatError; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 12] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String [pc: 0, pc: 10] local: classRep index: 2 type: byte[] [pc: 0, pc: 10] local: offset index: 3 type: int [pc: 0, pc: 10] local: length index: 4 type: int [pc: 0, pc: 10] local: protectionDomain index: 5 type: java.security.ProtectionDomain // Method descriptor #46 (Ljava/lang/String;Ljava/nio/ByteBuffer;Ljava/security/ProtectionDomain;)Ljava/lang/Class; // Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;Ljava/security/ProtectionDomain;)Ljava/lang/Class<*>; // Stack: 3, Locals: 4 protected final java.lang.Class defineClass(java.lang.String name, java.nio.ByteBuffer b, java.security.ProtectionDomain protectionDomain) throws java.lang.ClassFormatError; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 13] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: name index: 1 type: java.lang.String [pc: 0, pc: 10] local: b index: 2 type: java.nio.ByteBuffer [pc: 0, pc: 10] local: protectionDomain index: 3 type: java.security.ProtectionDomain // Method descriptor #52 (Ljava/lang/String;)Ljava/lang/Class; // Signature: (Ljava/lang/String;)Ljava/lang/Class<*>; // Stack: 3, Locals: 2 protected java.lang.Class findClass(java.lang.String className) throws java.lang.ClassNotFoundException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 14] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String // Method descriptor #52 (Ljava/lang/String;)Ljava/lang/Class; // Signature: (Ljava/lang/String;)Ljava/lang/Class<*>; // Stack: 3, Locals: 2 protected final java.lang.Class findLoadedClass(java.lang.String className); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 15] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String // Method descriptor #52 (Ljava/lang/String;)Ljava/lang/Class; // Signature: (Ljava/lang/String;)Ljava/lang/Class<*>; // Stack: 3, Locals: 2 protected final java.lang.Class findSystemClass(java.lang.String className) throws java.lang.ClassNotFoundException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 16] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String // Method descriptor #17 ()Ljava/lang/ClassLoader; // Stack: 3, Locals: 1 public final java.lang.ClassLoader getParent(); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 17] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader // Method descriptor #19 (Ljava/lang/String;)Ljava/net/URL; // Stack: 3, Locals: 2 public java.net.URL getResource(java.lang.String resName); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 18] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: resName index: 1 type: java.lang.String // Method descriptor #23 (Ljava/lang/String;)Ljava/util/Enumeration; // Signature: (Ljava/lang/String;)Ljava/util/Enumeration<Ljava/net/URL;>; // Stack: 3, Locals: 2 public java.util.Enumeration getResources(java.lang.String resName) throws java.io.IOException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 19] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: resName index: 1 type: java.lang.String // Method descriptor #29 (Ljava/lang/String;)Ljava/io/InputStream; // Stack: 3, Locals: 2 public java.io.InputStream getResourceAsStream(java.lang.String resName); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 20] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: resName index: 1 type: java.lang.String // Method descriptor #52 (Ljava/lang/String;)Ljava/lang/Class; // Signature: (Ljava/lang/String;)Ljava/lang/Class<*>; // Stack: 3, Locals: 2 public java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 21] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String // Method descriptor #62 (Ljava/lang/String;Z)Ljava/lang/Class; // Signature: (Ljava/lang/String;Z)Ljava/lang/Class<*>; // Stack: 3, Locals: 3 protected java.lang.Class loadClass(java.lang.String className, boolean resolve) throws java.lang.ClassNotFoundException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 22] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: className index: 1 type: java.lang.String [pc: 0, pc: 10] local: resolve index: 2 type: boolean // Method descriptor #67 (Ljava/lang/Class;)V // Signature: (Ljava/lang/Class<*>;)V // Stack: 3, Locals: 2 protected final void resolveClass(java.lang.Class clazz); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 23] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: clazz index: 1 type: java.lang.Class Local variable type table: [pc: 0, pc: 10] local: clazz index: 1 type: java.lang.Class<?> // Method descriptor #19 (Ljava/lang/String;)Ljava/net/URL; // Stack: 3, Locals: 2 protected java.net.URL findResource(java.lang.String resName); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 24] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: resName index: 1 type: java.lang.String // Method descriptor #23 (Ljava/lang/String;)Ljava/util/Enumeration; // Signature: (Ljava/lang/String;)Ljava/util/Enumeration<Ljava/net/URL;>; // Stack: 3, Locals: 2 protected java.util.Enumeration findResources(java.lang.String resName) throws java.io.IOException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 25] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: resName index: 1 type: java.lang.String // Method descriptor #76 (Ljava/lang/String;)Ljava/lang/String; // Stack: 3, Locals: 2 protected java.lang.String findLibrary(java.lang.String libName); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 26] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: libName index: 1 type: java.lang.String // Method descriptor #79 (Ljava/lang/String;)Ljava/lang/Package; // Stack: 3, Locals: 2 protected java.lang.Package getPackage(java.lang.String name); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 27] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: name index: 1 type: java.lang.String // Method descriptor #81 ()[Ljava/lang/Package; // Stack: 3, Locals: 1 protected java.lang.Package[] getPackages(); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 28] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader // Method descriptor #83 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/net/URL;)Ljava/lang/Package; // Stack: 3, Locals: 9 protected java.lang.Package definePackage(java.lang.String name, java.lang.String specTitle, java.lang.String specVersion, java.lang.String specVendor, java.lang.String implTitle, java.lang.String implVersion, java.lang.String implVendor, java.net.URL sealBase) throws java.lang.IllegalArgumentException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 29] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: name index: 1 type: java.lang.String [pc: 0, pc: 10] local: specTitle index: 2 type: java.lang.String [pc: 0, pc: 10] local: specVersion index: 3 type: java.lang.String [pc: 0, pc: 10] local: specVendor index: 4 type: java.lang.String [pc: 0, pc: 10] local: implTitle index: 5 type: java.lang.String [pc: 0, pc: 10] local: implVersion index: 6 type: java.lang.String [pc: 0, pc: 10] local: implVendor index: 7 type: java.lang.String [pc: 0, pc: 10] local: sealBase index: 8 type: java.net.URL // Method descriptor #94 (Ljava/lang/Class;[Ljava/lang/Object;)V // Signature: (Ljava/lang/Class<*>;[Ljava/lang/Object;)V // Stack: 3, Locals: 3 protected final void setSigners(java.lang.Class c, java.lang.Object[] signers); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 30] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: c index: 1 type: java.lang.Class [pc: 0, pc: 10] local: signers index: 2 type: java.lang.Object[] Local variable type table: [pc: 0, pc: 10] local: c index: 1 type: java.lang.Class<?> // Method descriptor #100 (Ljava/lang/String;Z)V // Stack: 3, Locals: 3 public void setClassAssertionStatus(java.lang.String cname, boolean enable); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 31] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: cname index: 1 type: java.lang.String [pc: 0, pc: 10] local: enable index: 2 type: boolean // Method descriptor #100 (Ljava/lang/String;Z)V // Stack: 3, Locals: 3 public void setPackageAssertionStatus(java.lang.String pname, boolean enable); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 32] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: pname index: 1 type: java.lang.String [pc: 0, pc: 10] local: enable index: 2 type: boolean // Method descriptor #106 (Z)V // Stack: 3, Locals: 2 public void setDefaultAssertionStatus(boolean enable); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 33] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader [pc: 0, pc: 10] local: enable index: 1 type: boolean // Method descriptor #8 ()V // Stack: 3, Locals: 1 public void clearAssertionStatus(); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 34] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: java.lang.ClassLoader } So I am not sure where I went wrong. Thanks

    Read the article

  • English Error Messages in German Visual Studio 2008 / ASP.NET

    - by BlaM
    This might be a bit weird question, but I'll give it a shot: HELP, my Visual Studio 2008 / ASP.NET is giving me GERMAN error messages. Besides the fact that translations tend to be not as good as the original text, I can't search for those and find relevant answers to my problems on the internet. So: How do I switch my German Visual Studio 2008 Standard Edition to English locals? Update - Just to make it clear: I am a German developer, working with a German Windows Vista... I also have a German version of Visual Studio, so it is not surprising, that everything is German. Is just don't want it that way... There must be a way to install english locals into my Visual Studio, though? Or uninstall german ones, so that default english is used?!? (BTW: Same thing for SQL Server Management Studio, too. F**k "Sichten". I want "Views". That's how you really call them. No one says "Sichten", not even here in Germany, and not even though it is translated correctly).

    Read the article

  • Python: load variables in a dict into namespace

    - by celil
    I want to use a bunch of local variables defined in a function, outside of the function, so I am passing x=locals() as a return value. How can I load all the variables defined in that dictionary into the namespace outside the function, so that instead of accessing the value using x['variable'], I could simply use variable.

    Read the article

  • Can I programatically get hold of the Autos/local variables that is shown when debugging?

    - by Stefan
    Im trying to build an error-logger that loggs running values that is active in the function that caused the error. (just for fun so its not a critical problem) When going in break-mode and looking at the locals-tab and autos-tab you can see all active variables (name, type and value), it would be useful to get hold of that for logging purposes when an error occur and on some other occasions. For my example, I just want to find all local variables that are of type string and integer and store the name and value of them. Is this possible with reflection? Any tips or pointers that get me closer to my goal would be very appreciated. I have toyed with using expression on a specifik object (a structure) to create an automapper against a dataset, but I have not done anything like what I ask for above, so please make me happy and say its possible. Thanks.

    Read the article

  • Can 'locals' be used with 'collection' when rendering partials in Rails?

    - by Gav
    Everything works okay when I try to render a partial like this: = render :partial => "/shared/enquiry/car_type", :collection => @enquiry.available_car_types However, if I also want to pass a variable (in this case 'path', because I'm sharing this partial across two forms), the path is not available to me: = render :partial => "/shared/enquiry/car_type", :collection => @enquiry.available_car_types, :locals => {:path => customers_enquiry_path} I've tried moving things around, but nothing appears to work, leading me to believe one cannot use locals with collections. Any help would be appreciated. Gav

    Read the article

  • Why aren't the :locals hash variables being passed in to a partial, when called from inside my rake

    - by marshally
    I need to render a bunch of painfully long running partials using a rake task. When I try to pull the partial from a rake task, I get the dreaded "Called id for nil, which would mistakenly be 4" error, which usually means that my locals hash has not been properly set into the partial. Here's the rake task (some variable names have been changed to protect the innocent): namespace :precache do desc "Precache stuff" task :precache => :environment do av = ActionView::Base.new(Rails::Configuration.new.view_path, {}) av.class_eval do include ApplicationHelper end @user = User.find(21) @rank = Rank.find(2) data = av.render(:partial => "reports/listing", :locals => {:user => @user, :rank => @rank}) end end And this is the error that I am getting: ** Execute precache:precache rake aborted! Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id On line #1 of app/views/reports/listing.html.erb 1: <%- @rid = @rank.id %> 2: <%- @cid = @user.id %> 3: <%- cache(:action => 'reports', :key => [arg1, arg2, arg3] ) do %> 4: <%- app/views/reports/_downline_js.html.erb:1 lib/tasks/precache_fragments.rake:12 rake (0.8.7) lib/rake.rb:636:in `call' rake (0.8.7) lib/rake.rb:636:in `execute' rake (0.8.7) lib/rake.rb:631:in `each' rake (0.8.7) lib/rake.rb:631:in `execute' rake (0.8.7) lib/rake.rb:597:in `invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' rake (0.8.7) lib/rake.rb:590:in `invoke_with_call_chain' rake (0.8.7) lib/rake.rb:583:in `invoke' rake (0.8.7) lib/rake.rb:2051:in `invoke_task' rake (0.8.7) lib/rake.rb:2029:in `top_level' rake (0.8.7) lib/rake.rb:2029:in `each' rake (0.8.7) lib/rake.rb:2029:in `top_level' rake (0.8.7) lib/rake.rb:2068:in `standard_exception_handling' rake (0.8.7) lib/rake.rb:2023:in `top_level' rake (0.8.7) lib/rake.rb:2001:in `run' rake (0.8.7) lib/rake.rb:2068:in `standard_exception_handling' rake (0.8.7) lib/rake.rb:1998:in `run' rake (0.8.7) bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 details: I'm using Rails 2.3.5 and Ruby 1.8.7. Developing on Mac OSX. Eventually I will be deploying to Heroku.

    Read the article

  • Is there any way to evaluate (expand-file-name) in .dir-locals.el?

    - by vava
    I'm trying to move all my compilation config (compilation-command and compilation-directory to be exact) to .dir-locals.el file at the top of my project. It is working fine except that I can't find the way to use expand-file-name there and without it I have to use absolute path, which is not really convenient. So, is there a way (or a dirty hack) to make local directory variables to evaluate values before assigning?

    Read the article

  • python: strange behavior about exec statement

    - by ifocus
    exec statement: exec code [ in globals[, locals]] When I execute the following code in python, the result really confused me. Some of the variables were setup into the globals, some were setup into the locals. s = """ # test var define int_v1 = 1 list_v1 = [1, 2, 3] dict_v1 = {1: 'hello', 2:'world', 3:'!'} # test built-in function list_v2 = [float(x) for x in list_v1] len_list_v1 = len(list_v1) # test function define def func(): global g_var, list_v1, dict_v1 print 'access var in globals:' print g_var print 'access var in locals:' for x in list_v1: print dict_v1[x] """ g = {'__builtins__': __builtins__, 'g_var': 'global'} l = {} exec s in g, l print 'globals:', g print 'locals:', l exec 'func()' in g, l the result in python2.6.5: globals: {'__builtins__': <module '__builtin__' (built-in)>, 'dict_v1': {1: 'hello', 2: 'world', 3: '!'}, 'g_var': 'global', 'list_v1': [1, 2, 3]} locals: {'int_v1': 1, 'func': <function func at 0x00ACA270>, 'x': 3, 'len_list_v1': 3, 'list_v2': [1.0, 2.0, 3.0]} access var in globals: global access var in locals: hello world ! And if I want to setup all variables and functions into the locals, and keep the rights of accessing the globals. How to do ?

    Read the article

  • How to reload Django models without losing my locals in an interactive session?

    - by Gj
    I'm doing some research with an interactive shell and using a Django app (shell_plus) for storing data and browsing it using the convenient admin. Occasionally I add or change some of the app models, and run a syncdb (or South migration when changing a model). The changes to the models don't take effect in my interactive session even if I re-import the app models. Thus I'm forced to restart the shell_plus and lose my precious locals() in the process. Is there any way to reload the models during a session? Thanks!!

    Read the article

  • Basic data alignment question

    - by Broken Logic
    I've been playing around to see how my computer works under the hood. What I'm interested in is seeing is what happens on the stack inside a function. To do this I've written the following toy program: #include <stdio.h> void __cdecl Test1(char a, unsigned long long b, char c) { char c1; unsigned long long b1; char a1; c1 = 'b'; b1 = 4; a1 = 'r'; printf("%d %d - %d - %d %d Total: %d\n", (long)&b1 - (long)&a1, (long)&c1 - (long)&b1, (long)&a - (long)&c1, (long)&b - (long)&a, (long)&c - (long)&b, (long)&c - (long)&a1 ); }; struct TestStruct { char a; unsigned long long b; char c; }; void __cdecl Test2(char a, unsigned long long b, char c) { TestStruct locals; locals.a = 'b'; locals.b = 4; locals.c = 'r'; printf("%d %d - %d - %d %d Total: %d\n", (long)&locals.b - (long)&locals.a, (long)&locals.c - (long)&locals.b, (long)&a - (long)&locals.c, (long)&b - (long)&a, (long)&c - (long)&b, (long)&c - (long)&locals.a ); }; int main() { Test1('f', 0, 'o'); Test2('f', 0, 'o'); return 0; } And this spits out the following: 9 19 - 13 - 4 8 Total: 53 8 8 - 24 - 4 8 Total: 52 The function args are well behaved but as the calling convention is specified, I'd expect this. But the local variables are a bit wonky. My question is, why wouldn't these be the same? The second call seems to produce a more compact and better aligned stack. Looking at the ASM is unenlightening (at least to me), as the variable addresses are still aliased there. So I guess this is really a question about the assembler itself allocates the stack to local variables. I realise that any specific answer is likely to be platform specific. I'm more interested in a general explanation unless this quirk really is platform specific. For the record though, I'm compiling with VS2010 on a 64bit Intel machine.

    Read the article

  • DexFile.class error in eclipse

    - by ninjasense
    I get this weird error everytime I debug in eclipse. It just seemed to appear one day and I was wondering if anyone else was running int the same problem. It does not affect my app in anyway visibly and does not cause a crash but it is an annoyance while debugging. Here is the full error: // Compiled from DexFile.java (version 1.5 : 49.0, super bit) public final class dalvik.system.DexFile { // Method descriptor #8 (Ljava/io/File;)V // Stack: 3, Locals: 2 public DexFile(java.io.File file) throws java.io.IOException; 0 aload_0 [this] 1 invokespecial java.lang.Object() [1] 4 new java.lang.RuntimeException [2] 7 dup 8 ldc <String "Stub!"> [3] 10 invokespecial java.lang.RuntimeException(java.lang.String) [4] 13 athrow Line numbers: [pc: 0, line: 4] Local variable table: [pc: 0, pc: 14] local: this index: 0 type: dalvik.system.DexFile [pc: 0, pc: 14] local: file index: 1 type: java.io.File // Method descriptor #18 (Ljava/lang/String;)V // Stack: 3, Locals: 2 public DexFile(java.lang.String fileName) throws java.io.IOException; 0 aload_0 [this] 1 invokespecial java.lang.Object() [1] 4 new java.lang.RuntimeException [2] 7 dup 8 ldc <String "Stub!"> [3] 10 invokespecial java.lang.RuntimeException(java.lang.String) [4] 13 athrow Line numbers: [pc: 0, line: 5] Local variable table: [pc: 0, pc: 14] local: this index: 0 type: dalvik.system.DexFile [pc: 0, pc: 14] local: fileName index: 1 type: java.lang.String // Method descriptor #22 (Ljava/lang/String;Ljava/lang/String;I)Ldalvik/system/DexFile; // Stack: 3, Locals: 3 public static dalvik.system.DexFile loadDex(java.lang.String sourcePathName, java.lang.String outputPathName, int flags) throws java.io.IOException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 6] Local variable table: [pc: 0, pc: 10] local: sourcePathName index: 0 type: java.lang.String [pc: 0, pc: 10] local: outputPathName index: 1 type: java.lang.String [pc: 0, pc: 10] local: flags index: 2 type: int // Method descriptor #28 ()Ljava/lang/String; // Stack: 3, Locals: 1 public java.lang.String getName(); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 7] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile // Method descriptor #30 ()V // Stack: 3, Locals: 1 public void close() throws java.io.IOException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 8] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile // Method descriptor #32 (Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/Class; // Stack: 3, Locals: 3 public java.lang.Class loadClass(java.lang.String name, java.lang.ClassLoader loader); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 9] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile [pc: 0, pc: 10] local: name index: 1 type: java.lang.String [pc: 0, pc: 10] local: loader index: 2 type: java.lang.ClassLoader // Method descriptor #37 ()Ljava/util/Enumeration; // Signature: ()Ljava/util/Enumeration<Ljava/lang/String;>; // Stack: 3, Locals: 1 public java.util.Enumeration entries(); 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 10] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile // Method descriptor #30 ()V // Stack: 3, Locals: 1 protected void finalize() throws java.io.IOException; 0 new java.lang.RuntimeException [2] 3 dup 4 ldc <String "Stub!"> [3] 6 invokespecial java.lang.RuntimeException(java.lang.String) [4] 9 athrow Line numbers: [pc: 0, line: 11] Local variable table: [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile // Method descriptor #42 (Ljava/lang/String;)Z public static native boolean isDexOptNeeded(java.lang.String arg0) throws java.io.FileNotFoundException, java.io.IOException; } Thanks

    Read the article

  • Ruby w/ Postgres & Sinatra - Query won't order right with parameter??

    - by alleywayjack
    So I set a variable in my main ruby file that's handling all my post and get requests and then use ERB templates to actually show the pages. I pass the database handler itself into the erb templates, and then run a query in the template to get all (for this example) grants. In my main ruby file: grants_main_order = "id_num" get '/grants' do erb :grants, :locals => {:db=>db, :order=>grants_main_order, :message=>params[:message]} end In the erb template: db = locals[:db] getGrants = db.exec("SELECT * FROM grants ORDER BY $1", [locals[:order]]) This produces some very random ordering, however if I replace the $1 with id_num, it works as it should. Is this a typing issue? How can I fix this? Using string replacement with #{locals[:order]} also gives funky results.

    Read the article

  • Creating AST for shared and local variables

    - by Rizwan Abbasi
    Here is my grammar grammar simulator; options { language = Java; output = AST; ASTLabelType=CommonTree; } //imaginary tokens tokens{ SHARED; LOCALS; BOOL; RANGE; ARRAY; } parse : declaration+ ; declaration :variables ; variables : locals ; locals : (bool | range | array) ; bool :ID 'in' '[' ID ',' ID ']' ('init' ID)? -> ^(BOOL ID ID ID ID?) ; range : ID 'in' '[' INT '..' INT ']' ('init' INT)? -> ^(RANGE ID INT INT INT?) ; array :ID 'in' 'array' 'of' '[' INT '..' INT ']' ('init' INT)? -> ^(ARRAY ID INT INT INT?) ; ID : (('a'..'z' | 'A'..'Z'|'_')('a'..'z' | 'A'..'Z'|'0'..'9'|'_'))* ; INT : ('0'..'9')+ ; WHITESPACE : ('\t' | ' ' | '\r' | '\n' | '\u000C')+ {$channel = HIDDEN;} ; INPUT flag in [down, up] init down pc in [0..7] init 0 CA in array of [0..5] init 0 AST It is having a small problem. Variables (bool, range or array) can be of two abstract types 1. locals (each object will have it's own variable) 2. shared (think of static in java, same for all object) Now the requirements are changed. I want the user to input like this NEW INPUT domains: upDown [up,down] possibleStates [0-7] booleans [true,false] locals: pc in possibleStates init 0 flag in upDown init down flag1 in upDown init down map in array of booleans init false shared: pcs in possibleStates init 0 flag in upDown init down flag1 in upDown init down maps in array of booleans init false Again, all the variables can be of two types (of any domain sepecified) 1. Local 2. Shared In Domains: upDown [up,down] possibleStates [0-7] upDown, up, down and possibleStates are of type ID (ID is defined in my above grammar), 0 and 7 are of type INT Can any body help me how to convert my current grammar to meet new specifications.

    Read the article

  • Rails: Should partials be aware of instance variables?

    - by Alexandre
    Ryan Bates' nifty_scaffolding, for example, does this edit.html.erb <%= render :partial => 'form' %> new.html.erb <%= render :partial => 'form' %> _form.html.erb <%= form_for @some_object_defined_in_action %> That hidden state makes me feel uncomfortable, so I usually like to do this edit.html.erb <%= render :partial => 'form', :locals => { :object => @my_object } %> _form.html.erb <%= form_for object %> So which is better: a) having partials access instance variables or b) passing a partial all the variables it needs? I've been opting for b) as of late, but I did run into a little pickle: some_action.html.erb <% @dad.sons.each do |a_son| %> <%= render :partial => 'partial', :locals => { :son => a_son } %> <% end %> _partial.html.erb The son's name is <%= son.name %> The dad's name is <%= son.dad.name %> son.dad makes a database call to fetch the dad! So I would either have to access @dad, which would be going back to a) having partials access instance variables or I would have to pass @dad in locals, changing render :partial to <%= render :partial = 'partial', :locals = { :dad = @dad, :son = a_son } %, and for some reason passing a bunch of vars to my partial makes me feel uncomfortable. Maybe others feel this way as well. Hopefully that made some sense. Looking for some insight into this whole thing... Thanks!

    Read the article

  • Windows XP restarts itself suddenly

    - by LaD
    My computer (Windows XP sp3) gets stuck suddenly and restarts itself. When Windows loads I get the following message: error Signature: BCCode : 100000d1 BCP1 : 0000674B BCP2 : 00000002 BCP3 : 00000000 BCP4 : BA9910DC OSVer : 5_1_2600 SP : 3_0 Product : 256_1 error report content: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\WER811d.dir00\Mini090909-02.dmp C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\WER811d.dir00\sysdata.xml Help! Thanks.

    Read the article

  • Trouble Emitting Object Array using Reflection.Emit

    - by JoeGeeky
    I am trying to Emit what I thought would be a simple object array that would result in code similar to the below example object[] parameters = new object[] { a, b, }; When I write the above code in C# using VS, I get the following IL. As expected this works. .locals init ( [0] object[] parameters, [1] object[] CS$0$0000) However, when I try and Emit IL directly, I only ever get a one index init array. Can someone help tell me where I've gone wrong here? Here is the Emit code I'm using: int arraySize = 2; LocalBuilder paramValues = ilGenerator.DeclareLocal(typeof(object[])); paramValues.SetLocalSymInfo("parameters"); ilGenerator.Emit(OpCodes.Ldc_I4_S, arraySize); ilGenerator.Emit(OpCodes.Newarr, typeof(object)); ilGenerator.Emit(OpCodes.Stloc, paramValues); Here is the resulting IL: .locals init ( [0] object[] objArray) The rest of the resulting IL is identical between the two solutions, but for some reason the .locals init is different.

    Read the article

  • Best practice for string substition with gettext using Python

    - by Malcolm
    Looking for best practice advice on what string substitution technique to use when using gettext(). Or do all techniques apply equally? I can think of at least 3 string techniques: Classic "%" based formatting: "My name is %(name)s" % locals() .format() based formatting: "My name is {name}".format( locals() ) string.Template.safe_substitute() import string template = string.Template( "My name is ${name}" ) template.safe_substitute( locals() ) The advantage of the string.Template technique is that a translated string with with an incorrectly spelled variable reference can still yield a usable string value while the other techniques unconditionally raise an exception. The downside of the string.Template technique appears to be the inability for one to customize how a variable is formatted (padding, justification, width, etc).

    Read the article

  • Debugging Windows

    - by Bunch
    After installing VS 2008 on a new PC I noticed that the Autos and Locals windows did not show up when debugging. So I went to the logical place to find them View/Other Windows. No luck they were not there. I use VS every day but like a lot of folks I only need to install it every few years, usually with a new PC. So I forgot where they were. Finding them is easy, just start debugging a project and go to Debug/Windows. The Autos and Locals windows along with the others will be there. And I will probably be here reading this post a few years from now. Technorati Tags: Visual Studio

    Read the article

  • How to execute? [closed]

    - by Viswa
    Possible Duplicate: how to read the password from variable? I did the below code in my python script,but its not work. #! /usr/bin/python import os address = "rsync -avrz [email protected]:/opt/script/python/data/ /opt/script/python/data/" passwd ="my server password" os.system('%(address)s "echo %(passwd)s"' %locals()) it throws below error. If arg is a remote file/dir, prefix it with a colon (:). rsync error: syntax or usage error (code 1) at main.c(1236) [Receiver=3.0.7] If i run os.system('%(address)s' %locals()) means it work without any error but it ask password. I need that password should be read from my passwd variable. How to write python script to read server password from my variable.

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >