Search Results

Search found 4012 results on 161 pages for 'concept hierarchy'.

Page 7/161 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Preserving hierarchy when converting .csv file to xml or json

    - by Simon Levinson
    Hello I have a question concerning translating data from a CSV into XML or JSON where it is essential to preserve the heirarchy of the data. For example, if I have CSV data like this: type,brand,country,quantity apple,golden_delicious,english,1 apple,golden_delicious,french,2 apple,cox,,4 apple,braeburn,,1 banana,,carribean,6 banana,,central_america,7 clememtine,,,3 What I want is to preserve hierarchy in the XML so that I get something like: <fruit> <type = "apple"> <brand = "golden_delicious"> <country = "english" quantity = "1"> <country = "french" quantity = "2"> </brand> <brand = "cox"> <quantity = "4"> </brand> <brand = "braeburn"> <quantity = "1"> </brand> </type> <type = "banana"> <country = "carribean" quantity = "6"> <country = "central_america" quantity = "7"> </type> <type = "clementine"> <quantity = "3"> </type> <fruit /> Is it best to try to use JAXP or to convert the above into a table simply of parent, child and then writing the data to an array of strings for processing,? Like this: parent,child fruit,apple apple,golden_delicious golden_delicious,english golden_delicious,french english,1 french,2 apple,cox cox,4 apple,braeburn braeburn,1 And so on. Or is there a better way? Thanks Simon Levinson

    Read the article

  • MySQL nested set hierarchy with foreign table

    - by Björn
    Hi! I'm using a nested set in a MySQL table to describe a hierarchy of categories, and an additional table describing products. Category table; id name left right Products table; id categoryId name How can I retrieve the full path, containing all parent categories, of a product? I.e.: RootCategory > SubCategory 1 > SubCategory 2 > ... > SubCategory n > Product Say for example that I want to list all products from SubCategory1 and it's sub categories, and with each given Product I want the full tree path to that product - is this possible? This is as far as I've got - but the structure is not quite right... select parent.`name` as name, parent.`id` as id, group_concat(parent.`name` separator '/') as path from categories as node, categories as parent, (select inode.`id` as id, inode.`name` as name from categories as inode, categories as iparent where inode.`lft` between iparent.`lft` and iparent.`rgt` and iparent.`id`=4 /* The category from which to list products */ order by inode.`lft`) as sub where node.`lft` between parent.`lft` and parent.`rgt` and node.`id`=sub.`id` group by sub.`id` order by node.`lft`

    Read the article

  • Obtaining Current Fiscal Year from Hierarchy with MDX

    - by Robert Iver
    I'm building a report in Reporting Services 2005 based on a SSAS 2005 cube. The basic idea of the report is that they want to see sales for this fiscal year to date vs. last year sales year to date. It sounds simple, but being that this is my first "real" report based on SSAS, I'm having a hell of a time. First, how would one calculate the current fiscal year, quarter, or month. I have a Fiscal Date Hierarchy with all that information in it, but I can't figure out how to say: "Based on today's date, find the current fiscal year, quarter, and month." My second, but slightly smaller problem, is getting last years sales vs. this years sales. I have seen MANY examples on how to do this, but they all assume that you select the date manually. Since this is a report and will run pretty much on it's own, I need a way to insert the "current" fiscal year, quarter, and month into the PERIODSTODATE or PARALLELPERIOD functions to get what I want. So, I'm begging for your help on this one. I have to have this report done by tomorrow monring and I'm beginning to freak out a bit. Thanks in advance.

    Read the article

  • Creating a class Hierarchy for Atoms,neutrons,protons,chemical reationc

    - by Smart Zulu
    I need help to create a program that can show the hierarchy of any Atoms and its components (neutrons,protons,electrons,and chemical reaction) Here is a code of what i have done so far,being a novice at the subject using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Atoms { public class Atoms { protected string name = "Sodium"; protected string element ="Metal"; public virtual void GetInfo() { Console.WriteLine("name: {0}",name); Console.WriteLine("element: {0}", element); } } class Proton : Atoms { public int number = 11 ; public override void GetInfo() { base.GetInfo(); Console.WriteLine("Proton number: {0}",number); } } class Electron : Atoms { public int number = 11; public override void GetInfo() { base.GetInfo(); Console.WriteLine("Electron number: {0}", number); } class Neutrons : Atoms { public int number = 12; public override void GetInfo() { base.GetInfo(); Console.WriteLine("Neutron number: {0}", number); } class TestClass { static void Main() { Proton P = new Proton(); P.GetInfo(); Neutrons N = new Neutrons(); N.GetInfo(); Electron E = new Electron(); E.GetInfo(); Console.WriteLine("click any key to exit"); Console.ReadLine(); } } } } }

    Read the article

  • Question about Virtual Inheritance hierarchy

    - by Summer_More_More_Tea
    Hi there: I encounter this problem when tackling with virtual inheritance. I remember that in a non-virtual inheritance hierarchy, object of sub-class hold an object of its direct super-class. What about virtual inheritance? In this situation, does object of sub-class hold an object of its super-class directly or just hold a pointer pointing to an object of its super-class? By the way, why the output of the following code is: sizeof(A): 8 sizeof(B): 20 sizeof(C): 20 sizeof(C): 36 Code: #include <iostream> using namespace std; class A{ char k[ 3 ]; public: virtual void a(){}; }; class B : public virtual A{ char j[ 3 ]; public: virtual void b(){}; }; class C : public virtual B{ char i[ 3 ]; public: virtual void c(){}; }; class D : public B, public C{ char h[ 3 ]; public: virtual void d(){}; }; int main( int argc, char *argv[] ){ cout << "sizeof(A): " << sizeof( A ) << endl; cout << "sizeof(B): " << sizeof( B ) << endl; cout << "sizeof(C): " << sizeof( C ) << endl; cout << "sizeof(D): " << sizeof( D ) << endl; return 0; } Thanks in advance. Kind regards.

    Read the article

  • What are you telling yourself if you can't understand new concept, paradigm, feature ... ?

    - by Freshblood
    Programming always required to learn new concepts, paradigms, features and technologies and I always have been failed at first attempt to understand new concept what i encounter. I start to blame and humiliate myself without remember before how i understood new concept which i hadn't understand it before. I can hardly stop to tell myself "why i cant understand ? Am i stupid or idiot ? Yes, i am stuppiiddddd!!!" What your inner voice tells if you can not understand new concept after spend long time till been tired or hopeless ? How do you handle your self-esteem in such situations ?

    Read the article

  • Digia dévoile un nouveau concept d'interface homme-machine (IHM) en 3D pour les automobiles implémentée avec Qt

    Digia dévoile un nouveau concept d'interface homme-machine (IHM) en 3D pour les automobiles implémentée avec Qt Aux Qt Developer Days 2011 de Munich, Digia Qt Commercial a montré un nouveau concept d'interface homme-machine (IHM) en 3D pour les automobiles pour la prochaine version commerciale de Qt 4.8. Le concept sera utilisé comme une nouvelle plateforme d'innovation pour faciliter l'intégration et la présentation de nouvelles idées technologiques. Le principe d'interaction de l'IHM 3D est prévu pour la facilité et l'intuitivité de son utilisation. L'utilisateur est en mesure de contrôler l'interface utilisateur avec des gestes approximatifs au lieu de pointer précisément. Puisque le système m...

    Read the article

  • Concept of WNDCLASSEX, good programming habits and WndProc for system classes

    - by luiscubal
    I understand that the Windows API uses "classes", relying to the WNDCLASS/WNDCLASSEX structures. I have successfully gone through windows API Hello World applications and understand that this class is used by our own windows, but also by Windows core controls, such as "EDIT", "BUTTON", etc. I also understand that it is somehow related to WndProc(it allows me to define a function for it) Although I can find documentation about this class, I can't find anything explaining the concept. So far, the only thing I found about it was this: A Window Class has NOTHING to do with C++ classes. Which really doesn't help(it tells me what it isn't but doesn't tellme what it is). In fact, this only confuses me more, since I'd be tempted to associate WNDCLASSEX to C++ classes and think that "WNDCLASSEX" represents a control type . So, my first question is What is it? In second place, I understand that one can define a WndProc in a class. However, a window can also get messages from the child controls(or windows, or whatever they are called in the Windows API). How can this be? Finally, when is it a good programming practise to define a new class? Per application(for the main frame), per frame, one per control I define(if I create my own progress bar class, for example)? I know Java/Swing, C#/Windows.Form, C/GTK+ and C++/wxWidgets, so I'll probably understand comparisons with these toolkits.

    Read the article

  • Inheritance concept java..help

    - by max
    Hi everyone. I'd be very grateful if someone could help me to understand the inheritance concept in Java. Is the following code an example of that? I mean the class WavPanel is actually a subclass of JPanel which acts as a superclass. Is that correct? If so it means that "what JPanel has, also WavPanel but it is more specific since through its methods you can do something else". Am I wrong? thank you. Max import javax.swing.JPanel; class WavPanel extends JPanel { List<Byte> audioBytes; List<Line2D.Double> lines; public WavPanel() { super(); setBackground(Color.black); resetWaveform(); } public void resetWaveform() { audioBytes = new ArrayList<Byte>(); lines = new ArrayList<Line2D.Double>(); repaint(); } }

    Read the article

  • Not getting concept of null

    - by appu
    Hy Guys, Beginning with mysql. I am not able to grasp the concept of NULL. Check screen-shot (*declare_not_null, link*). In it when I specifically declared 'name' field to be NOT NULL. When i run the 'desc test' table command, the table description shows default value for name field to be NULL.Why is that so? From what I have read about NULL, it connotes a missing or information that is not applicable. So when I declare a field to be NOT NULL it implies (as per my understanding) that user must enter a value for the name field else the DB engine should generate an error i.e. record will not be entered in DB. However when i run 'insert into test value();' the DB engine enters the record in table. Check screen-shot(*empty_value, link*). FLICKR LINKS *declare_not_null* http://www.flickr.com/photos/55097319@N03/5302758813/ *empty_values* Check the second screenshot on flickr Q.2 what would be sql statemetn to drop a primary key from a table's field. If I use 'ALTER TABLE test drop key id;' it gives the following: ERROR: Incorrect table definition; there can be only one auto column and it must be defined as a key. Thanks for your help..

    Read the article

  • Object hierarchy returned by WCF Service is different than expected

    - by robalot
    Good Day Everyone... My understanding may be wrong, but I thought once you applied the correct attributes the DataContractSerializer would render fully-qualified instances back to the caller. The code runs and the objects return. But oddly enough, once I look at the returned objects I noticed the namespacing disappeared and the object-hierarchy being exposed through the (web applications) service reference seems to become "flat" (somehow). Now, I expect this from a web-service…but not through WFC. Of course, my understanding of what WFC can do may be wrong. ...please keep in mind I'm still experimenting with all this. So my questions are… Q: Can I do something within the WFC Service to force the namespacing to render through the (service reference) data client proxy? Q: Or perhaps, am I (merely) consuming the service incorrectly? Q: Is this even possible? The service code looks like… [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class DataService : IFishData { public C1FE GetC1FE(Int32 key) { //… more stuff here … } public Project GetProject(Int32 key) { //… more stuff here … } } [ServiceContract] [ServiceKnownType(typeof(wcfFISH.StateManagement.C1FE.New))] [ServiceKnownType(typeof(wcfFISH.StateManagement.Project.New))] public interface IFishData { [OperationContract] C1FE GetC1FE(Int32 key); [OperationContract] Project GetProject(Int32 key); } [DataContract] [KnownType(typeof(wcfFISH.StateManagement.ObjectState))] public class Project { [DataMember] public wcfFISH.StateManagement.ObjectState ObjectState { get; set; } //… more stuff here … } [DataContract] KnownType(typeof(wcfFISH.StateManagement.ObjectState))] public class C1FE { [DataMember] public wcfFISH.StateManagement.ObjectState ObjectState { get; set; } //… more stuff here … } [DataContract(Namespace = "wcfFISH.StateManagement")] [KnownType(typeof(wcfFISH.StateManagement.C1FE.New))] [KnownType(typeof(wcfFISH.StateManagement.Project.New))] public abstract class ObjectState { //… more stuff here … } [DataContract(Namespace = "wcfFISH.StateManagement.C1FE", Name="New")] [KnownType(typeof(wcfFISH.StateManagement.ObjectState))] public class New : ObjectState { //… more stuff here … } [DataContract(Namespace = "wcfFISH.StateManagement.Project", Name = "New")] [KnownType(typeof(wcfFISH.StateManagement.ObjectState))] public class New : ObjectState { //… more stuff here … } The web application code looks like… public partial class Fish_Invite : BaseForm { protected void btnTest_Click(object sender, EventArgs e) { Project project = new Project(); project.Get(base.ProjectKey, base.AsOf); mappers.Project mapProject = new mappers.Project(); srFish.Project fishProject = new srFish.Project(); srFish.FishDataClient fishService = new srFish.FishDataClient(); mapProject.MapTo(project, fishProject); fishProject = fishService.AddProject(fishProject, IUser.UserName); project = null; } } In case I’m not being clear… The issue arises as there is a difference in (the name spacing) that I expect to see (returned) is different from what is actually returned. fishProject.ObjectState should look like... srFish.StateManagement.Project.New fishC1FE.ObjectState should look like... srFish.StateManagement.C1FE.New fishProject.ObjectState looks like... srFish.New1 fishC1FE.ObjectState looks like... srFish.New …“Help me Obi-Wan Kenobi, you’re my only hope!”

    Read the article

  • Nhibernate multilevel hierarchy save error?

    - by nisbus
    Hi, I have a database with a 6 level hierarchy and a domain model on top of that. something like this: Category -SubCategory -Container -DataDescription | Meta data -Data The mapping I'm using follows the following pattern: <class name="Category, Sample" table="Categories"> <id name="Id" column="Id" type="System.Int32" unsaved-value="0"> <generator class="native"/> </id> <property name="Name" access="property" type="String" column="Name"/> <property name="Metadata" access="property" type="String" column="Metadata"/> <bag name="SubCategories" cascade="save-update" lazy="true" inverse="true"> <key column="Id" foreign-key="category_subCategory_fk"/> <one-to-many class="SubCategory, Sample" /> </bag> </class> <class name="SubCategory, Sample" table="SubCategories"> <id name="Id" column="Id" type="System.Int32" unsaved-value="0"> <generator class="native"/> </id> <many-to-one name="Category" class="Category, Sample" foreign-key="subCat_category_fk"/> <property name="Name" access="property" type="String"/> <property name="Metadata" access="property" type="String"/> <bag name="Containers" inverse="true" cascade="save-update" lazy="true"> <key column="Id" foreign-key="subCat_container_fk" /> <one-to-many class="Container, Sample" /> </bag> </class> <class name="Container, Sample" table="Containers"> <id name="Id" column="Id" type="System.Int32" unsaved-value="0"> <generator class="assigned"/> </id> <many-to-one name="SubCategory" class="SubCategory,Sample" foreign-key="container_subCat_fk"/> <property name="Name" access="property" type="String" column="Name"/> <bag name="DataDescription" cascade="all" lazy="true" inverse="true"> <key column="Id" foreign-key="container_ DataDescription_fk"/> <one-to-many class="DataDescription, Sample" /> </bag> <bag name="MetaData" cascade="all" lazy="true" inverse="true"> <key column="Id" foreign-key="container_metadata_cat_fk"/> <one-to-many class="MetaData, Sample" /> </bag> </class> For some reason when I try to save the category (with the subcategory, container etc. attached) I get a foreign key violation from the database. The code is something like this (Pseudo). var category = new Category(); var subCategory = new SubCategory(); var container = new Container(); var dataDescription = new DataDescription(); var metaData = new MetaData(); category.AddSubCategory(subCategory); subCategory.AddContainer(container); container.AddDataDescription(dataDescription); container.AddMetaData(metaData); Session.Save(category); Here is the log from this test : DEBUG NHibernate.SQL - INSERT INTO Categories (Name, Metadata) VALUES (@p0, @p1); select SCOPE_IDENTITY(); @p0 = 'Unit test', @p1 = 'unit test' DEBUG NHibernate.SQL - INSERT INTO SubCategories (Category, Name, Metadata) VALUES (@p0, @p1, @p2); select SCOPE_IDENTITY(); @p0 = '1', @p1 = 'Unit test', @p2 = 'unit test' DEBUG NHibernate.SQL - INSERT INTO Containers (SubCategory, Name, Frequency, Scale, Measurement, Currency, Metadata, Id) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7); @p0 = '1', @p1 = 'Unit test', @p2 = '15', @p3 = '1', @p4 = '1', @p5 = '1', @p6 = 'unit test', @p7 = '0' ERROR NHibernate.Util.ADOExceptionReporter - The INSERT statement conflicted with the FOREIGN KEY constraint "subCat_container_fk". The conflict occurred in database "Sample", table "dbo.SubCategories", column 'Id'. The methods for adding items to objects is always as follows: public void AddSubCategory(ISubCategory subCategory) { subCategory.Category = this; SubCategories.Add(subCategory); } What am I missing?? Thanks, nisbus

    Read the article

  • Vernon's book Implementing DDD and modeling of underlying concepts

    - by EdvRusj
    Following questions all refer to examples presented in Implementing DDD In article we can see from Figure 6 that both BankingAccount and PayeeAccount represent the same underlying concept of Banking Account BA 1. On page 64 author gives an example of a publishing organization, where the life-cycle of a book goes through several stages ( proposing a book, editorial process, translation of the book ... ) and at each of those stages this book has a different definition. Each stage of the book is defined in a different Bounded Context, but do all these different definitions still represent the same underlying concept of a Book, just like both BankingAccount and PayeeAccount represent the same underlying concept of a BA? 2. a) I understand why User shouldn't exist in Collaboration Context ( CC ), but instead should be defined within Identity and Access Context IAC ( page 65 ). But still, do User ( IAC ), Moderator ( CC ), Author ( CC ),Owner ( CC ) and Participant ( CC ) all represent different aspects of the same underlying concept? b) If yes, then this means that CC contains several model elements ( Moderator, Author, Owner and Participant ), each representing different aspect of the same underlying concept ( just like both BankingAccount and PayeeAccount represent the same underlying concept of a BA ). But isn't this considered a duplication of concepts ( Evan's book, page 339 ), since several model elements in CC represent the same underlying concept? c) If Moderator, Author ... don't represent the same underlying concept, then what underlying concept does each represent? 3. In an e-commerce system, the term Customer has multiple meanings ( page 49 ): When user is browsing the Catalog, Customer has different meaning than when user is placing an Order. But do these two different definitions of a Customer represent the same underlying concept, just like both BankingAccount and PayeeAccount represent the same underlying concept of a BA? thanks

    Read the article

  • php security holes Proof-Of-Concept [closed]

    - by Flavius
    Hi Could you show me a Proof-Of-Concept for all of these: XSS, CSRF, SQL injection with both the source code and the attack steps for each? Other attack vectors are welcome. The most complete answer gets accepted. The configuration is a fairly standard one, as of PHP 5.3.2, core settings: allow_call_time_pass_reference => Off => Off allow_url_fopen => On => On allow_url_include => Off => Off always_populate_raw_post_data => Off => Off arg_separator.input => & => & arg_separator.output => & => & asp_tags => Off => Off auto_append_file => no value => no value auto_globals_jit => On => On auto_prepend_file => no value => no value browscap => no value => no value default_charset => no value => no value default_mimetype => text/html => text/html define_syslog_variables => Off => Off disable_classes => no value => no value disable_functions => no value => no value display_errors => STDOUT => STDOUT display_startup_errors => On => On doc_root => no value => no value docref_ext => no value => no value docref_root => no value => no value enable_dl => Off => Off error_append_string => no value => no value error_log => syslog => syslog error_prepend_string => no value => no value error_reporting => 32767 => 32767 exit_on_timeout => Off => Off expose_php => On => On extension_dir => /usr/lib/php/modules/ => /usr/lib/php/modules/ file_uploads => On => On html_errors => Off => Off ignore_repeated_errors => Off => Off ignore_repeated_source => Off => Off ignore_user_abort => Off => Off implicit_flush => On => On include_path => .:/usr/share/pear => .:/usr/share/pear log_errors => On => On log_errors_max_len => 1024 => 1024 magic_quotes_gpc => Off => Off magic_quotes_runtime => Off => Off magic_quotes_sybase => Off => Off mail.add_x_header => On => On mail.force_extra_parameters => no value => no value mail.log => no value => no value max_execution_time => 0 => 0 max_file_uploads => 20 => 20 max_input_nesting_level => 64 => 64 max_input_time => -1 => -1 memory_limit => 128M => 128M open_basedir => no value => no value output_buffering => 0 => 0 output_handler => no value => no value post_max_size => 8M => 8M precision => 14 => 14 realpath_cache_size => 16K => 16K realpath_cache_ttl => 120 => 120 register_argc_argv => On => On register_globals => Off => Off register_long_arrays => Off => Off report_memleaks => On => On report_zend_debug => Off => Off request_order => GP => GP safe_mode => Off => Off safe_mode_exec_dir => no value => no value safe_mode_gid => Off => Off safe_mode_include_dir => no value => no value sendmail_from => no value => no value sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i serialize_precision => 100 => 100 short_open_tag => Off => Off SMTP => localhost => localhost smtp_port => 25 => 25 sql.safe_mode => Off => Off track_errors => Off => Off unserialize_callback_func => no value => no value upload_max_filesize => 2M => 2M upload_tmp_dir => no value => no value user_dir => no value => no value user_ini.cache_ttl => 300 => 300 user_ini.filename => .user.ini => .user.ini variables_order => GPCS => GPCS xmlrpc_error_number => 0 => 0 xmlrpc_errors => Off => Off y2k_compliance => On => On zend.enable_gc => On => On

    Read the article

  • What problems will I face if I remove the concept of interfaces from my code?

    - by Vishwas Gagrani
    I have been programming for many years but I am still not comfortable with the concept of "Interfaces". I try to use interfaces but many times I don't see a mandatory use for it. I think this is probably because the projects weren't so big, or because interfaces are more useful when teamwork is involved. So, making another attempt to understand the importance of interfaces, here is my question: What problems will I face if I remove the concept of interfaces from my code?

    Read the article

  • How does the overall view hierarchy change when using UIKit view manipulations?

    - by executor21
    I've been trying to figure out what happens in the view hierarchy when methods like pushViewController:animated, presentModalViewController:animated, and tab switches in UITabBarViewController are used, as well as UIAlertView and UIActionSheet. (Side note: I'm doing this because I need to know whether a specific UIView of my creation is visible on screen when I do not know anything about how it or its superview may have been added to the view hierarchy. If someone knows a good way to determine this, I'd welcome the knowledge.) To figure it out, I've been logging out the hierarchy of [[UIApplication sharedApplication] keyWindow] subviews in different circumstances. Is the following correct: When a new viewController is pushed onto the stack of a UINavigationController, the old viewController's view is no longer in the view hierarchy. That is, only the top view controller's view is a subview of UINavigationController's view (according to logs, it's actually several private classes such as UILayoutContainerView). Are the views of view controllers below the top controller of the stack actually removed from the window? A very similar thing happens when a new viewController is presented via presentModalViewController:animated. The new viewController's view is the only subview of the kew window. Is this correct? The easiest thing to understand: a UIAlertView creates its own window and makes it key. The strangest thing I encountered: a UIActionSheet is shown via showInView: method, the actionSheet isn't in the view hierarchy at all. It's not a subview of the view passed as an argument to showInView:, it isn't added as a subview of the key window, and it doesn't create its own window. How does it appear, then? I haven't tried this yet, so I'd like to know what happens in the keyWindow hierarchy when tabs in a UITabBarController are switched. Is the view of the selected UIViewController moved to the top, or does it work like with pushViewController:animated and presentModalViewController:animated, where only the displayed view is in the window hierarchy?

    Read the article

  • Is there any replication standard or concept for application server data replication

    - by Naga
    Hi friends, Say, I have a server that handles file based mass data and can process thousands of read requests and hundreds of provisioning requests(Add, modify, delete) per second. This is not SQL based database. Now i planned to implement replication. There should be master- master replication, master slave replication, partial replication(entries matching a criteria) and fractional replication(part of an entry). Is there any standard for implementing such replication mechanisms? Can you please suggest some solution overview? Thanks, Naga

    Read the article

  • What's the best way to refresh a UITableView within a UINavigationController hierarchy

    - by Steve Neal
    Hi, I'm pretty new to iPhone development and have struggled to find what I consider to be a neat way around this problem. I have a user interface where a summary of record data is displayed in a table inside a navigation controller. When the user clicks the accessory button for a row, a new view is pushed onto the navigation controller revealing a view where the user can edit the data in the corresponding record. Once done, the editing view is popped from the navigation controller's stack and the user is returned to the table view. My problem is that when the user returns to the table view, the table still shows the state of the data before the record was edited. I must therefore reload the table data to show the changes. It doesn't seem possible to reload the table data before it is displayed as the call only updates displayed records. Reloading it after the table has been displayed results in the old data changing before the user's eyes, which I'm not too happy with. This seems to me like a pretty normal thing to want to do in an iPhone app. Can anyone please suggest the best practice approach to doing this? I feel like I'm missing something. Cheers - Steve.

    Read the article

  • C# serial port driver wrapper class code and concept quality

    - by Ruben Trancoso
    Hi folks, Would like to know from all you guys what you think about my Serial Wrapper class. Had be a while I've beem working with serial port but never shared the code what somekind make closed to my very own vision. Would like to know if it's a good/bad approach, if the interface is enough and what more you see on it. I know that Stackoverflow is for question but at the same time there's a lot of very good skilled people here and share code and opinion can also bennefit everybody, it's why I decided to post it anyway. thanks! using System.Text; using System.IO; using System.IO.Ports; using System; namespace Driver { class SerialSingleton { // The singleton instance reference private static SerialSingleton instance = null; // System's serial port interface private SerialPort serial; // Current com port identifier private string comPort = null; // Configuration parameters private int confBaudRate; private int confDataBits; private StopBits confStopBits; private Parity confParityControl; ASCIIEncoding encoding = new ASCIIEncoding(); // ================================================================================== // Constructors public static SerialSingleton getInstance() { if (instance == null) { instance = new SerialSingleton(); } return instance; } private SerialSingleton() { serial = new SerialPort(); } // =================================================================================== // Setup Methods public string ComPort { get { return comPort; } set { if (value == null) { throw new SerialException("Serial port name canot be null."); } if (nameIsComm(value)) { close(); comPort = value; } else { throw new SerialException("Serial Port '" + value + "' is not a valid com port."); } } } public void setSerial(string baudRate, int dataBits, StopBits stopBits, Parity parityControl) { if (baudRate == null) { throw new SerialException("Baud rate cannot be null"); } string[] baudRateRef = { "300", "600", "1200", "1800", "2400", "3600", "4800", "7200", "9600", "14400", "19200", "28800", "38400", "57600", "115200" }; int confBaudRate; if (findString(baudRateRef, baudRate) != -1) { confBaudRate = System.Convert.ToInt32(baudRate); } else { throw new SerialException("Baurate parameter invalid."); } int confDataBits; switch (dataBits) { case 5: confDataBits = 5; break; case 6: confDataBits = 6; break; case 7: confDataBits = 7; break; case 8: confDataBits = 8; break; default: throw new SerialException("Databits parameter invalid"); } if (stopBits == StopBits.None) { throw new SerialException("StopBits parameter cannot be NONE"); } this.confBaudRate = confBaudRate; this.confDataBits = confDataBits; this.confStopBits = stopBits; this.confParityControl = parityControl; } // ================================================================================== public string[] PortList { get { return SerialPort.GetPortNames(); } } public int PortCount { get { return SerialPort.GetPortNames().Length; } } // ================================================================================== // Open/Close Methods public void open() { open(comPort); } private void open(string comPort) { if (isOpen()) { throw new SerialException("Serial Port is Already open"); } else { if (comPort == null) { throw new SerialException("Serial Port not defined. Cannot open"); } bool found = false; if (nameIsComm(comPort)) { string portId; string[] portList = SerialPort.GetPortNames(); for (int i = 0; i < portList.Length; i++) { portId = (portList[i]); if (portId.Equals(comPort)) { found = true; break; } } } else { throw new SerialException("The com port identifier '" + comPort + "' is not a valid serial port identifier"); } if (!found) { throw new SerialException("Serial port '" + comPort + "' not found"); } serial.PortName = comPort; try { serial.Open(); } catch (UnauthorizedAccessException uaex) { throw new SerialException("Cannot open a serial port in use by another application", uaex); } try { serial.BaudRate = confBaudRate; serial.DataBits = confDataBits; serial.Parity = confParityControl; serial.StopBits = confStopBits; } catch (Exception e) { throw new SerialException("Serial port parameter invalid for '" + comPort + "'.\n" + e.Message, e); } } } public void close() { if (serial.IsOpen) { serial.Close(); } } // =================================================================================== // Auxiliary private Methods private int findString(string[] set, string search) { if (set != null) { for (int i = 0; i < set.Length; i++) { if (set[i].Equals(search)) { return i; } } } return -1; } private bool nameIsComm(string name) { int comNumber; int.TryParse(name.Substring(3), out comNumber); if (name.Substring(0, 3).Equals("COM")) { if (comNumber > -1 && comNumber < 256) { return true; } } return false; } // ================================================================================= // Device state Methods public bool isOpen() { return serial.IsOpen; } public bool hasData() { int amount = serial.BytesToRead; if (amount > 0) { return true; } else { return false; } } // ================================================================================== // Input Methods public char getChar() { int data = serial.ReadByte(); return (char)data; } public int getBytes(ref byte[] b) { int size = b.Length; char c; int counter = 0; for (counter = 0; counter < size; counter++) { if (tryGetChar(out c)) { b[counter] = (byte)c; } else { break; } } return counter; } public string getStringUntil(char x) { char c; string response = ""; while (tryGetChar(out c)) { response = response + c; if (c == x) { break; } } return response; } public bool tryGetChar(out char c) { c = (char)0x00; byte[] b = new byte[1]; long to = 10; long ft = System.Environment.TickCount + to; while (System.Environment.TickCount < ft) { if (hasData()) { int data = serial.ReadByte(); c = (char)data; return true; } } return false; } // ================================================================================ // Output Methods public void sendString(string data) { byte[] bytes = encoding.GetBytes(data); serial.Write(bytes, 0, bytes.Length); } public void sendChar(char c) { char[] data = new char[1]; data[0] = c; serial.Write(data, 0, 1); } public void sendBytes(byte[] data) { serial.Write(data, 0, data.Length); } public void clearBuffer() { if (serial.IsOpen) { serial.DiscardInBuffer(); serial.DiscardOutBuffer(); } } } }

    Read the article

  • JPA Lookup Hierarchy Mapping

    - by Andy Trujillo
    Given a lookup table: | ID | TYPE | CODE | DESCRIPTION | | 1 | ORDER_STATUS | PENDING | PENDING DISPOSITION | | 2 | ORDER_STATUS | OPEN | AWAITING DISPOSITION | | 3 | OTHER_STATUS | OPEN | USED BY OTHER ENTITY | If I have an entity: @MappedSuperclass @Table(name="LOOKUP") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="TYPE", discriminatorType=DiscriminatorType.STRING) public abstract class Lookup { @Id @Column(name="ID") int id; @Column(name="TYPE") String type; @Column(name="CODE") String code; @Column(name="DESC") String description; ... } Then a subclass: @Entity @DiscriminatorValue("ORDER_STATUS") public class OrderStatus extends Lookup { } The expectation is to map it: @Entity @Table(name="ORDERS") public class OrderVO { ... @ManyToOne @JoinColumn(name="STATUS", referencedColumnName="CODE") OrderStatus status; ... } So that the CODE is stored in the database. I expected that if I wrote: OrderVO o = entityManager.find(OrderVO.class, 123); the SQL generated using OpenJPA would look something like: SELECT t0.id, ..., t1.CODE, t1.TYPE, t1.DESC FROM ORDERS t0 LEFT OUTER JOIN LOOKUP t1 ON t0.STATUS = t1.CODE AND t1.TYPE = 'ORDER_STATUS' WHERE t0.ID = ? But the actual SQL that gets generated is missing the AND t1.TYPE = 'ORDER_STATUS' This causes a problem when the CODE is not unique. Is there a way to have the discriminator included on joins or am I doing something wrong here?

    Read the article

  • Exception hierarchy in java

    - by Abhishek Jain
    As Error and Exception are subclass of throwable class, we can throw any error, runtime ex and other ex. Also we can catch any of these type. Why do we usually catch only checked Exception? Can somebody provide me good links for exception with examples?

    Read the article

  • Emulating old-school sprite flickering (theory and concept)

    - by Jeffrey Kern
    I'm trying to develop an oldschool NES-style video game, with sprite flickering and graphical slowdown. I've been thinking of what type of logic I should use to enable such effects. I have to consider the following restrictions if I want to go old-school NES style: No more than 64 sprites on the screen at a time No more than 8 sprites per scanline, or for each line on the Y axis If there is too much action going on the screen, the system freezes the image for a frame to let the processor catch up with the action From what I've read up, if there were more than 64 sprites on the screen, the developer would only draw high-priority sprites while ignoring low-priority ones. They could also alternate, drawing each even numbered sprite on opposite frames from odd numbered ones. The scanline issue is interesting. From my testing, it is impossible to get good speed on the XBOX 360 XNA framework by drawing sprites pixel-by-pixel, like the NES did. This is why in old-school games, if there were too many sprites on a single line, some would appear if they were cut in half. For all purposes for this project, I'm making scanlines be 8 pixels tall, and grouping the sprites together per scanline by their Y positioning. So, dumbed down I need to come up with a solution that.... 64 sprites on screen at once 8 sprites per 'scanline' Can draw sprites based on priority Can alternate between sprites per frame Emulate slowdown Here is my current theory First and foremost, a fundamental idea I came up with is addressing sprite priority. Assuming values between 0-255 (0 being low), I can assign sprites priority levels, for instance: 0 to 63 being low 63 to 127 being medium 128 to 191 being high 192 to 255 being maximum Within my data files, I can assign each sprite to be a certain priority. When the parent object is created, the sprite would randomly get assigned a number between its designated range. I would then draw sprites in order from high to low, with the end goal of drawing every sprite. Now, when a sprite gets drawn in a frame, I would then randomly generate it a new priority value within its initial priority level. However, if a sprite doesn't get drawn in a frame, I could add 32 to its current priority. For example, if the system can only draw sprites down to a priority level of 135, a sprite with an initial priority of 45 could then be drawn after 3 frames of not being drawn (45+32+32+32=141) This would, in theory, allow sprites to alternate frames, allow priority levels, and limit sprites to 64 per screen. Now, the interesting question is how do I limit sprites to only 8 per scanline? I'm thinking that if I'm sorting the sprites high-priority to low-priority, iterate through the loop until I've hit 64 sprites drawn. However, I shouldn't just take the first 64 sprites in the list. Before drawing each sprite, I could check to see how many sprites were drawn in it's respective scanline via counter variables . For example: Y-values between 0 to 7 belong to Scanline 0, scanlineCount[0] = 0 Y-values between 8 to 15 belong to Scanline 1, scanlineCount[1] = 0 etc. I could reset the values per scanline for every frame drawn. While going down the sprite list, add 1 to the scanline's respective counter if a sprite gets drawn in that scanline. If it equals 8, don't draw that sprite and go to the sprite with the next lowest priority. SLOWDOWN The last thing I need to do is emulate slowdown. My initial idea was that if I'm drawing 64 sprites per frame and there's still more sprites that need to be drawn, I could pause the rendering by 16ms or so. However, in the NES games I've played, sometimes there's slowdown if there's not any sprite flickering going on whereas the game moves beautifully even if there is some sprite flickering. Perhaps give a value to each object that uses sprites on the screen (like the priority values above), and if the combined values of all objects w/ sprites surpass a threshold, introduce the sprite flickering? IN CONCLUSION... Does everything I wrote actually sound legitimate and could work, or is it a pipe dream? What improvements can you all possibly think with this game programming theory of mine?

    Read the article

  • GWT - How to define a Widget outside layout hierarchy in uibinder xml file

    - by mr_room
    Hello, this is my first post. I hope someone could help me. I'm looking for a way to define a widget in UiBinder XML layout file separately, without being part of the layout hierachy. Here's a small example: <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"> <g:Label ui:field="testlabel" text="Hallo" /> <g:HTMLPanel> ... </g:HTMLPanel> The compile fails since the ui:UiBinder element expects only one child element. In Java Code i will access and bind the Label widget as usual: @UiField Label testlabel; For example, this could be useful when you define a Grid or FlexTable - i want to define the Labels for the table header within the XML layout file, not programmatically within the code. Many thanks in advance

    Read the article

  • SQL Server 2005 database design - many-to-many relationships with hierarchy

    - by Remnant
    Note I have completely re-written my original post to better explain the issue I am trying to understand. I have tried to generalise the problem as much as possible. Also, my thanks to the original people who responded. Hopefully this post makes things a little clearer. Context In short, I am struggling to understand the best way to design a small scale database to handle (what I perceive to be) multiple many-to-many relationships. Imagine the following scenario for a company organisational structure: Textile Division Marketing Division | | ---------------------- ---------------------- | | | | HR Dept Finance Dept HR Dept Finance Dept | | | | ---------- ---------- ---------- --------- | | | | | | | | Payroll Hiring Audit Tax Payroll Hiring Audit Accounts | | | | | | | | Emps Emps Emps Emps Emps Emps Emps Emps NB: Emps denotes a list of employess that work in that area When I first started with this issue I made four separate tables: Divisions - Textile, Marketing (PK = DivisionID) Departments - HR, Finance (PK = DeptID) Functions - Payroll, Hiring, Audit, Tax, Accounts (PK = FunctionID) Employees - List of all Employees (PK = EmployeeID) The problem as I see it is that there are multiple many-to-many relationships i.e. many departments have many divisions and many functions have many departments. Question Giving the database structure above, suppose I wanted to do the following: Get all employees who work in the Payroll function of the Marketing Division To do this I need to be able to differentiate between the two Payroll departments but I am not sure how this can be done? I understand that I could build a 'Link / Junction' table between Departments and Functions so that I can retrieve which Functions are in which Departments. However, I would still need to differentiate the Division they belong to. Research Effort As you can see I am an abecedarian when it comes to database deisgn. I have spent the last two days resaerching this issue, traversing nested set models, adjacency models, reading that this issue is known not to be NP complete etc. I am sure there is a simple solution?

    Read the article

  • How to make concept representation with the help of bag of words

    - by agazerboy
    Hi All, Thanks for stoping to read my question :) this is very sweet place full of GREAT peoples ! I have a question about "creating sentences with words". NO NO it is not about english grammar :) Let me explain, If I have bag of words like "person apple apple person person a eat person will apple eat hungry apple hungry" and it can generate some kind of following sentence "hungry person eat apple" I don't in which field this topic will relate. Where should I try to find an answer. I tried to search google but I only found english grammar stuff :) Any body there who can tell me which algo can work in this problem? or any program Thanks P.S: It is not an assignment :) if it would be i would ask for source code ! I don't even know in which field I should look for :)

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >