nested

Return value from nested function in Javascript

I have a function that is set up as follows function mainFunction() { function subFunction() { var str = "foo"; return str; } } var test = mainFunction(); alert(test); To my logic, that alert should return 'foo', but instead it returns undefined. What am I doing wrong? UPDATE: Here's my actual co...

Loop through multi-dimensional array and remove certain keys

Hi! I've got a nested tree structure which is based on the array below: Array ( [1] => Array ( [id] => 1 [parent] => 0 [name] => Startpage [uri] => 125 [basename] => index.php [child] => ) [23] => Array ( [id] => 23 ...

Referencing a union inside a structure using union tag gives incorrect address

I had a need to declare a union inside a structure as defined below: struct MyStruct { int m_DataType; DWORD m_DataLen; union theData { char m_Buff [_MAX_PATH]; struct MyData m_myData; } m_Data; }; Initially, I tried accessing the union data as follows (before I added the m_Data declaration):...

javascript test for existence of nested object key

If I a reference to an object - var test = {}; that will potentially (but not immediately) have nested objects, something like - { level1:{level2:{level3:'level3'}} }; what is the best way to test for the existence of keys in the most deeply nested objects? This - alert(test.level1); returns 'undefined', but this - alert(t...

In PHP... best way to turn string representation of a folder structure into nested array

Hi everyone, I looked through the related questions for a similar question but I wasn't seeing quite what I need, pardon if this has already been answered already. In my database I have a list of records that I want represented to the user as files inside of a folder structure. So for each record I have a VARCHAR column called "FolderS...

Nested Groups in Regex

I'm constructing a regex that is looking for dates. I would like to return the date found and the sentence it was found in. In the code below, the strings on either side of date_string should check for the conditions of a sentence. For your sake, I've omitted the regex for date_string - sufficed to say, it works for picking out dates. Wh...

Can a freemarker interpolation contain an interpolation?

Let's say I have Freemarker variable A that contains the name of another variable on the hash tree, say. "B." I'd like to use a to read the value of B so, for example, if B contained "C" I could tell Freemarker to output C using A: ${${A}} should result in the output of "C". Naturally, this doesn't work in Freemarker, but is there a way ...

Nested function inside literal Object...

Hello guys, if in a literal object i try to reference a function using "this" inside a nested property/function, this don't work. Why? A nested property have it's own scope? For example, i want to call f1 from inside d.f2: var object = { a: "Var a", b: "Var b", c: "Var c", f1: function() { alert("This is f1"); }, ...

Ruby on Rails: using nested named_scopes

I just got referred to stackoverflow by a friend here to help with a problem I am having. I am fairly new to ruby on rails and I am working on a collaborative project where we have a script (medal_worker.rb) that is scheduled to run at a fixed intervals to award people various medals based on various participation and success on our web...

jQueryUI Sortable won't accept connected Draggable on a nested UL

I've posted an example here: http://jsfiddle.net/ericclemmons/LEHLX/2/ Really, what it comes down to is the classic "assigning users to groups" issue. I have a list of users and a list of groups, but I'd like to be able to have nesting of the groups: user "Eric" would be in "Users", "Web", and "Administrators". The problem is that I ...

Loop with a while

Very basic question.. but I'm missing the point.. I have this data on my table: ID SITEID SECTION 1 1 posts 2 2 posts 3 1 aboutme 4 1 contact 5 2 questions The output is an array. I can't change it. I want to make this output on php with a single for loop with that array: <h1> sections for site 1 </h1>...

jQuery nested sortables jumpy behaviour

I want to allow user to drag and drop UI elements. I've 'container' and 'control', control may be in container, containers may include other containers (this is important requirement). I created simple prototype using jQuery. HTML: <div class="one"> <div class="control">Control 1</div> <div class="control">Control 2</div> <div class="c...

Alternative to Nested Loop For Comparison

I'm currently writing a program that needs to compare each file in an ArrayList of variable size. Right now, the way I'm doing this is through a nested code loop: if(tempList.size()>1){ for(int i=0;i<=tempList.size()-1;i++) //Nested loops. I should feel dirty? for(int j=i+1;j<=tempL...

rails search a category for sub categories

Hello, I am using the http://github.com/collectiveidea/awesome_nested_set awesome nested set plugin and currently, if I choose a sub category as my category_id for an item, I can not search by its parent. Category.parent Category.Child I choose Category.child as the category that my item is in. So now my item has category_id ...

AS3 access to properties of movieclip loaded in dynamically

My movieclip clipArt_mc receives movieclips that are loaded dynamically from a listbox selection using: var myLoader9:Loader = new Loader(); I apply color to clipArt_mc using the following: var trans3:Transform = new Transform(MovieClip(parent).design_mc.clipArt_mc); I would like to access the nested or loaded in movieclip insid...

Basic Recursion, Check Balanced Parenthesis

Greetings all, I've written software in the past that uses a stack to check for balanced equations, but now I'm asked to write a similar algorithm recursively to check for properly nested brackets and parenthesis. Good examples: () [] () ([]()[]) Bad examples: ( (] ([)] Suppose my function is called: isBalanced. Should e...

ASP.NET MVC2 - Does Html.EditorForModel() work on the nested data model?

My test shows it doesn't work. It ignores the nested data in model. Can anyone confirm this? ...

Flex Datagrid and nested array

I have a JSON decoded array of Projects which contain a nested array of Milestones. I'm trying to display the Milestones one at a time inside a Datagrid. However, it seem Datagrid can't handle more than 1 level of data. Following is a simple diagram of what I'm trying to do. [Project Name [0]] [Milestone[0]] [Project Name [1]] [Mile...

Is there a simple way to validate a hash of hash element exists and is defined?

I need to validate a Perl hash of hash element such as $Table{$key1}{$key2} to exist and be defined. Here is what I do. (I have no idea $key1 even exists) if ((defined $Table{$key1}) && (exists $Table{$key1}) && (defined $Table{$key1}{$key2}) && (exists $Table{$key1}{$key2})) { #do whatever } Is there an easier and cleaner w...

CSS Hover on parent list Item only

Hey Everyone, So I have some nested lists (only one level deep) and I'm running into trouble with the CSS :hover feature. I only want the hover to apply to the parent class, but I can't figure that one out. Here's my CSS <style type="text/css" media="screen"> .listblock li img { visibility: hidden; } .listblock li:hover img ...