Search Results

Search found 13450 results on 538 pages for 'recent items'.

Page 112/538 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • Multicolumn ListView in WPF - errors

    - by Will
    Hi, I am trying to define a multicolumn listview in xaml (visual studio 2008) and then add items to it in c#. I have seen many posts on this subject, and tried the various methods, but I am getting errors. my xaml code is below, VS does not flag any errors on it. <ListView Height="234.522" Name="chartListView" Width="266.337"> <ListView.View> <GridView> <GridViewColumn Header="Name" Width="70"/> <GridViewColumn Header="ID" /> </GridView> </ListView.View> </ListView> to try and add data to the columns, I created a button and put the code in the button click : private void button3_Click(object sender, RoutedEventArgs e) { chartListView.Items.Add("item1").SubItems.Add("item2"); } the error that is showing is on Subitems is: 'int' does not contain a definition for 'SubItems' and no extension method 'SubItems' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?) D:\devel\VS\pchart\pchart\pchart\Window1.xaml.cs Also, I tried looking at some other posts on listview controls such as http://stackoverflow.com/questions/1260812/listview-inserting-items i tried the code there : ListViewItem item = new ListViewItem(); item.Text=anInspector.getInspectorName().ToString(); and got almost the same error on item.Text as i did with SubItems. is there something earlier in my code, or project definition that i am missing? Thanks for any help

    Read the article

  • How to persist options selected in AlertDialog spawned from ItemizedOverlay onTap method

    - by ahsteele
    In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class. In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on. The below code is the onTap method I've written. It functions as written but doesn't yet do what I'd hope. I'd like to capture and persist each selection made by the user to be used later. How do I do that? Is using an AlertDialog in this manner a good idea? Are there better options? protected boolean onTap(int index) { OverlayItem item = _overlays.get(index); final CharSequence[] items = { "WiFi", "BlueTooth" }; final boolean[] checked = { false, false }; AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setTitle(item.getTitle()); builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int item, boolean isChecked) { // for now just show that the user touched an option Toast.makeText(_context, items[item], Toast.LENGTH_SHORT).show(); } }); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // should I be examining what was checked here? dialog.dismiss(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); return true; }

    Read the article

  • popViewController does not autorotate back to allowed orientation

    - by JoeGaggler
    I have two UIViewControllers, "A" and "B", where "A" overrides the shouldAutorotateToInterfaceOrientation to return YES for UIInterfaceOrientationPortrait, and "B" returns YES for all orientations. In my example "A" is the root navigation view controller, and I then use pushViewController for "B". After that I rotate the device into landscape, which successfully autorotates "B", then I pop "B" (back button or via popViewController) to return to "A". When targetting iPhone OS 3.1.3, "A" returns to the portrait orientation as expected. When targetting iPhone OS 3.2, I have two side-effects: "A" is displayed in landscape. The navigation bar does not update even though "A" is now displayed. The navigation bar still shows the items for "B". Only after trying to go back/pop one more time will the navigation bar animate to show the items for "A". If I instead attempt to push "B" again and go back, I have to pop twice before the navigation bar animates to show the items for "A". During these "intermediate pops" the view for "A" remains displayed. While researching this issue, I have seen other answers suggesting performing the rotation manually ([UIDevice setOrientation] or via a tranformation), however this does not help understand what the problem is, especially why it behaves differently between the two OS's. So my question is: must all of my UIViewControllers on the UINavigationController stack support exactly the same orientations going forward? And if not, then is there something that I need to do to make it behave as it did for OS 3.1.3?

    Read the article

  • Displaying Many-To-Many Database relationship in VB.NET 2008 with DataGrid, MS SQL 2008

    - by user337501
    Computer bombed while posting this, couldnt find a duplicate question but if there is one, forgive me. So, I've run into a wall. And rather than use a ladder to avoid it, I'd like go through it. I'm setting up what I can best describe as a many-to-many relationship in a database. To examplify, imagine I have three primary tables: Items, Categories, Sections(nevermind the potential redundancy) Then I have another table, Properties. Items, Categories, and Sections can be associated with many properties. A single property can be associated with one, all, or none of the other tables. The best way I can figure to do this is to have join tables make the relationship. i.e. tblItems----(Foreign Key)----tblItems_To_Properties----(Foreign Key)----tblProperties In this example, tblItems simply has an "ItemID" Primary Key. tblItems_To_Properties has its own Primary Key(tblItems_To_PropertiesID), a Foreign Key to the Item(ItemID) and a Foreign key to the Property(PropertyID). The Properties table simply has its primary key(PropertyID) I hope this example isnt too confusing...if I have to I can find a way to put a diagram up or something. My problem is, I want to display this in a DataGrid using the Master-Detail method(DevExpress GridControl). I use the tblItems as a test, and I can see the Items in the parent view, but in the child view I see(understandably) the join table and that is it. My goal is to make it so the Grid ignores the join table and shows the Properties table as the only child. Any help on this method or insight into another solution would be muuuuuuuch appreciat

    Read the article

  • NoRM MongoConfiguration

    - by user365836
    Something is wrong with my MongoConfiguration I think, I read the following on NoRM's google group: On Mar 22, 3:14 am, Andrew Theken wrote: It can easily live in the object: public class POCO{ //implicitly runs one time. static POCO(){   MongoConfiguration.Initialize(cfg= cfg.For<POCO>(f=     {        f.ForProperty(p=p.ALongProperty).UseAlias("A");        f.ForProperty(p=p.AnotherLongProperty).UseAlias("B");        //etc.     }    }    public string ALongProperty {get;set;}    public int AnotherLongProperty{get;set;} } ;-) //Andrew Theken In my class I have public class Item { static Item() { MongoConfiguration.Initialize( cfg=> cfg.For<Item>( c => { c.ForProperty(i => i.Name).UseAlias("N"); c.ForProperty(i => i.Description).UseAlias("D"); }) ); } public String Name { get; set; } public String Description { get; set; } } After I save them there are items in DB with short key namse, the problem is when I try to read up all previously created items on start I get no items back.

    Read the article

  • When using ItemsControl ItemsControl.ItemsPanel is set to Canvas, ContenPresenter comes in and break

    - by code-zoop
    I am using an ItemsControl where the ItemsPanel is set to Canvas (see this question for more background information). The ItemsControl is performing as I want, and it works like a charm when adding a child element manually by putting it into ItemsControl.Items: <ItemsControl> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas IsItemsHost="True" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.Items> <Button Canvas.Left="500" Content="Button Text" /> </ItemsControl.Items> </ItemsControl> Note the Canvas.Left property on the Button. This works like a charm, and the Button is placed 500 pixels from the left of the ItemsControl left side. Great! However, When I am defining a ItemsSource binding to a List, the Canvas.left doesn't have any effect: <ItemsControl ItemsSource="{Binding Elements}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas IsItemsHost="True" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Button Canvas.Left="500" Content="Button Text" /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> By inspecting the application during run time, I see one difference. The container ContentPresenter has been added between the Canvas and the button.. How can I set the Canvas.Left property on the ContentPresenter itself? Or is there another way to solve this problem? Thanks to all!

    Read the article

  • Seeking help with a MT design pattern

    - by SamG
    I have a queue of 1000 work items and a n-proc machine (assume n = 4).The main thread spawns n (=4) worker threads at a time ( 25 outer iterations) and waits for all threads to complete before processing the next n (=4) items until the entire queue is processed for(i= 0 to queue.Length / numprocs) for(j= 0 to numprocs) { CreateThread(WorkerThread,WorkItem) } WaitForMultipleObjects(threadHandle[]) The work done by each (worker) thread is not homogeneous.Therefore in 1 batch (of n) if thread 1 spends 1000 s doing work and rest of the 3 threads only 1 s , above design is inefficient,becaue after 1 sec other 3 processors are idling. Besides there is no pooling - 1000 distinct threads are being created How do I use the NT thread pool (I am not familiar enough- hence the long winded question) and QueueUserWorkitem to achieve the above. The following constraints should hold The main thread requires that all worker items are processed before it can proceed.So I would think that a waitall like construct above is required I want to create as many threads as processors (ie not 1000 threads at a time) Also I dont want to create 1000 distinct events, pass to the worker thread, and wait on all events using the QueueUserWorkitem API or otherwise Exisitng code is in C++.Prefer C++ because I dont know c# I suspect that the above is a very common pattern and was looking for input from you folks.

    Read the article

  • Save options selected in AlertDialog spawned from ItemizedOverlay onTap method

    - by ahsteele
    In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class. In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on. That said I am unsure if utilizing an AlertDialog in this manner is the right approach and open to other suggestions. protected boolean onTap(int index) { OverlayItem item = _overlays.get(index); final CharSequence[] items = { "WiFi", "BlueTooth" }; final boolean[] checked = { false, false }; AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setTitle(item.getTitle()); builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int item, boolean isChecked) { // for now just show that the user touched an option Toast.makeText(_context, items[item], Toast.LENGTH_SHORT).show(); } }); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // should I be examining what was checked here? dialog.dismiss(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); return true; }

    Read the article

  • Autocomplet extender control in ajax (asp.net)?

    - by Surya sasidhar
    hi, i am using autocomplete extender in my application but it is not working. this is my code.. <form id="form1" runat="server"> <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager> <br /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <div> <cc1:AutoCompleteExtender TargetControlID="TextBox1" MinimumPrefixLength="1" ServiceMethod="GetVideoTitles" CompletionSetCount="10" ServicePath="Myservices.asmx" ID="AutoCompleteExtender1" runat="server"> </cc1:AutoCompleteExtender> </div> </form> this is webservice method public string[] GetVideoTitles(string prefixText) { SqlConnection con = new SqlConnection(@"Data Source=SERVER5\SQLserver2005;Initial Catalog=tpvnew;User ID=xx;Password=525"); con.Open(); SqlCommand cmd = new SqlCommand("video_videotitles", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@prefixText", SqlDbType.VarChar, 50); cmd.Parameters["@prefixText"].Value = prefixText; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["videotitle"].ToString(), i); i++; } return items; }

    Read the article

  • drupal ajax create node

    - by Mark
    I need to create a drupal node via ajax. I'm looking for some instructions as in: http://stackoverflow.com/questions/960343/creating-a-drupal-node-with-javascript But with more detail, and including the js steps. The JS will probably look something like this: var title = 'Demo Node Title' $('button').click(function () { $.post('demo/js', {"title" : title}, function(data) { var json = eval("(" + data + ")"); if (json['status'] == "error") { alert(json['message']); } else if (json['status'] == "success") { alert(json['message']); // Need to return the nid of the new node here. Anyone know how to do this? } }); }); The PHP (copied from the other question, but I don't understand it much, how do I set the title of the node? also as the comments says, how do I set an input filter?): <?php /** * Implementation of hook_menu(). */ function demo_menu() { $items = array(); $items['demo/js'] = array( 'title' => 'Demo page', 'page callback' => 'demo_js_page', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); return $items; } /** * Page callback that saves a node. */ function demo_js_page() { if (isset($_REQUEST['title'])) { $node = new stdClass; $node->type = 'blog'; $node->title = check_plain($_REQUEST['title']); node_save($node); drupal_set_message(t('Created node %title', array('%title' => $_REQUEST['title']))); } return t('Thanks for visiting'); } Thanks in advance.

    Read the article

  • Example with Visitor Pattern

    - by devoured elysium
    public class Song { public string Genre { get; protected set; } public string Name { get; protected set; } public string Band { get; protected set; } public Song(string name, string band, string genre) { Name = name; Genre = genre; Band = band; } } public interface IMusicVisistor { void Visit(List<Song> items); } public class MusicLibrary { List<Song> _songs = new List<Song> { ...songs ... }; public void Accept(IMusicVisitor visitor) { visitor.Visit(_songs); } } and now here's one Visitor I made: public class RockMusicVisitor : IMusicVisitor { public List<Song> Songs { get; protected set; } public void Visit(List<Song> items) { Songs = items.Where(x => x.Genre == "Rock").ToList(); } } Why is this any better than just putting a public property Songs and then letting any kind of class do with it anything that it wants to? This example comes from this post.

    Read the article

  • LocalAlloc and LocalRealloc usage

    - by PaulH
    I have a Visual Studio 2008 C++ Windows Mobile 6 application where I'm using a FindFirst() / FindNext() style API to get a collection of items. I do not know how many items will be in the list ahead of time. So, I would like to dynamically allocate an array for these items. Normally, I would use a std::vector<>, but, for other reasons, that's not an option for this application. So, I'm using LocalAlloc() and LocalReAlloc(). What I'm not clear on is if this memory should be marked fixed or moveable. The application runs fine either way. I'm just wondering what's 'correct'. int count = 0; INFO_STRUCT* info = ( INFO_STRUCT* )LocalAlloc( LHND, sizeof( INFO_STRUCT ) ); while( S_OK == GetInfo( &info[ count ] ) { ++count; info = ( INFO_STRUCT* )LocalRealloc( info, sizeof( INFO_STRUCT ) * ( count + 1 ), LHND ); } if( count > 0 ) { // use the data in some interesting way... } LocalFree( info ); Thanks, PaulH

    Read the article

  • text-area-text-to-be-split-with-conditions repeated

    - by desmiserables
    I have a text area wherein i have limited the user from entering more that 15 characters in one line as I want to get the free flow text separated into substrings of max limit 15 characters and assign each line an order number. This is what I was doing in my java class: int interval = 15; items = new ArrayList(); TextItem item = null; for (int i = 0; i < text.length(); i = i + interval) { item = new TextItem (); item.setOrder(i); if (i + interval < text.length()) { item.setSubText(text.substring(i, i + interval)); items.add(item); } else { item.setSubText(text.substring(i)); items.add(item); } } Now it works properly unless the user presses the enter key. Whenever the user presses the enter key I want to make that line as a new item having only that part as the subText. I can check whether my text.substring(i, i + interval) contains any "\n" and split till there but the problem is to get the remaining characters after "\n" till next 15 or till next "\n" and set proper order and subText.

    Read the article

  • cfchart ignores my scalefrom value

    - by Monte Chan
    Hi all, I have the following codes in my page. The style variable holds the custom style. <cfchart chartheight="450" chartwidth="550" gridlines="9" yaxistitle="Score" scalefrom="20" scaleto="100" style="#style#" format="png" > <cfchartseries query="variables.chart_query" type="scatter" seriescolor="##000000" itemcolumn="MyItem" valuecolumn="MyScore"/> </cfchart> Before I begin, please go to http://www.monteandjanicechan.com/chart_good.jpg. This is how I want my report to come up. On the x-axis, there will always be three items as long as at least one of them has values. If an item does not have any values (i.e. 2010), there would not be a marker in the chart. The problem occurs only when only one item has value. Please see http://www.monteandjanicechan.com/chart_bad.jpg. As you can see, 2008 and 2010 do not have any values; y-axis is now scaled from 0 to 100. I have tried setting one of the items (ex. 2008) a value of 0 or something off the chart; it would scale according to this off-the-chart value and the 2009 value. In short, I have to have at least two items with values between 20 and 100 in order for cfchart to scale from 20 to 100. My question is, how can I correct the issue so that cfchart would ALWAYS scale from 20 to 100? I am running CF9. Thanks in advance, Monte

    Read the article

  • Storing arrays in NSUserDefaultsController

    - by neoneye
    Currently I use NSUserDefaults and I'm interested in using NSUserDefaultsController, so that I get notifications when things change. Below is my current code. items = /* NSArray of MYItem's */; NSData* data = [NSKeyedArchiver archivedDataWithRootObject:items]; [[NSUserDefaults standardUserDefaults] setObject:data forKey:kMYItems]; How should I rework my code to store items in NSUserDefaultsController ? Is NSKeyedArchiver the smartest way to store arrays? @interface MYItem : NSObject <NSCoding> { NSString* name; NSString* path; } @property (copy) NSString* name; @property (copy) NSString* path; @end @implementation MYItem @synthesize name, path; -(void)encodeWithCoder:(NSCoder*)coder { [coder encodeObject:name forKey:@"name"]; [coder encodeObject:path forKey:@"path"]; } -(id)initWithCoder:(NSCoder*)coder { [super init]; [self setName:[coder decodeObjectForKey:@"name"]]; [self setPath:[coder decodeObjectForKey:@"path"]]; return self; } @end

    Read the article

  • How to invalidate layout of listbox from custom children

    - by Stephen Price
    I have a custom panel for a listbox <ItemsPanelTemplate x:Key="FloatPanelTemplate"> <Controls:FloatPanel x:Name="CardPanel" /> </ItemsPanelTemplate> The panel lays out its children using its X and Y dependency properties. This all works nicely when the FloatPanel is used by itself - I'm using FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure on the dependency properties of the child items to tell the FloatPanel to redraw its layout. When I use it in a Listbox (code above) then it draws fine the first time, but when I drag the children (which modifies the item's X and Y) it is not notifying the Listbox that it needs to redraw the FloatPanel's children. I think the issue is related to the fact that each item in the bound collection is wrapped with a ListBoxItem. Hopefully I've described what i'm doing well enough that someone can tell me how to make the panel (or its children) tell it needs to do the Layout routines again. As I said it works once (initial draw) but then dragging items doesn't work (Listbox isnt aware that its children have changed and needs to relayout.) If I drag an item and then resize the window, the listbox does a layout and the items are drawn in their new locations. How do I notify the ListBox (or more importantly the FloatPanel in the ItemsPanelTemplate) that it needs to do a Layout pass?

    Read the article

  • AuthorizationExecuteWithPrivileges and osascript failing

    - by cygnl7
    I'm attempting to execute an uninstaller (written in AppleScript) through AuthorizationExecuteWithPrivileges. I'm setting up my rights after creating an empty auth ref like so: char *tool = "/usr/bin/osascript"; AuthorizationItem items = {kAuthorizationRightExecute, strlen(tool), tool, 0}; AuthorizationRights rights = {sizeof(items)/sizeof(AuthorizationItem), &items}; AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed; status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL); Later I call: status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, (char *const *)args, NULL); On Snow Leopard this works fine, but on Leopard I get the following in syslog.log: Apr 19 15:30:09 hostname /usr/bin/osascript[39226]: OpenScripting.framework - 'gdut' event blocked in process with mixed credentials (issetugid=0 uid=501 euid=0 gid=20 egid=20) Apr 19 15:30:12: --- last message repeated 1 time --- ... Apr 19 15:30:12 hostname [0x0-0x2e92e9].com.example.uninstaller[39219]: /var/folders/vm/vmkIi0nYG8mHMrllaXaTgk+++TI/-Tmp-/TestApp_tmpfiles/Uninstall.scpt: Apr 19 15:30:12 hostname [0x0-0x2e92e9].com.example.uninstaller[39219]: execution error: «constant afdmasup» doesn’t understand the «event earsffdr» message. (-1708) Am I going about this all wrong? I just want to run the equivalent of "sudo /usr/bin/osascript ..."

    Read the article

  • priority queue with limited space: looking for a good algorithm

    - by SigTerm
    This is not a homework. I'm using a small "priority queue" (implemented as array at the moment) for storing last N items with smallest value. This is a bit slow - O(N) item insertion time. Current implementation keeps track of largest item in array and discards any items that wouldn't fit into array, but I still would like to reduce number of operations further. looking for a priority queue algorithm that matches following requirements: queue can be implemented as array, which has fixed size and _cannot_ grow. Dynamic memory allocation during any queue operation is strictly forbidden. Anything that doesn't fit into array is discarded, but queue keeps all smallest elements ever encountered. O(log(N)) insertion time (i.e. adding element into queue should take up to O(log(N))). (optional) O(1) access for *largest* item in queue (queue stores *smallest* items, so the largest item will be discarded first and I'll need them to reduce number of operations) Easy to implement/understand. Ideally - something similar to binary search - once you understand it, you remember it forever. Elements need not to be sorted in any way. I just need to keep N smallest value ever encountered. When I'll need them, I'll access all of them at once. So technically it doesn't have to be a queue, I just need N last smallest values to be stored. I initially thought about using binary heaps (they can be easily implemented via arrays), but apparently they don't behave well when array can't grow anymore. Linked lists and arrays will require extra time for moving things around. stl priority queue grows and uses dynamic allocation (I may be wrong about it, though). So, any other ideas?

    Read the article

  • Grouping Collection seperating numeric 5 from String "5"

    - by invertedSpear
    BackGround: I have an advanced data grid. The data provider for this ADG is an ArrayCollection. There is a grouping collection on an ID field of this AC. Example of a couple items within this AC the AC var name is "arcTemplates": (mx.collections::ArrayCollection)#0 filterFunction = (null) length = 69 list = (mx.collections::ArrayList)#1 length = 69 source = (Array)#2 [0] (Object)#3 abbreviation = "sore-throat" insertDate = "11/16/2009" name = "sore throat" templateID = 234 templateType = "New Problem" templateTypeID = 1 [32] (Object)#35 abbreviation = 123 insertDate = "03/08/2010" name = 123 templateID = 297 templateType = "New Problem" templateTypeID = 1 [55] (Object)#58 abbreviation = 1234 insertDate = "11/16/2009" name = 1234 templateID = 227 templateType = "Exam" templateTypeID = 5 [56] (Object)#59 abbreviation = "breast only" insertDate = "03/15/2005" name = "breast exam" templateID = 195 templateType = "Exam" templateTypeID = 5 Example of Flex code leading to the Grouping: <mx:AdvancedDataGrid displayItemsExpanded="true" id="gridTemplates"> <mx:dataProvider> <mx:GroupingCollection id="gc" source="{arcTemplates}"> <mx:Grouping > <mx:GroupingField name="templateTypeID" compareFunction="gcSort"> GC sort function: public function gcSort(a:Object, b:Object):int{ return ObjectUtil.stringCompare(String(a.templateTypeID + a.name).toLowerCase(), String(b.templateTypeID + b.name).toLowerCase()); } Problem: In my AC example there are a few items, items 0, 32 and 56 properly sort and group to their templateTypeID, but item 55 does something weird. It seems to sort/group on the numeric 5 instead of the string "5". Gets stranger. If I change the name property to contain text (so 1234x) it then correctly sorts/groups to the string "5" Question: What is going on here and how do I fix it?

    Read the article

  • Pair-wise iteration in C# or sliding window enumerator

    - by f3lix
    If I have an IEnumerable like: string[] items = new string[] { "a", "b", "c", "d" }; I would like to loop thru all the pairs of consecutive items (sliding window of size 2). Which would be ("a","b"), ("b", "c"), ("c", "d") My solution was is this public static IEnumerable<Pair<T, T>> Pairs(IEnumerable<T> enumerable) { IEnumerator<T> e = enumerable.GetEnumerator(); e.MoveNext(); T current = e.Current; while ( e.MoveNext() ) { T next = e.Current; yield return new Pair<T, T>(current, next); current = next; } } // used like this : foreach (Pair<String,String> pair in IterTools<String>.Pairs(items)) { System.Out.PrintLine("{0}, {1}", pair.First, pair.Second) } When I wrote this code, I wondered if there are already functions in the .NET framework that do the same thing and do it not just for pairs but for any size tuples. IMHO there should be a nice way to do this kind of sliding window operations. I use C# 2.0 and I can imagine that with C# 3.0 (w/ LINQ) there are more (and nicer) ways to do this, but I'm primarily interested in C# 2.0 solutions. Though, I will also appreciate C# 3.0 solutions.

    Read the article

  • Windows Phone 7 ListBox uncustomizable?

    - by Roy
    I've just recently started development using Visual Studio 2010 Express for Windows Phone and I put in a ListBox. I can't seem to manipulate the formatting. No matter what I do, the background is black/gray, the selected items have a blue border, and there is padding between the items in the listbox (i'm using images). Here is my code: Xaml: <Grid x:Name="ContentGrid" Grid.Row="1"> <Grid Name="gallery"> <Grid.RowDefinitions> <RowDefinition Height="370" /> <RowDefinition Height="150" /> </Grid.RowDefinitions> <Border BorderBrush="Red" Width="450" CornerRadius="4" BorderThickness="2" Background="Red" Margin="10,30,20,10" Padding="6,6,6,6"> <Image Grid.Row="0" Grid.Column="0" Height="360" x:Name="imgPreview"/> </Border> <ListBox x:Name="lbScrollGallery" Grid.Row="1" Grid.Column="0" Padding="0" VerticalAlignment="Top" Width="450" SelectionChanged="ScrollerSelectionChanged" d:LayoutOverrides="HorizontalAlignment" ScrollViewer.HorizontalScrollBarVisibility="Hidden"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Image Width="100" Height="100" Stretch="Fill" Name="imgSource" VerticalAlignment="Center" Source="{Binding Path=Url}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> </Grid> Is there some way I can customize the listbox? Like change the background to red or make the padding between different items 0?

    Read the article

  • Deserializing XML to Objects in C#

    - by Justin Bozonier
    So I have xml that looks like this: <todo-list> <id type="integer">#{id}</id> <name>#{name}</name> <description>#{description}</description> <project-id type="integer">#{project_id}</project-id> <milestone-id type="integer">#{milestone_id}</milestone-id> <position type="integer">#{position}</position> <!-- if user can see private lists --> <private type="boolean">#{private}</private> <!-- if the account supports time tracking --> <tracked type="boolean">#{tracked}</tracked> <!-- if todo-items are included in the response --> <todo-items type="array"> <todo-item> ... </todo-item> <todo-item> ... </todo-item> ... </todo-items> </todo-list> How would I go about using .NET's serialization library to deserialize this into C# objects? Currently I'm using reflection and I map between the xml and my objects using the naming conventions.

    Read the article

  • Outlook 2010 Retrieving and restricting appointments programmatically causing recurrences to be incl

    - by Mike Dearing
    I wrote a winforms app that uses Microsoft.Office.Interop.Outlook to retrieve and restrict appointments based upon the date range entered by a user. This worked fine with Outlook 2007 installed, however now that some users have updated to Outlook 2010 the appointment retrieval is pulling back incorrect appointments along with the correct ones falling within the specified date range. The additional incorrect appointments being retrieved always appear to be recurring appointments. I was wondering if this is a known bug and if so what exactly is happening that is causing these additional recurring appointments to come in? I'd rather not have to throw in a workaround where I step through the items after they have been restricted and remove the extra ones, when this functionality works fine with 2007. Note: I've not recompiled or updated any code when experiencing this issue, just running the old program. This is the spot in my code where appointments are being restricted. This is similar to the way advised in the following msdn link: http://msdn.microsoft.com/en-us/library/bb611267.aspx Microsoft.Office.Interop.Outlook.Items outlookItems = outlookMapiFolder.Items.Restrict( "[Start] >= '" + outlookImport.startDay.ToString("g") + "' AND [Start] <= '" + outlookImport.endDay.ToString("g") + "'"); outlookItems.Sort("[Start]", Type.Missing); outlookItems.IncludeRecurrences = true;

    Read the article

  • NSPopupButton bound to NSArrayController not updating

    - by BuzzB
    I've got an NSPopupButton bound to an NSArrayController. (Man, that was harder than I thought it would be!) I have an NSArrayController bound to an NSMutableArray via the NSArrayController's "Controller Content" binding. The "Content" and "Content Values" bindings of the NSPopupButton are bound to my NSArrayController, and "Selected Object" is bound to a member in my app delegate. It is working as I expect. Except, when I add items to the NSMutableArray that my NSArrayController is bound to they don't appear in the popup. I kind of expected this to work automagically... with the NSArrayController observing the NSMutableArray and updating the NSPopupButton as necessary. Clearly I am missing something. [Update] Ok, clearly I am adding items to my array in a way that the array controller can't see. I finally found this... https://developer.apple.com/library/mac/documentation/cocoa/conceptual/CocoaBindings/Concepts/Troubleshooting.html But I really don't understand what it means. Does anyone know of a simple example of the proper way to dynamically added items to a bound NSMutableArray when the "adder" has no idea that there is a UI element bound to the array? Any help would be greatly appreciated.

    Read the article

  • PHP: How to store XML data in an array?

    - by tommy
    Below is the XML I am working with - there are more items - this is the first set. How can I get these elements in to an array? I have been trying with PHP's SimpleXML etc. but I just cant do it. <response xmlns:lf="http://api.lemonfree.com/ns/1.0"> <lf:request_type>listing</lf:request_type> <lf:response_code>0</lf:response_code> <lf:result type="listing" count="10"> <lf:item id="56832429"> <lf:attr name="title">Used 2005 Ford Mustang V6 Deluxe</lf:attr> <lf:attr name="year">2005</lf:attr> <lf:attr name="make">FORD</lf:attr> <lf:attr name="model">MUSTANG</lf:attr> <lf:attr name="vin">1ZVFT80N555169501</lf:attr> <lf:attr name="price">12987</lf:attr> <lf:attr name="mileage">42242</lf:attr> <lf:attr name="auction">no</lf:attr> <lf:attr name="city">Grand Rapids</lf:attr> <lf:attr name="state">Michigan</lf:attr> <lf:attr name="image">http://www.lemonfree.com/images/stock_images/thumbnails/2005_38_557_80.jpg</lf:attr> <lf:attr name="link">http://www.lemonfree.com/56832429.html</lf:attr> </lf:item> <!-- more items --> </lf:result> </response> Thanks guys EDIT: I want the first items data in easy to access variables, I've been struggling for a couple of days to get SimpleXML to work as I am new to PHP, so I thought manipulating an array is easier to do.

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >