Search Results

Search found 15081 results on 604 pages for 'passing by reference'.

Page 106/604 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • How to do a back-reference on Google Webapp?

    - by jCuga
    I'm trying to access an object that is linked to by a db.ReferenceProperty in Google app engine. here's the model's code: class InquiryQuestion(db.Model): inquiry_ref = db.ReferenceProperty(reference_class=GiftInquiry, required=True, collection_name="inquiry_ref") And I am trying to access it in the following way: linkedObject = question.inquiry_ref and then linkedKey = linkedObject.key but it's not working. Can anyone please help?

    Read the article

  • How do I order by foreign attribute for belongs_to reference where there are 2 keys to foreign table

    - by Will
    I have a Model which has a belongs_to association with another Model as follows class Article belongs_to :author, :class_name => "User" end If I wanted to find all articles for a particular genre ordered by author I would do something like the following articles = Article.all(:includes => [:author], :order => "users.name") However if Article happens to have two references to User how can I sort on :author? class Article belongs_to :editor, :class_name => "User" belongs_to :author, :class_name => "User" end I have tried articles = Article.all(:includes => [:author], :order => "users.name") #=> incorrect results articles = Article.all(:includes => [:author], :order => "authors.name") #=> Exception Thrown

    Read the article

  • Prompting for authentication from a wxPython program and passing it along to IIS?

    - by MetaHyperBolic
    I have a client (written in Python, with a wxPython front end in dead-simple wizard style) which communicates a website running IIS. A python script receives requests and does the usual client-server dance. I would have written this as a browser application, but for the requirement that certain things happen on the local PC that the web can't help with (file manipulation, interfacing with certain USB hardware, etc.) Right now, I am simply using the logon credentials, compounded as a string from os.environ['USERDOMAIN'] and os.environ['USERNAME'], to pass along to the server, which connects to Active Directory and enumerates the members of the group, looking for those logon credentials. It's an ugly hack, but it works. Obviously, I could make people log out of the generic helper accounts and log back into Windows using specific accounts. However, I wondered how feasible it would be to provide some kind of logon prompt wherein the user can type in a name and password, then some kind of authorization token could be passed on to IIS. This seems like something I would not want to do myself, given that amateurs almost always make huge security mistakes. Now you can see why I am wishing this was purely web-based. What's a good way to handle this?

    Read the article

  • Need help in creating test appliaction in Java and passing parameters into a new designed Java API.

    - by Christophe
    Need help, Please!!! By following the protocol, the Request should be built in 5 byte length, including 1 byte for changing Braud rate (Speed), and send request to a RS-232 port. Protocol: --------------- Request for the command processing, with optional extra byte for changing Baud Rate: LGT : length message ( LGT = 5 ) TYPE : 0x06 TO(time out): 0x0000 CMD : (1 byte) 0x02 application update Baud Rate : (1 byte) 0xNN (optional parameter to change baud rate of the Mnt App) where NN can be: 0x00 = No Baud Rate Change (similar to 4-byte command above) 0x09 = Change to 9600 Baud for Application Update speed 0x0A = Change to 19200 Baud for Application Update speed 0x0E = Change to 115200 Baud for Application Update speed All other bytes are not accepted and will result in a status of 0x01. ------------------ I'm trying to test if my code works or not by creating another class (TestApplication.java) and pass the "3 differenr Baut rate" to this CPXAppliaction. the 3 Baud Rate is supposed to input by reading a file.txt. Question: How do you think these code (first half)? please don't warry about the details about the "sending part". I mean, do I need setter/getter for the "speed" parameter pass? I created the demo test class DemoApp.java (input speed by reading a txt file, and pass into CPXAppliaction). how do you think about that code? Many thanks to you guys!! public class CPXApplication extends CPXCommand { private int speed; . public CPXApplication() { speed = 9600; } public CPXApplication(int speedinit) { speed = speedinit; // TODO: where to get the speed? } protected void buildRequest() throws ElitePortException { String trans = ""; // build the full-qualified message following the protocol trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 5); trans = addToRequest(trans, (char) 6); trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 2); switch (speed) { case 9600: trans = addToRequest(trans, (char) 0x09); break; case 19200: trans = addToRequest(trans, (char) 0x0A); break; case 115200: trans = addToRequest(trans, (char) 0x0E); break; default: // TODO: unexpected baud rate. throw(); break; } trans = EncryptBinary(trans); trans = "F0." + trans; wrapRequest(trans); } protected String addToRequest(String req, char c) { return req + c; } protected String addToRequest(String req, String s) { return req + s; } protected String addToRequest(String req) { return req; } public void analyzeResponse() { //.............. } } Here is the demo test code: package com.ingenico.testApp; import com.ingenico.EliteFd.; import java.util.Scanner; import java.io.; class Run { public static void run() { CPXAppliactionUpdate input = new CpXApplicationUpdate(); int lineno = 0; try { FileReader fr = new FileReader("baudRateSpeed.txt"); BufferedReader reader = new BufferedReader(fr); String line = reader.readLine(); Scanner scan = null; while (line != null) { scan = new Scanner(line); String speed; speed = scan.next(); if (lineno == 0) { input.speed = speed; lineno++; } else { input = cpxapplicationupdate(speed, input); } line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { System.out.println("Could not find the file"); } catch (IOException e) { System.out.println("Had a problem reading from file"); } } public class DemoApp{ public void main(String args[]) { run(); } } }

    Read the article

  • Passing arguments between classes - use public properties or pass a properties class as argument?

    - by devoured elysium
    So let's assume I have a class named ABC that will have a list of Point objects. I need to make some drawing logic with them. Each one of those Point objects will have a Draw() method that will be called by the ABC class. The Draw() method code will need info from ABC class. I can only see two ways to make them have this info: Having Abc class make public some properties that would allow draw() to make its decisions. Having Abc class pass to draw() a class full of properties. The properties in both cases would be the same, my question is what is preferred in this case. Maybe the second approach is more flexible? Maybe not? I don't see here a clear winner, but that sure has more to do with my inexperience than any other thing. If there are other good approaches, feel free to share them. Here are both cases: class Abc1 { public property a; public property b; public property c; ... public property z; public void method1(); ... public void methodn(); } and here is approach 2: class Abc2 { //here we make take down all properties public void method1(); ... public void methodn(); } class Abc2MethodArgs { //and we put them here. this class will be passed as argument to //Point's draw() method! public property a; public property b; public property c; ... public property z; } Also, if there are any "formal" names for these two approaches, I'd like to know them so I can better choose the tags/thread name, so it's more useful for searching purposes. That or feel free to edit them.

    Read the article

  • Question on passing a pointer to a structure in C to a function?

    - by worlds-apart89
    Below, I wrote a primitive singly linked list in C. Function "addEditNode" MUST receive a pointer by value, which, I am guessing, means we can edit the data of the pointer but can not point it to something else. If I allocate memory using malloc in "addEditNode", when the function returns, can I see the contents of first-next ? Second question is do I have to free first-next or is it only first that I should free? I am running into segmentation faults on Linux. #include <stdio.h> #include <stdlib.h> typedef struct list_node list_node_t; struct list_node { int value; list_node_t *next; }; void addEditNode(list_node_t *node) { node->value = 10; node->next = (list_node_t*) malloc(sizeof(list_node_t)); node->next->value = 1; node->next->next = NULL; } int main() { list_node_t *first = (list_node_t*) malloc(sizeof(list_node_t)); first->value = 1; first->next = NULL; addEditNode(first); free(first); return 0; }

    Read the article

  • Passing user_id, site_id, and question_id to same table on create...

    - by bgadoci
    I can't seem to figure out how to do this. I am trying to pass four different variables to a single table. To be more specific I am trying to create a "like" in a likes table that also captures the site_id (like an answer), user_id, and the question_id. Here is the set up. class Like < ActiveRecord::Base belongs_to :site belongs_to :user belongs_to :question end I will spare you the reverse, has_many associations but they are there. Here is the likes controller where I think the problem is. class LikesController < ApplicationController def create @user = current_user @site = Site.find(params[:site_id]) @like = @site.likes.create!(params[:like]) @like.user = current_user @like.save respond_to do |format| format.html { redirect_to @site} format.js end end end This code successfully passes the like and site_id but after many different variations of trying I can't get it to pass the question id. Here is my form: /views/sites/_site.html.erb (though the partial is being displayed in the /views/questions/show.html.erb file). <% remote_form_for [site, Like.new] do |f| %> <%= f.hidden_field :site_name, :value => "#{site.name}" %> <%= f.hidden_field :ip_address, :value => "#{request.remote_ip}" %> <%= f.hidden_field :like, :value => "1" %> <%= submit_tag "^" , :class => 'voteup' %> <% end %>

    Read the article

  • How can I reference only a portion of a TextArea's htmlText block?

    - by Charles Shoults
    I have a number of very poor-quality pdf documents that look like 80's photocopies, which I'm rebuilding in Flash (Flex Builder 3 MXML application), representing paragraphs of text in TextAreas so that selected portions can be bold or italic, or whatever I need. I need a way to apply toolTips or event listeners to individual words within the block of text to link those words to a glossary. I'm perfectly happy to create a definition panel that is populated and made visible with a mouseOver, but don't know how to do it to just a portion of the text. Is there a good / clean / easy way to do this?

    Read the article

  • Getting values from another winform and passing it to current!

    - by klm9971
    Hello: I have 2 windows forms. The 1st one who gets active during start of the program has a button in which another 2nd windows form appears which has text field in which user type their name and HIT okay. Now in the 1st form I have a variable name: nameproccessed which takes the name from the second form. But the problem is my button which is in the 1st form has more functions besides taking name, how can I stop the flow of the compiler to take first the name from the second form and then process the rest execution of the function??? Here is the snippet of my code: //1st form //Class1 public string _nameProcessed = ""; private void btnGetSomething_Click(object sender, EventArgs e) { showdial(); //some more functionalities in this function!!! } private void showdial() { InputName inm = new InputName(); inm.Show(); } //2nd form //Class2 public string name; private void btnEnterName_Click(object sender, EventArgs e) { name = tbxName.Text; Class1 ict = new Class1(); ict._nameProcessed = name; this.Close(); } Now I want to take the 'name' from the second form put it on the _nameprocessed in the 1st form and then execute the rest of the function. How can I do that? Any help!

    Read the article

  • Passing page control from jscript to pagemethod in the codebehind?

    - by brandonprry
    Hi, I am looking write a javascript method as such called when a dropdownlist changes value function GetStuff(sender, destID){ var dest = document.getElementById(destID); this.PageMethods.GetStuffs(sender, dest, null, null); } GetStuffs() is in the Codebehind as follows: [WebMethod] public static void GetStuffs(object sender, object dest) { DropDownList s = sender as DropDownList; DropDownList d = dest as DropDownList; d.Items.Add(new ListItem(s.SelectedValue)); } I have a break point set at the method and alerts in the GetStuff() jscript method fire up until the PageMethod call, at which nothing happens. I have set OnSuccess and OnFailure methods up with alerts and they don't get fired. Any thoughts? Am I doing something inherently wrong?

    Read the article

  • Is there a reference document for OOTB SharePoint web part interfaces?

    - by Javaman59
    I want my web parts to act as providers and consumers with OOTB SharePoint web parts, including filters. To design these web parts I need to know the interface of the OOTB web parts, eg. a "Links" web part provides an IWebPartRow, with a Type, URL and Notes. I can get the information by: a web part programmed to interact generically, and display the data it receives putting the web parts on a page, and look at the available connections inspecting the DLL's (haven't tried this, because I can't find the DLL's, but I guess it's possible) It seems strange to me that there is no documentation of these interfaces. Is there a Microsoft document, or a book, which documents the OOTB web parts and filters?

    Read the article

  • How can I declare an object with properties that I will be passing around inside of my function using Typescript?

    - by Marilou
    I've been using the following: var modal = { content: '', form: '', href: '' } But now I have started to use Typescript is there a better way I can declare an object and how can I declare the types of my properties. The reason I am using this object is that it's inside of a function and inside that function I have other functions that set and use the values of the properties. Is this the best way for me to do this or is there another way I could better do this with typescript?

    Read the article

  • When Creating a Reference for an Object Where from where that class is Loaded?

    - by asela38
    When doing some sample codings with Java I came crosss ClassCast Exception, from where I cast the object to StaticClass. Can any explaing the what has happened here. public void test5() throws Exception { System.out.println(StaticClass.obj); Object newInstance = ClassLoader.getSystemClassLoader().loadClass("com.StaticClass").newInstance(); System.out.println(newInstance.getClass().getDeclaredField("obj").get(newInstance)); Object newInstance2 = new ILoader().loadClass("com//StaticClass.class").newInstance(); System.out.println(newInstance2.getClass().getDeclaredField("obj").get(newInstance2)); StaticClass s = (StaticClass)newInstance2; System.out.println(s.obj); System.out.println(newInstance.getClass().getClassLoader()); System.out.println(newInstance2.getClass().getClassLoader()); } package com; public class StaticClass { public static final Object obj = new Object(); } package com; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class ILoader extends ClassLoader { public ILoader() { super(null); } @Override protected Class<?> findClass(String name) throws ClassNotFoundException { File file = new File(name); byte[] bytes = new byte[(int)file.length()]; try { new FileInputStream(file).read(bytes); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return super.defineClass("com.StaticClass",bytes, 0, bytes.length); } } output which was given by last sysout's when the casting part of the code not existed is as belows. sun.misc.Launcher$AppClassLoader@133056f com.ILoader@1ac3c08

    Read the article

  • C# Dataset usage necessary before passing to GridView datasource?

    - by Goober
    Scenario Lets say for example I have a series of events that fire continually every half second presenting me with an object containing some bits of information. There are always between 10 and 15 objects that are being updated constantly. Since these bits of information are changing continually I want to display them in a GridView. When I do so, I want the user to see the data displayed in the gridview and actually be updated as opposed to just a continually extending list being printed and incrementing (like writeline on the console). Question Is the best way to achieve this to map my objects to a dataset and have the dataset mapped to the gridview? Thoughts Will this allow the gridview to just be "UPDATED" as opposed to being added to? Any implementation suggestions would be greatly appreciated. EDIT: it MUST be windows forms (I use DevExpress too)

    Read the article

  • Need help in creating test application in Java and passing parameters into a new designed Java API.

    - by Christophe
    Need help, Please!!! By following the protocol, the Request should be built in 5 byte length, including 1 byte for changing Braud rate (Speed), and send request to a RS-232 port. Protocol: Request for the command processing, with optional extra byte for changing Baud Rate: LGT : length message ( LGT = 5 ) TYPE : 0x06 TO(time out): 0x0000 CMD : (1 byte) 0x02 application update Baud Rate : (1 byte) 0xNN (optional parameter to change baud rate of the Mnt App) where NN can be: 0x00 = No Baud Rate Change (similar to 4-byte command above) 0x09 = Change to 9600 Baud for Application Update speed 0x0A = Change to 19200 Baud for Application Update speed 0x0E = Change to 115200 Baud for Application Update speed All other bytes are not accepted and will result in a status of 0x01. I'm trying to test if my code works or not by creating another class (TestApplication.java) and pass the "3 differenr Baut rate" to this CPXAppliaction. the 3 Baud Rate is supposed to input by reading a file.txt. Question: How do you think these code (first half)? please don't warry about the details about the "sending part". I mean, do I need setter/getter for the "speed" parameter pass? I created the demo test class DemoApp.java (input speed by reading a txt file, and pass into CPXAppliaction). how do you think about that code? Many thanks to you guys!! public class CPXApplication extends CPXCommand { private int speed; . public CPXApplication() { speed = 9600; } public CPXApplication(int speedinit) { speed = speedinit; // TODO: where to get the speed? } protected void buildRequest() throws ElitePortException { String trans = ""; // build the full-qualified message following the protocol trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 5); trans = addToRequest(trans, (char) 6); trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 0); trans = addToRequest(trans, (char) 2); switch (speed) { case 9600: trans = addToRequest(trans, (char) 0x09); break; case 19200: trans = addToRequest(trans, (char) 0x0A); break; case 115200: trans = addToRequest(trans, (char) 0x0E); break; default: // TODO: unexpected baud rate. throw(); break; } trans = EncryptBinary(trans); trans = "F0." + trans; wrapRequest(trans); } protected String addToRequest(String req, char c) { return req + c; } protected String addToRequest(String req, String s) { return req + s; } protected String addToRequest(String req) { return req; } public void analyzeResponse() { //.............. } } Here is the demo test code: class Run { public static void run() { CPXAppliaction input = new CpXApplication(); int lineno = 0; try { FileReader fr = new FileReader("baudRateSpeed.txt"); BufferedReader reader = new BufferedReader(fr); String line = reader.readLine(); Scanner scan = null; while (line != null) { scan = new Scanner(line); String speed; speed = scan.next(); if (lineno == 0) { input.speed = speed; lineno++; } else { input = cpxapplication(speed, input); } line = reader.readLine(); } reader.close(); } catch (FileNotFoundException e) { System.out.println("Could not find the file"); } catch (IOException e) { System.out.println("Had a problem reading from file"); } } } public class DemoApp{ public void main(String args[]) { run(); }

    Read the article

  • How to only reference one element when using .live("click" with elements within each other?

    - by think123
    Suppose I have the following code: <div id="outerrt"> <div id="rt" style="width: 200px; height: 200px; border: 1px solid black;"> <span id="rt2">content</span> </div> </div> And I use the following: $("#outerrt *").live("click", function () { alert($(this).attr('id')); }); What it would give me when I click on the content text is three alert windows, in the following order: rt2 rt outerrt What I actually want it to give me is only one id: rt2. How do I accomplish that?

    Read the article

  • iphone application development -- passing data to and from the server.

    - by SAPNA
    i have to develop an -phone application .user logs in through the i-phone and gets data stored in the database.our database is created in MY SQL. and website is developed in (classic) ASP.interface is created in i-phone SDK. connection is remaining.what should i use for transferring data to server and from the server. JSON or SOAP.is XML parsing necessary.actually i am very new to this field. so a bit confused. we have some time left for completing our application.so in urgent need of help. thank you in advance.

    Read the article

  • Php, passing data between pages without using the url?

    - by terabytest
    I have a php page that has a form that asks for an e-mail. When you press the send button, it gets to another php page, which gets the form data and does its stuff. I need to then be able to go back to the old page (the one that contained the form) and give it some data so that it will be able to change itself and say "You've sent your e-mail successfully, and will not display the form. How do I do it?

    Read the article

  • Is passing a struct value to a method by-reference in C# an acceptable optimization?

    - by Arc
    Say I have a struct: struct MyStruct { public int X public int Y } And a method in some class that is iterated over many times elsewhere: public bool MyMethod( MyStruct myStruct ) { return ... } Is changing the MyMethod signature to the following an acceptable optimization? public bool MyMethod( ref MyStruct myStruct ) If so, how much of an advantage would it really be? If not, about how many fields would a struct need for a big enough advantage using ref this way?

    Read the article

  • What's the differenct between passing a function and the function call itself in javascript?

    - by Mingus Rude
    In the application I'm building I'm polling for a status update and I have noticed that if the call is made as follows the timeout fires continuously: setTimeout($.get("http://localhost:8080/status", function(data) { UpdateStatus(data);}), 1000); While if use a function instead the timeout fires every 1000 ms: setTimeout(function() {$.get("http://localhost:8080/status", function(data) { UpdateStatus(data);})}, 1000); Why?

    Read the article

  • What's the best way to generate an API reference document using a Rails routes.rb file?

    - by RNHurt
    I am trying to document the API for my Rails application and I can't help but wonder if there is a better way to generate an XML file based on my routes.rb file. I'm envisioning something similar to the output of rake routes but in a more friendly, XML type format. Corey has some interesting ideas about using reflection/introspection on the routes file here but it's not quite what I need. Please tell me this is a solved problem and I'm not the first one to think of this. :)

    Read the article

  • Delphi : What is the best way for passing data between forms?

    - by Flom Enol
    It may seem a little newbie, but I really have got problem with it. I have a form (not the main one)for getting many different data form the user and I want to pass it to a manager class for creating an object with these. The problem is that I can't have this class to use the other unit (getting circle uses) and also it doesn't have access to the manager class instance (which is in main form). So, what shall I do? I've already considered using public variable but I have a bad feeling about it (regarding OOD patterns). Any ideas? thanks in advance.

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >