nested

Python nested classes scope

Im trying to understand scope in nested classes in python. Here is my example code : class OuterClass: outer_var = 1 class InnerClass: inner_var = outer_var The creation of class does not complete and I get the error : <type 'exceptions.NameError'>: name 'outer_var' is not defined trying inner_var = Outerclass...

Accessing data in a nested matrix

This one has me stumped, and none of the other related questions here have given me clues. I'm using regexp to parse a string. When I print t afterward, it looks something like this: t = { [1,1] = { [1,1] = HELLO [1,2] = 1234 } } I would like to be able to pull out the HELLO and 1234. I've tried all different ways to ...

Nested Class In Signed Java Applet

I'v been playing with java applets recently. In the one im writing now I have a static nested class. It works fine in the viewer, but when I compile it I get 2 class files. classname.class and classname$nestedclassname.class. I've never encountered anything like this (started java a week ago) and I don't how I would jar/sign them. Also, ...

WCF Calling a service from a callback method in Client

Hello, I have a scenario where, upon receiving a command on one of the callback methods in client, the client needs to call another service. For example: In OnNewCommand() callback method client receives a message X. Now the client must call Service1() defined in the server. Note, Client has registered to the callback of Service1(). I c...

Nested Lambdas in Python

Hi, I'm a beginning python programmer, and I'd like someone to clarify the following behavior. I have the following code: env = lambda id: -1 def add(id, val, myenv): return lambda x: val if x == id else myenv(id) test_env = add("a", 1, env) test_env_2 = add("b", 2, test_env) When I look up "a" in test_env, it functions correc...

VB.Net event handler registration for nested linkbutton

Hi All, I have a linkbutton that is nested in a datagrid that is nested in a datalist (yes, very strange, but unfortunately it's part of the site which I cannot change). Essentially I want the linkbutton to fire an event handler that calls Response.Redirect(e.CommandArgument)). In other words, I already have the URL that I want to redir...

Properly reading a nested XML document using an XmlReader.ReadInnerXML in .NET 3.5

I'm using an XmlReader.ReadInnerXML to read an XML document (as text) embedded within in an element of an outer XML document. This works fine except for the handling of tab characters in attributes of the inner XML. Example: <document> <interface> <scriptaction script="&#x9;one tab&#xD;&#xA;&#x9;&#x9;two tabs&#xD;&#xA;&#x9;&#x9;...

Mysql query, select 2 databases with 4 tables + nested SELECT?

This is my current query $sel = "SELECT db1t1.userid, db1t1.customer_id, db2t1.customers_id, db2t1.orders_id, db2t2.products_price FROM database1.table1 db1t1 LEFT JOIN database2.table1 db2t1 ON db1t1.customer_id = db2t1.customers_id LEFT JOIN database2.table2 db2t2 ON db2t1.orders_id = db2t2.orders_id WHERE db1t1.use...

Why do you have to explicitly specify scope with friendly_id?

I'm using the friendly_id gem. I also have my routes nested: # config/routes.rb map.resources :users do |user| user.resources :events end So I have URLs like /users/nfm/events/birthday-2009. In my models, I want the event title to be scoped to the username, so that both nfm and mrmagoo can have events birthday-2009 without them bei...

How to reduce the number of if-else statements in PHP?

I found that there are many if-else statements, especially nested if else statements, these statements make my code less readable. How to reduce the number of if else statements in PHP? My tips are as follows: 1.Use a switch statement when it is suitable; 2.use exit() statement when it is feasible; 3. Use ternary statement when it is fe...

Show nested value entity in textbox on databinding (c# - winforms)

Hello, I have an entity with others entities inside. Per example, Entity A has entities B and C. So, I want to show in a text box the value of A.B.SomeProperty when I set a datasource for bindindsource. Is it possible with a workaround? tks ...

WPF Menu disappears when nested too deeply

I'm trying to create a nested menu hierarchy from the main menu bar. For example, the main menu bar would contain a "Goto" menuitem that could be navigated as "Goto" -> "Chapter" -> "Chapter Name" -> "Subchapter name". The hierachy below "Chapter" needs to be added dynamically. When I do this, the menu disappears when it tries to di...

C++ returning nested class with template on base class problem

I am trying to create a list object, with the iterator class nested inside to understand how it works. In some method, I am trying to return an iterator object but it doesn't work. I created an example to show the problem : // CLASS A template <class T> class A { public: class B; A(){} }; // CLASS B template <class T> cla...

should nested tables have any horizontal space in between them

i think i have set all padding, margin, border-spacing, etc to 0 but i have a nested table within another table and there is a very tiny (but visible) horizontal space. I know this as the backcolor of the nested table is blue and the backcolor of the top table is white and i can see a line of white to the right and left of the table. I...

nested try catch with reponse.redirect in asp.net

Hey... i have nested try catch blocks try { statements try { } catch(SqlException sqlex) { Response.Redirect(@"~/Error.aspx?err=" + Server.UrlEncode (sqlex.Message) + "&src=" + Server.UrlEncode(...

Python: Nested Loop

Consider this: >>> a = [("one","two"), ("bad","good")] >>> for i in a: ... for x in i: ... print x ... one two bad good How can I write this code, but using a syntax like: for i in a: print [x for x in i] Obviously, This does not work, it prints: ['one', 'two'] ['bad', 'good'] I want the same output. Can it be ...

Nested Portlet Serialization

Does anyone have a link to a good tutorial on nesting portlets and serializing the data? i am trying to create a jQuery drag and drop tool where users can manage fleet -> country -> port data. For example the second fleet consists of X countries and those countries have X ports inside of them. I have the drag and drop functionality wo...

Nested List Question

I have a question about Nested Lists. I have a class similar to the following... public class Order { private Guid id; [DataMember] public Guid ID { get { return id; } set { id = value; }} private List<Items> orderItems; [DataMember] public List<Items> OrderItems { get { return orderItems; } set { orderItem...

Inner div to scroll if outer div is too small?

Tentatively answered Thanks dcneiner - new answers are appreciated. Hi, I'm trying to make a sidebar which on a website which will have a "panel" in it containing contact info. The problem is that on smaller screens, the text overflows the background. Here is the CSS, where #navigation is the outer div and the inner div is called .in...

Converting a Tuples List into a nested List using Python

I want to convert a tuples list into a nested list using Python. How do I do that? I have a sorted list of tuples (sorted by the second value): [(1, 5), (5, 4), (13, 3), (4, 3), (3, 2), (14, 1), (12, 1), (10, 1), (9, 1), (8, 1), (7, 1), (6, 1), (2, 1)] Now I want it to have like this (second value ignored and nested in lists): [...