Search Results

Search found 336 results on 14 pages for 'doe'.

Page 13/14 | < Previous Page | 9 10 11 12 13 14  | Next Page >

  • Get Nhibernate entity and complete it from a web service.

    - by Nour Sabouny
    Hi every one. let's say that i have an order system. each "Order" references a "Customer" Object. when i fill the orders list in Data Access Layer, the customer object should be brought from a Customer Web Service "WCF". so i didn't map the Customer property in the Order mapping class, Id(o => o.OrderID).GeneratedBy.Identity(); //References(o => o.Customer).Not.Nullable().Column("CustomerID"); HasMany(o => o.Details).KeyColumn("OrderID").Cascade.AllDeleteOrphan(); Map(c => c.CustomerID).Not.Nullable(); and asked the nhibernate session to get me the orders list. and tried to loop on every order in the list to fill it's customer property, doe's any body have a good idea for this ???? IList<Order> lst = Session.CreateCriteria<Order>().List<Order>(); foreach (Order order in lst) order.Customer = serviceProxy.GetCustomerByID(order.CustomerID);

    Read the article

  • JSDoc with AngularJS

    - by Nick White
    Currently within my Project we are using JSDoc, we have recently started to implement Angular and I want to continue using JSDoc to ensure that all the documentation is within the same place. I have taken a look at people mainly just saying to use ngDoc but this isn't really a viable option as we will always have separate JavaScript and I ideally would have everything together. /** * @author Example <[email protected]> * @copyright 2014 Example Ltd. All rights reserved. */ (function () { window.example = window.example || {}; /** * Example Namespace * @memberOf example * @namespace example.angular */ window.example.angular = window.example.angular || {}; var exAngular = window.example.angular; /** * A Example Angular Bootstrap Module * @module exampleAngularBootstrap */ exAngular.bootstrap = angular.module('exampleAngularBootstrap', [ 'ngRoute', 'ngResource', 'ngCookies' ]) .run(function ($http, $cookies) { $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken; $http.defaults.headers.common['X-CSRFToken'] = $cookies.csrftoken; }); })(); Currently this is what I have but am unable to put documentation for the run() any ideas? Thank you in advanced!

    Read the article

  • Mysql query in drupal database - groupwise maximum with duplicate data

    - by nselikoff
    I'm working on a mysql query in a Drupal database that pulls together users and two different cck content types. I know people ask for help with groupwise maximum queries all the time... I've done my best but I need help. This is what I have so far: # the artists SELECT users.uid, users.name AS username, n1.title AS artist_name FROM users LEFT JOIN users_roles ur ON users.uid=ur.uid INNER JOIN role r ON ur.rid=r.rid AND r.name='artist' LEFT JOIN node n1 ON n1.uid = users.uid AND n1.type = 'submission' WHERE users.status = 1 ORDER BY users.name; This gives me data that looks like: uid username artist_name 1 foo Joe the Plumber 2 bar Jane Doe 3 baz The Tooth Fairy Also, I've got this query: # artwork SELECT n.nid, n.uid, a.field_order_value FROM node n LEFT JOIN content_type_artwork a ON n.nid = a.nid WHERE n.type = 'artwork' ORDER BY n.uid, a.field_order_value; Which gives me data like this: nid uid field_order_value 1 1 1 2 1 3 3 1 2 4 2 NULL 5 3 1 6 3 1 Additional relevant info: nid is the primary key for an Artwork every Artist has one or more Artworks valid data for field_order_value is NULL, 1, 2, 3, or 4 field_order_value is not necessarily unique per Artist - an Artist could have 4 Artworks all with field_order_value = 1. What I want is the row with the minimum field_order_value from my second query joined with the artist information from the first query. In cases where the field_order_value is not valuable information (either because the Artist has used duplicate values among their Artworks or left that field NULL), I would like the row with the minimum nid from the second query.

    Read the article

  • C Programming - Passing a pointer to array

    - by Pedro
    How do I pass a pointer value to an array of the struct; For example, on a txt I have this: John Doe;[email protected];214425532; My code: typedef struct Person{ char name[100]; char email[100]; int phone; }PERSON; int main(){ PERSON persons[100]; FILE *fp; char *ap_name; char *ap_email; char *ap_phone; char line[100]; fp=("text.txt","r"); if(fp==NULL){ exit(1); } else{ fgets(line,100,fp); ap_name=strtok(line,";"); ap_email=strtok(NULL,";"); ap_phone=strtok(NULL,";"); } return 0; } My question is how can I pass the value of ap_name, ap_email, ap_phone to the struct? And, do I need to use all of these pointers?

    Read the article

  • 1.8.x Ruby on Rails RESTful nested admin page and form_for problems

    - by Loomer
    So I am creating a website that I want to have an admin directory in rails 1.8.x and I'm struggling a bit to get the form_for to link to the right controller. I am trying to be RESTful. What I basically want is an admin page that has a summary of actions which can then administer sub models such as: /admin (a summary of events) /admin/sales (edit sales on the site) /admin/sales/0 (the normal RESTful stuff) I can't use namespaces since they were introduced in Rails 2.0 (production site that I don't want to mess with updating rails and all that). Anyway, what I have in the routes.rb is: map.resource :admin do |admin| admin.resources :sales end I am using the map.resource as a singleton as recommended by another site. The problem comes in when I try to use the form_for to link to the subresource RESTfully. If i do : form_for(:sales, @sale) it never links to the right controller no matter what I try. I have also tried: form_for [@admin, @sale] do |f| and that doe not work either (I am guessing since admin is a singleton which does not have a model, it's just a placeholder for the admin controller). Am I supposed to add a prefix or something? Or something into the sales controller to specify that it is a subcontroller to admin? Is there an easier way to do this without manually creating a bunch of routes? Thanks for any help.

    Read the article

  • Iterate Through JSON Data for Specific Element - Similar to XPath

    - by Highroller
    I am working on an embedded system and my theory of the overall process follows this methodology: 1. Send a command to the back end asking for account information in JSON format. 2. The back end writes a JSON file with all accounts and associated information (there could be 0 to 16 accounts). 3. Here's where I get stuck - use JavaScript (we are using the JQuery library) to iterate through the returned information for a specific element (similar to XPath) and build an array based on the number of elements found to populate a drop-down box to select the account you want to view and then do stuff with the account info. So my code looks like this: loadAccounts = function() { $.getJSON('/info?q=voip.accounts[]', function(result) { var sipAcnts = $("#sipacnts"); $(sipAcnts).empty(); // empty the dropdown (if necessarry) // Get the 'label' element and stick it in an array // build the array and append it to the sipAcnts dropdown // use array index to ref the accounts info and do stuff with it } So what I need is the JSON version of XPath to build the array of voip.accounts.label. The first account info looks something like this: { "result_set": { "voip.accounts[0]": { "label": "Dispatch1", "enabled": true, "user": "1234", "name": "Jane Doe", "type": "sip", "sip": { "lots and lots of stuff": }, } } } Am I over complicating the issue? Any wisdom anyone could thrown down would be greatly appreciated.

    Read the article

  • How to access individual items in Android GridView?

    - by source.rar
    Hi, I'm trying to create a game with a 9x9 grid with GridView. Each item in the grid is a TextView. I am able to set the initial values of each item in the grid within the getView() method to "0", however I want to change the value of each grid individually after this but have been unable to do so. I tried adding an update() function in my extended GridAdapter class that takes a position and a number to update at that position but this doesnt seem to be working. public void update(int position, int number) { TextView cell; cell = (TextView) getItem(position); if (cell != null) { cell.setText(Integer.toString(number)); } } Doe anyone know how this can be achieved? Here's the whole GridAdapter class in case require, public class SudokuGridAdapter extends BaseAdapter { private Context myContext; private TextView[] myCells; public SudokuGridAdapter(Context c) { myContext = c; myCells = new TextView[9*9]; } @Override public int getCount() { // TODO Auto-generated method stub return 9*9; } @Override public Object getItem(int position) { return myCells[position]; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView cell; if (myCells[position] == null) { cell = myCells[position] = new TextView(myContext); cell.setText("0"); } else { cell = myCells[position]; } return cell; } public void update(int position, int number) { TextView cell; cell = (TextView) getItem(position); if (cell != null) { cell.setText(Integer.toString(number)); } } }

    Read the article

  • Writing all the html of a document with jquery instead of in the page body?

    - by Robert
    I'm a UI person currently working on a web application, where most of the people I work with are back end developers. I'm currently at a disagreement with them about whether or not the above is a prudent thing to do. This application doe use quite a bit of JavaScript, and wouldn't even work without it unfortunately. This being the case, One of the back end developers that I'm working with is claiming that pages could and even SHOULD be build completely with JavaScript or jquery. This caught me completely off guard. We're talking about div tags, lists, background images and text here. I'm trying to explain to him that this isn't the right way to do things at all, and from a best practices perspective: content(html) should be separate from presentation(css), and behavior(script etc.). I know that it's possible to write html in jquery, although I haven't done it, but am I wrong in my thinking that this isn't the way things should be done. Is it even possible to write ALL the code with jquery? would love to hear any thoughts either way, as I will be discussing this with him again tomorrow.

    Read the article

  • Basic SQL Query, I am newbie

    - by user3530547
    I just started my database and query class on Monday. We met on Monday and just went over the syllabus, and on Wednesday the network at school was down so we couldn't even do the power point lecture. Right now I am working on my first homework assignment and I am almost finished but I am having trouble on one question. Here is is... Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. Format the columns with the last name, a comma, a space, and the first name like this: Doe, John Sort the result set by last name in ascending sequence. Return only the contacts whose last name begins with letters from M to Z. Here is what I have so far... USE md0577283 SELECT FirstName,LastName FROM Customers ORDER BY LastName,FirstName My question is how do I format is Lastname, FirstName like the professor wants and how do I only select names M-Z? If someone could point me in the right direction I would greatly appreciate it. Thank you. PS With all do respect, I didn't ask for the answer I asked for a nudge in the right direction so why the down vote guys?

    Read the article

  • Filtering Security Logs by User and Logon Type

    - by Trido
    I have been asked to find out when a user has logged on to the system in the last week. Now the audit logs in Windows should contain all the info I need. I think if I search for Event ID 4624 (Logon Success) with a specific AD user and Logon Type 2 (Interactive Logon) that it should give me the information I need, but for the life of my I cannot figure out how to actually filter the Event Log to get this information. Is it possible inside of the Event Viewer or do you need to use an external tool to parse it to this level? I found http://nerdsknowbest.blogspot.com.au/2013/03/filter-security-event-logs-by-user-in.html which seemed to be part of what I needed. I modified it slightly to only give me the last 7 days worth. Below is the XML I tried. <QueryList> <Query Id="0" Path="Security"> <Select Path="Security">*[System[(EventID=4624) and TimeCreated[timediff(@SystemTime) &lt;= 604800000]]]</Select> <Select Path="Security">*[EventData[Data[@Name='Logon Type']='2']]</Select> <Select Path="Security">*[EventData[Data[@Name='subjectUsername']='Domain\Username']]</Select> </Query> </QueryList> It only gave me the last 7 days, but the rest of it did not work. Can anyone assist me with this? EDIT Thanks to the suggestions of Lucky Luke I have been making progress. The below is my current query, although as I will explain it isn't returning any results. <QueryList> <Query Id="0" Path="Security"> <Select Path="Security"> *[System[(EventID='4624')] and System[TimeCreated[timediff(@SystemTime) &lt;= 604800000]] and EventData[Data[@Name='TargetUserName']='john.doe'] and EventData[Data[@Name='LogonType']='2'] ] </Select> </Query> </QueryList> As I mentioned, it wasn't returning any results so I have been messing with it a bit. I can get it to produce the results correctly until I add in the LogonType line. After that, it returns no results. Any idea why this might be? EDIT 2 I updated the LogonType line to the following: EventData[Data[@Name='LogonType'] and (Data='2' or Data='7')] This should capture Workstation Logons as well as Workstation Unlocks, but I still get nothing. I then modify it to search for other Logon Types like 3, or 8 which it finds plenty of. This leads me to believe that the query works correctly, but for some reason there are no entries in the Event Logs with Logon Type equalling 2 and this makes no sense to me. Is it possible to turn this off?

    Read the article

  • =?UTF-8?B??= in Emails sent via php mail problem

    - by Camran
    I have a website, and in the "Contact" section I have a form which users may fill in to contact me. The form is a simple form which action is a php page. The php code: $to = "[email protected]"; $name=$_POST['name']; // sender name $email=$_POST['email']; // sender email $tel= $_POST['tel']; // sender tel $subject=$_POST['subject']; // subject CHOSEN FROM DROPLIST, ALL TESTED $text=$_POST['text']; // Message from sender $text.="\n\nTel:".$tel; // Added to message to show me the telephone nr to the sender at bottom of message $headers="MIME-Version: 1.0"."\n"; $headers.="Content-type: text/plain; charset=UTF-8"."\n"; $headers.="From: $name <$email>"."\n"; mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $text, $headers, '[email protected]'); Could somebody please tell me why this works most of the time, but sometimes I receive email whith no text and the subject line showing =?UTF-8?B??= I use outlook express, and I have read this http://stackoverflow.com/questions/454833/system-net-mail-and-utf-8bxxxxx-headers but it didn't help. The problem is not in Outlook, because when I log in to the actual mailprogram where I fetch the POP3 emails from, the email looks the same. When I right click in Outlook and chose "message source" then there is no "From" information. Ex, a good message should look like this: Subject: =?UTF-8?B?w5Z2cmlndA==?= MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 From: John Doe However, the ones with problem looks like this: Subject: =?UTF-8?B??= MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 From: As if the information has been lost somewhere. You should know also that I have a VPS, which I manage myself. I use postfix as an emailserver, if thats got anything to do with it. But then again, why does it work sometimes? Also another thing that I have noticed is that sometimes special characters are not shown correctly (by both Outlook and the webmail). For instance, the name "Björkman" in swedish is shown like Björkman, but again, only sometimes. I hope anybody knows something about this problem, because it is very hard to track down for me atleast. If you need more input let me know.

    Read the article

  • WPF Databinding- Not your fathers databinding Part 1-3

    - by Shervin Shakibi
    As Promised here is my advanced databinding presentation from South Florida Code camp and also Orlando Code camp. you can find the demo files here. http://ssccinc.com/wpfdatabinding.zip Here is a quick description of the first demos, there will be 2 other Blogposting in the next few days getting into more advance databinding topics.   Example00 Here we have 3 textboxes, The first textbox mySourceElement Second textbox has a binding to mySourceElement and Path= Text <Binding ElementName="mySourceElement" Path="Text"  />   Third textbox is also bound to the Text property but we use inline Binding <TextBlock Text="{Binding ElementName=mySourceElement,Path=Text }" Grid.Row="2" /> Here is the entire XAML     <Grid  >           <Grid.RowDefinitions >             <RowDefinition Height="*" />             <RowDefinition Height="*" />             <RowDefinition Height="*" />         </Grid.RowDefinitions>         <TextBox Name="mySourceElement" Grid.Row="0"                  TextChanged="mySourceElement_TextChanged">Hello Orlnado</TextBox>         <TextBlock Grid.Row="1">                        <TextBlock.Text>                 <Binding ElementName="mySourceElement" Path="Text"  />             </TextBlock.Text>         </TextBlock>         <TextBlock Text="{Binding ElementName=mySourceElement,Path=Text }" Grid.Row="2" />     </Grid> </Window> Example01 we have a slider control, then we have two textboxes bound to the value property of the slider. one has its text property bound, the second has its fontsize property bound. <Grid>      <Grid.RowDefinitions >          <RowDefinition Height="40px" />          <RowDefinition Height="40px" />          <RowDefinition Height="*" />      </Grid.RowDefinitions>      <Slider Name="fontSizeSlider" Minimum="5" Maximum="100"              Value="10" Grid.Row="0" />      <TextBox Name="SizeTextBox"                    Text="{Binding ElementName=fontSizeSlider, Path=Value}" Grid.Row="1"/>      <TextBlock Text="Example 01"                 FontSize="{Binding ElementName=SizeTextBox,  Path=Text}"  Grid.Row="2"/> </Grid> Example02 very much like the previous example but it also has a font dropdown <Grid>      <Grid.RowDefinitions >          <RowDefinition Height="20px" />          <RowDefinition Height="40px" />          <RowDefinition Height="40px" />          <RowDefinition Height="*" />      </Grid.RowDefinitions>      <ComboBox Name="FontNameList" SelectedIndex="0" Grid.Row="0">          <ComboBoxItem Content="Arial" />          <ComboBoxItem Content="Calibri" />          <ComboBoxItem Content="Times New Roman" />          <ComboBoxItem Content="Verdana" />      </ComboBox>      <Slider Name="fontSizeSlider" Minimum="5" Maximum="100" Value="10" Grid.Row="1" />      <TextBox Name="SizeTextBox"      Text="{Binding ElementName=fontSizeSlider, Path=Value}" Grid.Row="2"/>      <TextBlock Text="Example 01" FontFamily="{Binding ElementName=FontNameList, Path=Text}"                 FontSize="{Binding ElementName=SizeTextBox,  Path=Text}"  Grid.Row="3"/> </Grid> Example03 In this example we bind to an object Employee.cs Notice we added a directive to our xaml which is clr-namespace and the namespace for our employee Class xmlns:local="clr-namespace:Example03" In Our windows Resources we create an instance of our object <Window.Resources>     <local:Employee x:Key="MyEmployee" EmployeeNumber="145"                     FirstName="John"                     LastName="Doe"                     Department="Product Development"                     Title="QA Manager" /> </Window.Resources> then we bind our container to the that instance of the data <Grid DataContext="{StaticResource MyEmployee}">         <Grid.RowDefinitions>             <RowDefinition Height="*" />             <RowDefinition Height="*" />             <RowDefinition Height="*" />             <RowDefinition Height="*" />             <RowDefinition Height="*" />         </Grid.RowDefinitions>         <Grid.ColumnDefinitions >             <ColumnDefinition Width="130px" />             <ColumnDefinition Width="178*" />         </Grid.ColumnDefinitions>     </Grid> and Finally we have textboxes that will bind to that textbox         <Label Grid.Row="0" Grid.Column="0">Employee Number</Label>         <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=EmployeeNumber}"></TextBox>         <Label Grid.Row="1" Grid.Column="0">First Name</Label>         <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=FirstName}"></TextBox>         <Label Grid.Row="2" Grid.Column="0">Last Name</Label>         <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=LastName}" />         <Label Grid.Row="3" Grid.Column="0">Title</Label>         <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=Title}"></TextBox>         <Label Grid.Row="4" Grid.Column="0">Department</Label>         <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=Department}" />

    Read the article

  • Dataform fields won't appear

    - by dsetton
    Hello! I am trying to learn how to use the Silverlight 3 DataForm control, because I need to define the DataForm fields myself in the XAML code, that is, I don't want to use the AutoGenerateFields property. My problem is: the dataform works perfectly when the AutoGenerateFields is set to true, but when I create a DataForm and set the fields manually and run the application, all I get is an empty blank rectangle where my form and its fields should be. I created a blank Silverligh Navigation Application to test this, and below is the code of the Home.xaml page: <Grid x:Name="LayoutRoot"> <StackPanel> <!-- This doesn't work. It renders a blank rectangle --> <dataFormToolkit:DataForm x:Name="DataForm"> <dataFormToolkit:DataForm.EditTemplate> <DataTemplate> <StackPanel dataFormToolkit:DataField.IsFieldGroup="True"> <dataFormToolkit:DataField> <TextBox Text="Test1" /> </dataFormToolkit:DataField> <dataFormToolkit:DataField> <TextBox Text="Test2" /> </dataFormToolkit:DataField> <dataFormToolkit:DataField> <TextBox Text="Test3" /> </dataFormToolkit:DataField> </StackPanel> </DataTemplate> </dataFormToolkit:DataForm.EditTemplate> </dataFormToolkit:DataForm> <!-- This works. --> <dataFormToolkit:DataForm x:Name="DataForm2"/> </StackPanel> </Grid> To make the second DataForm work, I simply created a Person class, and put the following in Home.xaml.cs: protected override void OnNavigatedTo(NavigationEventArgs e) { Person client = new Person { Age = 10, DateOfBirth = new DateTime(1980, 10, 20), FirstName = "John", LastName = "Doe" }; DataForm2.CurrentItem = client; } You can see what happens when I run the application in the following link: http://dl.dropbox.com/u/1946004/image.PNG (I don't have enough points to post images, so...) Does anyone know what's wrong? Thank you in advance.

    Read the article

  • C# XPath Not Finding Anything

    - by ehdv
    I'm trying to use XPath to select the items which have a facet with Location values, but currently my attempts even to just select all items fail: The system happily reports that it found 0 items, then returns (instead the nodes should be processed by a foreach loop). I'd appreciate help either making my original query or just getting XPath to work at all. XML <?xml version="1.0" encoding="UTF-8" ?> <Collection Name="My Collection" SchemaVersion="1.0" xmlns="http://schemas.microsoft.com/collection/metadata/2009" xmlns:p="http://schemas.microsoft.com/livelabs/pivot/collection/2009" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <FacetCategories> <FacetCategory Name="Current Address" Type="Location"/> <FacetCategory Name="Previous Addresses" Type="Location" /> </FacetCategories> <Items> <Item Id="1" Name="John Doe"> <Facets> <Facet Name="Current Address"> <Location Value="101 America Rd, A Dorm Rm 000, Chapel Hill, NC 27514" /> </Facet> <Facet Name="Previous Addresses"> <Location Value="123 Anywhere Ln, Darien, CT 06820" /> <Location Value="000 Foobar Rd, Cary, NC 27519" /> </Facet> </Facets> </Item> </Items> </Collection> C# public void countItems(string fileName) { XmlDocument document = new XmlDocument(); document.Load(fileName); XmlNode root = document.DocumentElement; XmlNodeList xnl = root.SelectNodes("//Item"); Console.WriteLine(String.Format("Found {0} items" , xnl.Count)); } There's more to the method than this, but since this is all that gets run I'm assuming the problem lies here. Calling root.ChildNodes accurately returns FacetCategories and Items, so I am completely at a loss. Thanks for your help!

    Read the article

  • Advice on displaying and allowing editing of data using ASP.NET MVC?

    - by Remnant
    I am embarking upon my first ASP.NET MVC project and I would like to get some input on possible ways to display database data and general best practice. In short, the body of my webpage will show data from my database in a table like format, with each table row showing similar data. For example: Name Age Position Date Joined Jon Smith 23 Striker 18th Mar 2005 John Doe 38 Defender 3rd Jan 1988 In terms of functionality, primarily I’d like to give the user the ability to edit the data and, after the edit, commit the edit to the database and refresh the view.The reason I want to refresh the view is because the data is date ordered and I will need to re-sort if the user edits a date field. My main question is what architecture / tools would be best suited to this fulfil my requirements at a high level? From the research I have done so far my initial conclusions were: ADO.NET for data retrieval. This is something I have used before and feel comfortable with. I like the look of LINQ to SQL but don’t want to make the learning curve any steeper for my first outing into MVC land just yet. Partial Views to create a template and then iterate through a datatable that I have pulled back from my database model. jQuery to allow the user to edit data in the table, error check edited data entries etc. Also, my intial view was that caching the data would not be a key requirement here. The only field a user will be able to update is the field and, if they do, I will need to commit that data to the database immediately and then refresh the view (as the data is date sorted). Any thoughts on this? Alternatively, I have seen some jQuery plug-ins that emulate a datagrid and provide associated functionality. My first thoughts are that I do not need all the functionality that comes with these plug-ins (e.g. zebra striping, ability to sort by column using sort glyph in column headers etc .) and I don’t really see any benefit to this over and above the solution I have outlined above. Again, is there reason to reconsider this view? Finally, when a user edits a date , I will need to refresh the view. In order to do this I had been reading about Html.RenderAction and this seemed like it may be a better option than using Partial Views as I can incorporate application logic into the action method. Am I right to consider Html.RenderAction or have I misunderstood its usage? Hope this post is clear and not too long. I did consider separate posts for each topic (e.g. Partial View vs. Html.RenderAction, when to use jQury datagrid plug-in) but it feels like these issues are so intertwined that they need to be dealt with in contect of each other. Thanks

    Read the article

  • Sockets receiving null (Android)

    - by Henrik
    I have a android app that is communicating with a server (written in java). Between these two parts I have established a Socket connection and want to send data. The problem I am having is that sometimes, for some users, the information that reaches the server is null. This works (for all phones, all users): Server: int a = Integer.parseInt(in.readLine()); int b = Integer.parseInt(in.readLine()); int c = Integer.parseInt(in.readLine()); int d = Integer.parseInt(in.readLine()); String checksum = in.readLine(); String model = in.readLine(); String device = in.readLine(); String name = in.readLine(); Client: out.println(a); out.println(b); out.println(c); out.println(d); out.println(hash); out.println(Build.MODEL); out.println(Build.DEVICE); String name = fixName(); out.print(name); out.flush(); This does not work (for some users): Server: int a = Integer.parseInt(in.readLine()); String checksum = in.readLine(); String model = in.readLine(); String device = in.readLine(); String name = in.readLine(); String msg = in.readLine(); int version = -1; String test = "hej"; try{ test = in.readLine(); version = Integer.parseInt(test); }catch(Exception e){ e.printStackTrace(); } Client: out.println(a); out.println(hash); out.println(Build.MODEL); out.println(Build.DEVICE); String name = fixName(); if(name == null) name = "John Doe"; out.println(name); String msg = fixMsg(); if(msg == null) name = "nada"; out.println(msg); out.println(curversion); out.flush(); Sometimes, in the second case, the name, msg, and version (the string test) are null at the server side. The catch is triggered because test is null. curversion,a are ints, the rest are strings. Any ideas?

    Read the article

  • How do I use data from the main window in a sub-window?

    - by eagle
    I've just started working on a photo viewer type desktop AIR app with Flex. From the main window I can launch sub-windows, but in these sub-windows I can't seem to access the data I collected in the main window. How can I access this data? Or, how can I send this data to the sub-window on creation? It doesn't need to be dynamically linked. myMain.mxml <?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="260" height="200" title="myMain"> <fx:Declarations> </fx:Declarations> <fx:Script> <![CDATA[ public function openWin():void { new myWindow().open(); } public var myData:Array = new Array('The Eiffel Tower','Paris','John Doe'); ]]> </fx:Script> <s:Button x="10" y="10" width="240" label="open a sub-window" click="openWin();"/> </s:WindowedApplication> myWindow.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Window name="myWindow" title="myWindow" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="640" height="360"> <mx:Script> <![CDATA[ ]]> </mx:Script> <mx:Label id="comment" x="10" y="10" text=""/> <mx:Label id="location" x="10" y="30" text=""/> <mx:Label id="author" x="10" y="50" text=""/> </mx:Window> I realize this might be a very easy question but I have searched the web, read and watched tutorials on random AIR subjects for a few days and couldn't find it. The risk of looking like a fool is worth it now, I want to get on with my first app!

    Read the article

  • How to access a field's value in an object using reflection

    - by kentcdodds
    My Question: How to overcome an IllegalAccessException to access the value of a an object's field using reflection. Expansion: I'm trying to learn about reflection to make some of my projects more generic. I'm running into an IllegalAccessException when trying to call field.getValue(object) to get the value of that field in that object. I can get the name and type just fine. If I change the declaration from private to public then this works fine. But in an effort to follow the "rules" of encapsulation I don't want to do this. Any help would be greatly appreciated! Thanks! My Code: package main; import java.lang.reflect.Field; public class Tester { public static void main(String args[]) throws Exception { new Tester().reflectionTest(); } public void reflectionTest() throws Exception { Person person = new Person("John Doe", "555-123-4567", "Rover"); Field[] fields = person.getClass().getDeclaredFields(); for (Field field : fields) { System.out.println("Field Name: " + field.getName()); System.out.println("Field Type: " + field.getType()); System.out.println("Field Value: " + field.get(person)); //The line above throws: Exception in thread "main" java.lang.IllegalAccessException: Class main.Tester can not access a member of class main.Tester$Person with modifiers "private final" } } public class Person { private final String name; private final String phoneNumber; private final String dogsName; public Person(String name, String phoneNumber, String dogsName) { this.name = name; this.phoneNumber = phoneNumber; this.dogsName = dogsName; } } } The Output: run: Field Name: name Field Type: class java.lang.String Exception in thread "main" java.lang.IllegalAccessException: Class main.Tester can not access a member of class main.Tester$Person with modifiers "private final" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) at java.lang.reflect.Field.doSecurityCheck(Field.java:983) at java.lang.reflect.Field.getFieldAccessor(Field.java:927) at java.lang.reflect.Field.get(Field.java:372) at main.Tester.reflectionTest(Tester.java:17) at main.Tester.main(Tester.java:8) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)

    Read the article

  • Multiple column subselect in mysql 5 (5.1.42)

    - by rubber boots
    This one seems to be a simple problem, but I can't make it work in a single select or nested select. Retrieve the authors and (if any) advisers of a paper (article) into one row. I order to explain the problem, here are the two data tables (pseudo) papers (id, title, c_year) persons (id, firstname, lastname) plus a link table w/one extra attribute (pseudo): paper_person_roles( paper_id person_id act_role ENUM ('AUTHOR', 'ADVISER') ) This is basically a list of written papers (table: papers) and a list of staff and/or students (table: persons) An article my have (1,N) authors. An article may have (0,N) advisers. A person can be in 'AUTHOR' or 'ADVISER' role (but not at the same time). The application eventually puts out table rows containing the following entries: TH: || Paper_ID | Author(s) | Title | Adviser(s) | TD: || 21334 |John Doe, Jeff Tucker|Why the moon looks yellow|Brown, Rayleigh| ... My first approach was like: select/extract a full list of articles into the application, eg.SELECT q.id, q.title FROM papers AS q ORDER BY q.c_year and save the results of the query into an array (in the application). After this step, loop over the array of the returned information and retrieve authors and advisers (if any), via prepared statement (? is the paper's id) from the link table like:APPLICATION_LOOP(paper_ids in array) SELECT p.lastname, p.firstname, r.act_role FROM persons AS p, paper_person_roles AS r WHERE p.id=r.person_id AND r.paper_id = ? # The application does further processing from here (pseudo): foreach record from resulting records if record.act_role eq 'AUTHOR' then join to author_column if record.act_role eq 'ADVISER' then join to avdiser_column end print id, author_column, title, adviser_column APPLICATION_LOOP This works so far and gives the desired output. Would it make sense to put the computation back into the DB? I'm not very proficient in nontrivial SQL and can't find a solution with a single (combined or nested) select call. I tried sth. like SELECT q.title (CONCAT_WS(' ', (SELECT p.firstname, p.lastname AS aunames FROM persons AS p, paper_person_roles AS r WHERE q.id=r.paper_id AND r.act_role='AUTHOR') ) ) AS aulist FROM papers AS q, persons AS p, paper_person_roles AS r in several variations, but no luck ... Maybe there is some chance? Thanks in advance r.b.

    Read the article

  • Using PHP5s SOAP Client to send data to an ASP/.NET based SOAP server.

    - by user325143
    I am trying to write a snippet of PHP to connect to a third party's API via SOAP to enter some data into their database. The API requires me to pass several mandatory fields for every call (username, password, companyid, entitytype) in addition to the mandatory data fields. It also requires me to call the "ValidateEntity" funciton before calling the "CreateEntity" function. Documentation can be found here: http://wiki.agemni.com/Getting_Started/APIs/Database_API I have never worked with SOAP before, so I am very new to this. Here is what I have so far: error_reporting(E_ALL); ini_set('display_errors', '1'); $client = new SoapClient("http://agemni.com/AgemniWebservices/service1.asmx?WSDL", array('trace'=> true)); $options = array( 'username' => "myuser", 'password' => "mypassword", 'companyid' => myID, 'entitytype' => 2 ); $params = array( 'fname' => "John", 'lname' => "Doe", 'phone' => "859-333-3333", 'zip' => "40332", 'area id' => "12345", 'lead id' => "28222", 'contactdate' => "4/10/2010" ); $validate = $client->__soapCall("ValidateEntity", array($params), array($options)); $client->__soapCall("CreateEntity", array($params), array($options)); echo "<pre>"; var_dump($client-> __getLastRequestHeaders()); var_dump($client-> __getLastRequest()); var_dump($client-> __getLastResponseHeaders()); var_dump($client-> __getLastResponse()); var_dump($result); echo "</pre>"; Upon executing this code, I get the following error: Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'objecttype' property in /www/tmp/index-soap.php:24 Stack trace: #0 /www/tmp/index-soap.php(24): SoapClient->__soapCall('ValidateEntity', Array) #1 {main} thrown in /www/stealth/tmp/index-soap.php on line 24 I guess my question is.. am I even going about doing this the right way? I know this is a very broad question, but I appreciate any advice you can give me about making this work. Please let me know if you require more detail. Thanks!

    Read the article

  • Exchange Server 2007 Send and Receive Connectors

    - by Mistiry
    I have gotten awesome advice from users on here for getting Exchange on Windows SBS 2008 set up. I think this is the final piece and I'm ready for roll-out! I need to set up Exchange so that it RECEIVES mail from our existing mail server as a Forward [aliases on the existing mail server to forward mail from [email protected] to [email protected]] (not using the POP3 Connector), and SENDS mail through that server as well (sends from [email protected] to [email protected] and then out to the world, showing in the headers as from [email protected] or at absolute least have the reply-to set as this). Alternatively, as long as the .net email address doesn't show in the From and replies are directed to the .com account, email can go from Exchange to the outside world without directing through the existing mail server. External Domain: domain.com Internal Domain: domain.local Internet Domain Name Set in SBS Console: domain.net When I go to http://remote.domain.net I get the Remote Web Workspace, and can login to both Sharepoint and OWA. I can send an email from OWA to a GMail account. I receive it from [email protected], which is an alias of [email protected]. I cannot, however, send an email from OWA to ANY domain.com email addresses. I am also not receiving any email to this Exchange account (except for NDRs). When I try sending an email to a domain.com account, here is the error (I had to replace all < and with { and }): Delivery has failed to these recipients or distribution lists: [email protected] The recipient's e-mail address was not found in the recipient's e-mail system. Microsoft Exchange will not try to redeliver this message for you. Please check the e-mail address and try resending this message, or provide the following diagnostic text to your system administrator. Generating server: IFEXCHANGE.domain.local [email protected] #550 5.1.1 RESOLVER.ADR.RecipNotFound; not found ## Original message headers: Received: from IFEXCHANGE.domain.local ([fe80::4d34:abc5:f7fd:e51a]) by IFEXCHANGE.domain.local ([fe80::4d34:abc5:f7fd:e51a%10]) with mapi; Tue, 17 Aug 2010 14:14:14 -0400 Content-Type: application/ms-tnef; name="winmail.dat" Content-Transfer-Encoding: binary From: John Doe {[email protected]} To: "[email protected]" {[email protected]} Date: Tue, 17 Aug 2010 14:14:12 -0400 Subject: asdf Thread-Topic: asdf Thread-Index: AQHLPjf+h6hA5MJ1JUu1WS4I4CiWeA== Message-ID: {E4E10393768D784D8760A51938BA456A029934BA30@IFEXCHANGE.domain.local} Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: {E4E10393768D784D8760A51938BA456A029934BA30@IFEXCHANGE.domain.local} MIME-Version: 1.0 I hope I explained the situation well enough for someone to be able to explain to me what I'm missing. If I could, I'd be putting a 10K bounty, but unfortunately I've got only 74 reputation (hey, I'm a newbie here!). I'm pretty sure the obvious "RecipNotFound" error is why its not working, my question is how to resolve this. The email account exists, it receives mail just fine, yet when I send it from the Exchange server it fails. EDIT In OC-Hub Transport, the Email Address Policies has 2 entries. "Windows SBS Email Address Policy" is set up to: Include All Recipient Types, no conditions, and SMTP %[email protected]. "Default Policy" set to: Include All Recipient Types, no conditions, and SMTP @domain.net. Three Authoritative Accepted domains domain.com domain.local (Default) domain.net Remote Domains tab has two entries. Default with domain * Windows SBS Company Web Domain with domain companyweb.

    Read the article

  • Android - Create a custom multi-line ListView bound to an ArrayList

    - by Bill Osuch
    The Android HelloListView tutorial shows how to bind a ListView to an array of string objects, but you'll probably outgrow that pretty quickly. This post will show you how to bind the ListView to an ArrayList of custom objects, as well as create a multi-line ListView. Let's say you have some sort of search functionality that returns a list of people, along with addresses and phone numbers. We're going to display that data in three formatted lines for each result, and make it clickable. First, create your new Android project, and create two layout files. Main.xml will probably already be created by default, so paste this in: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:orientation="vertical"  android:layout_width="fill_parent"   android:layout_height="fill_parent">  <TextView   android:layout_height="wrap_content"   android:text="Custom ListView Contents"   android:gravity="center_vertical|center_horizontal"   android:layout_width="fill_parent" />   <ListView    android:id="@+id/ListView01"    android:layout_height="wrap_content"    android:layout_width="fill_parent"/> </LinearLayout> Next, create a layout file called custom_row_view.xml. This layout will be the template for each individual row in the ListView. You can use pretty much any type of layout - Relative, Table, etc., but for this we'll just use Linear: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:orientation="vertical"  android:layout_width="fill_parent"   android:layout_height="fill_parent">   <TextView android:id="@+id/name"   android:textSize="14sp"   android:textStyle="bold"   android:textColor="#FFFF00"   android:layout_width="wrap_content"   android:layout_height="wrap_content"/>  <TextView android:id="@+id/cityState"   android:layout_width="wrap_content"   android:layout_height="wrap_content"/>  <TextView android:id="@+id/phone"   android:layout_width="wrap_content"   android:layout_height="wrap_content"/> </LinearLayout> Now, add an object called SearchResults. Paste this code in: public class SearchResults {  private String name = "";  private String cityState = "";  private String phone = "";  public void setName(String name) {   this.name = name;  }  public String getName() {   return name;  }  public void setCityState(String cityState) {   this.cityState = cityState;  }  public String getCityState() {   return cityState;  }  public void setPhone(String phone) {   this.phone = phone;  }  public String getPhone() {   return phone;  } } This is the class that we'll be filling with our data, and loading into an ArrayList. Next, you'll need a custom adapter. This one just extends the BaseAdapter, but you could extend the ArrayAdapter if you prefer. public class MyCustomBaseAdapter extends BaseAdapter {  private static ArrayList<SearchResults> searchArrayList;    private LayoutInflater mInflater;  public MyCustomBaseAdapter(Context context, ArrayList<SearchResults> results) {   searchArrayList = results;   mInflater = LayoutInflater.from(context);  }  public int getCount() {   return searchArrayList.size();  }  public Object getItem(int position) {   return searchArrayList.get(position);  }  public long getItemId(int position) {   return position;  }  public View getView(int position, View convertView, ViewGroup parent) {   ViewHolder holder;   if (convertView == null) {    convertView = mInflater.inflate(R.layout.custom_row_view, null);    holder = new ViewHolder();    holder.txtName = (TextView) convertView.findViewById(R.id.name);    holder.txtCityState = (TextView) convertView.findViewById(R.id.cityState);    holder.txtPhone = (TextView) convertView.findViewById(R.id.phone);    convertView.setTag(holder);   } else {    holder = (ViewHolder) convertView.getTag();   }      holder.txtName.setText(searchArrayList.get(position).getName());   holder.txtCityState.setText(searchArrayList.get(position).getCityState());   holder.txtPhone.setText(searchArrayList.get(position).getPhone());   return convertView;  }  static class ViewHolder {   TextView txtName;   TextView txtCityState;   TextView txtPhone;  } } (This is basically the same as the List14.java API demo) Finally, we'll wire it all up in the main class file: public class CustomListView extends Activity {     @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);                 ArrayList<SearchResults> searchResults = GetSearchResults();                 final ListView lv1 = (ListView) findViewById(R.id.ListView01);         lv1.setAdapter(new MyCustomBaseAdapter(this, searchResults));                 lv1.setOnItemClickListener(new OnItemClickListener() {          @Override          public void onItemClick(AdapterView<?> a, View v, int position, long id) {           Object o = lv1.getItemAtPosition(position);           SearchResults fullObject = (SearchResults)o;           Toast.makeText(ListViewBlogPost.this, "You have chosen: " + " " + fullObject.getName(), Toast.LENGTH_LONG).show();          }          });     }         private ArrayList<SearchResults> GetSearchResults(){      ArrayList<SearchResults> results = new ArrayList<SearchResults>();            SearchResults sr1 = new SearchResults();      sr1.setName("John Smith");      sr1.setCityState("Dallas, TX");      sr1.setPhone("214-555-1234");      results.add(sr1);            sr1 = new SearchResults();      sr1.setName("Jane Doe");      sr1.setCityState("Atlanta, GA");      sr1.setPhone("469-555-2587");      results.add(sr1);            sr1 = new SearchResults();      sr1.setName("Steve Young");      sr1.setCityState("Miami, FL");      sr1.setPhone("305-555-7895");      results.add(sr1);            sr1 = new SearchResults();      sr1.setName("Fred Jones");      sr1.setCityState("Las Vegas, NV");      sr1.setPhone("612-555-8214");      results.add(sr1);            return results;     } } Notice that we first get an ArrayList of SearchResults objects (normally this would be from an external data source...), pass it to the custom adapter, then set up a click listener. The listener gets the item that was clicked, converts it back to a SearchResults object, and does whatever it needs to do. Fire it up in the emulator, and you should wind up with something like this:

    Read the article

  • terminating java applet thread on page unload

    - by Hammad Tariq
    Hello, I have got a problem here in terminating the threads. The problem is that I am using applet thread to access JS DOM and manipulate innerHTML of a span to right the Thread Name as the innerHTML. It works fine until I keep refreshing the page but if I dont give it a sleep of like 200ms and go to another page which dont have any applet on it, it will give me an error in firebug console: document.getElementById("userName") is null What I am suspecting is, although I send an interrupt on stop and I have also tried the same by setting a flag variable of running in run while loop, the thread executes much faster than the time JVM takes to unload it and I get my page changed in browser but applet is still trying to find an element with id userName. Is that true? Is there any work around of it? Is there any way to know how many threads are running at the moment? Is there any kill all command to send on destroy()? I have searched a lot, seen all the API of java threads and applets, couldn't get this to work. Below is the code: import java.applet.Applet; import netscape.javascript.*; //No need to extend JApplet, since we don't add any components; //we just paint. public class firstApplet extends Applet { /** * */ private static final long serialVersionUID = 1L; firstThread first; boolean running = false; public class firstThread extends Thread{ JSObject win; JSObject doc; firstThread second; public firstThread(JSObject window){ this.win = window; } public void run() { try{ System.out.println("running... "); while (!isInterrupted()){ doc = (JSObject) win.getMember("document"); String userName = Thread.currentThread().getName(); //String userName = "John Doe"; String S = "document.getElementById(\"userName\").innerHTML = \""+userName+"\";"; doc.eval(S); Thread.sleep(5); } }catch(Exception e){ System.out.println("exception in first thread... "); e.printStackTrace(); } } } public void init() { System.out.println("initializing... "); } public void start() { System.out.println("starting... "); JSObject window = JSObject.getWindow(this); first = new firstThread(window); first.start(); running = true; } public void stop() { first.interrupt(); first = null; System.out.println("stopping... "); } public void destroy() { if(first != null){ first = null; } System.out.println("preparing for unloading..."); } } Thanks

    Read the article

  • JOptionPane opening another JFrame

    - by mike_hornbeck
    So I'm continuing my fight with this : http://stackoverflow.com/questions/2923545/creating-java-dialogs/2926126 task. Now my JOptionPane opens new window with envelope overfiew, but I can't change size of this window. Also I wanted to have sender's data in upper left corner, and receiver's data in bottom right. How can I achieve that ? There is also issue with OptionPane itself. After I click 'OK' it opens small window in the upper left corner of the screen. What is this and why it's appearing ? My code: import java.awt.*; import java.awt.Font; import javax.swing.*; public class Main extends JFrame { private static JTextField nameField = new JTextField(20); private static JTextField surnameField = new JTextField(); private static JTextField addr1Field = new JTextField(); private static JTextField addr2Field = new JTextField(); private static JComboBox sizes = new JComboBox(new String[] { "small", "medium", "large", "extra-large" }); public Main(){ JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); getContentPane().add(mainPanel); JPanel addrPanel = new JPanel(new GridLayout(0, 1)); addrPanel.setBorder(BorderFactory.createTitledBorder("Receiver")); addrPanel.add(new JLabel("Name")); addrPanel.add(nameField); addrPanel.add(new JLabel("Surname")); addrPanel.add(surnameField); addrPanel.add(new JLabel("Address 1")); addrPanel.add(addr1Field); addrPanel.add(new JLabel("Address 2")); addrPanel.add(addr2Field); mainPanel.add(addrPanel); mainPanel.add(new JLabel(" ")); mainPanel.add(sizes); String[] buttons = { "OK", "Cancel"}; int c = JOptionPane.showOptionDialog( null, mainPanel, "My Panel", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, buttons, buttons[0] ); if(c ==0){ new Envelope(nameField.getText(), surnameField.getText(), addr1Field.getText() , addr2Field.getText(), sizes.getSelectedIndex()); } setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String[] args) { new Main(); } } class Envelope extends JFrame { private final int SMALL=0; private final int MEDIUM=1; private final int LARGE=2; private final int XLARGE=3; public Envelope(String n, String s, String a1, String a2, int i){ Container content = getContentPane(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(new JLabel("John Doe")); mainPanel.add(new JLabel("FooBar str 14")); mainPanel.add(new JLabel("Newark, 45-99")); JPanel dataPanel = new JPanel(); dataPanel.setFont(new Font("sansserif", Font.PLAIN, 32)); //set size from i mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBackground(Color.ORANGE); mainPanel.add(new JLabel("Mr "+n+" "+s)); mainPanel.add(new JLabel(a1)); mainPanel.add(new JLabel(a2)); content.setSize(450, 600); content.setBackground(Color.ORANGE); content.add(mainPanel, BorderLayout.NORTH); content.add(dataPanel, BorderLayout.SOUTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } }

    Read the article

  • With NHibernate, how can I add a child object when updating a parent object?

    - by BMZ
    I have a simple Parent/Child relationship between a Person object and an Address object. The Person object exists in the DB. After doing a Get on the Person, I add a new Address object to the Address sub-object list of the parent, and do some other updates to the Person object. Finally, I do an Update on the Person object. With a SQL trace window, I can see the update to the Person object to the Person table and the Insert of the Address record to the Address table. The issue is that, after the update is performed, the AddressId (primary key on the Address object) is still set to 0, which is what it defaults to when you first initialize the Address object. I have verified that when I do an Add, this value is set correctly. Is this a known issue when trying to add sub-objects as part of an NHibernate UPDATE? Sample code and mapping files are below Thanks <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="BusinessEntities.Wellness.Person,BusinessEntities.Wellness" table="Person" lazy="true" dynamic-insert="true" dynamic-update="false"> <id name="Personid" column="PersonID" type="int"> <generator class="native" /> </id> <version type="binary" generated="always" name="RecordVersion" column="`RecordVersion`"/> <property type="int" not-null="true" name="Customerid" column="`CustomerID`" /> <property type="AnsiString" not-null="true" length="9" name="Ssn" column="`SSN`" /> <property type="AnsiString" not-null="true" length="30" name="FirstName" column="`FirstName`" /> <property type="AnsiString" not-null="true" length="35" name="LastName" column="`LastName`" /> <property type="AnsiString" length="1" name="MiddleInitial" column="`MiddleInitial`" /> <property type="DateTime" name="DateOfBirth" column="`DateOfBirth`" /> <bag name="PersonAddresses" inverse="true" lazy="true" cascade="all"> <key column="PersonID" /> <one-to-many class="BusinessEntities.Wellness.PersonAddress,BusinessEntities.Wellness" / </bag> </class> </hibernate-mapping> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="BusinessEntities.Wellness.PersonAddress,BusinessEntities.Wellness" table="PersonAddress" lazy="true" dynamic-insert="true" dynamic-update="false"> <id name="PersonAddressId" column="PersonAddressID" type="int"> <generator class="native" /> </id> <version type="binary" generated="always" name="RecordVersion" column="`RecordVersion`" /> <property type="AnsiString" not-null="true" length="1" name="AddressTypeid" column="`AddressTypeID`" /> <property type="AnsiString" not-null="true" length="60" name="AddressLine1" column="`AddressLine1`" /> <property type="AnsiString" length="60" name="AddressLine2" column="`AddressLine2`" /> <property type="AnsiString" length="60" name="City" column="`City`" /> <property type="AnsiString" length="2" name="UsStateId" column="`USStateID`" /> <property type="AnsiString" length="5" name="UsPostalCodeId" column="`USPostalCodeID`" /> <many-to-one name="Person" cascade="none" column="PersonID" /> </class> </hibernate-mapping> Person newPerson = new Person(); newPerson.PersonName = "John Doe"; newPerson.SSN = "111111111"; newPerson.CreatedBy = "RJC"; newPerson.CreatedDate = DateTime.Today; personDao.AddPerson(newPerson); Person updatePerson = personDao.GetPerson(newPerson.PersonId); updatePerson.PersonAddresses = new List<PersonAddress>(); PersonAddress addr = new PersonAddress(); addr.AddressLine1 = "1 Main St"; addr.City = "Boston"; addr.State = "MA"; addr.Zip = "12345"; updatePerson.PersonAddresses.Add(addr); personDao.UpdatePerson(updatePerson); int addressID = updatePerson.PersonAddresses[0].AddressId;

    Read the article

< Previous Page | 9 10 11 12 13 14  | Next Page >