namespaces

Adding to local namespace in Python?

三世轮回 提交于 2020-01-02 06:15:30
问题 Is there a way in Python to add to the locals name-space by calling a function without explicitly assigning variables locally? Something like the following for example (which of course doesn't work, because locals() return a copy of the local name-space) where the print statement would print '1'. def A(): B(locals()) print x def B(d): d['x'] = 1 回答1: In Python 2.* , you can disable the normal optimizations performed by the Python compiler regarding local variable access by starting your

Get Namespace, classname from a dll in C# 2.0

坚强是说给别人听的谎言 提交于 2020-01-02 05:48:07
问题 I will get dll's dynamically. I need to load the dll and get the namespace, classname to invoke a method (the method name is static it will be always "OnStart()"). Basically I need to run a method by loading the dll. Can somebody help!!!. 回答1: To load the assembly, you would do this: Assembly assembly = Assembly.LoadFile(@"test.dll"); This assumes you have the assemblies on disk as files. If you don't, like if you get them from a database as a byte array, there are other methods on the

XSL and Namespaces

人盡茶涼 提交于 2020-01-02 05:37:06
问题 This may be a really simple question, but its one I can't seem to get and am tearing my hair out over. I have the following XML: <?xml-stylesheet type="text/xsl" href="email.xsl"?> <Example xmlns=""> <Name xmlns="urn:rnb.fulfilment.bus.contracts.public.exampleBookName.v1">Mark</Name> </Example> And am trying to use the following XSLT: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:template match="/"> <html> <body> <table width="90%" border="0"

ASP.NET: Register multiple controls at once via namespace?

北城余情 提交于 2020-01-02 05:06:08
问题 Is it possible to register a complete namespace of usercontrols in an aspx-File, instead of each control seperately? I have created a bunch of usercontrols and collected them into an own namespace "MyWebControls", like this: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LevelFilter.ascx.cs" Inherits="MyWebControls.LevelFilter" %> Codebehind: namespace MyWebControls { public partial class LevelFilter : System.Web.UI.UserControl { ... } } What I tried now to include them in my

Why is ::class appended to PHP class in Laravel 5.1

半城伤御伤魂 提交于 2020-01-02 02:20:32
问题 In Laravel 5.0 code like this is used for names-pacing/loading classes: 'providers' => [ /* * Laravel Framework Service Providers... */ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', ] However, am seeing this in Laravel 5.1 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Foundation\Providers\ArtisanServiceProvider::class,

Anonymous class construction

…衆ロ難τιáo~ 提交于 2020-01-02 01:47:10
问题 I need an idea to create anonymous class on PHP. I don't know how I can works. See my limitations : On PHP you can't make anonymous class, like anonymous function (like class {} ); On PHP you don't have class scope (except in namespaces, but it have the same problem below); On PHP you can't use variables to specify the class name (like class $name {} ); I don't have access to install the runkit PECL. What I need, and why : Well, I need create a function called ie create_class() that receives

Laravel error 'ReflectionException' - 'Class App\Http\Kernel does not exist'

混江龙づ霸主 提交于 2020-01-02 01:09:09
问题 I was trying to go live with a laravel project i developped a year back in school and i ran into some issue. After uploading the whole project on my hosting service's server, i got these errors on my browser as well as on my SSH shell. Fatal error: Uncaught exception 'ReflectionException' with message 'Class App\Http\Kernel does not exist' in /home/clients/ffa41f94063541f86a0fe6602a73caa1/myforms/vendor/laravel/framework/src/Illuminate/Container/Container.php:779 Stack trace: #0 /home/clients

Is it possible to nest methods in Vue.js in order to group related methods?

不羁的心 提交于 2020-01-01 17:19:48
问题 I'd like to group some of my Vue.js methods together in a sort of "submethod" class, but I only seem to be able to have single level methods. For example, if I wanted to have a set of methods dealing purely with button actions: new Vue({ el: '#app', data: { }, methods: { buttonHandlers: { handler1: function() { dosomething; }, handler2: function() { dosomething; } } } }); I would expect to be able to then use something like: <button v-on:click="buttonHandlers.handler1">Click Me</button> but

Rails 3 trouble with namespaces & custom classes (uninitialized constant)

旧巷老猫 提交于 2020-01-01 17:11:14
问题 I have a file in my Rails 3.2.11 project called app/queries/visible_discussions.rb which looks like the following: class VisibleDiscussions ... end I'd like to namespace the query so that I can call it using something like Queries::VisibleDiscussions so I tried to do the following: module Queries class VisibleDiscussions ... end end However, I'm getting a uninitialized constant Queries (NameError) when I try to call Queries::VisibleDiscussions from the rails console. Any ideas? 回答1: if you

wpf binding combobox to enum in different namespace

三世轮回 提交于 2020-01-01 15:06:23
问题 I'm trying to bind a XAML ComboBox so that its list items are the members of the System.IO.Ports.Parity enum. I've found plenty of examples of databinding enums, but it seems these don't work if the enum is in a different namespace (like System.IO.Ports). Right now I have: <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="parityValues"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="System.IO.Ports.Parity" /> </ObjectDataProvider.MethodParameters> <