Search Results

Search found 4646 results on 186 pages for 'multi'.

Page 31/186 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Loop through multi-dimensional array and remove certain keys

    - by Webkungen
    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 [parent] = 0 [name] = Events [uri] = 0 [basename] = [child] = Array ( [24] = Array ( [id] = 24 [parent] = 23 [name] = Public news [uri] = 0 [basename] = [child] = Array ( [27] = Array ( [id] = 27 [parent] = 24 [name] = Add [uri] = 100 [basename] = news.public.add.php [child] = ) [28] = Array ( [id] = 28 [parent] = 24 [name] = Overview [uri] = 101 [basename] = news.public.overview.php [child] = ) ) ) [25] = Array ( [id] = 25 [parent] = 23 [name] = Private news [uri] = 0 [basename] = [child] = Array ( [29] = Array ( [id] = 29 [parent] = 25 [name] = Add [uri] = 67 [basename] = news.private.add.php [child] = ) [30] = Array ( [id] = 30 [parent] = 25 [name] = Overview [uri] = 68 [basename] = news.private.overview.php [child] = ) ) ) [26] = Array ( [id] = 26 [parent] = 23 [name] = Calendar [uri] = 0 [basename] = [child] = Array ( [31] = Array ( [id] = 31 [parent] = 26 [name] = Add [uri] = 69 [basename] = news.event.add.php [child] = ) [32] = Array ( [id] = 32 [parent] = 26 [name] = Overview [uri] = 70 [basename] = news.event.overview.php [child] = ) ) ) ) ) ) I'm looking for a function to loop (recursive?) through the array and remove some keys. I my system I can allow users to certain functions/pages and if I deny access to the whole "block" "Events", the array will look like this: Array ( [1] = Array ( [id] = 1 [parent] = 0 [name] = Startpage [uri] = 125 [basename] = index.php [child] = ) [23] = Array ( [id] = 23 [parent] = 0 [name] = Events [uri] = 0 [basename] = [child] = Array ( [24] = Array ( [id] = 24 [parent] = 23 [name] = Public news [uri] = 0 [basename] = [child] = ) [25] = Array ( [id] = 25 [parent] = 23 [name] = Private news [uri] = 0 [basename] = [child] = ) [26] = Array ( [id] = 26 [parent] = 23 [name] = Calendar [uri] = 0 [basename] = [child] = ) ) ) ) As you can see above, the whole "block" "Events" is useless right now, becuase there is no page associated with each option. So I need to find all "keys" where "basename" is null AND where child is not an array or where the array is empty and remove them. I found this function when searching the site: function searchAndDestroy(&$a, $key, $val){ foreach($a as $k = &$v){ if(is_array($v)){ $r = searchAndDestroy($v, $key, $val); if($r){ unset($a[$k]); } }elseif($key == $k && $val == $v){ return true; } } return false; } It can be used to remove a key any where in the array, but only based in one thing, for example remove all keys where "parent" equals "23". But I need to find and remove (unset) all keys where "basename" is null AND where child isn't an array or where the array is empty. Can anyone help me out and possibly tweak the function above? Thank you,

    Read the article

  • Tinyxml Multi Task

    - by shaimagz
    I have a single xml file and every new thread of the program (BHO) is using the same Tinyxml file. every time a new window is open in the program, it runs this code: const char * xmlFileName = "C:\\browsarityXml.xml"; TiXmlDocument doc(xmlFileName); doc.LoadFile(); //some new lines in the xml.. and than save: doc.SaveFile(xmlFileName); The problem is that after the first window is adding new data to the xml and saves it, the next window can't add to it. although the next one can read the data in the xml, it can't write to it. I thought about two possibilities to make it work, but I don't know how to implement them: Destroy the doc object when I'm done with it. Some function in Tinyxml library to unload the file. Any help or better understanding of the problem will be great. Thanks.

    Read the article

  • Java Swt Text (SWT.MULTI) append text without scroll

    - by mchr
    I have a Java SWT GUI with a multiline Text control. I want to append lines of text to the Text control without affecting the position of the cursor within the text box. In particular, the user should be able to scroll and select text at the top of the Text control while new text lines are appended to the bottom. Is this possible?

    Read the article

  • Multi choice form field in Django

    - by Dingo
    Hi! I'am developing application on app-engine-path. I would like to make form with multichoice (acceptably languages for user). Code look like this: Language settings: settings.LANGUAGES = ((u"cs", u"Ceština"), (u"en", u"English")) Form model: class UserForm(forms.ModelForm): first_name = forms.CharField(max_length=100) last_name = forms.CharField(max_length=100) languages = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=settings.LANGUAGES) The form is rendered o.k. (all languages have checkbox. IDs, NAMEs is ok.) But if I save some languages for user, those languages don't check checkboxes. User model look like this class User(User): #... languages = db.StringListProperty() #... and view: def edit_profile(request): user = request.user if request.method == 'POST': form = UserForm(request.POST) if form.is_valid(): # ... else: form = UserForm(instance=user) data = {"user":user, "form": form} return render_to_response(request, 'user_profile/user_profile.html', data)

    Read the article

  • Multi Select Checkbox using ListView

    - by Parsa
    I have a CheckBox in the header of ListView. I write a code to select all Checkboxes in ItemTemplate automatically when the user select the checkBox in the header of ListView. This code is useful, when you bind your ListView in DataPager_PreRender. protected void DataPager1_PreRender(object sender, EventArgs e) { //get the user id of the current user Guid userGuid = (Guid)Membership.GetUser().ProviderUserKey; ListView1.DataSource = MyClass.MyStaticMethod(userGuid.ToString()); ListView1.DataBind(); } protected void ListView1_ItemCreated(object sender, ListViewItemEventArgs e) { //Find the checkBox in each Row CheckBox checkBoxRow = e.Item.FindControl("CheckBoxRow") as CheckBox; //Assign the value of checkBoxHeader to the checkBoxRow checkBoxRow.Checked = CheckBoxHeader.Checked; } protected void ListView1_PagePropertiesChanged(object sender, EventArgs e) { // assign false value to the CheckBoxHeader when user click on the DataPager // so if checkboxheader is true in the page 1, when user select Page 2,this check box will be false // therefore all checkbox rows will be false in the new page. if (CheckBoxHeader.Checked == true) CheckBoxHeader.Checked = false; }

    Read the article

  • Multi-level inheritance with Implements on properties in VB.NET vs C#

    - by Ben McCormack
    Let's say I have 2 interfaces defined like so: public interface ISkuItem { public string SKU { get; set; } } public interface ICartItem : ISkuItem { public int Quantity { get; set; } public bool IsDiscountable { get; set; } } When I go to implement the interface in C#, VS produces the following templated code: public class CartItem : ICartItem { #region ICartItem Members public int Quantity { get {...} set {...} } public bool IsDiscountable { get {...} set {...} } #endregion #region ISkuItem Members public string SKU { get {...} set {...} } #endregion } In VB.NET, the same class is built out like so: Public Class CartItem Implements ICartItem Public Property IsDiscountable As Boolean Implements ICartItem.IsDiscountable 'GET SET' End Property Public Property Quantity As Integer Implements ICartItem.Quantity 'GET SET' End Property Public Property SKU As String Implements ISkuItem.SKU 'GET SET' End Property End Class VB.NET explicitly requires you to add Implements IInterfaceName.PropertyName after each property that gets implemented whereas C# simply uses regions to indicate which properties and methods belong to the interface. Interestingly in VB.NET, on the SKU property, I can specify either Implements ISkuItem.SKU or Implements ICartItem.SKU. Although the template built by VS defaults to ISkuItem, I can also specify ICartItem if I want. Oddly, because C# only uses regions to block out inherited properties, it seems that I can't explicitly specify the implementing interface of SKU in C# like I can in VB.NET. My question is: Is there any importance behind being able to specify one interface or another to implement properites in VB.NET, and if so, is there a way to mimic this functionality in C#?

    Read the article

  • using Multi Probe LSH with LSHKIT

    - by Yijinsei
    Hi Guys, I have read through the source code for mplsh, but I still unsure on how to use the indexes generated by lshkit to speed up the process in comparing feature vector in Euclidean Distance. Do you guys have any experience regarding this?

    Read the article

  • Visual Studio Multi-Targeting (maintaining backwards compatibility)

    - by Phillip Benages
    I know in Visual Studio 2008 you can target a specific framework with your projects, but from what I have been told if you open a project originally created in Visual Studio 2003 or 2005 in Visual Studio 2008, it requires you to upgrade the project to a 2008 project to work on it. Does Visual Studio 2010 have this same type of restriction? It would be very nice being able to use features of 2010 when working in our projects that target different frameworks, but we do not want to force all of our developers to upgrade in order to continue working in these projects.

    Read the article

  • Multi-lingual website and webby

    - by ximus
    Hi, Anyone know how to best implement a multilingual static site using webby? I would put content for the multiple languages in content/{lang}/{page}.txt for starters, any ideas on the rest? I've never used webby. Thanks, Max.

    Read the article

  • Qt Program depoly to multi platform, how?

    - by coderex
    Hi, Am new in Qt Programming and i would like to develop a program which i want to run in Windows, Linux(ubuntu), and Mac. I heard that Qt support mutli-platform application development, but my Question is that, would any Qt library need to run these appilication in Ubuntu after i depolyed or compiled. Or

    Read the article

  • Calculate # of Rowspans and Colspans based on keys in a Multi-Array

    - by sologhost
    Ok, I have these 2 types of layouts, basically, it can be any layout really. I have decided to use tables for this, since using div tags cause undesirable results in some possible layout types. Here are 2 pics that describe the returned results of row and column: This would return the $layout array like so: $layout[0][0] $layout[0][1] $layout[1][1] In this layout type: $layout[1][0] is NOT SET, or doesn't exist. Row 1, Column 0 doesn't exist in here. So how can we use this to help us determine the rowspans...? Ok, this layout type would now return the following: $layout[0][0] $layout[0][1] $layout[1][0] $layout[2][0] $layout[2][1] $layout[3][1] Again, there are some that are NOT SET in here: $layout[1][1] $layout[3][0] Ok, I have an array called $layout that does a foreach on the row and column, but it doesn't grab the rows and columns that are NOT SET. So I created a for loop (with the correct counts of how many rows there are and how many columns there are). Here's what I got so far: // $not_set = array(); for($x = 0; $x < $cols; $x++) { $f = 0; for($p = 0; $p < $rows; $p++) { // $f = count($layout[$p]); if(!isset($layout[$p][$x])) { $f++; // It could be a rowspan or a Colspan... // We need to figure out which 1 it is! /* $not_set[] = array( 'row' => $p, 'column' => $x, ); */ } // if ($rows - count($layout[$p])) } } Ok, the $layout array has 2 keys. The first 1 is [ row ] and the 2nd key is [ column ]. Now looping through them all and determining whether it's NOT SET, tells me that either a rowspan or a colspan needs to be put into something somewhere. I'm completely lost here. Basically, I would like to have an array returned here, something like this: $spans['row'][ row # ][ column # ] = Number of rowspans for that <td> element. $spans['column'][ row # ][ column # ] = Number of colspans for that <td> element. It's either going to need a colspan or a rowspan, it will definitely never need both for the same element. Am I going about this whole thing the wrong way? Any help at all would be greatly appreciated!! I've been driving myself crazy with this for days! Pllleaase...

    Read the article

  • Maven multi-module project with many reports: looking for an example

    - by hstoerr
    Is there an open source project that can serve as a good example on how to use the maven site plugin to generate reports? I would prefer it to consist of many modules, possibly hierarchically structured use as many plugins as possible (surefire, jxr, pmd, findbugs, javadoc, checkstyle, you name it) the reports should be aggregated: if some tests fail you want to have a single page that shows all modules with failing tests, not only a gazillion individual pages to check include enterprisey stuff (WAR, EAR etc), but this is not so important. The idea is to have something where you can gather ideas on how it is done and what is possible.

    Read the article

  • Visual Studio C++ multi-project solution

    - by Lucas
    I have created an C++ solution in VS2008. The first project contains the model. The second projects is the view. The problem is that i don't get make references to my model classes defined in the first project. The message error is : Error 1 fatal error C1083: Cannot open include file: 'utils/GeradorSistematicoDeAlturaDoPlanoDeCorteStrategy.h': No such file or directory c:\Users\user\Programação em C++\Simulacao\Simulacao_Testes\src\Teste1.cpp 3 Simulacao_Testes Is there any configuration in VS2008 that makes to be made in order to, from the my view (second project) project, i do make references to the first project, the model?

    Read the article

  • How to create a custom ADO Multi Dimensional Catalog with no database

    - by Alan Clark
    Does anyone know of an example of how to dynamically define and build ADO MD (ActiveX Data Objects Multidimensional) catalogs and cube definitions with a set of data other than a database? Background: we have a huge amount of data in our application that we export to a database and then query using the usual SQL joins, groups, sums etc to produce reports. The data in the application is originally in objects and arrays. The problem is the amount of data is so large the export can take 2 hours. So I am trying to figure out a good way of querying the objects in memory, either by a custom OLAP algorithm or library, or ADO MD. But I haven't been able to find an example of using ADO MD without a database behind it. We are using Delphi 2010 so would use ADO ActiveX but I imagine the ADO.NET MD is similar. I realize that if the application data was already stored in a database the problem would solve itself. Also if Delphi had LINQ capability I could query the objects and arrays that way.

    Read the article

  • Using the iPhones Multi-Touch Keyboard Search Button

    - by senfo
    I have a regular text field on a view and I'd like to make use of the search button on the iPhones keyboard. For the life of me, I can't figure out how to do this. There doesn't seem to be any event exposed that I can wire up that specifically relates to the search button on the keyboard. I've googled around, but I also haven't found anything related to this subject.

    Read the article

  • Multi-level clones with Git?

    - by Chad Johnson
    So, I'm thinking of having the following centralized setup with Git (each of these are clones): stable development developer1 developer2 developer3 So, I created my stable repository git --bare init made the 'development' clone git clone ssh://host.name//path/to/stable/project.git development and made a 'developer' clone git clone ssh://host.name//path/to/development/project.git developer So, now, I make a change, commit, and then I push from my developer account git commit --all git push and the change goes to the development clone. But now, when I ssh to the server, go to the development clone directory, and run "git fetch" or "get pull", I don't see the changes. So what do I do? Am I totally misunderstanding things and doing things wrong? How can I see the changes in the 'development' clone that I pushed from my 'developer' clone? This worked fine in Mercurial.

    Read the article

  • Multi-Array of XML Requests

    - by sologhost
    OMG, I am in need of a way to set up arrays of XML Requests based on the idShout - 1. So it would be something like this... var req = new Array(); req[idShout - 1] = ALL XML Data... Here's what I got so far but it's not working at all :( var idShout; var req = new Array(); function htmlRequest(url, params, HttpMethod) { req[req.push] = ajax_function(); for (i=0;i<req.length;i++) { if (req[i]) { if (HttpMethod == "GET") { req[i].onreadystatechange = function() { if (req[i].readyState != 4) return; if (req[i].responseText !== null && req[i].status == 200) { document.getElementById("shoutbox_area" + idShout).innerHTML = req[i].responseText; } } } req[i].open(HttpMethod,url,true); if (HttpMethod == "POST") req[i].setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); if (params == "") req[i].send(null); else req[i].send(params); return req[i]; } else return null; } } function ajax_function() { var ajax_request = null; try { // Opera 8.0+, Firefox, Safari ajax_request = new XMLHttpRequest(); } catch (e) { // IE Browsers try { ajax_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajax_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { //No browser support, rare case return null; } } } return ajax_request; } function send() { var send_data = "shoutmessage=" + document.getElementById("shout_message" + idShout).value; var url = smf_prepareScriptUrl(smf_scripturl) + "action=dreamaction;sa=shoutbox;xml;send_shout="+ idShout; htmlRequest(url, send_data, "POST"); document.getElementById("shout_message" + idShout).value = ""; document.getElementById("shout_message" + idShout).focus(); return true; } function startShouts(refreshRate, shoutCount) { clearInterval(Timer[shoutCount-1]); idShout = shoutCount; show_shouts(); Timer[shoutCount - 1] = setInterval("show_shouts()", refreshRate); return; } function show_shouts() { var url = smf_prepareScriptUrl(smf_scripturl) + "action=dreamaction;sa=shoutbox;xml;get_shouts=" + idShout; htmlRequest(url, "", "GET"); } Any help at all on this would be greatly appreciated... Basically, I'm setting the Timer Arrays in a different function before this, and I call startShouts which is supposed to show all of the information, but startShouts gets called more than once, which is why I have idShout set to equal shoutCount. So it will go something like this: shoutCount = 1, shoutCount = 2, shoutCount = 3, everytime it is being called. So I set the req[idShout - 1] array and it should return the result right?? Well, I get no errors in Firefox in the error console with this code above, but it doesn't work... Any ideas anyone?? As it needs to output into more than 1 area... argg. Thanks for any help you can offer here :) Thanks guys :)

    Read the article

  • using Autofac in a multi-layered architecture

    - by Kamyar
    I'm fairly new to the DI/IoC concept and would like to use Autofac in a 3-layered ASP.NET Webforms application. UI layer: An ASP.NET webforms website. BLL: Business logic layer which calls the repositories on DAL. DAL: .EDMX file (Entity Model) and ObjectContext with Repository classes which abstract the CRUD operations for each entity. Entities: The POCO Entities. Persistence Ignorant. Generated by Microsoft's ADO.Net POCO Entity Generator. I have asked a more general question here. Basically, I'd like to create an obejctcontext per HttpContext in my DAL. But i don't want to add a reference to DAL in UI or access to HttpContext in DAL directly. I guess this is where IoC tools come to play. The answer to my previous question is a very good example of using Windsor Castle. I'd like to use Autofac as my IoC tool and Don't know how to achieve this. (How to access DAL in application_start to register the component while I don't want to reference it in my UI, what are the proper references to be able to use DAL component in BLL with Autofac, Should I register BLL as a component with Autofac too) Sorry folks for not providing an explicit question and requesting a kind of working example, But I'm very unfamiliar to the whole IoC concept and I don't think I can achieve it to use in my current time-limited project.

    Read the article

  • CSS sidebar multi-level menu

    - by NachoF
    Can you guys point me in the right direction?? I want to add sidebar multilevel functionality to this template. So when I hover over one of the items in the main menu some subitems slide to the right... preferably using only css and mantaining the style/color/look, etc... I suck at css, please help.

    Read the article

  • Multi:Threading - Is this the right approach?

    - by HonorGod
    Experts - I need some advice in the following scenario. I have a configuration file with a list of tasks. Each task can have zero, one or more dependencies. I wanted to execute these tasks in parallel [right now they are being executed sequentially] The idea is to have a main program to read the configuration file and load all the tasks. Read individual tasks and give it to an executor [callable] that will perform the task and return results in a Future. When the task is submitted to the executor (thread) it will monitor for its dependencies to finish first and perform its own task. Is this the right approach? Are there any other better approaches using java 1.5 features?

    Read the article

  • Convert json data to javascript array - in multi-dimensional sense

    - by AW-GWTF899
    I have a json array say { "People": { "Person": [ {"FirstName": "John", "LastName": "Smith"} {"FirstName": "Joe", "LastName": "Bloggs"} {"FirstName": "Wendy", "LastName": "Deng"} ] } } And I want to convert this into a javascript array (something like this) var persons = [ ["FirstName", "John", "LastName", "Smith"], ["FirstName", "Joe", "LastName", "Bloggs"], ["FirstName", "Wendy", "LastName": "Deng"] ]; How do I accomplish this? Hope my question makes sense and I realise the javascript array initialization may not be the correct way to put it. Thanks.

    Read the article

  • Returning PHP Multi-Dimension Array to Javascript/AJAX

    - by GregH
    My understanding is that in order to return a complex PHP variable to Javascript, it should be done via AJAX and json_encode. Could somebody give me an actual example (both PHP and Javascript code) of this? Lets say we have the two-dim array in PHP: $twoDArr = array( array('Greg', 44, 'Owner'), array('Joe', 23, 'Renter'), array('Susan', 39, 'Owner'), array('John', 32, 'Renter) ); How would we return this to an analogous two dimensional array in javascript using json_encode?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >