Search Results

Search found 345 results on 14 pages for 'coral doe'.

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

  • "Downloading" a computed value form JavaScript

    - by Travis Jensen
    I'm hoping you can prove me wrong here (please, please, please! ;). I have a situation where I need to download encrypted data from a Server D (for "Data"). Server K (for "Key") has the encryption key. For security sake, I would really prefer that Server D never know the key that Server K knows. What I want is my client (e.g. your browser) to connect to Server D for the data and Server K for the key and doe the decryption locally so the unencrypted stuff never leaves your computer. I can do this fine for text areas in the dom by replacing the contents of the HTML. However, sometimes, I would like to do larger files that I stream to the file system. For instance, perhaps I want to encrypt a movie and decrypt it and stream the contents to the my video player. I am not a JavaScript guru by any stretch, especially when it comes to the edge cases of things like the security sandbox. For Small D, I can handle the decryption, but I don't know how to save the decrypted file. Large D seems problematic as memory runs out. Anybody have any ideas that don't involve native plugins? Thanks!

    Read the article

  • How do I use XML Builder to create xml in rails?

    - by Angela
    I am trying the following, but the output XML is badly formed: def submit xml = Builder::XmlMarkup.new xml.instruct! xml.mail xml.documents xml.document xml.template xml.source "gallery" xml.name "Postcard: Image fill front" @xml_display = xml end I need it to look more like this: <?xml version="1.0" encoding="UTF-8"?> <mail> <documents> <document> <template> <source>gallery</source> <name>Postcard: Image fill front</name> </template> <sections> <section> <name>Text</name> <text>Hello, World!</text> </section> <section> <name>Image</name> <attachment>...attachment id...</attachment> </section> </sections> </document> </documents> <addressees> <addressee> <name>John Doe</name> <address>123 Main St</address> <city>Anytown</city> <state>AZ</state> <postal-code>10000</postal-code> </addressee> </addressees> </mail>

    Read the article

  • Alternate widgets and logic for ManyToManyField with Django forms

    - by Jaearess
    In my Django project, I have a simple ticket system. When creating a ticket, certain users have the ability to assign the ticket to other users, and to email the ticket to other users as well (this is used as an FYI for those users, so they're aware of the ticket, even though it's not assigned to them.) At the moment, the form for adding a ticket is simply the default Django form, with the "assigned_to" and "email_to" fields being ManyToManyFields, and therefore displayed as MultipleSelect widgets, each with a list of all users. Due to the relatively large number of users, and general awkwardness of the MultipleSelect widget, and alternate layout is now required. The desired layout is a pair of simple Select widgets side-by-side. The first has the option of "Assign to" or "Email to" and the second is a list of the users. Essentially, like this: [Assign to] [John Doe] [Email to] [Jane Roe] [Jack Smith], etc. Of course, since an arbitrary number of users can be assigned or emailed a ticket, there's a simple button that runs some Javascript to add another set of widgets, to allow the user to assign and email as many people as they need to. So far all of that is fairly simple and straight forward. However, the problem I have is using this widget setup/logic setup with Django forms. Instead of lists of users to assign to and email, instead we're getting back pairs of information, one a user and the other which list that user should be placed in. What I'm looking for, but have yet to find, is a way to offload the translation between how the user uses the form, and how Django understands the model to the form itself, so I don't have to manually do the processing of the data before passing it to the form in each place this form is used. Additionally, there's a review screen with the option to go back and change the form before submitting it, so a way to have the form translate both to and from this format would be extremely helpful.

    Read the article

  • PHP and Gettext not work on my server!

    - by NeoNmaN
    i have this site ( http://rssbot.dk/en/ ) i try to get gettext to work so my english, sweiden and norway site can comming up. Bot i can't get it to work, what have i doe wrong? this is my config code // define constants ( defualt - danish ) $lang = 'da_DA'; $lang_short = ''; $lang_prefix = 'da'; if ( isset( $_GET['lang'] ) ) { switch( $_GET['lang'] ) { case 'en': $lang = 'en_EN'; $lang_short = 'en/'; $lang_prefix = 'en'; break; case 'se': $lang = 'se_SE'; $lang_short = 'se/'; $lang_prefix = 'se'; break; case 'no': $lang = 'no_NO'; $lang_short = 'no/'; $lang_prefix = 'no'; break; } } define( 'LANG', $lang_short ); define( 'LANG_PREFIX', $lang_prefix ); putenv("LC_ALL=". $lang ); bindtextdomain('messages', ROOT .'lang/'); and my path is /var/www/rssbot.dk/lang/ folder. shut i make chmod right or? i hob to can be helpet

    Read the article

  • Is context:annotation-config an alternative to @AutoWired?

    - by Antacid
    Is it correct that I can put context:annotation-config in my XML config and it will automatically inject the bean class without needing any annotations? So instead of using these annotation types: public class Mailman { private String name; @Autowired private Parcel Parcel; public Mailman(String name) { this.name = name; } @Autowired public void setParcel(Parcel Parcel) { this.Parcel = Parcel; } @Autowired public void directionsToParcel(Parcel Parcel) { this.Parcel = Parcel; } } I would just need to write this: <beans ... > <bean id="mailMan" class="MailMan"> <constructor-arg value="John Doe"/> </bean> <bean id="parcel" class="Parcel" /> <context:annotation-config /> </beans> and then my MailMan class would look a lot simpler without the need for annotations: public class Mailman { private String name; private Parcel Parcel; public Mailman(String name) { this.name = name; } }

    Read the article

  • JAAS + authentification from database

    - by AhmedDrira
    i am traying to performe an authentification from data base using JAAS i v configured the login-config.xml like this <application-policy name="e-procurment_domaine"> <authentication> <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required"> <module-option name = "dsJndiName">BasepfeDS</module-option> <module-option name="securityDomain">java:/jaas/e-procurment_domaine</module-option> <module-option name="principalsQuery">SELECT pass FROM personne WHERE login=?</module-option> <module-option name="rolesQuery">SELECT disc FROM personne WHERE login=?</module-option> </login-module> </authentication> </application-policy> and I've written a test : this one @Test public void testFindALL() { System.out.println("Debut test de la méthode findALL"); // WebAuthentication wa=new WebAuthentication(); // wa.login("zahrat", "zahrat"); securityClient.setSimple("zahrat", "zahrat"); try { securityClient.login(); } catch (LoginException e) { // TODO Auto-generated catch block e.printStackTrace(); } Acheteur acheteur = new Acheteur(); System.out.println("" + acheteurRemote.findAll().size()); // } catch (EJBAccessException ex) { // System.out.println("Erreur attendue de type EJBAccessException: " // + ex.getMessage()); // } catch (Exception ex) { // ex.printStackTrace(); // fail("Exception pendant le test find ALL"); System.out.println("Fin test find ALL");} // } the test is fail i dont know why , but when i change the polycy with the methode of .property file it works .. i am using the annotation on the session BEAN classes @SecurityDomain("e-procurment_domaine") @DeclareRoles({"acheteur","vendeur","physique"}) @RolesAllowed({"acheteur","vendeur","physique"}) and the annotation on the session for the methode @RolesAllowed("physique") @Override public List<Acheteur> findAll() { log.debug("fetching all Acheteur"); return daoGenerique.findWithNamedQuery("Acheteur.findAll"); } i think that the test have an acess to my data base doe's it need mysql DRIVER or a special config on JBOSS?

    Read the article

  • .net runtime type casting when using reflection

    - by Mike
    I have need to cast a generic list of a concrete type to a generic list of an interface that the concrete types implement. This interface list is a property on an object and I am assigning the value using reflection. I only know the value at runtime. Below is a simple code example of what I am trying to accomplish: public void EmployeeTest() { IList<Employee> initialStaff = new List<Employee> { new Employee("John Smith"), new Employee("Jane Doe") }; Company testCompany = new Company("Acme Inc"); //testCompany.Staff = initialStaff; PropertyInfo staffProperty = testCompany.GetType().GetProperty("Staff"); staffProperty.SetValue(testCompany, (staffProperty.PropertyType)initialStaff, null); } Classes are defined like so: public class Company { private string _name; public string Name { get { return _name; } set { _name = value; } } private IList<IEmployee> _staff; public IList<IEmployee> Staff { get { return _staff; } set { _staff = value; } } public Company(string name) { _name = name; } } public class Employee : IEmployee { private string _name; public string Name { get { return _name; } set { _name = value; } } public Employee(string name) { _name = name; } } public interface IEmployee { string Name { get; set; } } Any thoughts? I am using .NET 4.0. Would the new covariant or contravariant features help? Thanks in advance.

    Read the article

  • Creating one row of information in excel using a unique value

    - by user1426513
    This is my first post. I am currently working on a project at work which requires that I work with several different worksheets in order to create one mail master worksheet, as it were, in order to do a mail merge. The worksheet contains information regarding different purchases, and each purchaser is identified with their own ID number. Below is an example of what my spreadsheet looks like now (however I do have more columns): ID Salutation Address ID Name Donation ID Name Tickets 9 Mr. John Doe 123 12 Ms. Jane Smith 100.00 12 Ms.Jane Smith 300.00 12 Ms. Jane Smith 456 22 Mr. Mike Man 500.00 84 Ms. Jo Smith 300.00 What I would like to do is somehow sort my data so that everythign with the same unique identifier (ID) lines up on the same row. For example ID 12 Jane Smith - all the information for her will show up under her name matched by her ID number, and ID 22 will match up with 22 etc... When I merged all of my spreadsheets together, I sorted them all by ID number, however my problem is, not everyone who made a donation bought a ticket or some people just bought tickets and nothing us, so sorting doesn't work. Hopefully this makes sense. Thanks in advance.

    Read the article

  • How do I send an email with HTML with an address the user inputs?

    - by MeganSime
    I have an app i am designing and there is a page for emails. The user inputs their name, email address and message and then clicks 'submit'. this works, but i don't know how to make the user's input be on the email. this is the code so far; <form id="contacts-form" action="mailto:[email protected]"> <ul class = "rounded"> <li style = "color: #FFFFFF">Full Name:<input type="text" placeholder = "J. Doe" name = "signature" id = 'signature' /></li> <li style = "color: #FFFFFF">E-mail:<input type="text" placeholder = "[email protected]" name = "address" id = 'address' /></li> <li style = "color: #FFFFFF">Message:<input type = "text" placeholder = "Message" name = "message" id = 'message' /></li> <a href="mailto:address?subject=subject&body=message" class="button">Submit</a> </ul> </form> does anyone know how to change the code to allow the user input to go onto the email? Thanks a lot in advance x

    Read the article

  • 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

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