Daily Archives

Articles indexed Tuesday April 13 2010

Page 24/126 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • save and restore state of a tab bar controller

    - by phunehehe
    I have an application that has a UITabBarController with two tabs, each having its own navigation controller. Now I want to store the state of the application when the user closes it, so that when the user relauches the application will show the same place as the last time before it was closed. So, in applicationWillTerminate: I have [NSKeyedArchiver archiveRootObject:tabBarController toFile:@"lastVisitedTab"]; Then, in applicationDidFinishLaunching: I have UITabBarController *last= (UITabBarController *)[NSKeyedUnarchiver unarchiveObjectWithFile:@"lastVisitedTab"]; if (last) tabBarController = [last retain]; I also have an extension to UIImage to make it compliant to NSCoding. However, this doesn't work, as the state is not preserved. The first tab gets selected all the time, and no navigation is preserved either. Can someone tell me what's wrong, or show me how to do it correctly?

    Read the article

  • How to implement IEquatable<T> when mutable fields are part of the equality - Problem with GetHashCo

    - by Shimmy
    Hello! I am using Entity Framework in my application. I implemented with the partial class of an entity the IEquatable<T> interface: Partial Class Address : Implements IEquatable(Of Address) 'Other part generated Public Overloads Function Equals(ByVal other As Address) As Boolean _ Implements System.IEquatable(Of Address).Equals If ReferenceEquals(Me, other) Then Return True Return AddressId = other.AddressId End Function Public Overrides Function Equals(ByVal obj As Object) As Boolean If obj Is Nothing Then Return MyBase.Equals(obj) If TypeOf obj Is Address Then Return Equals(DirectCast(obj, Address)) Else Return False End Function Public Overrides Function GetHashCode() As Integer Return AddressId.GetHashCode End Function End Class Now in my code I use it this way: Sub Main() Using e As New CompleteKitchenEntities Dim job = e.Job.FirstOrDefault Dim address As New Address() job.Addresses.Add(address) Dim contains1 = job.Addresses.Contains(address) 'True e.SaveChanges() Dim contains2 = job.Addresses.Contains(address) 'False 'The problem is that I can't remove it: Dim removed = job.Addresses.Remoeve(address) 'False End Using End Sub Note (I checked in the debugger visualizer) that the EntityCollection class stores its entities in HashSet so it has to do with the GetHashCode function, I want it to depend on the ID so entities are compared by their IDs. The problem is that when I hit save, the ID changes from 0 to its db value. So the question is how can I have an equatable object, being properly hashed. Please help me find what's wrong in the GetHashCode function (by ID) and what can I change to make it work. Thanks a lot.

    Read the article

  • What is .tpl files? php, web design

    - by Dan
    Hi guys! A man wants me to redesign a site run in PHP (VideoCMS). But when I asked him to send me the source he has given me *.tpl files instead of *.php. There is some code inside them: {include file='header.tpl' p="article"} <br /> <table width="886" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="150" valign="top"> <div id="reg_box"> <h3 class="captions">{$lang.articles}</h3> <div id="list_cats"> <ul> {$article_categories} </ul> </div> </div> <br /> <div id="reg_box"> <h3 class="captions">{$lang.members}</h3> {if $logged_in == '1'} {include file='loggedin_body.tpl'} {else} {include file='login_body.tpl'} {/if} or {include file='header.tpl' p="index"} {php} $_SESSION['isFair'] = "Yes"; {/php} Question: what's the interpreter of the code? How to redesign this site?

    Read the article

  • Insert multiple records from a XML string differing on one parameter in SQL SERVER 2008

    - by Rohit
    Below in a query which inserts records to SimpleDictationProfileMapping table after reading it from a XML string. Now this query inserts a single record in which DictationCaptureProfileID is @dictationCaptureProfileId . Now i want to insert multiple rows in which @dictationCaptureProfileId is different and other 2 values are same. What i want to achieve by this is in case parent changes all child values should also change. INSERT INTO SimpleDictationProfileMapping ( DictationCaptureProfileID, DictationProfileMappingAttributeID, DictationProfileMappingAttributeValue ) SELECT @dictationCaptureProfileId, row.value('@attrId','varchar(max)'), row.value('@value', 'varchar(max)') FROM @simpleDictationCaptureProfileMappings.nodes('/simpleMappingAtribute/attribute') AS d ( row ) ; I want INSERT INTO SimpleDictationProfileMapping ( DictationCaptureProfileID OR (SELECT DictationCaptureProfileID FROM DictationCaptureProfile WHERE SystemDictationCaptureProfileID = @systemDictationCaptureProfileID), DictationProfileMappingAttributeID, DictationProfileMappingAttributeValue ) SELECT @dictationCaptureProfileId , row.value('@attrId','varchar(max)'), row.value('@value', 'varchar(max)') FROM @simpleDictationCaptureProfileMappings.nodes ('/simpleMappingAtribute/attribute') AS d ( row ) ; Please tell how to achieve this.

    Read the article

  • Why is the HttpContext.Cache count always zero?

    - by jjr2527
    I set up a few pages with OutputCache profiles and confirmed that they are being cached by using multiple browsers and requests to retrieve the page with a timestamp which matched across all requests. When I try to enumerate the HttpContect.Cache it is always empty. Any ideas what is going on here or where I should be going for this information instead?

    Read the article

  • Ontologies in .NET

    - by Lily
    I need to make use of some OWL ontologies in c#. Does anyone have a suggestion where I can start? Or if there are any libraries available for .NET please?

    Read the article

  • Most effective server side programming language for web development?

    - by ihaveitnow
    This is more a question of pros/cons between PHP and JAVA. Iv been doing research, and iv narrowed it down to those two. And in consideration, id like to go into mobile app dev...So thats +1 for Java. Time taken to learn the language is not an issue...Just would like to know which is the most profitable at the end of all the training. And on a slight note. Can Javascript work with Java? And what is the real advantage of that?

    Read the article

  • Al Zimmermann's Son of Darts

    - by polygenelubricants
    There's about 2 months left in Al Zimmermann's Son of Darts programming contest, and I'd like to improve my standing (currently in the 60s) to something more respectable. I'd like to get some ideas from the great community of stackoverflow on how best to approach this problem. The contest problem is known as the Global Postage Stamp Problem in literatures. I don't have much experience with optimization algorithms (I know of hillclimbing and simulated annealing in concept only from college), and in fact the program that I have right now is basically sheer brute force, which of course isn't feasible for the larger search spaces. Here are some papers on the subject: A Postage Stamp Problem (Alter & Barnett, 1980) Algorithms for Computing the h-Range of the Postage Stamp Problem (Mossige, 1981) A Postage Stamp Problem (Lunnon, 1986) Two New Techniques for Computing Extremal h-bases Ak (Challis, 1992) Any hints and suggestions are welcome. Also, feel free to direct me to the proper site if stackoverflow isn't it.

    Read the article

  • Sorting GridView Formed With Data Set

    - by nani
    Following Code is for Sorting GridView Formed With DataSet Source: http://www.highoncoding.com/Articles/176_Sorting_GridView_Manually_.aspx But it is not displaying any output. There is no problem in sql connection. I am unable to trace the error, please help me. Thank You. public partial class _Default : System.Web.UI.Page { private const string ASCENDING = " ASC"; private const string DESCENDING = " DESC"; private DataSet GetData() { SqlConnection cnn = new SqlConnection("Server=localhost;Database=Northwind;Trusted_Connection=True;"); SqlDataAdapter da = new SqlDataAdapter("SELECT TOP 5 firstname,lastname,hiredate FROM EMPLOYEES", cnn); DataSet ds = new DataSet(); da.Fill(ds); return ds; } public SortDirection GridViewSortDirection { get { if (ViewState["sortDirection"] == null) ViewState["sortDirection"] = SortDirection.Ascending; return (SortDirection)ViewState["sortDirection"]; } set { ViewState["sortDirection"] = value; } } protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { string sortExpression = e.SortExpression; if (GridViewSortDirection == SortDirection.Ascending) { GridViewSortDirection = SortDirection.Descending; SortGridView(sortExpression, DESCENDING); } else { GridViewSortDirection = SortDirection.Ascending; SortGridView(sortExpression, ASCENDING); } } private void SortGridView(string sortExpression, string direction) { // You can cache the DataTable for improving performance DataTable dt = GetData().Tables[0]; DataView dv = new DataView(dt); dv.Sort = sortExpression + direction; GridView1.DataSource = dv; GridView1.DataBind(); } } aspx page asp:GridView ID="GridView1" runat="server" AllowSorting="True" OnSorting="GridView1_Sorting" /asp:GridView

    Read the article

  • Most computer users need Linux

    <b>Technology & Life Integration:</b> "One thing I have noticed on just about all windows installed computers outside of my strict control is that they are full of viruses, spyware and there are more programs installed than they know what to do with."

    Read the article

  • How to replace a region in emacs with yank buffer contents?

    - by Mad Wombat
    When I use VIM or most modeless editors (Eclipse, NetBeans etc.) I frequently do the following. If I have similar text blocks and I need to change them all, I will change one, copy it (or use non-deleting yank), select next block I need and paste the changed version over it. If I do the same thing in emacs (select region and paste with C-y), it doesn't replace the region, it just pastes at the cursor position. What is the way to do this in emacs?

    Read the article

  • Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

    - by Lirik
    What's a better way to start a thread? I'm trying to determine what are the advantages/disadvantages of _beginthread, _beginthreadex and CreateThread. All of these functions return a thread handle to a newly created thread, I already know that CreateThread provides a little extra information when an error occurs (it can be checked by calling GetLastError)... but what are some things I should consider when I'm using these functions? I'm working with a windows application, so cross-platform computability is already out of the question. I have gone through the msdn documentation and I just can't understand, for example, why anybody would decide to use _beginthread instead of CreateThread or vice versa. Cheers! Update: OK, thanks for all the info, I've also read in a couple of places that I can't call WaitForSingleObject() if I used _beginthread(), but if I call _endthread() in the thread shouldn't that work? What's the deal there?

    Read the article

  • accessing $_SESSION when using file_get_contents in PHP

    - by hairdresser-101
    I am basic - intermediate developer using php and am a little stumped as to what I have found. I need some help in understanding how to alleviate this issue: I have a page called send.email.php which sends an email - pretty simple stuff - I pass an order id, it creates job request and sends it out. This works fine when used in the context I developed it (Use javascript to make an AJAX call to the URL and pass the order_id as a query parameter) I am now trying to reuse the exact same page in another application however I am calling it using php file_get_contents($base_url.'admin/send.email.php?order_id='.$order_id). When I call the page this way, the $_SESSION array is empty isempty() = 1. Is this because I am initiating a new session using file_get_contents and the values I stored in the $_SESSION on login are not available to me within there? Any help? Thanks

    Read the article

  • Treeview - Hierarchical Data Template - Binding does not update on source change?

    - by ClearsTheScreen
    Greetings! I ran into this problem in my project (Silverlight 3 with C#): I have a TreeView which is data bound to, well, a tree. This TreeView has a HierarchicalDataTamplate in a resource dictionary, that defines various controls. Now I want to hide (Visibility.Collapse) some items depending on wether a node has children or not. Other items shall be visible under the same condition. It works like charm when I first bind the source tree to the TreeView, but when I change the source tree, the visibility in the treeview does not change. XAML - page: <controls:TreeView x:Name="SankeyTreeView" ItemContainerStyle="{StaticResource expandedTreeViewItemStyle}" ItemTemplate="{StaticResource SankeyTreeTemplate}"> <controls:TreeViewItem IsExpanded="True"> <controls:TreeViewItem.HeaderTemplate> <DataTemplate> <TextBlock Text="This is just for loading and will be replaced directly after the data becomes available..."/> </DataTemplate> </controls:TreeViewItem.HeaderTemplate> </controls:TreeViewItem> </controls:TreeView> XAML - ResourceDictionary <!-- Each node in the tree is structurally identical, hence only one Hierarchical Data Template that'll use itself on the children. --> <Data:HierarchicalDataTemplate x:Key="SankeyTreeTemplate" ItemsSource="{Binding Children}"> <Grid Height="24"> <TextBlock x:Name="TextBlockName" Text="{Binding Path=Value.name, Mode=TwoWay}" VerticalAlignment="Center" Foreground="Black"/> <TextBox x:Name="TextBoxFlow" Text="{Binding Path=Value.flow, Mode=TwoWay}" Grid.Column="1" Visibility="{Binding Children, Converter={StaticResource BoxConverter}, ConverterParameter=\{box\}}"/> <TextBlock x:Name="TextBlockThroughput" Text="{Binding Path=Value.throughput, Mode=TwoWay}" Grid.Column="1" Visibility="{Binding Children, Converter={StaticResource BoxConverter}, ConverterParameter=\{block\}}"/> <Button x:Name="ButtonAddNode"/> <Button x:Name="ButtonDeleteNode"/> <Button x:Name="ButtonEditNode"/> </Grid> </Data:HierarchicalDataTemplate> Now, as you can see, the TextBoxFlow and the TextBlockThroughput share the same space. What I aim at: The "Throughput" value of a node is how much of something 'flows' through this node from its children. It can't be changed directly, so I want to display a text block. Only leaf nodes have a TextBox to let someone enter the 'flow' that is generated in this leaf node. (I.E.: Node.Throughput = Node.Flow + Sum(Children.Throughput), where Node.Flow = 0 for each non-leaf.) What the BoxConverter (silly name -.-) does: public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((value as NodeList<TreeItem>).Count > 1) // Node has Children? { if ((parameter as String) == "{box}") { return Visibility.Collapsed; } else ((parameter as String) == "{block}") { return Visibility.Visible; } } else { /* * As above, just with Collapsed and Visible switched */ } } The structure of the tree that is bound to the TreeView is essentially stolen from Dan Vanderboom (a bit too much to dump the whole code here), except that I here of course use an ObservableCollection for the children and the value items implement INotifyPropertyChanged. I would be very grateful if someone could explain to me, why inserting items into the underlying tree does not update the visibility for box and block. Thank you in advance!

    Read the article

  • Dynamics AX 2009 Report: LabelPosition above does not work?

    - by Sam
    I'm just in the process of changing the SalesInvoice Report. One thing I'm trying to do is show the label of some items not left of the item value but above it instead. Seems easy enough: just change the LabelPosition (for example from CustInvoiceJour_InvoiceId) setting from "left" to "above" and voila: the label has vanished. It is just shown nowhere at all. Strange. I would have expected the label to show up, well, above the content. Not to vanish. Am I missing something (there is no label height to set), or is this functionality broken?

    Read the article

  • X509Certificate.Export Method

    - by klerik123456
    I try export cert .pfx : string certPath = "D:\\cert.pfx"; cert = new X509Certificate2(certPath, "pass"); byte[] certData = cert.Export(X509ContentType.Pfx,"pass"); /// **error in this line** X509Certificate newCert = new X509Certificate(certData,"pass"); But it finish with this error : Key not valid for use in specified state. Can somebody help me ?? Any solution as export certificate from store ??

    Read the article

  • Jquery simple photo manager demo - recycle trash completely

    - by Roman
    Hi, I'm using the Jquery's simple photo manager just as it is and it's working properly. http://jqueryui.com/demos/droppable/photo-manager.html All I need is the possibility to recycle all the elements from the trash by a single click. Sounds simple but I couldn't get it so far. Ok, I'm a newbie to Jquery. Help would be appreciated!

    Read the article

  • How to get the required value displayed from the given array?

    - by Parth
    From below array i want the value of "_sql" to be displayed or we can I want to echo the "_sql" value, so what should be the syntax to display it in PHP code? JTableMenu Object ( [lft] => [rgt] => [home] => [_tbl] => #__menu [_tbl_key] => id [_db] => JDatabaseMySQL Object ( [name] => mysql [_nullDate] => 0000-00-00 00:00:00 [_nameQuote] => ` [_sql] => INSERT INTO `jos_menu` ( `id`,`menutype`,`name`,`alias`,`link`,`type`,`published`,`componentid`,`parent`,`ordering`,`checked_out`,`checked_out_time`,`brow............ [_errorNum] => 0 ) )

    Read the article

  • Fetch data from multiple MySQL tables

    - by Jon McIntosh
    My two tables look like this: TABLE1 TABLE2 +--------------------+ +--------------------+ |field1|field2|field3| and |field2|field4|field5| +--------------------+ +--------------------+ I am already running a SELECT query for TABLE1, and assorting all of the data into variables: $query = "SELECT * FROM TABLE1 WHERE field2 = 2"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if((!is_bool($result) || $result) && $num_rows) { while($row = mysql_fetch_array($result)) { $field1 = $row['field1']; $field2 = $row['field2']; $field3 = $row['field3']; } } What I want to do is get the data from 'field4' on TABLE2 and add it to my variables. I would want to get field4 WHERE field2 = 2

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >